Package org.mockserver.state
Class FilesystemBlobStore
java.lang.Object
org.mockserver.state.FilesystemBlobStore
- All Implemented Interfaces:
AutoCloseable,BlobStore
Filesystem-backed
BlobStore implementation. Blob keys are
interpreted as file paths: absolute keys are used as-is; relative keys
are resolved against a configurable base directory.
The write path uses the same FileOutputStream + FileChannel
+ FileLock pattern as the pre-existing
ExpectationFileSystemPersistence, so
on-disk behaviour is byte-for-byte identical to today's persistence.
Metadata is stored alongside the data file as <key>.meta using
Java Properties format. When no metadata is provided, no .meta
file is written.
Thread-safety: a per-key ReentrantLock serialises concurrent
writes to the same key, matching the single-lock design of the original
persistence classes.
-
Constructor Summary
ConstructorsConstructorDescriptionFilesystemBlobStore(Path baseDir, MockServerLogger mockServerLogger) Creates a filesystem blob store with the given base directory.FilesystemBlobStore(MockServerLogger mockServerLogger) Creates a filesystem blob store using the current working directory as the base directory. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDeletes a blob by key.Retrieves a blob by key.Lists all blob keys that start with the given prefix.voidStores a blob, overwriting any existing blob with the same key.
-
Constructor Details
-
FilesystemBlobStore
Creates a filesystem blob store with the given base directory. The directory is created if it does not exist.- Parameters:
baseDir- the base directory for relative keysmockServerLogger- logger for error reporting (may be null in tests)
-
FilesystemBlobStore
Creates a filesystem blob store using the current working directory as the base directory.- Parameters:
mockServerLogger- logger for error reporting (may be null in tests)
-
-
Method Details
-
put
Description copied from interface:BlobStoreStores a blob, overwriting any existing blob with the same key. -
get
Description copied from interface:BlobStoreRetrieves a blob by key. -
list
Description copied from interface:BlobStoreLists all blob keys that start with the given prefix. -
delete
Description copied from interface:BlobStoreDeletes a blob by key.
-