bcache

package
v3.0.0-beta+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeOut = 5 * time.Second
	SlowRequest    = 2 * time.Second
)
View Source
const (
	PathListSeparator    = ";"
	CacheConfSeparator   = ":"
	BlockLimit           = 10000
	SpaceLimit           = 85
	SpaceCheckInterval   = 60 * time.Second
	TmpFileCheckInterval = 20 * 60 * time.Second
	FilePerm             = 0644
	Basedir              = "blocks"
)
View Source
const (
	UnixSocketPath         = "/var/lib/adls/bcache.socket"
	CacheKey               = "cachekey"
	CheckSum               = "md5sum"
	OffSet                 = "offset"
	Len                    = "len"
	Volume                 = "volume"
	ContextKeyStatusCode   = "status_code"
	ContextKeyErrorMessage = "error_message"
	ContextKeyRequestID    = "ctx_request_id"

	//config
	CacheDir     = "cacheDir"
	CacheSize    = "cacheSize"
	CacheLimit   = "cacheLimit"
	CacheFree    = "cacheFree"
	BlockSize    = "blockSize"
	MaxBlockSize = 128 << 20
)

Variables

View Source
var (
	BadDigest       = &ErrorCode{ErrorCode: "BadDigest", ErrorMessage: "The Content-MD5 you specified did not match what we received.", StatusCode: http.StatusBadRequest}
	KeyTooLongError = &ErrorCode{ErrorCode: "KeyTooLongError", ErrorMessage: "", StatusCode: http.StatusBadRequest}
	InvalidKey      = &ErrorCode{ErrorCode: "InvalidKey", ErrorMessage: "Cache key is Illegal", StatusCode: http.StatusBadRequest}
	EntityTooLarge  = &ErrorCode{ErrorCode: "EntityTooLarge", ErrorMessage: "Your proposed upload exceeds the maximum allowed object size.", StatusCode: http.StatusBadRequest}
	InvalidArgument = &ErrorCode{ErrorCode: "InvalidArgument", ErrorMessage: "Invalid Argument,cachekey|md5|offsetlen is required.", StatusCode: http.StatusBadRequest}
	InvalidNumber   = &ErrorCode{ErrorCode: "InvalidNumber", ErrorMessage: "Invalid Argument type,need number .", StatusCode: http.StatusBadRequest}
	NoSuchCacheKey  = &ErrorCode{ErrorCode: "NoSuchCacheKey", ErrorMessage: "The specified cache key does not exist.", StatusCode: http.StatusNotFound}
	ReadStreamError = &ErrorCode{ErrorCode: "ReadStreamError", ErrorMessage: "Read body stream unknown exception.", StatusCode: http.StatusBadRequest}
	InternalError   = &ErrorCode{ErrorCode: "InternalError", ErrorMessage: "Server interval error.", StatusCode: http.StatusInternalServerError}
)

Functions

func AccessTime

func AccessTime(info os.FileInfo) int64

func NewServer

func NewServer() *bcacheStore

Types

type BcacheClient

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

func NewBcacheClient

func NewBcacheClient() *BcacheClient

func (*BcacheClient) Evict

func (bc *BcacheClient) Evict(key string)

func (*BcacheClient) Get

func (bc *BcacheClient) Get(key string, buf []byte, offset uint64, size uint32) (int, error)

func (*BcacheClient) Put

func (bc *BcacheClient) Put(key string, buf []byte) error

type BcacheManager

type BcacheManager interface {
	// contains filtered or unexported methods
}

type DiskStore

type DiskStore struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewDiskStore

func NewDiskStore(dir string, cacheSize int64, config *bcacheConfig) *DiskStore

type ErrorCode

type ErrorCode struct {
	ErrorCode    string
	ErrorMessage string
	StatusCode   int
}

func (ErrorCode) ServeResponse

func (code ErrorCode) ServeResponse(w http.ResponseWriter, r *http.Request) error

type ReadCloser

type ReadCloser interface {
	io.Reader
	io.ReaderAt
	io.Closer
}

Jump to

Keyboard shortcuts

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