auradefi 0.1.1
PyPI GitHub

SyncStatePort

auradefi.embed.state · source

Structural contract for embed sync-state persistence.

Tenant-scoped throughout (rule #6): tenant_id is the first argument of every scoped method, and no call may read or write across tenants. tenants is the one enumeration, and it yields ids only, never another tenant's records.

get_state

get_state(self, tenant_id: str, connection_id: str) -> SyncState

Return the stored SyncState for one connection.

A fresh default SyncState() when nothing was stored: a never-synced connection and an absent one are indistinguishable.

Parameters

tenant_idrequired, str

none

connection_idrequired, str

none

put_state

put_state(self, tenant_id: str, connection_id: str, state: SyncState) -> None

Store state for one connection; last write wins.

Parameters

tenant_idrequired, str

none

connection_idrequired, str

none

staterequired, SyncState

none

connections

connections(self, tenant_id: str) -> tuple[ConnectionRecord, ...]

All of one tenant's connection records, in creation order.

Parameters

tenant_idrequired, str

none

add_connection

add_connection(self, tenant_id: str, record: ConnectionRecord) -> None

Register a connection record under one tenant.

A duplicate record.id within the tenant raises auradefi.errors.ConflictError carrying existing_id=record.id (SPEC §7.1, Vezgo's 409 with existing_connection_id, kept); the stored record is never overwritten.

Parameters

tenant_idrequired, str

none

recordrequired, ConnectionRecord

none

Raises

ConflictError

tenants

tenants(self) -> tuple[str, ...]

Every tenant this store holds anything for, first-seen order.

The ONE method with no tenant_id argument: it is what lets a freshly bound Auradefi find the connections its dead predecessor stored, instead of enumerating an empty in-process list and calling that a no-op (RELEASE_0.1.1 §5 #21). A tenant appears once, whether it became known through add_connection or put_state, and the order is the order sync() then spends its shared budget in. Ids only. This is not a way to read another tenant's rows.

__init__

__init__(self, *args, **kwargs)

Parameters

argsrequired, any

none

kwargsoptional, any

none