storage

package
v0.0.0-...-eedcae6 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2015 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockStorage

type BlockStorage struct {
	*BlockStorageOptions

	// Max Open files locker
	FDLocks *concurrency.Locks

	*concurrency.BatchPool
}

Simple block device storage

func NewBlockStorage

func NewBlockStorage(options *BlockStorageOptions) *BlockStorage

func (*BlockStorage) CreateUploadSession

func (s *BlockStorage) CreateUploadSession(uploadID uuid.UUID, in []proto.Manifest, ttl time.Duration) (missing []proto.ID, err error)

func (*BlockStorage) FinishUploadSession

func (s *BlockStorage) FinishUploadSession(uploadID uuid.UUID) (err error)

func (*BlockStorage) GetManifests

func (s *BlockStorage) GetManifests(ids []proto.ID) (res []proto.Manifest, err error)

func (*BlockStorage) GetMissingBlobIDs

func (s *BlockStorage) GetMissingBlobIDs(ids []proto.ID) (res []proto.ID, err error)

func (*BlockStorage) IsSpecExists

func (s *BlockStorage) IsSpecExists(id proto.ID) (ok bool, err error)

func (*BlockStorage) ReadChunkFromBlob

func (s *BlockStorage) ReadChunkFromBlob(blobID proto.ID, size, offset int64, w io.Writer) (err error)

func (*BlockStorage) ReadSpec

func (s *BlockStorage) ReadSpec(id proto.ID) (res proto.Spec, err error)

func (*BlockStorage) SetTag

func (s *BlockStorage) SetTag(tag string, blobIDs []proto.ID) (err error)

func (*BlockStorage) UploadChunk

func (s *BlockStorage) UploadChunk(uploadID uuid.UUID, chunkID proto.ID, r io.Reader) (err error)

func (*BlockStorage) WriteChunk

func (s *BlockStorage) WriteChunk(blobID, chunkID proto.ID, size int64, r io.Reader) (err error)

func (*BlockStorage) WriteSpec

func (s *BlockStorage) WriteSpec(in proto.Spec) (err error)

type BlockStorageOptions

type BlockStorageOptions struct {
	// Storage root
	Root string

	// Split factor
	Split int

	MaxFiles int
	PoolSize int
}

type Storage

type Storage interface {
	IsSpecExists(id proto.ID) (ok bool, err error)

	// Write spec
	WriteSpec(s proto.Spec) (err error)

	// Read spec
	ReadSpec(id proto.ID) (res proto.Spec, err error)

	// Get manifests by it's ids
	GetManifests(ids []proto.ID) (res []proto.Manifest, err error)

	// Read Chunk from blob by size and offset
	ReadChunkFromBlob(blobID proto.ID, size, offset int64, w io.Writer) (err error)

	// Returns IDs of requested blobs except already stored
	GetMissingBlobIDs(ids []proto.ID) (res []proto.ID, err error)

	// Create new upload session. Returns upload ID and IDs of chunks
	// missing on bard. Upload id is simple uuid bytes
	CreateUploadSession(uploadID uuid.UUID, in []proto.Manifest, ttl time.Duration) (missingChunkIDs []proto.ID, err error)

	// Upload chunk
	UploadChunk(uploadID uuid.UUID, chunkID proto.ID, r io.Reader) (err error)

	// Finish upload session
	FinishUploadSession(uploadID uuid.UUID) (err error)

	// Set tag on blobs
	SetTag(tag string, blobIDs []proto.ID) (err error)
}

All operations in storage driver are independent to each other

func BlockStorageFactory

func BlockStorageFactory(opts map[string]string) (res Storage, err error)

func GuessStorage

func GuessStorage(arg string) (res Storage, err error)

type StorageFactory

type StorageFactory func(arg map[string]string) (res Storage, err error)

Storage factory

Jump to

Keyboard shortcuts

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