Documentation
¶
Overview ¶
Package store is remora's SQLite store: schema, migrations and repositories.
Index ¶
- Constants
- Variables
- func GenerateKeyValue() string
- func KeyPrefix(value string) string
- func LoadMasterKey(dataDir, env string) ([]byte, error)
- func WithTx(ctx context.Context, tx *Tx) context.Context
- type APIToken
- type Account
- type AccountQuota
- type AuditEntry
- type Billing
- type CatalogEntry
- type ClientKey
- type DailyCost
- type PendingWrite
- type PriceOverride
- type Provider
- type ProviderKey
- type ProviderKind
- type QuotaWindow
- type RequestCost
- type Sealer
- type Store
- func (s *Store) APITokenByHash(ctx context.Context, hash []byte) (APIToken, error)
- func (s *Store) Account(ctx context.Context, id int64) (Account, error)
- func (s *Store) AccountQuotas(ctx context.Context) (map[int64]AccountQuota, error)
- func (s *Store) AccountStrategies(ctx context.Context) (map[string]alias.Strategy, error)
- func (s *Store) Accounts(ctx context.Context) ([]Account, error)
- func (s *Store) Alias(ctx context.Context, name string) (alias.Alias, bool, error)
- func (s *Store) AliasRuleIDs(ctx context.Context) (map[string]string, error)
- func (s *Store) Aliases(ctx context.Context) (map[string]alias.Alias, error)
- func (s *Store) Billings(ctx context.Context) ([]Billing, error)
- func (s *Store) Catalog(ctx context.Context) ([]CatalogEntry, time.Time, error)
- func (s *Store) ClientKeyByValue(ctx context.Context, value string) (ClientKey, error)
- func (s *Store) ClientKeyVKIDs(ctx context.Context) (map[string]string, error)
- func (s *Store) Close() error
- func (s *Store) CreateAPIToken(ctx context.Context, t APIToken) error
- func (s *Store) CreateAccount(ctx context.Context, a Account) (Account, error)
- func (s *Store) CreateSession(ctx context.Context, hash []byte, expires time.Time) error
- func (s *Store) DB() *sql.DB
- func (s *Store) DailyCosts(ctx context.Context, from, to string) ([]DailyCost, error)
- func (s *Store) DeleteAPIToken(ctx context.Context, id string) error
- func (s *Store) DeleteAccount(ctx context.Context, id int64) error
- func (s *Store) DeleteExpiredSessions(ctx context.Context, now time.Time) error
- func (s *Store) DeleteSession(ctx context.Context, hash []byte) error
- func (s *Store) DeleteSessionsExcept(ctx context.Context, keep []byte) error
- func (s *Store) DisableProviderKey(ctx context.Context, id, reason string) error
- func (s *Store) EngineValue(ctx context.Context, engine, key string) (value string, ok bool, err error)
- func (s *Store) ListAPITokens(ctx context.Context) ([]APIToken, error)
- func (s *Store) ListAudit(ctx context.Context, operation string, limit, offset int) ([]AuditEntry, int, error)
- func (s *Store) LiveProviderKeys(ctx context.Context, provider string) ([]string, error)
- func (s *Store) LoadCooling(ctx context.Context, now time.Time) ([]cooling.Cooling, error)
- func (s *Store) PriceOverrides(ctx context.Context) ([]PriceOverride, error)
- func (s *Store) ProviderKeysByKind(ctx context.Context, kind ProviderKind) ([]string, error)
- func (s *Store) PruneRequestCost(ctx context.Context, before time.Time) error
- func (s *Store) PutAccountQuota(ctx context.Context, q AccountQuota) error
- func (s *Store) Read(ctx context.Context, fn func(tx *Tx) error) error
- func (s *Store) RecordAudit(ctx context.Context, e AuditEntry) error
- func (s *Store) RecordCosts(ctx context.Context, rows []RequestCost) error
- func (s *Store) RedactSecrets(text string) string
- func (s *Store) Refresh(ctx context.Context) error
- func (s *Store) ReplaceCatalog(ctx context.Context, entries []CatalogEntry, fetchedAt time.Time) error
- func (s *Store) RequestCosts(ctx context.Context, ids []string) (map[string]RequestCost, error)
- func (s *Store) SaveCooling(ctx context.Context, rows []cooling.Cooling) error
- func (s *Store) SessionExpiry(ctx context.Context, hash []byte) (time.Time, error)
- func (s *Store) SetAccountEnabled(ctx context.Context, id int64, enabled bool) error
- func (s *Store) SetAccountPriority(ctx context.Context, id int64, priority int) error
- func (s *Store) SetAccountStrategy(ctx context.Context, provider string, st alias.Strategy) error
- func (s *Store) SetEngineValue(ctx context.Context, engine, key, value string) error
- func (s *Store) SetSealer(sl *Sealer)
- func (s *Store) SetSetting(ctx context.Context, key, value string) error
- func (s *Store) Setting(ctx context.Context, key string) (value string, ok bool, err error)
- func (s *Store) SettleRequestCost(ctx context.Context, logID string, actualUSD float64, state string) (bool, error)
- func (s *Store) TouchAPIToken(ctx context.Context, id string, at time.Time) error
- func (s *Store) TouchAPITokens(ctx context.Context, batch map[string]time.Time) error
- func (s *Store) Write(ctx context.Context, fn func(tx *Tx) error) error
- func (s *Store) WriteWithUndo(ctx context.Context, fn func(tx *Tx) error) (*PendingWrite, error)
- type Tx
- func (tx *Tx) AliasRuleIDs(ctx context.Context) (map[string]string, error)
- func (tx *Tx) Aliases(ctx context.Context) (map[string]alias.Alias, error)
- func (tx *Tx) Billings(ctx context.Context) ([]Billing, error)
- func (tx *Tx) ClientKeys(ctx context.Context) ([]ClientKey, error)
- func (tx *Tx) DeleteAlias(ctx context.Context, name string) error
- func (tx *Tx) DeleteClientKey(ctx context.Context, id string) error
- func (tx *Tx) DeleteEngineMAC(ctx context.Context, object string) error
- func (tx *Tx) DeleteProvider(ctx context.Context, name string) error
- func (tx *Tx) DeleteProviderKey(ctx context.Context, id string) error
- func (tx *Tx) EngineMACs(ctx context.Context) (map[string]string, error)
- func (tx *Tx) Generation(ctx context.Context) (int64, error)
- func (tx *Tx) MAC(data []byte) ([]byte, error)
- func (tx *Tx) PriceOverrides(ctx context.Context) ([]PriceOverride, error)
- func (tx *Tx) ProviderKeys(ctx context.Context) ([]ProviderKey, error)
- func (tx *Tx) Providers(ctx context.Context) ([]Provider, error)
- func (tx *Tx) PutAlias(ctx context.Context, a alias.Alias) error
- func (tx *Tx) PutClientKey(ctx context.Context, k ClientKey, value string) (ClientKey, error)
- func (tx *Tx) PutProvider(ctx context.Context, p Provider) error
- func (tx *Tx) PutProviderKey(ctx context.Context, k ProviderKey) error
- func (tx *Tx) SetAccountStrategy(ctx context.Context, provider string, st alias.Strategy) error
- func (tx *Tx) SetAliasRuleID(ctx context.Context, name, ruleID string) error
- func (tx *Tx) SetBillings(ctx context.Context, items []Billing) error
- func (tx *Tx) SetClientKeyVK(ctx context.Context, id, vkID, vkValue string) error
- func (tx *Tx) SetEngineMAC(ctx context.Context, object, mac string) error
- func (tx *Tx) SetPriceOverrides(ctx context.Context, items []PriceOverride) error
Constants ¶
const ScopeAdmin = "admin"
ScopeAdmin is the default scope for API tokens and the scope of admin sessions.
Variables ¶
var ( ErrNotFound = errors.New("store: not found") ErrDuplicate = errors.New("store: duplicate") ErrInvalid = errors.New("store: invalid") )
Repository errors.
var ErrNoSealer = errors.New("store: no sealer configured")
ErrNoSealer means a repository needed to seal, open or MAC a secret but the store has no Sealer.
var ErrSchemaTooNew = errors.New("store: database schema is newer than this remora")
ErrSchemaTooNew means the database was written by a newer remora. Open never migrates down.
Functions ¶
func GenerateKeyValue ¶
func GenerateKeyValue() string
GenerateKeyValue returns a new client key value: "sk-" + base64url(32 random bytes), no padding.
func KeyPrefix ¶
KeyPrefix returns the part of a key value kept to recognise it: its first 8 characters, but never more than half of it, so a short caller-chosen value is not given away.
func LoadMasterKey ¶
LoadMasterKey returns the master key. env (the value of REMORA_MASTER_KEY, base64 of 32 bytes) wins when set; otherwise the key is read from dataDir/master.key, which is created (mode 0600) with a random key if absent.
Types ¶
type APIToken ¶
type APIToken struct {
ID, Name, Prefix string
Scope string
Hash []byte
CreatedAt time.Time
LastUsedAt *time.Time
ExpiresAt *time.Time
}
APIToken is an API token for /api/*. Hash is the sha256 of its value; the value itself is never stored.
type Account ¶
type Account struct {
ID int64
Provider, Label, Credential string
Enabled bool
Priority int // higher is tried first under the priority and fill-first strategies
CreatedAt time.Time
}
Account is a subscription account: one OAuth engine credential remora adopted. Provider is the user-facing provider name ("grok", not the engine's "xai"); Credential is the engine's credential file name.
type AccountQuota ¶ added in v0.3.0
type AccountQuota struct {
AccountID int64
Plan string
Windows []QuotaWindow
LimitReached bool
Source string // "poll" | "passive"
FetchedAt time.Time
CheckedAt time.Time
Error string
}
AccountQuota is an account's last quota snapshot. FetchedAt is when the windows were observed (zero = never); CheckedAt is the last poll attempt, successful or not.
type AuditEntry ¶ added in v0.7.0
type AuditEntry struct {
ID int64
At time.Time
Principal string
TokenID, TokenName string
OperationID string
Diff map[string]any
}
AuditEntry records an authenticated management action. Diff contains only audit-safe fields.
type Billing ¶ added in v0.9.0
Billing is a stored billing mode override and optional monthly fee for a provider.
type CatalogEntry ¶ added in v0.9.0
type CatalogEntry struct {
Source, Model string
Input, Output float64
CacheRead, CacheWrite *float64
}
CatalogEntry is one priced model from the daily price catalogue (USD per 1M tokens).
type ClientKey ¶
type ClientKey struct {
ID, Name string
Prefix string
Allow []string
Enabled bool
VKID, VKValue string
CreatedAt time.Time
}
ClientKey is a remora key a client presents on /v1. Its value is never stored, only its MAC and a short Prefix to recognise it by. VKID and VKValue are the front door's virtual key for it (VKValue sealed at rest). Prefix and CreatedAt are set by the store; PutClientKey ignores them.
type DailyCost ¶ added in v0.9.0
type DailyCost struct {
Day string
Provider string
Model string
KeyID string
Requests int64
ActualUSD float64
EquivalentUSD float64
SavingUSD float64
UnpricedActual int64
UnpricedEquivalent int64
}
DailyCost is one UTC day bucket of aggregated request costs.
type PendingWrite ¶ added in v0.7.0
type PendingWrite struct {
// contains filtered or unexported fields
}
PendingWrite holds a committed change whose publication waits for engine acceptance or compensation. The caller must resolve it once, through either Commit or Undo.
func (*PendingWrite) Abandon ¶ added in v0.7.0
func (p *PendingWrite) Abandon(ctx context.Context)
Abandon ends a change whose compensation failed and will not be retried: the committed rows, unaccepted by the engine, are published so later writes and changes are not held back; the next full sync pushes them.
type PriceOverride ¶ added in v0.9.0
type PriceOverride struct {
Provider, Model, PriceAs string
}
PriceOverride maps a provider's model to a "<source>/<model>" entry in the price catalogue.
type Provider ¶
type Provider struct {
Name string
Kind ProviderKind
Type string // builtin only: the front door's provider, e.g. "openrouter"
BaseURL string
AllowPrivateNetwork bool
MinDiscount *int // surplus only: 1..100; nil (or 0) means no floor
ZDR bool // surplus only: route via zero-data-retention endpoints
KeyStrategy alias.Strategy // "" stored and read as random
}
Provider is an upstream remora routes to.
type ProviderKey ¶
type ProviderKey struct {
ID, Provider, Name, Secret string
Enabled bool
Priority *int // nil = unset
DisabledReason string // "" = not disabled
}
ProviderKey is one credential of a provider. Secret is in clear in memory only; at rest it is sealed.
type ProviderKind ¶
type ProviderKind string
ProviderKind is how remora drives a provider: "builtin" (a provider the front door ships, named by Type), "openai-compatible", "typesafe-compatible" (decision endpoints), "soniox" or "surplus".
const ( KindBuiltin ProviderKind = "builtin" KindOpenAICompatible ProviderKind = "openai-compatible" KindTypeSafeCompatible ProviderKind = "typesafe-compatible" KindSoniox ProviderKind = "soniox" KindSurplus ProviderKind = "surplus" )
Provider kinds.
type QuotaWindow ¶ added in v0.3.0
type QuotaWindow struct {
Scope string `json:"scope"`
Window string `json:"window"`
Remaining *float64 `json:"remaining"`
ResetsAt *time.Time `json:"resets_at"`
}
QuotaWindow is one quota window of an account. Scope is a model family or model ("gemini", "claude-gpt", "opus", "" = the whole account); Window is "5h", "weekly" or the length in minutes. Remaining is 0..1, nil = unknown; ResetsAt nil = unknown or no reset.
type RequestCost ¶ added in v0.9.0
type RequestCost struct {
LogID string
At time.Time
Provider string
Model string
KeyID string
ActualUSD *float64 // nil = unpriced
EquivalentUSD *float64 // nil = unpriced
ActualState string
EquivalentState string
}
RequestCost records the actual and equivalent USD costs and states for a terminal request log row.
func (RequestCost) Saving ¶ added in v0.9.0
func (c RequestCost) Saving() float64
Saving returns equivalent - actual when both sides are priced, else 0.
type Sealer ¶
type Sealer struct {
// contains filtered or unexported fields
}
Sealer encrypts secrets at rest with AES-256-GCM and computes lookup MACs with HMAC-SHA256. Both keys are derived from the master key with HKDF-SHA256, so the master key itself is never used directly.
func (*Sealer) MAC ¶
MAC returns HMAC-SHA256(macKey, data), used to look up client keys without storing them.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the SQLite store.
func Open ¶
Open opens (or creates) the database at path and applies the embedded migrations that are missing.
func (*Store) APITokenByHash ¶
APITokenByHash finds the API token with this hash. ErrNotFound when there is none.
func (*Store) AccountQuotas ¶ added in v0.3.0
AccountQuotas returns every stored snapshot by account id.
func (*Store) AccountStrategies ¶ added in v0.3.0
AccountStrategies returns the stored strategy per subscription provider; a provider without one is not listed.
func (*Store) Alias ¶ added in v0.2.1
Alias returns the alias named name, without copying the whole set.
func (*Store) AliasRuleIDs ¶
AliasRuleIDs maps alias name to the front door's routing rule id, for aliases that have one.
func (*Store) Billings ¶ added in v0.9.0
Billings lists stored provider billing overrides ordered by provider name.
func (*Store) Catalog ¶ added in v0.9.0
Catalog returns the stored price catalogue and its newest fetched_at timestamp.
func (*Store) ClientKeyByValue ¶
ClientKeyByValue finds the client key whose value is value, enabled or not. ErrNotFound when none matches.
func (*Store) ClientKeyVKIDs ¶
ClientKeyVKIDs maps client key id to its virtual key id, for keys that have one.
func (*Store) CreateAPIToken ¶
CreateAPIToken stores t, defaulting an empty scope to admin. ErrDuplicate when its id or hash exists.
func (*Store) CreateAccount ¶
CreateAccount stores a new account and returns it with ID and CreatedAt set (a.ID and a.CreatedAt are ignored). ErrDuplicate when another account already has a.Credential.
func (*Store) CreateSession ¶
CreateSession stores a session by its hash.
func (*Store) DailyCosts ¶ added in v0.9.0
DailyCosts returns daily cost buckets within [from, to] (UTC YYYY-MM-DD; empty bounds are open).
func (*Store) DeleteAPIToken ¶
DeleteAPIToken deletes an API token. ErrNotFound when it does not exist.
func (*Store) DeleteAccount ¶
DeleteAccount deletes an account. ErrNotFound when it does not exist.
func (*Store) DeleteExpiredSessions ¶ added in v0.7.0
DeleteExpiredSessions deletes sessions that have expired at or before now.
func (*Store) DeleteSession ¶
DeleteSession deletes the session with this hash; deleting an absent session is not an error.
func (*Store) DeleteSessionsExcept ¶
DeleteSessionsExcept deletes every session but the one with hash keep (nil keeps none).
func (*Store) DisableProviderKey ¶ added in v0.12.0
DisableProviderKey sets or clears a provider key's disabled_reason without rebuilding the snapshot. An empty reason clears it. ErrNotFound when the key does not exist.
func (*Store) EngineValue ¶
func (s *Store) EngineValue(ctx context.Context, engine, key string) (value string, ok bool, err error)
EngineValue returns the value stored for engine under key, sealing legacy plaintext on first read. ok is false when the value is absent.
func (*Store) ListAPITokens ¶
ListAPITokens lists the API tokens, oldest first.
func (*Store) ListAudit ¶ added in v0.7.0
func (s *Store) ListAudit(ctx context.Context, operation string, limit, offset int) ([]AuditEntry, int, error)
ListAudit returns a newest-first page and the exact total for the operation filter (empty matches all).
func (*Store) LiveProviderKeys ¶ added in v0.12.0
LiveProviderKeys returns the IDs of enabled, non-disabled keys of provider, sorted by ID.
func (*Store) LoadCooling ¶ added in v0.7.0
LoadCooling deletes expired plain cooldowns but keeps breakers until a probe succeeds.
func (*Store) PriceOverrides ¶ added in v0.9.0
func (s *Store) PriceOverrides(ctx context.Context) ([]PriceOverride, error)
PriceOverrides lists stored price overrides ordered by provider and model.
func (*Store) ProviderKeysByKind ¶
ProviderKeysByKind returns the plaintext secrets of the enabled keys of every provider of that kind, never nil.
func (*Store) PruneRequestCost ¶ added in v0.9.0
PruneRequestCost deletes request_cost rows strictly before before, leaving cost_daily untouched.
func (*Store) PutAccountQuota ¶ added in v0.3.0
func (s *Store) PutAccountQuota(ctx context.Context, q AccountQuota) error
PutAccountQuota stores q as its account's snapshot, replacing the previous one. ErrNotFound when the account does not exist.
func (*Store) Read ¶ added in v0.7.0
Read runs fn against one SQLite snapshot, without acquiring the write lock.
func (*Store) RecordAudit ¶ added in v0.7.0
func (s *Store) RecordAudit(ctx context.Context, e AuditEntry) error
RecordAudit appends an entry without changing the configuration generation.
func (*Store) RecordCosts ¶ added in v0.9.0
func (s *Store) RecordCosts(ctx context.Context, rows []RequestCost) error
RecordCosts inserts each row with ON CONFLICT(log_id) DO NOTHING and adds it to cost_daily only when RowsAffected is 1, in one transaction through s.write (no snapshot Refresh: the feed calls this every flush).
func (*Store) RedactSecrets ¶ added in v0.7.0
RedactSecrets masks recoverable stored credentials in an unencoded engine log line. With no snapshot, omit the line rather than risk logging a credential.
func (*Store) Refresh ¶ added in v0.2.1
Refresh rebuilds the snapshot from the committed database, unless a reconcile write is still pending. On failure it drops the snapshot and returns the error; reads fall back to SQL. Without a sealer there is nothing to rebuild.
func (*Store) ReplaceCatalog ¶ added in v0.9.0
func (s *Store) ReplaceCatalog(ctx context.Context, entries []CatalogEntry, fetchedAt time.Time) error
ReplaceCatalog atomically replaces the price catalogue in one transaction without triggering a snapshot refresh.
func (*Store) RequestCosts ¶ added in v0.9.0
RequestCosts loads request_cost rows by log id. Missing ids are omitted.
func (*Store) SaveCooling ¶ added in v0.7.0
SaveCooling atomically replaces the cooldowns without rebuilding the key and alias snapshot.
func (*Store) SessionExpiry ¶
SessionExpiry returns when the session with this hash expires. ErrNotFound when there is none.
func (*Store) SetAccountEnabled ¶
SetAccountEnabled enables or disables an account. ErrNotFound when it does not exist.
func (*Store) SetAccountPriority ¶ added in v0.3.0
SetAccountPriority sets an account's priority. ErrNotFound when it does not exist.
func (*Store) SetAccountStrategy ¶ added in v0.3.0
SetAccountStrategy stores a subscription provider's strategy, replacing any earlier one.
func (*Store) SetEngineValue ¶
SetEngineValue seals and stores value for engine under key, replacing any previous value.
func (*Store) SetSetting ¶
SetSetting stores value under key, replacing any previous value.
func (*Store) Setting ¶
Setting returns the value stored under key. ok is false when the key is absent.
func (*Store) SettleRequestCost ¶ added in v0.10.0
func (s *Store) SettleRequestCost(ctx context.Context, logID string, actualUSD float64, state string) (bool, error)
SettleRequestCost records a late actual charge for an unpriced request_cost row and updates cost_daily in one transaction. Returns (false, ErrNotFound) when logID does not exist and (false, nil) when it is already priced.
func (*Store) TouchAPIToken ¶
TouchAPIToken records that the token was used at at. ErrNotFound when it does not exist.
func (*Store) TouchAPITokens ¶ added in v0.7.0
TouchAPITokens records last use in a single transaction. Deleted tokens are ignored.
func (*Store) Write ¶
Write runs fn in one BEGIN IMMEDIATE transaction and commits iff fn returns nil, then refreshes the snapshot unless a reconcile write is pending. Concurrent writers serialise on the database lock; Write waits up to 30 s.
func (*Store) WriteWithUndo ¶ added in v0.7.0
WriteWithUndo commits fn without publishing it. The caller must resolve the returned PendingWrite.
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx is a store transaction. Store.Read supplies a read-only view.
func (*Tx) AliasRuleIDs ¶
AliasRuleIDs maps alias name to the front door's routing rule id, as this transaction sees it (its own uncommitted writes included).
func (*Tx) Billings ¶ added in v0.9.0
Billings lists stored provider billing overrides visible in this transaction.
func (*Tx) ClientKeys ¶
ClientKeys lists the client keys by name, virtual key values opened.
func (*Tx) DeleteAlias ¶
DeleteAlias deletes an alias and its members. ErrNotFound when it does not exist.
func (*Tx) DeleteClientKey ¶
DeleteClientKey deletes a client key. ErrNotFound when it does not exist.
func (*Tx) DeleteEngineMAC ¶
DeleteEngineMAC forgets an engine object. Deleting an unknown object is not an error.
func (*Tx) DeleteProvider ¶
DeleteProvider deletes the provider, its keys, and its billing and price override rows. ErrNotFound when it does not exist.
func (*Tx) DeleteProviderKey ¶
DeleteProviderKey deletes a provider key. ErrNotFound when it does not exist.
func (*Tx) EngineMACs ¶
EngineMACs returns the MAC of every engine object as last pushed, keyed by object ("provider:<name>", "key:<id>", "vk:<client_key_id>", "rule:<alias>").
func (*Tx) Generation ¶ added in v0.7.0
Generation returns the reconcile-input generation in this transaction's snapshot.
func (*Tx) MAC ¶
MAC returns HMAC-SHA256(macKey, data) with the store's Sealer, for the engine_sync records of objects that carry a secret. ErrNoSealer when the store has none.
func (*Tx) PriceOverrides ¶ added in v0.9.0
func (tx *Tx) PriceOverrides(ctx context.Context) ([]PriceOverride, error)
PriceOverrides lists stored price overrides visible in this transaction.
func (*Tx) ProviderKeys ¶
func (tx *Tx) ProviderKeys(ctx context.Context) ([]ProviderKey, error)
ProviderKeys lists every provider key, secrets opened, by provider and name.
func (*Tx) PutAlias ¶
PutAlias creates or replaces the alias a.Name and replaces its members in order. The routing rule id is kept.
func (*Tx) PutClientKey ¶
PutClientKey creates or updates the client key k.ID (an empty ID creates a key with a new UUID v4) and returns it as stored. value is caller-chosen and only its MAC and prefix are stored; value "" on an existing key keeps the stored MAC, and a new key needs a value. The virtual key fields are not changed here (see SetClientKeyVK).
func (*Tx) PutProvider ¶
PutProvider creates or replaces the provider p.Name. Its keys are kept.
func (*Tx) PutProviderKey ¶
func (tx *Tx) PutProviderKey(ctx context.Context, k ProviderKey) error
PutProviderKey creates or replaces the key k.ID; an empty ID creates a key with a new UUID v4.
func (*Tx) SetAccountStrategy ¶ added in v0.3.0
SetAccountStrategy stores a subscription provider's strategy on the transaction.
func (*Tx) SetAliasRuleID ¶
SetAliasRuleID records the front door's routing rule id for an alias. ErrNotFound when the alias does not exist.
func (*Tx) SetBillings ¶ added in v0.9.0
SetBillings replaces all stored provider billing overrides.
func (*Tx) SetClientKeyVK ¶
SetClientKeyVK records the front door's virtual key for a client key; vkValue is sealed. ErrNotFound when the client key does not exist.
func (*Tx) SetEngineMAC ¶
SetEngineMAC records the MAC of an engine object as pushed.
func (*Tx) SetPriceOverrides ¶ added in v0.9.0
func (tx *Tx) SetPriceOverrides(ctx context.Context, items []PriceOverride) error
SetPriceOverrides replaces all stored price overrides.