Help us shape the future of Go! Take the 2026 Go Developer Survey

objectstore

package
v2.0.2 Latest Latest
Warning

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

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

Documentation

Overview

Package objectstore provides deterministic test doubles for AppTheory object-store code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Call

type Call struct {
	Operation   Operation
	Ref         store.ObjectRef
	MaxBytes    int64
	ContentType string
	Metadata    map[string]string
	Payload     []byte
}

Call is one recorded FakeStore operation.

type FakeStore

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

FakeStore is an in-memory Store for tests.

FakeStore records calls in order, injects per-operation failures, and copies all byte slices and metadata maps at its boundary.

func NewStore

func NewStore() *FakeStore

NewStore creates an empty FakeStore.

func (*FakeStore) Calls

func (s *FakeStore) Calls() []Call

Calls returns the recorded operations in call order.

func (*FakeStore) Delete

func (s *FakeStore) Delete(_ context.Context, input store.DeleteInput) error

Delete removes the referenced object. An unversioned ref removes all versions for the bucket/key.

func (*FakeStore) Get

func (s *FakeStore) Get(_ context.Context, input store.GetInput) (*store.GetOutput, error)

Get returns a bounded payload copy. MaxBytes must be positive.

func (*FakeStore) Put

Put stores a payload copy and returns a version-aware reference.

func (*FakeStore) SetError

func (s *FakeStore) SetError(operation Operation, err error)

SetError injects err for subsequent calls to operation. Passing nil clears the injection.

type Operation

type Operation string

Operation names a Store operation recorded by FakeStore.

const (
	// OperationPut records a Store.Put call.
	OperationPut Operation = "Put"
	// OperationGet records a Store.Get call.
	OperationGet Operation = "Get"
	// OperationDelete records a Store.Delete call.
	OperationDelete Operation = "Delete"
)

Jump to

Keyboard shortcuts

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