testblobs

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadBlobs

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

BadBlobs implements a bad blob store.

func (*BadBlobs) Close

func (bad *BadBlobs) Close() error

Close closes the blob store and any resources associated with it.

func (*BadBlobs) Create

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

Create creates a new blob that can be written optionally takes a size argument for performance improvements, -1 is unknown size.

func (*BadBlobs) Delete

func (bad *BadBlobs) Delete(ctx context.Context, ref storage.BlobRef) error

Delete deletes the blob with the namespace and key.

func (*BadBlobs) DeleteWithStorageFormat

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

DeleteWithStorageFormat deletes the blob with the namespace, key, and format version.

func (*BadBlobs) EmptyTrash added in v0.27.0

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

EmptyTrash empties the trash

func (*BadBlobs) FreeSpace

func (bad *BadBlobs) FreeSpace() (int64, error)

FreeSpace return how much free space left for writing.

func (*BadBlobs) ListNamespaces

func (bad *BadBlobs) ListNamespaces(ctx context.Context) ([][]byte, error)

ListNamespaces returns all namespaces that might be storing data.

func (*BadBlobs) Open

func (bad *BadBlobs) Open(ctx context.Context, ref storage.BlobRef) (storage.BlobReader, error)

Open opens a reader with the specified namespace and key.

func (*BadBlobs) OpenWithStorageFormat

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

OpenWithStorageFormat opens a reader for the already-located blob, avoiding the potential need to check multiple storage formats to find the blob.

func (*BadBlobs) RestoreTrash

func (bad *BadBlobs) RestoreTrash(ctx context.Context, namespace []byte) ([][]byte, error)

RestoreTrash restores all files in the trash.

func (*BadBlobs) SetError

func (bad *BadBlobs) SetError(err error)

SetError configures the blob store to return a specific error for all operations.

func (*BadBlobs) SpaceUsedForBlobs added in v0.28.3

func (bad *BadBlobs) SpaceUsedForBlobs(ctx context.Context) (int64, error)

SpaceUsedForBlobs adds up how much is used in all namespaces.

func (*BadBlobs) SpaceUsedForBlobsInNamespace added in v0.28.3

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

SpaceUsedForBlobsInNamespace adds up how much is used in the given namespace.

func (*BadBlobs) SpaceUsedForTrash added in v0.28.3

func (bad *BadBlobs) SpaceUsedForTrash(ctx context.Context) (int64, error)

SpaceUsedForTrash adds up how much is used in all namespaces.

func (*BadBlobs) Stat

func (bad *BadBlobs) Stat(ctx context.Context, ref storage.BlobRef) (storage.BlobInfo, error)

Stat looks up disk metadata on the blob file.

func (*BadBlobs) StatWithStorageFormat

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

StatWithStorageFormat looks up disk metadata for the blob file with the given storage format version. This avoids the potential need to check multiple storage formats for the blob when the format is already known.

func (*BadBlobs) Trash

func (bad *BadBlobs) Trash(ctx context.Context, ref storage.BlobRef) error

Trash deletes the blob with the namespace and key.

func (*BadBlobs) WalkNamespace

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

WalkNamespace executes walkFunc for each locally stored blob in the given namespace. If walkFunc returns a non-nil error, WalkNamespace will stop iterating and return the error immediately.

type BadDB

type BadDB struct {
	storagenode.DB
	// contains filtered or unexported fields
}

BadDB implements bad storage node DB.

func NewBadDB

func NewBadDB(log *zap.Logger, db storagenode.DB) *BadDB

NewBadDB creates a new bad storage node DB. Use SetError to manually configure the error returned by all piece operations.

func (*BadDB) Pieces

func (bad *BadDB) Pieces() storage.Blobs

Pieces returns the blob store.

func (*BadDB) SetError

func (bad *BadDB) SetError(err error)

SetError sets an error to be returned for all piece operations.

type SlowBlobs

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

SlowBlobs implements a slow blob store.

func (*SlowBlobs) Close

func (slow *SlowBlobs) Close() error

Close closes the blob store and any resources associated with it.

func (*SlowBlobs) Create

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

Create creates a new blob that can be written optionally takes a size argument for performance improvements, -1 is unknown size.

func (*SlowBlobs) Delete

func (slow *SlowBlobs) Delete(ctx context.Context, ref storage.BlobRef) error

Delete deletes the blob with the namespace and key.

func (*SlowBlobs) DeleteWithStorageFormat

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

DeleteWithStorageFormat deletes the blob with the namespace, key, and format version

func (*SlowBlobs) EmptyTrash added in v0.27.0

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

EmptyTrash empties the trash

func (*SlowBlobs) FreeSpace

func (slow *SlowBlobs) FreeSpace() (int64, error)

FreeSpace return how much free space left for writing.

func (*SlowBlobs) ListNamespaces

func (slow *SlowBlobs) ListNamespaces(ctx context.Context) ([][]byte, error)

ListNamespaces returns all namespaces that might be storing data.

func (*SlowBlobs) Open

func (slow *SlowBlobs) Open(ctx context.Context, ref storage.BlobRef) (storage.BlobReader, error)

Open opens a reader with the specified namespace and key.

func (*SlowBlobs) OpenWithStorageFormat

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

OpenWithStorageFormat opens a reader for the already-located blob, avoiding the potential need to check multiple storage formats to find the blob.

func (*SlowBlobs) RestoreTrash

func (slow *SlowBlobs) RestoreTrash(ctx context.Context, namespace []byte) ([][]byte, error)

RestoreTrash restores all files in the trash

func (*SlowBlobs) SetLatency

func (slow *SlowBlobs) SetLatency(delay time.Duration)

SetLatency configures the blob store to sleep for delay duration for all operations. A zero or negative delay means no sleep.

func (*SlowBlobs) SpaceUsedForBlobs added in v0.28.3

func (slow *SlowBlobs) SpaceUsedForBlobs(ctx context.Context) (int64, error)

SpaceUsedForBlobs adds up how much is used in all namespaces

func (*SlowBlobs) SpaceUsedForBlobsInNamespace added in v0.28.3

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

SpaceUsedForBlobsInNamespace adds up how much is used in the given namespace

func (*SlowBlobs) SpaceUsedForTrash added in v0.28.3

func (slow *SlowBlobs) SpaceUsedForTrash(ctx context.Context) (int64, error)

SpaceUsedForTrash adds up how much is used in all namespaces

func (*SlowBlobs) Stat

func (slow *SlowBlobs) Stat(ctx context.Context, ref storage.BlobRef) (storage.BlobInfo, error)

Stat looks up disk metadata on the blob file

func (*SlowBlobs) StatWithStorageFormat

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

StatWithStorageFormat looks up disk metadata for the blob file with the given storage format version. This avoids the potential need to check multiple storage formats for the blob when the format is already known.

func (*SlowBlobs) Trash

func (slow *SlowBlobs) Trash(ctx context.Context, ref storage.BlobRef) error

Trash deletes the blob with the namespace and key.

func (*SlowBlobs) WalkNamespace

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

WalkNamespace executes walkFunc for each locally stored blob in the given namespace. If walkFunc returns a non-nil error, WalkNamespace will stop iterating and return the error immediately.

type SlowDB

type SlowDB struct {
	storagenode.DB
	// contains filtered or unexported fields
}

SlowDB implements slow storage node DB.

func NewSlowDB

func NewSlowDB(log *zap.Logger, db storagenode.DB) *SlowDB

NewSlowDB creates a new slow storage node DB wrapping the provided db. Use SetLatency to dynamically configure the latency of all piece operations.

func (*SlowDB) Pieces

func (slow *SlowDB) Pieces() storage.Blobs

Pieces returns the blob store.

func (*SlowDB) SetLatency

func (slow *SlowDB) SetLatency(delay time.Duration)

SetLatency enables a sleep for delay duration for all piece operations. A zero or negative delay means no sleep.

Jump to

Keyboard shortcuts

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