Disk to Cloud: Abstract your File Operations with CBFS

ortussolutions 124 views 19 slides Jun 30, 2024
Slide 1
Slide 1 of 19
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19

About This Presentation

In this session, we explored how the cbfs module empowers developers to abstract and manage file systems seamlessly across their lifecycle. From local development to S3 deployment and customized media providers requiring authentication, cbfs offers flexible solutions. We discussed how cbfs simplifie...


Slide Content

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 filesystem within your ColdBox applications
-
Configure named disks that represent file 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, different destinations
-
Different locations for different tiers: development, staging, production
-
Flexibility
-
Ability to change providers with no change of code *
-
Ease of Use
-
Focus on abstraction instead of a specific protocol
-
Modularity
-
Leverages ColdBox’s HVMC
-
Any module can define 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 different 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 files in memory
-
Temp
-
Stores files in CFML engine’s temporary file 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!