STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
stardesign.storage.LocalBackend Class Reference

Public Member Functions

None __init__ (self, UserData ud)
dict snapshot_micro (self, str user, str doc_id, Snapshot data)
list[dict] list_micro (self, str user, str doc_id, int limit=50)
Snapshot|None get_micro (self, str user, str doc_id, str version_id)
Snapshot|None latest_micro (self, str user, str doc_id)
dict create_release (self, str user, str doc_id, str label, Snapshot data)
list[dict] list_releases (self, str user, str doc_id)
Snapshot|None get_release (self, str user, str doc_id, str label)

Protected Member Functions

Path _doc_dir (self, str user, str doc_id)
Path _sub (self, str user, str doc_id, str name)

Protected Attributes

 _ud = ud

Detailed Description

Filesystem version history under ``<root>/<user>/<app>/<id>/``.

Definition at line 72 of file storage.py.

Constructor & Destructor Documentation

◆ __init__()

None stardesign.storage.LocalBackend.__init__ ( self,
UserData ud )

Definition at line 75 of file storage.py.

Member Function Documentation

◆ _doc_dir()

Path stardesign.storage.LocalBackend._doc_dir ( self,
str user,
str doc_id )
protected

Definition at line 78 of file storage.py.

References _ud.

Referenced by _sub().

◆ _sub()

Path stardesign.storage.LocalBackend._sub ( self,
str user,
str doc_id,
str name )
protected

Definition at line 81 of file storage.py.

References _doc_dir().

Referenced by create_release(), get_micro(), get_release(), list_micro(), list_releases(), and snapshot_micro().

◆ create_release()

dict stardesign.storage.LocalBackend.create_release ( self,
str user,
str doc_id,
str label,
Snapshot data )

◆ get_micro()

Snapshot | None stardesign.storage.LocalBackend.get_micro ( self,
str user,
str doc_id,
str version_id )

Definition at line 123 of file storage.py.

References stardesign.storage._read_json(), and _sub().

Referenced by latest_micro().

◆ get_release()

Snapshot | None stardesign.storage.LocalBackend.get_release ( self,
str user,
str doc_id,
str label )

Definition at line 154 of file storage.py.

References stardesign.storage._read_json(), and _sub().

◆ latest_micro()

Snapshot | None stardesign.storage.LocalBackend.latest_micro ( self,
str user,
str doc_id )

Definition at line 129 of file storage.py.

References get_micro(), and list_micro().

◆ list_micro()

list[dict] stardesign.storage.LocalBackend.list_micro ( self,
str user,
str doc_id,
int limit = 50 )
Snapshots newest first.

Sorted on ``st_mtime_ns`` then the id, not on the formatted ``savedAt``:
two snapshots written in the same filesystem timestamp tick otherwise
come back in whatever order ``glob`` happened to yield. The id carries a
nanosecond prefix (see :meth:`snapshot_micro`), so it breaks that tie in
real write order rather than arbitrarily. Ids written before that prefix
existed are fully random, but they are older files whose mtimes already
separate them from anything new.

Definition at line 99 of file storage.py.

References _sub().

Referenced by latest_micro().

◆ list_releases()

list[dict] stardesign.storage.LocalBackend.list_releases ( self,
str user,
str doc_id )

Definition at line 140 of file storage.py.

References _sub().

◆ snapshot_micro()

dict stardesign.storage.LocalBackend.snapshot_micro ( self,
str user,
str doc_id,
Snapshot data )

Member Data Documentation

◆ _ud

stardesign.storage.LocalBackend._ud = ud
protected

Definition at line 76 of file storage.py.

Referenced by _doc_dir().


The documentation for this class was generated from the following file: