store

package
v0.39.0 Latest Latest
Warning

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

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

Documentation

Overview

Package store is the lab's in-memory record store. Audit webhook delivery is asynchronous and batched, so a late event from one scenario can land after the next has started; clearing between scenarios is therefore not enough. The store keeps every record attributed to its scenario and serves reads filtered by scenario, so the test driver isolates scenarios instead of trusting a clean slate (see docs/spec/mutation-capture-lab-design.md, "Isolated Test Setup").

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
}

Store is a concurrency-safe, insertion-ordered record store.

func New

func New() *Store

New returns an empty Store.

func (*Store) Add

Add stores a record, assigning a stable insertion ID when the record has none, and returns the stored copy. Records are kept in observation (insertion) order, because for the corpus the ordering and count of events are part of the behavior under test.

func (*Store) Clear

func (s *Store) Clear()

Clear removes all records.

func (*Store) Len

func (s *Store) Len(scenario string) int

Len reports the number of records for one scenario ("" counts all). It is the signal the test driver's bounded drain watches: it waits until the expected records have arrived and the count has been quiet for a settle window.

func (*Store) List

func (s *Store) List(scenario string) []mutationlab.Record

List returns the records for one scenario in insertion order. An empty scenario returns every record.

Jump to

Keyboard shortcuts

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