store

package
v0.0.0-...-302cdf8 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrKeyNotFound = errors.ConstError("key not found")
)

Variables

View Source
var ChunkOptions = fastcdc.Options{
	MinSize:     1 * 1024 * 1024,
	AverageSize: 4 * 1024 * 1024,
	MaxSize:     (8 * 1024 * 1024) - 1024,
}

Functions

This section is empty.

Types

type CachingStore

type CachingStore struct {
	Disk   Store
	Memory Store
}

func (*CachingStore) Delete

func (c *CachingStore) Delete(key string, ctx context.Context) error

func (*CachingStore) Get

func (c *CachingStore) Get(key string, ctx context.Context) (reader io.ReadCloser, err error)

func (*CachingStore) Init

func (c *CachingStore) Init(ctx context.Context) error

func (*CachingStore) List

func (*CachingStore) Put

func (c *CachingStore) Put(key string, reader io.ReadCloser, ctx context.Context) error

func (*CachingStore) PutAsync

func (c *CachingStore) PutAsync(key string, reader io.ReadCloser, ctx context.Context) (nats.PubAckFuture, error)

func (*CachingStore) Stat

func (c *CachingStore) Stat(key string, ctx context.Context) (ok bool, err error)

type CdcStore

type CdcStore struct {
	Meta   Store
	Chunks Store
}

func (*CdcStore) Delete

func (c *CdcStore) Delete(digest Digest, ctx context.Context) error

func (*CdcStore) Get

func (c *CdcStore) Get(digest Digest, ctx context.Context) (io.ReadCloser, error)

func (*CdcStore) Init

func (c *CdcStore) Init(ctx context.Context) error

func (*CdcStore) List

func (*CdcStore) Put

func (c *CdcStore) Put(reader io.ReadCloser, ctx context.Context) (*Digest, error)

func (*CdcStore) Stat

func (c *CdcStore) Stat(digest Digest, ctx context.Context) (ok bool, err error)

type Digest

type Digest [32]byte

func (Digest) String

func (d Digest) String() string

type NatsStore

type NatsStore struct {
	Conn          *nats.Conn
	StreamConfig  *nats.StreamConfig
	SubjectPrefix string
}

func (*NatsStore) Delete

func (n *NatsStore) Delete(key string, ctx context.Context) error

func (*NatsStore) Get

func (n *NatsStore) Get(key string, ctx context.Context) (io.ReadCloser, error)

func (*NatsStore) Init

func (n *NatsStore) Init(ctx context.Context) error

func (*NatsStore) List

func (*NatsStore) Put

func (n *NatsStore) Put(key string, reader io.ReadCloser, ctx context.Context) error

func (*NatsStore) PutAsync

func (n *NatsStore) PutAsync(key string, reader io.ReadCloser, ctx context.Context) (nats.PubAckFuture, error)

func (*NatsStore) Stat

func (n *NatsStore) Stat(key string, ctx context.Context) (ok bool, err error)

type Store

type Store interface {
	Init(ctx context.Context) error
	Get(key string, ctx context.Context) (io.ReadCloser, error)
	Put(key string, reader io.ReadCloser, ctx context.Context) error
	PutAsync(key string, reader io.ReadCloser, ctx context.Context) (nats.PubAckFuture, error)
	List(ctx context.Context) (util.Iterator[io.ReadCloser], error)
	Stat(key string, ctx context.Context) (bool, error)
	Delete(key string, ctx context.Context) error
}

Jump to

Keyboard shortcuts

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