pyrocko.squirrel.database¶
Database interface code.
Classes
|
Shared meta-information database used by Squirrel. |
|
Container to hold statistics about contents cached in meta-information db. |
- class Database(database_path=':memory:', log_statements=False)[source]¶
Bases:
objectShared meta-information database used by Squirrel.
- dig(nuts, transaction=None)[source]¶
Store or update content meta-information.
Given
nutsare assumed to represent an up-to-date and complete inventory of a set of files. Any old information about these files is first pruned from the database (via database triggers). If such content is part of a live selection, it is also removed there. Then the new content meta-information is inserted into the main database. The content is not automatically inserted into the live selections again. It is in the responsibility of the selection object to perform this step.
- remove(path)[source]¶
Prune content meta-information about a given file.
All content pieces belonging to file
pathare removed from the main database and any attached live selections (via database triggers).
- remove_glob(pattern)[source]¶
Prune content meta-information about files matching given pattern.
All content pieces belonging to files who’s pathes match the given
patternare removed from the main database and any attached live selections (via database triggers).
- reset(path, transaction=None)[source]¶
Prune information associated with a given file, but keep the file path.
This method is called when reading a file failed. File attributes, format, size and modification time are set to NULL. File content meta-information is removed from the database and any attached live selections (via database triggers).
- class DatabaseStats(**kwargs)[source]¶
Bases:
ObjectContainer to hold statistics about contents cached in meta-information db.
- ♦ nfiles¶
intNumber of files in database.
- ♦ nnuts¶
intNumber of index nuts in database.
- ♦ codes¶
listoftupleofstrobjects objects, default:[]Available code sequences in database, e.g. (agency, network, station, location) for stations nuts.
- ♦ kinds¶
listofstrobjects, default:[]Available content types in database.
- ♦ total_size¶
intAggregated file size [bytes] of files referenced in database.
- ♦ counts¶
dictofdictofintobjects objects, default:{}Breakdown of how many nuts of any content type and code sequence are available in database,
counts[kind][codes].
- ♦ persistent¶
listofstrobjects, default:[]Names of persistent selections stored in database.