store package
base module
Thie is the base module for the store package, it contains the Store Spec and HashStore class which must be extended by all store classes.
- class hash.store.base.HashStore
- This is the base class for all store classes, it offers the re-usable methods which need to call other store backend
specific methods to do their work, these methods include:
store_artifacts: This method is calls the store_artifact for the chosen backend on all artifacts found in the state. get: This method class get_states to retrieve a list of all states for the current resource and return one of them based on the chosen hash store: This method calls store_state to store the current state of a resource, it reads all states from the backend, adds the new state, and then asks the backend to store the states again.
- get(resource_id: str, h: str)
This method is used to read a state from the backend.
- Parameters:
resource_id (str) – The ID of resource that we want to read from its state.
h (str) – The hash of the state that we want to read.
- Returns:
The state object
- Return type:
- store(state: State)
This method is used to store a state in the backend.
- Parameters:
state (State) – The state to store
- store_artifacts(state: State)
This method is used to store all the artifacts of kind file found in the state.
- Parameters:
state (State) – The state object which contains the artifacts that we want to save.
- Returns:
It returns an exception object if saving one artifact caused an error, and None otherwise
- Return type:
Exception | NoneType
- class hash.store.base.HashStoreDOSpace
- class hash.store.base.HashStoreGCPBucket
- class hash.store.base.HashStoreLocalFile
This class is used to store resources in a local path.
Required config key is output which is a directory path that must already exist.
- hash.store.base.get_plugin_manager()
Return the plugin manager for hash-store plugins.
- hash.store.base.get_store(store, args)
Return a store plugin by its name
- Parameters:
store (str) – The name of the store to return.
args (dict) – A dictionary which contains the options for this store
- Returns:
The store object, which can be used to store, list and get resources.
- Return type:
object