hio.base.hier.durqing

hio.base.hier.durqing Module

Provides durable queue for hold hierarchical actions

Module Contents

class hio.base.hier.durqing.Durq(*pa)

Durq (durable queue) class when injected with .sdb and .key will store its ordered list durably and allow access as a FIFO queue

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:

_deq (deque): in-memory cache as deque _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
extend(vals: hio.help.NonStringIterable[hio.help.RegDom | hio.help.IceRegDom])

Extend ._deq with vals Performs equivalent operation on durable .sdb at .key if any

push(val: hio.help.RegDom | hio.help.IceRegDom)

If not None, add val to last in. 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 value 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 from deque Performs equivalent operation on durable .sdb at .key if any

count(value)

Returns count of entries in ._deq equal to value

put(vals: hio.help.NonStringIterable[hio.help.RegDom | hio.help.IceRegDom])

Put (append) vals to .sdb at .key if any

add(val)

Add value to .sdb at .key if any

pop()

Pop value from .sdb at .key if any

rem()

Remove all values from .sdb at .key if any

cnt()

Count all values in .sdb at .key if any

pin()

Pins all of ._deq 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