storage

package
v0.5.0-beta Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LocalStorage  = config.LocalStorage
	MemoryStorage = config.MemoryStorage
)
View Source
const (
	MinioStorage = config.MinioStorage
)
View Source
const (
	OSSStorage = config.OSSStorage
)
View Source
const (
	S3Storage = config.S3Storage
)
View Source
const (
	WebdavStorage = config.WebdavStorage
)

Variables

This section is empty.

Functions

func InitLocalCache

func InitLocalCache(config config.Config)

Types

type CacheNode

type CacheNode interface {
	io.ReaderAt
	io.WriterAt
	io.Closer
	Size() int64
	// contains filtered or unexported methods
}

func NewMemCacheNode

func NewMemCacheNode(needBig bool) CacheNode

type Info

type Info struct {
	Key  string
	Size int64
}

type LocalCache

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

func NewLocalCache

func NewLocalCache(s Storage) *LocalCache

func (*LocalCache) CommitTemporaryNode

func (c *LocalCache) CommitTemporaryNode(ctx context.Context, segID, idx int64, node CacheNode) error

func (*LocalCache) OpenCacheNode

func (c *LocalCache) OpenCacheNode(ctx context.Context, key, idx int64) (CacheNode, error)

func (*LocalCache) OpenTemporaryNode

func (c *LocalCache) OpenTemporaryNode(ctx context.Context, oid, off int64) (CacheNode, error)

type Storage

type Storage interface {
	ID() string
	Get(ctx context.Context, key, idx int64) (io.ReadCloser, error)
	Put(ctx context.Context, key, idx int64, dataReader io.Reader) error
	Delete(ctx context.Context, key int64) error
	Head(ctx context.Context, key int64, idx int64) (Info, error)
}

func NewStorage

func NewStorage(storageID, storageType string, cfg config.Storage) (s Storage, err error)

Jump to

Keyboard shortcuts

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