MicroStream supports a variety of storage targets. Through an abstracted file system (AFS), it is possible to connect to a lot of different back ends. The AFS allows to use folders and files, like in all common file systems, but with different connectors it is possible to use different solutions as the actual storage.
To connect to the local file system use the Java Non-Blocking IO (NIO) connector, which is part of the
base module, so no additional dependency is needed.
EmbeddedStorage.start(Paths.get("path", "to", "storage"));
Internally this creates and uses a
NioFileSystem and is a shortcut for:
NioFileSystem fileSystem = NioFileSystem.New(); EmbeddedStorage.start(fileSystem.ensureDirectoryPath("path", "to", "storage"));
The file system API is the same for all connectors, like for S3.
This is part of another module.
<!-- S3 file system --> <dependency> <groupId>one.microstream</groupId> <artifactId>microstream-afs-aws-s3</artifactId> <version>07.01.00-MS-GA</version> </dependency>
// create S3 client S3Client client = ...; BlobStoreFileSystem fileSystem = BlobStoreFileSystem.New( // use caching connector S3Connector.Caching(client) ); EmbeddedStorage.start(fileSystem.ensureDirectoryPath("path", "to", "storage");