BAOBs, or Binary All-sized OBjects, are the preferred way of sharing files between SMOK server and SMOK devices. They are monotonically versioned, with each update to the file adding a 1 to version.
Upon reconnection, a synchronization with the server proceeds, with the usual last-write-wins rule.
- class smok.baob.BAOB(device: SMOKDevice, key: str)¶
A Binary All-sized OBject.
Note that a BAOB will not signal that it does not exist upon construction, it will rather do so when queried about version or value.
To create a new BAOB, just get a BAOB from device with given name and assign any value to it.
- property value: bytes¶
This property is both gettable and settable.
value of this BAOB
KeyError – this BAOB does not exist
- property version: int¶
version of this BAOB or -1 if does not exist.
Note that if a client has a BAOB that server doesn’t, such BAOB will be deleted. A client can upload his BAOB to server only if server has lower version.