hio.base.hier.dusqing
hio.base.hier.dusqing Module
Provides durable set queue for hold hierarchical actions
Module Contents
- class hio.base.hier.dusqing.Dusq(*pa)
Dusq (durable set queue) class when injected with .sdb and .key will store its ordered set durably and allow access as a deduped FIFO queue. A set is deduped.
- Properties:
- stale (bool): True means in-memory and durable on disk not synced.
False means in-memory and durable on disk synced.
- durable (bool): True means ._sdb and ._key and ._sdb.db and
._sdb.db.opened are not None. False otherwise.
- Hidden:
_oset (oset): in-memory cache as ordered set _sdb (DomIoSuber): instance of durable store _key (str): into .sdb _stale (bool): stale-status cache for .stale property.
- property stale
Getter for ._stale
- Returns:
True means in-memory and durable on disk not synced; False means in-memory and durable on disk synced
- Return type:
stale (bool)
- property durable
Property durable True when durable subdb injected and opened.
Returns:
durable (bool): True means ._sdb and ._key and ._sdb.db and ._sdb.db.opened are not None False otherwise
- update(vals: hio.help.NonStringIterable[hio.help.RegDom | hio.help.IceRegDom], *, deep=True)
Update ._oset with vals Performs equivalent operation on durable .sdb at .key if any
- Parameters:
vals (NonStringIterable[hio.help.doming.RegDom]) – to add to dusq
deep (bool) – True means deepcopy to ensure can’t mutate outside False means do not deepcopy
- push(val: hio.help.RegDom | hio.help.IceRegDom)
If not None, add val add val to last in if unique. Otherwise ignore Performs equivalent operation on durable .sdb at .key if any
- Parameters:
val (hio.help.doming.RegDom) – element to be appended to deck (deque)
- pull(emptive=True)
Remove and return first in val If empty and emptive return None else raise IndexError
Performs equivalent operation on durable .sdb at .key if any
Parameters:
emptive (bool): True means return None instead of raise IndexError when attempt to pull False means normal behavior of deque
- clear()
Clear all values Performs equivalent operation on durable .sdb at .key if any
- remove(value: hio.help.RegDom | hio.help.IceRegDom)
Remove value if contained
Returns:
result (bool): True value was removed Raises KeyError if value not found
Performs equivalent operation on durable .sdb at .key if any
- put(vals: hio.help.NonStringIterable[hio.help.RegDom | hio.help.IceRegDom])
Put (append) vals to .sdb at .key if any and unique to set
- add(val)
Add value to .sdb at .key if any
- pop()
Pop value from .sdb at .key if any
- rem(val=None)
Remove all values from .sdb at .key if any
- cnt()
Count all values in .sdb at .key if any
- pin()
Pins all of ._oset to ._sdb at ._key if any. Sets ._stale to False on success
- sync(force=False)
Syncs by checking exists durable copy in ._sdb at ._key. If so and ._stale or force then reads own data from ._sdb at ._key if any. If not attempts to write to ._sdb at ._key
- Parameters::
- force (bool): True means force read even if not ._stale
False means do not force read