Available on crate feature
sessions and (crate features postgres or sqlite) only.Expand description
SQL-backed subject registries and consent stores.
SQL-backed SubjectRegistry and
ConsentStore implementations.
| Table | Key | Holds |
|---|---|---|
adk_subjects | subject_key (kind:id) | Pseudonym (unique), state, the link, registration time |
adk_consent_records | id | One consent record; indexed by (subject_key, granted_at_us, id) |
A subject key is the subject’s kind, a colon, and its id. Kinds contain no colon, so two subjects never share a key.
| Change | Statement | Why it has one winner |
|---|---|---|
ensure, set_state | INSERT ... ON CONFLICT (subject_key) DO NOTHING / DO UPDATE | The primary key admits one insert |
link | UPDATE ... WHERE subject_key = $k AND linked_to IS NULL AND state = 'active' | The empty link is compared inside the write |
grant | INSERT ... ON CONFLICT (id) DO NOTHING | The primary key admits one insert |
revoke | UPDATE ... WHERE id = $k AND revoked_at_us IS NULL | The first revocation is kept |
| Backend | Feature |
|---|---|
SqliteSubjectRegistry, SqliteConsentStore | sqlite |
PostgresSubjectRegistry, PostgresConsentStore | postgres |
Structs§
- Sqlite
Consent Store - SQLite-backed
ConsentStore. - Sqlite
Subject Registry - SQLite-backed
SubjectRegistry.