Documentation
¶
Overview ¶
Package memrepo is an in-memory repository.ServerlessRepository for unit tests of the serverless operator core and leaser. It implements the methods the core uses and records the writes tests assert on. Methods the core never calls are left to the embedded nil interface and panic when reached.
Index ¶
- type ActionWrite
- type Repo
- func (r *Repo) ActionWrites() []ActionWrite
- func (r *Repo) AddEndpoint(ep *sqlcv1.V1ServerlessEndpoint)
- func (r *Repo) ByIdsCalls() int
- func (r *Repo) ClaimCalls() []int32
- func (r *Repo) DeletedProcs() []uuid.UUID
- func (r *Repo) Endpoint(id uuid.UUID) *sqlcv1.V1ServerlessEndpoint
- func (r *Repo) Endpoints() repository.ServerlessEndpointRepository
- func (r *Repo) Heartbeats() []repository.UpsertServerlessProcessOpts
- func (r *Repo) Lease(unit Unit) *sqlcv1.V1ServerlessLease
- func (r *Repo) Leases() repository.ServerlessLeaseRepository
- func (r *Repo) ListForTenantCalls() int
- func (r *Repo) ListSinceCalls() int
- func (r *Repo) ListVersionsCalls() int
- func (r *Repo) Processes() repository.ServerlessProcessRepository
- func (r *Repo) ReadRows() int
- func (r *Repo) ReleaseAlls() int
- func (r *Repo) RemoveEndpoint(id uuid.UUID)
- func (r *Repo) SetEntitled(tenantId uuid.UUID, entitled bool)
- func (r *Repo) SetFailWrites(err error)
- func (r *Repo) SetLease(unit Unit, owner *uuid.UUID, endpointCount int32)
- func (r *Repo) SetProcess(id uuid.UUID, unitCount, endpointCount int32, expired bool)
- func (r *Repo) ShedCalls() [][]Unit
- func (r *Repo) StatusWrites() []StatusWrite
- func (r *Repo) Tenants() repository.ServerlessTenantRepository
- func (r *Repo) UpdateEndpoint(id uuid.UUID, fn func(ep *sqlcv1.V1ServerlessEndpoint))
- type StatusWrite
- type Unit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionWrite ¶
type ActionWrite struct {
Actions []string
StreamActions []string
EndpointId uuid.UUID
DurableSupported bool
}
ActionWrite is one UpdateRegisteredActions call.
type Repo ¶
Repo is the in-memory repository. Every method is safe for concurrent use.
func (*Repo) ActionWrites ¶
func (r *Repo) ActionWrites() []ActionWrite
func (*Repo) AddEndpoint ¶
func (r *Repo) AddEndpoint(ep *sqlcv1.V1ServerlessEndpoint)
AddEndpoint stores a copy of ep, stamps updated_at, and creates or bumps its lease unit.
func (*Repo) ByIdsCalls ¶
func (*Repo) ClaimCalls ¶
func (*Repo) DeletedProcs ¶
func (*Repo) Endpoint ¶
func (r *Repo) Endpoint(id uuid.UUID) *sqlcv1.V1ServerlessEndpoint
Endpoint returns a copy of a stored endpoint.
func (*Repo) Endpoints ¶
func (r *Repo) Endpoints() repository.ServerlessEndpointRepository
func (*Repo) Heartbeats ¶
func (r *Repo) Heartbeats() []repository.UpsertServerlessProcessOpts
func (*Repo) Lease ¶
func (r *Repo) Lease(unit Unit) *sqlcv1.V1ServerlessLease
Lease returns a copy of a lease row.
func (*Repo) Leases ¶
func (r *Repo) Leases() repository.ServerlessLeaseRepository
func (*Repo) ListForTenantCalls ¶
ListForTenantCalls counts full loads; ListSinceCalls counts incremental refreshes.
func (*Repo) ListSinceCalls ¶
func (*Repo) ListVersionsCalls ¶
ListVersionsCalls counts anti-entropy version pages; ByIdsCalls counts fetches of changed rows by id; ReadRows counts every endpoint row returned in full.
func (*Repo) Processes ¶
func (r *Repo) Processes() repository.ServerlessProcessRepository
func (*Repo) ReleaseAlls ¶
func (*Repo) RemoveEndpoint ¶
RemoveEndpoint hard-deletes an endpoint and decrements its unit's count. RemoveEndpoint deletes the endpoint the way the API does: the row is marked deleted and versioned by the deletion, so only ListUpdatedSince returns it, and the lease unit's count drops. PurgeDeleted removes the row.
func (*Repo) SetEntitled ¶
SetEntitled switches the tenant's serverless entitlement; tenants start entitled.
func (*Repo) SetFailWrites ¶
SetFailWrites makes every write fail with err until called with nil.
func (*Repo) SetProcess ¶
SetProcess creates or overwrites a process row.
func (*Repo) StatusWrites ¶
func (r *Repo) StatusWrites() []StatusWrite
func (*Repo) Tenants ¶
func (r *Repo) Tenants() repository.ServerlessTenantRepository
func (*Repo) UpdateEndpoint ¶
func (r *Repo) UpdateEndpoint(id uuid.UUID, fn func(ep *sqlcv1.V1ServerlessEndpoint))
UpdateEndpoint mutates a stored endpoint and bumps updated_at.
type StatusWrite ¶
StatusWrite is one UpdateStatus call.