index#
- hydromodpy.index(db_path=None, *, read_only=False)[source]#
Open the machine-wide global index that federates registered workspaces.
Parameters#
- db_path
Optional path to the index DuckDB file.
Noneuses the default machine-state location.- read_only
Open the index in read-only mode. Writes (
register_workspace,forget,prune) will raise. Pure reads (search,find,list_workspaces) keep working while another process holds the write-lock.
Returns#
- GlobalIndex
Index object exposing
register_workspace,find,search,pruneandforget.
Raises#
- RuntimeError
If a mutating method is called on a read-only handle.
- duckdb.IOException
If the index database cannot be opened due to non-lock I/O errors.
Examples#
>>> import hydromodpy as hmp >>> idx = hmp.index(read_only=True) >>> idx.list_workspaces()
See Also#
- hydromodpy.core.state.global_index.GlobalIndex
Underlying federation implementation.