graflo.db.sync¶
The protocol a backend implements to sync owner records into a loaded target.
The caller folds the whole sync input first and groups it by owner. The order
of calls is: sync_begin, every vertex chunk (sync_ensure_vertices),
then every owner chunk (sync_write_owners). Rows are in the names the
target stores. Every call is safe to repeat: a chunk whose commit was not
recorded is simply written again.
An owner chunk is written as one unit: for each owner whose stored sync hash differs from the one it carries, its properties are replaced, the edges it owns are deleted and its edges created, and its hash is stored last.
Classes¶
SyncEdgeType
¶
Bases: BaseModel
One edge type an owner type owns, as stored, and where its owner is read.
Source code in graflo/db/sync.py
Attributes¶
match_keys_source
instance-attribute
¶
match_keys_target
instance-attribute
¶
owner_property = None
class-attribute
instance-attribute
¶
For side == "field": the edge property holding the owner's identity value.
relation_name
instance-attribute
¶
side
instance-attribute
¶
The endpoint that is the owner, or field: the owner is owner_property.
source_class
instance-attribute
¶
target_class
instance-attribute
¶
SyncOwner
¶
Bases: BaseModel
One owner record: its vertex and, per edge type, the edges it owns.
Source code in graflo/db/sync.py
SyncOwnerChunk
¶
Bases: BaseModel
Owners of one vertex type, with every edge type that type owns.
Source code in graflo/db/sync.py
SyncWritten
¶
Bases: BaseModel
What an owner chunk did: owners rewritten, and owners left as they were.