teststore

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package teststore provides a strict transactional fake for operation and adapter conformance tests. It is not a production in-memory database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

func New

func New() *Store

func (*Store) AcquireDocumentLock

func (backend *Store) AcquireDocumentLock(_ context.Context, candidate store.DocumentLock, now time.Time, takeover bool) (store.DocumentLock, bool, error)

func (*Store) AllowAuthAttempt

func (backend *Store) AllowAuthAttempt(_ context.Context, keyHash string, now time.Time, window time.Duration, maximum int) (bool, error)

func (*Store) Begin

func (backend *Store) Begin(ctx context.Context) (store.Transaction, error)

func (*Store) BeginSnapshot

func (backend *Store) BeginSnapshot(ctx context.Context) (store.Transaction, error)

func (*Store) CancelTask

func (backend *Store) CancelTask(ctx context.Context, id string) error

func (*Store) ChangePasswordHash

func (backend *Store) ChangePasswordHash(_ context.Context, collection schema.Collection, userID string, expectedPasswordHash, hash []byte) error

func (*Store) ClaimTasks

func (backend *Store) ClaimTasks(ctx context.Context, request store.TaskClaim) ([]store.Task, error)

func (*Store) CompleteTask

func (backend *Store) CompleteTask(ctx context.Context, id, leaseToken string, output json.RawMessage) error

func (*Store) CreateAPIKey

func (backend *Store) CreateAPIKey(_ context.Context, key store.AuthAPIKey, sessionTokenHash string, now time.Time) error

func (*Store) CreateAuthToken

func (backend *Store) CreateAuthToken(_ context.Context, token store.AuthToken) error

func (*Store) CreateSession

func (backend *Store) CreateSession(_ context.Context, record store.AuthSession, expectedPasswordHash []byte) error

func (*Store) DeleteAPIKey

func (backend *Store) DeleteAPIKey(_ context.Context, collectionID schema.StableID, userID, id string) error

func (*Store) DeletePreference

func (backend *Store) DeletePreference(_ context.Context, collectionID schema.StableID, userID, key string) error

func (*Store) DeletePreferences

func (backend *Store) DeletePreferences(_ context.Context, collectionID schema.StableID, userID string) error

func (*Store) DeleteSession

func (backend *Store) DeleteSession(_ context.Context, tokenHash string) error

func (*Store) DeleteUserSession

func (backend *Store) DeleteUserSession(_ context.Context, collectionID schema.StableID, userID, sessionID string) error

func (*Store) DeleteUserSessions

func (backend *Store) DeleteUserSessions(_ context.Context, collectionID schema.StableID, userID string) error

func (*Store) DismissTaskForTarget

func (backend *Store) DismissTaskForTarget(ctx context.Context, id, slug string, target store.DocumentReference) error

func (*Store) EnqueueTask

func (backend *Store) EnqueueTask(ctx context.Context, task store.Task) (store.Task, error)

func (*Store) Events

func (backend *Store) Events() []string

func (*Store) FailTask

func (backend *Store) FailTask(ctx context.Context, failure store.TaskFailure) error

func (*Store) FindAPIKey

func (backend *Store) FindAPIKey(_ context.Context, id string, now time.Time) (store.AuthAPIKey, error)

func (*Store) FindAuthCredential

func (backend *Store) FindAuthCredential(_ context.Context, collection schema.Collection, identity string) (store.AuthCredential, error)

func (*Store) FindDocumentLock

func (backend *Store) FindDocumentLock(_ context.Context, collectionID schema.StableID, documentID string, now time.Time) (store.DocumentLock, error)

func (*Store) FindSession

func (backend *Store) FindSession(_ context.Context, tokenHash string, now time.Time) (store.AuthSession, error)

func (*Store) FindTask

func (backend *Store) FindTask(ctx context.Context, id string) (store.Task, error)

func (*Store) ForceUnlock

func (backend *Store) ForceUnlock(_ context.Context, collectionID schema.StableID, userID string) error

func (*Store) GetPreference

func (backend *Store) GetPreference(_ context.Context, collectionID schema.StableID, userID, key string) (store.Preference, error)

func (*Store) HeartbeatTask

func (backend *Store) HeartbeatTask(ctx context.Context, id, leaseToken string, leaseDuration time.Duration) error

func (*Store) ListAPIKeys

func (backend *Store) ListAPIKeys(_ context.Context, collectionID schema.StableID, userID string, now time.Time) ([]store.AuthAPIKey, error)

func (*Store) ListSessions

func (backend *Store) ListSessions(_ context.Context, collectionID schema.StableID, userID string, now time.Time) ([]store.AuthSession, error)

func (*Store) ListTasks

func (backend *Store) ListTasks(ctx context.Context, request store.TaskList) ([]store.Task, error)

func (*Store) LockUploadObjects

func (backend *Store) LockUploadObjects(ctx context.Context, objectKeys []string) (func(), error)

func (*Store) Ping

func (backend *Store) Ping(ctx context.Context) error

func (*Store) PruneExpiredAuth

func (backend *Store) PruneExpiredAuth(ctx context.Context, limit int) (store.AuthPruneResult, error)

func (*Store) PruneTasks

func (backend *Store) PruneTasks(ctx context.Context, limit int) (int, error)

func (*Store) Ready

func (backend *Store) Ready(ctx context.Context, _ schema.Manifest) error

func (*Store) RecordFailedLogin

func (backend *Store) RecordFailedLogin(_ context.Context, collectionID schema.StableID, userID string, now time.Time, maximum int, lockDuration time.Duration) (store.AuthCredential, error)

func (*Store) ReleaseDocumentLock

func (backend *Store) ReleaseDocumentLock(_ context.Context, collectionID schema.StableID, documentID string, ownerCollectionID schema.StableID, ownerID string) error

func (*Store) ReleaseTask

func (backend *Store) ReleaseTask(ctx context.Context, id, leaseToken string, delay time.Duration, code, message string) error

func (*Store) ResetLoginAttempts

func (backend *Store) ResetLoginAttempts(_ context.Context, collectionID schema.StableID, userID string, now time.Time) (bool, error)

func (*Store) ResetPasswordWithToken

func (backend *Store) ResetPasswordWithToken(_ context.Context, collectionID schema.StableID, tokenHash string, hash []byte, now time.Time) (string, error)

func (*Store) RotateSession

func (backend *Store) RotateSession(_ context.Context, currentHash string, replacement store.AuthSession, now time.Time) error

func (*Store) SetPasswordHash

func (backend *Store) SetPasswordHash(_ context.Context, collection schema.Collection, userID string, hash []byte, initiallyVerified bool) error

func (*Store) SetPreference

func (backend *Store) SetPreference(_ context.Context, preference store.Preference) (store.Preference, error)

func (*Store) TouchAPIKey

func (backend *Store) TouchAPIKey(_ context.Context, id string, now time.Time) error

func (*Store) UpgradePasswordHash

func (backend *Store) UpgradePasswordHash(_ context.Context, collection schema.Collection, userID string, expectedPasswordHash, hash []byte) error

func (*Store) VerifyEmailWithToken

func (backend *Store) VerifyEmailWithToken(_ context.Context, collectionID schema.StableID, tokenHash string, now time.Time) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL