fixture

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package fixture owns bounded, expiring synthetic test data. It has no access to platform credentials, other servers, the filesystem, or external services.

Index

Constants

View Source
const (
	MaxRuns       = 128
	MaxRecords    = 64
	MaxValueBytes = 4096
	DefaultTTL    = 15 * time.Minute
	MaxTTL        = time.Hour
)

Variables

View Source
var (
	ErrNotFound = errors.New("run or record not found (it may have expired)")
	ErrConflict = errors.New("revision conflict")
	ErrCapacity = errors.New("fixture capacity reached; close a run or remove a record")
)

Functions

This section is empty.

Types

type Record

type Record struct {
	Key      string `json:"key"`
	Value    string `json:"value"`
	Revision uint64 `json:"revision"`
}

type RunInfo

type RunInfo struct {
	ID        string    `json:"run_id"`
	Label     string    `json:"label"`
	ExpiresAt time.Time `json:"expires_at"`
}

type Stats

type Stats struct {
	Runs    int `json:"active_runs"`
	Records int `json:"records"`
}

type Store

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

func NewStore

func NewStore(now func() time.Time) *Store

func (*Store) Close

func (s *Store) Close(id string) (bool, error)

func (*Store) Delete

func (s *Store) Delete(id, key string, expected *uint64) (bool, error)

func (*Store) Get

func (s *Store) Get(id, key string) (Record, error)

func (*Store) Inspect

func (s *Store) Inspect() Stats

func (*Store) Open

func (s *Store) Open(label string, ttl time.Duration) (RunInfo, error)

func (*Store) Put

func (s *Store) Put(id, key, value string, expected *uint64) (Record, error)

Jump to

Keyboard shortcuts

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