annals.tags#
The owner’s tags: a MutableMapping from item key to tag list, kept apart from the items.
Tags the owner adds on the page are stored here, never in the items themselves: a folder
source belongs to whoever writes it (a crowsnest ledger belongs to its session), so annals
must not edit it, and a published document’s meta.json is the publisher’s record.
An entry, once present, is the item’s whole tag list (it replaces the item’s own tags, so
removing a tag the publisher set works too); deleting the entry falls back to them.
JsonTagStore, the default, is one JSON file under the data root
(<data root>/tags/tags.json), written atomically. Any MutableMapping[str, list[str]]
can replace it (mk_api(tags=...)), e.g. a table in a database.
Functions
|
Trimmed, single-spaced, de-duplicated (ignoring case), sorted; refuses junk. |
Classes
|
|
- class annals.tags.JsonTagStore(path)[source]#
Bases:
JsonFileStore{item key: [tags]}in one JSON file (seeannals.jsonstore.JsonFileStore).Safe with several server processes on one machine; a damaged file reads as empty and is kept aside (
tags.json.damaged) at the next write.