blobstore

package
v0.0.0-...-7570391 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyMux = errors.New("blobstore.Mux is empty.")
)

Functions

func GenerateNewBlobPath

func GenerateNewBlobPath(bs RandomAccessBlobStore) (string, error)

GenerateNewBlobPath tries to return a new unique blob path. Note that this may return an already used blobpath in high contention, although it is highly unlikely it will happen.

Types

type BlobHandle

type BlobHandle interface {
	RandomAccessIO
	SizeQueryable
	Truncate(int64) error
	io.Closer
}

type BlobLister

type BlobLister interface {
	ListBlobs() ([]string, error)
}

type BlobMatcher

type BlobMatcher func(blobpath string) bool

type BlobRemover

type BlobRemover interface {
	RemoveBlob(blobpath string) error
}

type BlobSizer

type BlobSizer interface {
	BlobSize(blobpath string) (int64, error)
}

type BlobStore

type BlobStore interface {
	OpenWriter(blobpath string) (io.WriteCloser, error)
	OpenReader(blobpath string) (io.ReadCloser, error)
}

type FileBlobHandle

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

func (FileBlobHandle) Close

func (h FileBlobHandle) Close() error

func (FileBlobHandle) PRead

func (h FileBlobHandle) PRead(p []byte, offset int64) error

func (FileBlobHandle) PWrite

func (h FileBlobHandle) PWrite(p []byte, offset int64) error

func (FileBlobHandle) Size

func (h FileBlobHandle) Size() int64

func (FileBlobHandle) Truncate

func (h FileBlobHandle) Truncate(size int64) error

type FileBlobStore

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

func NewFileBlobStore

func NewFileBlobStore(base string, flags int) (*FileBlobStore, error)

func (*FileBlobStore) BlobSize

func (f *FileBlobStore) BlobSize(blobpath string) (int64, error)

func (*FileBlobStore) Flags

func (f *FileBlobStore) Flags() int

func (*FileBlobStore) GetBase

func (f *FileBlobStore) GetBase() string

func (*FileBlobStore) ImplName

func (*FileBlobStore) ImplName() string

func (*FileBlobStore) ListBlobs

func (f *FileBlobStore) ListBlobs() ([]string, error)

func (*FileBlobStore) Open

func (f *FileBlobStore) Open(blobpath string, flags int) (BlobHandle, error)

func (*FileBlobStore) OpenReader

func (f *FileBlobStore) OpenReader(blobpath string) (io.ReadCloser, error)

func (*FileBlobStore) OpenWriter

func (f *FileBlobStore) OpenWriter(blobpath string) (io.WriteCloser, error)

func (*FileBlobStore) RemoveBlob

func (f *FileBlobStore) RemoveBlob(blobpath string) error

func (*FileBlobStore) SetFlags

func (f *FileBlobStore) SetFlags(flags int)

func (*FileBlobStore) TotalSize

func (f *FileBlobStore) TotalSize() (int64, error)

type MemBlobHandle

type MemBlobHandle struct {
	Content []byte
}

func NewMemBlobHandle

func NewMemBlobHandle() *MemBlobHandle

func (*MemBlobHandle) Close

func (bh *MemBlobHandle) Close() error

func (*MemBlobHandle) PRead

func (bh *MemBlobHandle) PRead(p []byte, offset int64) error

func (*MemBlobHandle) PWrite

func (bh *MemBlobHandle) PWrite(p []byte, offset int64) error

func (*MemBlobHandle) Size

func (bh *MemBlobHandle) Size() int64

func (*MemBlobHandle) Truncate

func (bh *MemBlobHandle) Truncate(newSize int64) error

type MemBlobStore

type MemBlobStore struct {
	Paths map[string]*MemBlobHandle
}

func NewMemBlobStore

func NewMemBlobStore() *MemBlobStore

func (*MemBlobStore) Flags

func (bs *MemBlobStore) Flags() int

func (*MemBlobStore) Open

func (bs *MemBlobStore) Open(blobpath string, flags int) (BlobHandle, error)

type MockBlobHandle

type MockBlobHandle struct {
	Log        []MockBlobStoreOperation
	PayloadLen int64
}

func NewMockBlobHandle

func NewMockBlobHandle() *MockBlobHandle

func (*MockBlobHandle) Close

func (bh *MockBlobHandle) Close() error

func (*MockBlobHandle) PRead

func (bh *MockBlobHandle) PRead(p []byte, offset int64) error

func (*MockBlobHandle) PWrite

func (bh *MockBlobHandle) PWrite(p []byte, offset int64) error

func (*MockBlobHandle) Size

func (bh *MockBlobHandle) Size() int64

func (*MockBlobHandle) Truncate

func (bh *MockBlobHandle) Truncate(size int64) error

type MockBlobStore

type MockBlobStore struct {
	Paths map[string]*MockBlobHandle
}

func NewMockBlobStore

func NewMockBlobStore() *MockBlobStore

func (*MockBlobStore) Flags

func (bs *MockBlobStore) Flags() int

func (*MockBlobStore) Open

func (bs *MockBlobStore) Open(blobpath string, flags int) (BlobHandle, error)

type MockBlobStoreOperation

type MockBlobStoreOperation struct {
	Type      rune
	Offset    int64
	Length    int
	FirstByte byte
}

type Mux

type Mux []MuxEntry

func (Mux) BlobSize

func (m Mux) BlobSize(blobpath string) (int64, error)

func (Mux) Flags

func (m Mux) Flags() int

func (Mux) ImplName

func (Mux) ImplName() string

func (Mux) ListBlobs

func (m Mux) ListBlobs() ([]string, error)

func (Mux) Open

func (m Mux) Open(blobpath string, flags int) (BlobHandle, error)

func (Mux) OpenReader

func (m Mux) OpenReader(blobpath string) (io.ReadCloser, error)

func (Mux) OpenWriter

func (m Mux) OpenWriter(blobpath string) (io.WriteCloser, error)

func (Mux) RemoveBlob

func (m Mux) RemoveBlob(blobpath string) error

type MuxEntry

type MuxEntry struct {
	BlobMatcher
	BlobStore
}

type OffsetReader

type OffsetReader struct {
	PReader
	Offset int64
}

OffsetReader provides io.Reader from PReader

func (*OffsetReader) Read

func (r *OffsetReader) Read(p []byte) (int, error)

type OffsetWriter

type OffsetWriter struct {
	PWriter
	Offset int64
}

OffsetWriter provides io.Reader from PWriter

func (*OffsetWriter) Write

func (w *OffsetWriter) Write(p []byte) (int, error)

type PReader

type PReader interface {
	PRead(p []byte, offset int64) error
}

PReader implements positioned read

type PWriter

type PWriter interface {
	PWrite(p []byte, offset int64) error
}

PWriter implements positioned write

type RandomAccessBlobStore

type RandomAccessBlobStore interface {
	Open(blobpath string, flags int) (BlobHandle, error)
	flags.FlagsReader
}

type RandomAccessIO

type RandomAccessIO interface {
	PReader
	PWriter
}

type SizeQueryable

type SizeQueryable interface {
	Size() int64
}

type TotalSizer

type TotalSizer interface {
	TotalSize() (int64, error)
}

type ZeroFillPReader

type ZeroFillPReader struct{}

func (ZeroFillPReader) PRead

func (ZeroFillPReader) PRead(p []byte, offset int64) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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