memory

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package memory provides a deterministic, concurrency-safe in-memory filesystem adapter intended for tests and ephemeral workloads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

Adapter stores objects in memory and is safe for concurrent use.

func New

func New(options ...Option) *Adapter

New constructs an empty adapter.

func (*Adapter) Capabilities

func (a *Adapter) Capabilities() filesystem.CapabilitySet

Capabilities reports the adapter's explicitly supported operations.

func (*Adapter) Checksum

Checksum computes an explicitly requested digest.

func (*Adapter) Copy

func (a *Adapter) Copy(ctx context.Context, source, destination filesystem.Path, options filesystem.CopyOptions) error

Copy duplicates an object and its properties.

func (*Adapter) Delete

func (a *Adapter) Delete(ctx context.Context, path filesystem.Path) error

Delete removes an object.

func (*Adapter) List

List returns a deterministic snapshot iterator.

func (*Adapter) Move

func (a *Adapter) Move(ctx context.Context, source, destination filesystem.Path, options filesystem.MoveOptions) error

Move atomically renames an object within this adapter.

func (*Adapter) Open

func (a *Adapter) Open(ctx context.Context, path filesystem.Path) (io.ReadCloser, error)

Open returns an independent reader over an immutable snapshot.

func (*Adapter) OpenRange

func (a *Adapter) OpenRange(ctx context.Context, path filesystem.Path, byteRange filesystem.ByteRange) (io.ReadCloser, error)

OpenRange returns an independent reader over a bounded object snapshot.

func (*Adapter) OpenWriter

func (a *Adapter) OpenWriter(ctx context.Context, path filesystem.Path, options filesystem.WriteOptions) (io.WriteCloser, error)

OpenWriter returns a streaming writer that publishes through Write on Close. Abandoning it without closing leaves the publication incomplete.

func (*Adapter) SetMetadata

func (a *Adapter) SetMetadata(ctx context.Context, path filesystem.Path, metadata map[string]string) error

SetMetadata replaces user metadata.

func (*Adapter) SetVisibility

func (a *Adapter) SetVisibility(ctx context.Context, path filesystem.Path, visibility filesystem.Visibility) error

SetVisibility changes an object's coarse visibility.

func (*Adapter) Stat

Stat returns a defensive metadata copy.

func (*Adapter) Visibility

func (a *Adapter) Visibility(ctx context.Context, path filesystem.Path) (filesystem.Visibility, error)

Visibility retrieves an object's coarse visibility.

func (*Adapter) Write

func (a *Adapter) Write(ctx context.Context, path filesystem.Path, source io.Reader, options filesystem.WriteOptions) (filesystem.Metadata, error)

Write consumes source before atomically publishing the object.

type Option

type Option func(*Adapter)

Option configures an Adapter.

func WithClock

func WithClock(clock func() time.Time) Option

WithClock replaces the clock used for modification times.

Jump to

Keyboard shortcuts

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