backend

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SMALL_FILE_POOLNAME = "rabbit"
	BIG_FILE_POOLNAME   = "tiger"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster interface {
	// get cluster ID
	ID() string
	// get cluster usage statistics
	GetUsage() (Usage, error)
	// put new object to storage Cluster
	Put(poolName string, object io.Reader) (objectName string,
		bytesWritten uint64, err error)
	// append a new chunk to object, empty existName means new object
	Append(poolName, existName string, objectChunk io.Reader,
		offset int64) (objectName string, bytesWritten uint64, err error)
	// get a ReadCloser for object, length == 0 means get the whole object
	GetReader(poolName, objectName string,
		offset int64, length uint64) (io.ReadCloser, error)
	// remove an object
	Remove(poolName, objectName string) error
}

type Plugin

type Plugin interface {
	// initialize backend cluster handlers,
	// returns cluster ID -> Cluster, panic on errors
	Initialize(logger *log.Logger, config helper.Config) map[string]Cluster
}

Backend plugins should implement this interface

type Usage

type Usage struct {
	UsedSpacePercent int // range 0 ~ 100
}

Jump to

Keyboard shortcuts

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