Give connectors a store that survives restarts, and a way to clear it

`ConnectorNode.store` keeps short strings per connector package in the
engine's database (`connector_state`, migration f8c3e5a91d27), so the nodes of
one package share them and `fluksio serve` needs nothing new: get, set and
delete, at most 64 kB a value and 256 keys a package. A superuser lists the
keys (never the values) and clears them through `/connectors/{node_type}/state`,
or under Stored state in a connector node's panel. Documented in the connector
contract.
This commit is contained in:
2026-10-06 17:19:48 +02:00
parent 8a1685741b
commit 243d39b591
15 changed files with 710 additions and 4 deletions
+22
View File
@@ -544,3 +544,25 @@ class FlavorPublic(FlavorBase):
class FlavorsPublic(SQLModel):
data: list[FlavorPublic]
count: int
# -----------------------------------------------------------------------------
# Connector state
#
# What a connector has to remember across restarts and has no other home for:
# a certificate it pinned on first contact, a pairing token a device handed it.
# Small values by design — `fluksio.flow.connector_store` caps them.
# -----------------------------------------------------------------------------
class ConnectorState(SQLModel, table=True):
"""One value a connector package stored under a key of its own."""
__tablename__ = "connector_state"
#: The connector's top-level package, so every node type it installs and
#: every node of those shares one set of keys.
connector: str = Field(primary_key=True, max_length=100)
key: str = Field(primary_key=True, max_length=200)
value: str
updated_at: datetime = Field(default_factory=get_datetime_utc, sa_type=UTCDateTime)