FileSystemKeyValueStoreClient
Hierarchy
- KeyValueStoreClient
- FileSystemKeyValueStoreClient
Index
Methods
__init__
Initialize a new instance.
Preferably use the
FileSystemKeyValueStoreClient.openclass method to create a new instance.Parameters
keyword-onlymetadata: KeyValueStoreMetadata
keyword-onlypath_to_kvs: Path
keyword-onlylock: asyncio.Lock
Returns None
delete_value
Delete a value from the key-value store by its key.
The backend method for the
KeyValueStore.delete_valuecall.Parameters
keyword-onlykey: str
Returns None
drop
Drop the whole key-value store and remove all its values.
The backend method for the
KeyValueStore.dropcall.Returns None
get_metadata
Get the metadata of the key-value store.
Returns KeyValueStoreMetadata
get_public_url
Return a file:// URL for the given key.
Parameters
keyword-onlykey: str
The key to get the public URL for.
Returns str
A file:// URL pointing to the file on the local filesystem.
get_value
Retrieve the given record from the key-value store.
The backend method for the
KeyValueStore.get_valuecall.Parameters
keyword-onlykey: str
Returns KeyValueStoreRecord | None
File system implementation of the key-value store client.
This client persists data to the file system, making it suitable for scenarios where data needs to survive process restarts. Keys are mapped to file paths in a directory structure following the pattern:
Binary data is stored as-is, while JSON and text data are stored in human-readable format. The implementation automatically handles serialization based on the content type and maintains metadata about each record.
This implementation is ideal for long-running crawlers where persistence is important and for development environments where you want to easily inspect the stored data between runs.