store

package
v0.0.0-...-edb713b Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound indicates a key is not in the store.
	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type DiskStatus

type DiskStatus struct {
	All  uint64 `json:"all"`
	Used uint64 `json:"used"`
	Free uint64 `json:"free"`
}

func DiskUsage

func DiskUsage(path string) (disk DiskStatus, err error)

DiskUsage returns the disk usage of path

type DiskStore

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

DiskStore implements Store.

func NewDiskStore

func NewDiskStore(dir string) *DiskStore

func (*DiskStore) Delete

func (s *DiskStore) Delete(key []byte) (err error)

func (*DiskStore) Get

func (s *DiskStore) Get(key []byte) (value []byte, err error)

func (*DiskStore) Put

func (s *DiskStore) Put(key, value []byte) (err error)

func (*DiskStore) Stats

func (s *DiskStore) Stats() (*Stats, error)

func (*DiskStore) String

func (s *DiskStore) String() string

type RemoteStore

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

RemoteStore implements Store. It requires to connect to a blobserver.

func (*RemoteStore) Delete

func (r *RemoteStore) Delete(key []byte) (err error)

func (*RemoteStore) Get

func (r *RemoteStore) Get(key []byte) (value []byte, err error)

func (*RemoteStore) Put

func (r *RemoteStore) Put(key, value []byte) (err error)

func (*RemoteStore) Stats

func (s *RemoteStore) Stats() (*Stats, error)

func (*RemoteStore) String

func (s *RemoteStore) String() string

type Stats

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

func (Stats) Blobs

func (s Stats) Blobs() uint64

func (Stats) Free

func (s Stats) Free() uint64

func (Stats) Used

func (s Stats) Used() uint64

type Store

type Store interface {
	fmt.Stringer

	Put(key, value []byte) (err error)

	// Get should return ErrNotFound if the key is not in the store.
	Get(key []byte) (value []byte, err error)

	// Delete should return ErrNotFound if the ksy is not in the store.
	Delete(key []byte) (err error)

	Stats() (*Stats, error)
}

Store represents a key-value store.

func NewBeyondStore

func NewBeyondStore(cfg string) (Store, error)

func NewRemoteStore

func NewRemoteStore(address string) Store

func NewStore

func NewStore(uri string) (Store, error)

type URI

type URI struct {
	Type    string
	SubType string
	Config  string
}

func ParseURI

func ParseURI(uri string) (*URI, error)

func (*URI) String

func (u *URI) String() string

Jump to

Keyboard shortcuts

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