cache

package
v0.0.0-...-50e0f8f Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrObjectNotFound = errors.New("object not found")
)

Functions

This section is empty.

Types

type FilesystemClient

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

func NewFilesystemClient

func NewFilesystemClient(opts FilesystemClientOptions) *FilesystemClient

func (*FilesystemClient) Get

func (c *FilesystemClient) Get(ctx context.Context, key string) ([]byte, error)

func (*FilesystemClient) Put

func (c *FilesystemClient) Put(ctx context.Context, key string, raw []byte, tags map[string]string) (*ObjectInfo, error)

func (*FilesystemClient) Stat

func (c *FilesystemClient) Stat(ctx context.Context, key string) (*ObjectInfo, error)

func (*FilesystemClient) Type

type FilesystemClientOptions

type FilesystemClientOptions struct {
	BaseDir string
}

type MinioClient

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

func NewMinioClient

func NewMinioClient(opts MinioClientOptions) (*MinioClient, error)

func (*MinioClient) Get

func (c *MinioClient) Get(ctx context.Context, key string) ([]byte, error)

func (*MinioClient) Put

func (c *MinioClient) Put(ctx context.Context, key string, raw []byte, tags map[string]string) (*ObjectInfo, error)

func (*MinioClient) Stat

func (c *MinioClient) Stat(ctx context.Context, key string) (*ObjectInfo, error)

func (*MinioClient) Type

func (c *MinioClient) Type() ObjectStoreType

type MinioClientOptions

type MinioClientOptions struct {
	Endpoint        string
	Bucket          string
	AccessKeyID     string
	SecretAccessKey string
}

type ObjectInfo

type ObjectInfo struct {
	Key  string
	ETag string
	Size int64
	Tags map[string]string
}

type ObjectStore

type ObjectStore interface {
	Type() ObjectStoreType
	Get(context.Context, string) ([]byte, error)
	Put(context.Context, string, []byte, map[string]string) (*ObjectInfo, error)
	Stat(context.Context, string) (*ObjectInfo, error)
}

func NewObjectStore

func NewObjectStore(opts ObjectStoreOptions) (ObjectStore, error)

type ObjectStoreOptions

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

func (*ObjectStoreOptions) SetFilesystem

func (o *ObjectStoreOptions) SetFilesystem(baseDir string) *ObjectStoreOptions

func (*ObjectStoreOptions) SetMinio

func (o *ObjectStoreOptions) SetMinio(endpoint, bucket, accessKeyID, secretAccessKey string) *ObjectStoreOptions

type ObjectStoreType

type ObjectStoreType string
const (
	MinioObjectStore      ObjectStoreType = "minio"
	FilesystemObjectStore ObjectStoreType = "filesystem"
)

func (ObjectStoreType) String

func (t ObjectStoreType) String() string

Jump to

Keyboard shortcuts

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