badger

package module
v0.0.0-...-b3e3566 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: AGPL-3.0 Imports: 14 Imported by: 1

README

This repository contains an implementation of storage.BlobStore of the Storj storagenodes.

This is just an experiment. It's slower than the default file-based one, and if you don't know what is it, you probably don't need it anyway.

Limitations:

  • Some parts are not yet implemented
  • Trash functionality is definitelly not implemented
  • Size calculation is 'estimation' based

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReader

func NewReader(db *badger.DB, ref storage.BlobRef) (storage.BlobReader, error)

func NewWriter

func NewWriter(db *badger.DB, ref storage.BlobRef) *writer

Types

type BlobInfo

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

func (BlobInfo) BlobRef

func (i BlobInfo) BlobRef() storage.BlobRef

func (BlobInfo) FullPath

func (i BlobInfo) FullPath(ctx context.Context) (string, error)

func (BlobInfo) Stat

func (i BlobInfo) Stat(ctx context.Context) (os.FileInfo, error)

func (BlobInfo) StorageFormatVersion

func (i BlobInfo) StorageFormatVersion() storage.FormatVersion

type BlobStore

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

func NewBlobStore

func NewBlobStore(dir string) (*BlobStore, error)

func (*BlobStore) CheckWritability

func (b *BlobStore) CheckWritability(ctx context.Context) error

func (*BlobStore) Close

func (b *BlobStore) Close() error

func (*BlobStore) Create

func (b *BlobStore) Create(ctx context.Context, ref storage.BlobRef, size int64) (storage.BlobWriter, error)

func (*BlobStore) CreateVerificationFile

func (b *BlobStore) CreateVerificationFile(ctx context.Context, id storj.NodeID) error

func (*BlobStore) Delete

func (b *BlobStore) Delete(ctx context.Context, ref storage.BlobRef) error

func (*BlobStore) DeleteNamespace

func (b *BlobStore) DeleteNamespace(ctx context.Context, ref []byte) (err error)

func (*BlobStore) DeleteWithStorageFormat

func (b *BlobStore) DeleteWithStorageFormat(ctx context.Context, ref storage.BlobRef, formatVer storage.FormatVersion) error

func (*BlobStore) EmptyTrash

func (b *BlobStore) EmptyTrash(ctx context.Context, namespace []byte, trashedBefore time.Time) (int64, [][]byte, error)

func (*BlobStore) FreeSpace

func (b *BlobStore) FreeSpace(ctx context.Context) (int64, error)

func (*BlobStore) ListNamespaces

func (b *BlobStore) ListNamespaces(ctx context.Context) ([][]byte, error)

func (*BlobStore) Open

func (*BlobStore) OpenWithStorageFormat

func (b *BlobStore) OpenWithStorageFormat(ctx context.Context, ref storage.BlobRef, formatVer storage.FormatVersion) (storage.BlobReader, error)

func (*BlobStore) RestoreTrash

func (b *BlobStore) RestoreTrash(ctx context.Context, namespace []byte) ([][]byte, error)

func (*BlobStore) SpaceUsedForBlobs

func (b *BlobStore) SpaceUsedForBlobs(ctx context.Context) (int64, error)

func (*BlobStore) SpaceUsedForBlobsInNamespace

func (b *BlobStore) SpaceUsedForBlobsInNamespace(ctx context.Context, namespace []byte) (int64, error)

func (*BlobStore) SpaceUsedForTrash

func (b *BlobStore) SpaceUsedForTrash(ctx context.Context) (int64, error)

func (*BlobStore) Stat

func (*BlobStore) StatWithStorageFormat

func (b *BlobStore) StatWithStorageFormat(ctx context.Context, ref storage.BlobRef, formatVer storage.FormatVersion) (storage.BlobInfo, error)

func (*BlobStore) Trash

func (b *BlobStore) Trash(ctx context.Context, ref storage.BlobRef) error

func (*BlobStore) VerifyStorageDir

func (b *BlobStore) VerifyStorageDir(ctx context.Context, id storj.NodeID) error

func (*BlobStore) WalkNamespace

func (b *BlobStore) WalkNamespace(ctx context.Context, namespace []byte, walkFunc func(storage.BlobInfo) error) error

type DiskInfo

type DiskInfo struct {
	ID             string
	AvailableSpace int64
}

DiskInfo contains statistics about this dir.

type FileInfo

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

func (FileInfo) IsDir

func (f FileInfo) IsDir() bool

func (FileInfo) ModTime

func (f FileInfo) ModTime() time.Time

func (FileInfo) Mode

func (f FileInfo) Mode() fs.FileMode

func (FileInfo) Name

func (f FileInfo) Name() string

func (FileInfo) Size

func (f FileInfo) Size() int64

func (FileInfo) Sys

func (f FileInfo) Sys() any

Jump to

Keyboard shortcuts

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