際際滷

際際滷Share a Scribd company logo
INTO THE BOX 2024
CBFS
Abstract, Extend, Integrate Any File System
Jon Clausen
Ortus Solutions
Senior Solutions Architect
Grand Rapids, Michigan
- ColdBox Module
- Abstract ANY
fi
lesystem within your ColdBox applications
- Con
fi
gure named disks that represent
fi
le systems
- Each disk is tied to a Storage Provider
- Storage Providers
- Local, RAM, Temporary, S3
- Various means to provide storage to your application
- Access and use disks using a simple API
What is CBFS?
- Abstraction
- Same API, di
ff
erent destinations
- Di
ff
erent locations for di
ff
erent tiers: development, staging, production
- Flexibility
- Ability to change providers with no change of code *
- Ease of Use
- Focus on abstraction instead of a speci
fi
c protocol
- Modularity
- Leverages ColdBoxs HVMC
- Any module can de
fi
ne disks or consume disks
Why CBFS?
Old School: List a Directory
CBFS:
Old School: Deliver an Image
CBFS:
Old School: File Writes
CBFS:
Architecture
- Responsible for managing disks
- Tracks instances and metadata
- Register / unregister
- Startup / shutdown
- Interact with your disks
Disk Service
- Use to register and interact with your disks
- Disks with the same names can can use di
ff
erent providers depending on the deploy tier
- Get names of disks
- diskService.names()
- Get count of disks
- diskService.count()
- Obtaining Disk Instances
- diskService.get( diskName )
- Default Disk
- diskService.defaultDisk()
- diskService.tempDisk()
Disk Service
- Local
- Java 11 + NIO
- 95% of our implementation is not using native CFML
- Adobe CF / Lucee is using Java-8 and earlier IO packages
- RAM
- Stores
fi
les in memory
- Temp
- Stores
fi
les in CFML engines temporary
fi
le storage
- S3
- Uses AmazonS3@s3sdk
- Connect to S3, Digital Ocean Spaces, Azure Blog Storage ( via S3 API implementation)
Included Providers
Global Configuration
Modular Configuration
- Retrieving Files
- disk.get( path )
- disk.allContents()
- Storing Files
- disk.create( path, contents )
- disk.append( path, contents)
- Deleting Files
- disk.delete( path )
- Directories
- disk.cleanDirectory( directory
Disk Instances
Injection DSL
- Disk Interface ( IDisk.cfc )
- Pointers
Custom File Systems
Case Study: ContentBox
Q & A
Thank You!

More Related Content

Disk to Cloud: Abstract your File Operations with CBFS

  • 1. INTO THE BOX 2024 CBFS Abstract, Extend, Integrate Any File System
  • 2. Jon Clausen Ortus Solutions Senior Solutions Architect Grand Rapids, Michigan
  • 3. - ColdBox Module - Abstract ANY fi lesystem within your ColdBox applications - Con fi gure named disks that represent fi le systems - Each disk is tied to a Storage Provider - Storage Providers - Local, RAM, Temporary, S3 - Various means to provide storage to your application - Access and use disks using a simple API What is CBFS?
  • 4. - Abstraction - Same API, di ff erent destinations - Di ff erent locations for di ff erent tiers: development, staging, production - Flexibility - Ability to change providers with no change of code * - Ease of Use - Focus on abstraction instead of a speci fi c protocol - Modularity - Leverages ColdBoxs HVMC - Any module can de fi ne disks or consume disks Why CBFS?
  • 5. Old School: List a Directory CBFS:
  • 6. Old School: Deliver an Image CBFS:
  • 7. Old School: File Writes CBFS:
  • 9. - Responsible for managing disks - Tracks instances and metadata - Register / unregister - Startup / shutdown - Interact with your disks Disk Service
  • 10. - Use to register and interact with your disks - Disks with the same names can can use di ff erent providers depending on the deploy tier - Get names of disks - diskService.names() - Get count of disks - diskService.count() - Obtaining Disk Instances - diskService.get( diskName ) - Default Disk - diskService.defaultDisk() - diskService.tempDisk() Disk Service
  • 11. - Local - Java 11 + NIO - 95% of our implementation is not using native CFML - Adobe CF / Lucee is using Java-8 and earlier IO packages - RAM - Stores fi les in memory - Temp - Stores fi les in CFML engines temporary fi le storage - S3 - Uses AmazonS3@s3sdk - Connect to S3, Digital Ocean Spaces, Azure Blog Storage ( via S3 API implementation) Included Providers
  • 14. - Retrieving Files - disk.get( path ) - disk.allContents() - Storing Files - disk.create( path, contents ) - disk.append( path, contents) - Deleting Files - disk.delete( path ) - Directories - disk.cleanDirectory( directory Disk Instances
  • 16. - Disk Interface ( IDisk.cfc ) - Pointers Custom File Systems
  • 18. Q & A