storage

package
v0.0.0-...-ca9423e Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package storage defines a persistent storage interface.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyNotFound is returned by Load when the specified key is not found.
	ErrKeyNotFound = errors.New("key not found")

	// ErrStopScan is returned by the callback to Scan to terminate a scan.
	ErrStopScan = errors.New("stop scanning")
)

Functions

This section is empty.

Types

type BlobStore

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

BlobStore implements the package Storage interfaces.

func NewBlob

func NewBlob(bs blob.Store) BlobStore

NewBlob constructs a storage implementation around a blob.Store.

func (BlobStore) Delete

func (s BlobStore) Delete(ctx context.Context, key string) error

Delete implements part of poll.Storage.

func (BlobStore) Load

func (s BlobStore) Load(ctx context.Context, key string, val proto.Message) error

Load implements part of graph.Storage and poll.Storage

func (BlobStore) Scan

func (s BlobStore) Scan(ctx context.Context, start string, f func(string) error) error

Scan implements part of graph.Storage and poll.Storage.

func (BlobStore) Store

func (s BlobStore) Store(ctx context.Context, key string, val proto.Message) error

Store implements part of graph.Storage and poll.Storage.

type Interface

type Interface interface {
	// Load reads the data for the specified key and unmarshals it into val.
	// If key is not present, Load must return storage.ErrKeyNotFound.
	Load(ctx context.Context, key string, val proto.Message) error

	// Store marshals the data from value and stores it under key.
	Store(ctx context.Context, key string, val proto.Message) error

	// Scan calls f with each key lexicographically greater than or equal to
	// start.  If f reports an error scanning stops; if the error is ErrStopScan
	// then Scan return nil, otherwise Scan returns the error from f.
	Scan(ctx context.Context, start string, f func(string) error) error

	// Delete removes the specified key from the database.
	Delete(ctx context.Context, key string) error
}

Interface represents the interface to persistent storage.

Jump to

Keyboard shortcuts

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