backend

package
v0.0.0-...-5c6c1e7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BackendStorageFactories = make(map[StorageType]BackendStorageFactory)
	BackendStorages         = make(map[string]BackendStorage)
)

Functions

func BackendNameToTypeId

func BackendNameToTypeId(backendName string) (backendType, backendId string)

func LoadConfiguration

func LoadConfiguration(config *util.ViperProxy)

used by master to load remote storage configurations

func LoadFromPbStorageBackends

func LoadFromPbStorageBackends(storageBackends []*master_pb.StorageBackend)

used by volume server to receive remote storage configurations from master

func ToPbStorageBackends

func ToPbStorageBackends() (backends []*master_pb.StorageBackend)

Types

type BackendStorage

type BackendStorage interface {
	ToProperties() map[string]string
	NewStorageFile(key string, tierInfo *volume_server_pb.VolumeInfo) BackendStorageFile
	CopyFile(f *os.File, fn func(progressed int64, percentage float32) error) (key string, size int64, err error)
	DownloadFile(fileName string, key string, fn func(progressed int64, percentage float32) error) (size int64, err error)
	DeleteFile(key string) (err error)
}

type BackendStorageFactory

type BackendStorageFactory interface {
	StorageType() StorageType
	BuildStorage(configuration StringProperties, configPrefix string, id string) (BackendStorage, error)
}

type BackendStorageFile

type BackendStorageFile interface {
	io.ReaderAt
	io.WriterAt
	Truncate(off int64) error
	io.Closer
	GetStat() (datSize int64, modTime time.Time, err error)
	Name() string
	Sync() error
}

func CreateVolumeFile

func CreateVolumeFile(fileName string, preallocate int64, memoryMapSizeMB uint32) (BackendStorageFile, error)

type DiskFile

type DiskFile struct {
	File *os.File
	// contains filtered or unexported fields
}

func NewDiskFile

func NewDiskFile(f *os.File) *DiskFile

func (*DiskFile) Close

func (df *DiskFile) Close() error

func (*DiskFile) GetStat

func (df *DiskFile) GetStat() (datSize int64, modTime time.Time, err error)

func (*DiskFile) Name

func (df *DiskFile) Name() string

func (*DiskFile) ReadAt

func (df *DiskFile) ReadAt(p []byte, off int64) (n int, err error)

func (*DiskFile) Sync

func (df *DiskFile) Sync() error

func (*DiskFile) Truncate

func (df *DiskFile) Truncate(off int64) error

func (*DiskFile) Write

func (df *DiskFile) Write(p []byte) (n int, err error)

func (*DiskFile) WriteAt

func (df *DiskFile) WriteAt(p []byte, off int64) (n int, err error)

type Properties

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

func (*Properties) GetString

func (p *Properties) GetString(key string) string

type StorageType

type StorageType string

type StringProperties

type StringProperties interface {
	GetString(key string) string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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