hio.base.hier.canning

hio.base.hier.canning Module

Provides durable dom support for items in Hold

Module Contents

class hio.base.hier.canning.CanDom

Bases: hio.help.TymeDom

CanDom is base class that adds support for durable storage via its ._sdb and ._key non-field attributes. Essentially acts as write through cache to durable copy in ._sdb at ._key when provided. Otherwise in memory only. Assignment to Hold instance at key, injects ._sdb and ._key. This makes the in-memory key in Hold and the durable key the same.

Inherited Non-Field Class Attributes:

_registry (ClassVar[dict]): dict of subclasses keyed by class.__name__
    Assigned by @registerify decorator
_names (ClassVar[tuple[str]|None]): tuple of field names for class
    Assigned by @namify decorator

Inherited Non-Field Attributes:

_tymth (None|Callable): function wrapper closure returned by
    Tymist.tymen() method. When .tymth is called it returns associated
    Tymist.tyme. Provides injected dependency on Tymist cycle tyme base.
    None means not assigned yet.
    Use ._wind method to assign ._tymth after init of bag.
_tyme (None|Float): cycle tyme of last update of a bag field;
    None means either ._tymth has not yet been assigned or this bag fields have not yet been updated.

Inherited Properties:

_now (None|float): current tyme given by ._tymth if not None.

Properties:

_durable (bool): True means ._sdb and ._key and ._sdb.db and
    ._sdb.db.opened are not None
    False otherwise

Non-Field Attributes:

_sdb (DomSuber|None): SuberBase subclass instance of durable subdb of Duror
_key (str|None): database key used to store serialized field in ._cans
_stale (bool): True means fields not yet been synced by write/read with durable; False means fields have been synced by write/read with durable
_fresh (bool): True means fields being synced by read from durable; False means fields not being synced by read from durable
_bulk (bool): True means do not write individual fields and wait for bulk update; False means write individual fields as updated
class hio.base.hier.canning.Can

Bases: CanDom

CanDom is base class that adds support for durable storage via its ._cans non-field attribute

Inherited Non-Field Class Attributes:

_registry (ClassVar[dict]): dict of subclasses keyed by class.__name__
    Assigned by @registerify decorator
_names (ClassVar[tuple[str]|None]): tuple of field names for class
    Assigned by @namify decorator

Inherited Non-Field Attributes:

_tymth (None|Callable): function wrapper closure returned by
    Tymist.tymen() method. When .tymth is called it returns associated
    Tymist.tyme. Provides injected dependency on Tymist cycle tyme base.
    None means not assigned yet.
    Use ._wind method to assign ._tymth after init of bag.

Additional inherited non-field attributes include _tyme (last field-update tyme), _sdb (durable subdb instance), and _key (storage key in ._cans).

Inherited Properties:

_now (None|float): current tyme given by ._tymth if not None.
_durable (bool): True means ._sdb and ._key are not None; False otherwise

Field Attributes:

value (Any):  generic value field