graflo.architecture.evolution.ops.identities¶
Ops that replace or extend vertex and edge identities.
Attributes¶
IdentityTarget = Annotated[NaturalIdentityTarget | HashIdentityTarget | FunnelIdentityTarget | AssignedIdentityTarget | BlankIdentityTarget, PydanticField(discriminator='mode')]
module-attribute
¶
Classes¶
AddSecondaryIdentitiesOp
¶
Bases: ConfigBaseModel
Declare alternate lookup keys on existing vertices.
Secondary identities are lookup-only: upserts keep using the primary identity.
Each declared field-set automatically gains a non-unique index at
:meth:Schema.finish_init, so this op is how an edge-only source gains a way to
reference endpoints by a business key without touching the primary identity.
Source code in graflo/architecture/evolution/ops/identities.py
Attributes¶
additions = PydanticField(..., description='Per-vertex secondary identities to declare: ``{vertex_name: [{name, fields}, ...]}``. A bare field list is accepted for each entry and auto-named.', min_length=1)
class-attribute
instance-attribute
¶
op = 'add_secondary_identities'
class-attribute
instance-attribute
¶
AssignedIdentityTarget
¶
Bases: ConfigBaseModel
Target an assigned identity: an intentional UUID primary key.
Source code in graflo/architecture/evolution/ops/identities.py
BlankIdentityTarget
¶
Bases: ConfigBaseModel
Target a blank identity: an auto-generated placeholder ID.
Source code in graflo/architecture/evolution/ops/identities.py
EdgeIdentitiesEntry
¶
Bases: ConfigBaseModel
New uniqueness keys for one edge triple.
Source code in graflo/architecture/evolution/ops/identities.py
Attributes¶
identities = PydanticField(..., description='Replacement uniqueness keys. Each key lists fields that, together with the resolved endpoints, must be unique; the ``source`` / ``target`` tokens stand for the endpoints themselves. An empty list clears them.')
class-attribute
instance-attribute
¶
relation = PydanticField(default=None, description='Relation name; ``None`` matches the edge with no relation set.')
class-attribute
instance-attribute
¶
source = PydanticField(..., description='Source vertex type name.')
class-attribute
instance-attribute
¶
target = PydanticField(..., description='Target vertex type name.')
class-attribute
instance-attribute
¶
Methods:¶
FunnelIdentityTarget
¶
Bases: ConfigBaseModel
Target an identity funnel: fallback branches digested into digest_field.
The general form of :class:HashIdentityTarget — a flat hash key is a funnel
with one branch. Both resolve to identity mode hash.
Source code in graflo/architecture/evolution/ops/identities.py
Attributes¶
digest_field = PydanticField(default='id', min_length=1, description="Property the digest is stored in; the vertex's identity field.")
class-attribute
instance-attribute
¶
funnel = PydanticField(..., description='Ordered fallback branches; the first complete one wins.')
class-attribute
instance-attribute
¶
mode = 'funnel'
class-attribute
instance-attribute
¶
HashIdentityTarget
¶
Bases: ConfigBaseModel
Target a hash identity: a deterministic synthetic id digested from fields.
Source code in graflo/architecture/evolution/ops/identities.py
IdentityReplacement
¶
Bases: ConfigBaseModel
New identity policy for one vertex, plus what becomes of the old one.
Source code in graflo/architecture/evolution/ops/identities.py
Attributes¶
endpoints = PydanticField(default='follow_new', description='How edge steps that match this vertex on its primary identity behave afterwards. ``follow_new`` (default) leaves them on the primary, so they match the new identity. ``pin_to_retired`` rewrites them to select the demoted secondary identity, preserving the previous matching behaviour for sources that only carry the old key. Requires ``retire: demote``.')
class-attribute
instance-attribute
¶
retire = PydanticField(default='demote', description='What happens to the old identity field-set. ``demote`` turns it into a secondary identity (lookup index follows automatically), ``keep`` leaves the fields as plain properties, ``drop`` removes them. Demotion is downgraded to ``keep`` when the old identity was synthetic (hash / assigned / blank) or already equals the new one.')
class-attribute
instance-attribute
¶
retire_as = PydanticField(default=None, description='Name for the demoted secondary identity. Defaults to ``retired_identity``. Only meaningful with ``retire: demote``.')
class-attribute
instance-attribute
¶
to = PydanticField(..., description='The identity policy this vertex should have after the op.')
class-attribute
instance-attribute
¶
NaturalIdentityTarget
¶
Bases: ConfigBaseModel
Target a natural key: the named properties identify the vertex directly.
Source code in graflo/architecture/evolution/ops/identities.py
RemoveSecondaryIdentitiesOp
¶
Bases: ConfigBaseModel
Withdraw alternate lookup keys, dropping their derived indexes.
Rejected when a surviving edge step still selects the removed field-set — that step would have no way to resolve its endpoint.
Source code in graflo/architecture/evolution/ops/identities.py
Attributes¶
op = 'remove_secondary_identities'
class-attribute
instance-attribute
¶
removals = PydanticField(..., description='Per-vertex secondary identities to withdraw, addressed by name or by field list: ``{vertex_name: [name | [field, ...], ...]}``.', min_length=1)
class-attribute
instance-attribute
¶
ReplaceEdgeIdentitiesOp
¶
Bases: ConfigBaseModel
Replace the uniqueness keys of logical edges.
The edge-side counterpart of :class:ReplaceIdentityOp. There is no retire policy:
edge identities have no lookup plane to demote into. Non-endpoint tokens are merged
into edge properties by Edge.finish_init, as with authored identities.
Source code in graflo/architecture/evolution/ops/identities.py
ReplaceIdentityOp
¶
Bases: ConfigBaseModel
Replace the identity policy of one or more vertices.
Covers both a change of identity fields and a change of identity mode
(natural / hash / assigned / blank), because the cascade is the
same in either case: the field-set that upserts changes, and everything that
referenced the old one must be repointed or retired.
Not covered: blank vertices cannot retire by demotion (they cannot declare
secondary identities at all).