graflo.architecture.contract.ingestion.sync¶
Record sync ownership: which resource's records replace which elements.
A resource that declares sync owns one vertex type and a set of edges.
In sync mode, re-ingesting one of its records replaces that record's vertex
properties and deletes and recreates the edges it owns. Each owned edge belongs
to one owner record, its owner key: the source endpoint when the resource
owns the source type, else the target endpoint when it owns the target type,
else the value of the edge's owner_field.
Attributes¶
OwnerSide = Literal['source', 'target', 'field']
module-attribute
¶
Classes¶
OwnedEdge
¶
Bases: NamedTuple
How one declared edge is owned: by which vertex type, read from where.
Source code in graflo/architecture/contract/ingestion/sync.py
ResourceSync
¶
Bases: ConfigBaseModel
What a resource's records replace when re-ingested in sync mode.
Source code in graflo/architecture/contract/ingestion/sync.py
Attributes¶
edges = PydanticField(default_factory=list, description="Edges the resource's records replace, each owned by one record.")
class-attribute
instance-attribute
¶
owns = PydanticField(..., description="Vertex type whose properties the resource's records replace.")
class-attribute
instance-attribute
¶
Methods:¶
owner_side(edge)
¶
Where edge's owner key is read; the source wins when both endpoints are owned.
Source code in graflo/architecture/contract/ingestion/sync.py
SyncEdge
¶
Bases: ConfigBaseModel
An edge a resource's records own.
Source code in graflo/architecture/contract/ingestion/sync.py
Attributes¶
edge_id
property
¶
owner_field = PydanticField(default=None, description='Edge identity field holding the owner key, for an edge whose endpoints are neither of the owned type.')
class-attribute
instance-attribute
¶
relation = PydanticField(default=None, description='Edge relation.')
class-attribute
instance-attribute
¶
source = PydanticField(..., description='Edge source vertex type.')
class-attribute
instance-attribute
¶
target = PydanticField(..., description='Edge target vertex type.')
class-attribute
instance-attribute
¶
Functions:¶
owned_edges(resources)
¶
Every edge the resources own, by its declared id.
Source code in graflo/architecture/contract/ingestion/sync.py
owned_types(resources)
¶
sync_errors(resources, produced, core_schema)
¶
Why the resources' sync blocks cannot be honoured; empty when they can.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resources
|
Sequence[ResourceConfig]
|
Every resource of the ingestion model. |
required |
produced
|
Mapping[str, set[str]]
|
The vertex types each resource can produce, by resource name. |
required |
core_schema
|
CoreSchema
|
The schema the blocks refer to. |
required |
Source code in graflo/architecture/contract/ingestion/sync.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |