Skip to main content

Module store_decode_cache

Module store_decode_cache 

Source
Expand description

Decoded execution store, shared within one process and between processes (issue #243).

Decoding executions.lino costs about 1-4 ms per record, and one --status used to decode it up to three times (get, then get_all twice for the execution chain). The file is still read on every call, so a write by any process is seen at once, but it is decoded again only when its content differs from the last decoded copy. The content itself is the key: unlike an mtime, it cannot miss two same-size writes within one clock tick.

A new process (every $ --status poll) still had to decode once. The decoded records are therefore also kept as JSON next to the store, tagged with the SHA-256 of the content they were decoded from; parsing that copy is far faster than the lino decode. A copy whose digest does not match the current content is ignored and replaced.

Enums§

DecodeSource
Where the records of a read came from.

Constants§

DECODED_COPY_FORMAT
Format tag of the JSON copy; a different tag is ignored.

Functions§

decode_count
How many times this process decoded the store at path since it was last forgotten.
decode_store_content
Decode content of the store at path into JSON records, or reuse an earlier decode of the same content: this process’s own, or the JSON copy at copy_path. Every call returns its own copy, so callers may change the records they get.
forget_decoded_store
Drop the decoded copy of a store held by this process; all stores when path is None.