memory

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package memory is an in-memory storage.Backend used as a test double. It is not a deployment target: Presign* return stub URLs since there is no real endpoint to sign against.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

Backend is a concurrency-safe in-memory object store.

func New

func New() *Backend

New returns an empty in-memory backend.

func (*Backend) Delete

func (b *Backend) Delete(ctx context.Context, key string) error

func (*Backend) Get

func (b *Backend) Get(ctx context.Context, key string) (io.ReadCloser, error)

func (*Backend) GetRange

func (b *Backend) GetRange(ctx context.Context, key string, offset, length int64) (io.ReadCloser, error)

func (*Backend) List

func (b *Backend) List(ctx context.Context, fn func(storage.StoredObject) error) error

func (*Backend) PresignGet

func (b *Backend) PresignGet(ctx context.Context, key string, ttl time.Duration) (string, error)

func (*Backend) PresignPut

func (b *Backend) PresignPut(ctx context.Context, key string, ttl time.Duration) (string, error)

func (*Backend) Put

func (b *Backend) Put(ctx context.Context, key string, r io.Reader, size int64, contentType string) error

Put buffers the whole reader — acceptable because this is a test double, not a production path.

func (*Backend) PutAged

func (b *Backend) PutAged(key string, data []byte, modTime time.Time)

PutAged stores an object with an explicit modification time, letting tests simulate objects old enough to be reclaimed by GC.

func (*Backend) Stat

func (b *Backend) Stat(ctx context.Context, key string) (storage.ObjectInfo, error)

Jump to

Keyboard shortcuts

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