index#
- hydromodpy.index(db_path=None, *, read_only=True)[source]#
Open the machine-wide global index that federates registered projects.
One row is one project root, since a project root is what owns an index database. Registering a workspace root expands it into the project roots it holds.
Read-only by default, mirroring
open(): browsing the federation index never migrates it or touches its mtime, and a reader never contends with a concurrent solve. Passread_only=Falsefor the writable handle used toregister/unregister/prune.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 (default
True). Writes (register,unregister,prune) will raise. Pure reads (search,find,list_projects) keep working while another process holds the write-lock.
Returns#
- GlobalIndex
Index object exposing
register,unregister,list_projects,find,searchandprune.
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_projects()
See Also#
- hydromodpy.core.state.global_index.GlobalIndex
Underlying federation implementation.