storage

package
v0.0.0-...-84ddfae Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ObjectList

type ObjectList struct {
	Names         []string
	NextPageToken string
}

type ObjectListOptions

type ObjectListOptions struct {
	// NamePrefix filters the object names to only those object names starting with NamePrefix.
	NamePrefix string

	// MaxResults is the maximum number of object names to return.
	// If MaxResults is 0 then the maximum number of object names to return is implemention-defined but non-zero.
	MaxResults int

	// PageToken ccan be set to o.NextPageToken where o is an *ObjectList returned from a call to ListObjects.
	PageToken string
}

type ObjectMetadata

type ObjectMetadata = map[string]string

type Storage

type Storage interface {
	// CreateObjectExclusively atomically creates an object named name with metadata metadata and data r if no object named name exists.
	// Returns an error e such that "github.com/go-mod-proxy/go-mod-proxy/internal/errors".ErrorIsCode(e, PreconditionFailed)
	// is true if an object named name already exists.
	CreateObjectExclusively(ctx context.Context, name string, metadata ObjectMetadata, data io.ReadSeeker) error

	// DeleteObject deletes an object named name.
	// Returns an error e such that "github.com/go-mod-proxy/go-mod-proxy/internal/errors".ErrorIsCode(e, NotFound)
	// is true if no object named name exists.
	DeleteObject(ctx context.Context, name string) error

	// GetObject returns the data of an object as a reader.
	// Returns an error e such that "github.com/go-mod-proxy/go-mod-proxy/internal/errors".ErrorIsCode(e, NotFound)
	// is true if no object named name exists.
	GetObject(ctx context.Context, name string) (io.ReadCloser, error)

	// GetObjectMetadata returns the metadata of an object as a reader.
	// Returns an error e such that "github.com/go-mod-proxy/go-mod-proxy/internal/errors".ErrorIsCode(e, NotFound)
	// is true if no object named name exists.
	GetObjectMetadata(ctx context.Context, name string) (ObjectMetadata, error)

	// ListObjects returns a page of objects. A result *ObjectList o may have len(o.Names) < opts.MaxResults
	// even if there are more pages.
	ListObjects(ctx context.Context, opts ObjectListOptions) (*ObjectList, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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