package fs

import "golang.org/x/perf/storage/fs"

Package fs provides a backend-agnostic filesystem layer for storing performance results.

Index

Types

type FS

type FS interface {
	// NewWriter returns a Writer for a given file name.
	// When the Writer is closed, the file will be stored with the
	// given metadata and the data written to the writer.
	NewWriter(ctx context.Context, name string, metadata map[string]string) (Writer, error)
}

An FS stores uploaded benchmark data files.

type MemFS

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

MemFS is an in-memory filesystem implementing the FS interface.

func NewMemFS

func NewMemFS() *MemFS

NewMemFS constructs a new, empty MemFS.

func (*MemFS) Files

func (fs *MemFS) Files() []string

Files returns the names of the files written to fs.

func (*MemFS) NewWriter

func (fs *MemFS) NewWriter(_ context.Context, name string, metadata map[string]string) (Writer, error)

NewWriter returns a Writer for a given file name. As a side effect, it associates the given metadata with the file.

type Writer

type Writer interface {
	io.WriteCloser
	// CloseWithError cancels the writing of the file, removing
	// any partially written data.
	CloseWithError(error) error
}

A Writer is an io.Writer that can also be closed with an error.

Source Files

fs.go

Directories

PathSynopsis
storage/fs/gcsPackage gcs implements the fs.FS interface using Google Cloud Storage.
storage/fs/localPackage local implements the fs.FS interface using local files.
Version
v0.0.0-20250214215153-c95ad7d5b636 (latest)
Published
Feb 14, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
1 week ago

Tools for package owners.