testblob

package
v0.0.0-...-90deddd Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package testblob implements a blobstore appropriate for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(scheme string) blob.Store

New returns a new blob store appropriate for testing. The returned store is empty and stored contents are kept in memory. New buckets are created as they are referenced. The implementation is not efficient for large numbers of keys. The provided scheme is used to construct object locations in the returned store.

Types

type ErrBucket

type ErrBucket struct {
	blob.Bucket
	PutErr           error
	CopyFromMaybeErr func() error
}

func (*ErrBucket) CopyFrom

func (eb *ErrBucket) CopyFrom(ctx context.Context, srcBucket blob.Bucket, src, dst string) error

CopyFrom bucket will invoke eb.CopyFromMaybeErr if it is non-nil. If the return value of the invocation is a non-nil error, it will be returned immediately. Otherwise, CopyFrom is called on the underlying bucket.

func (*ErrBucket) Put

func (eb *ErrBucket) Put(ctx context.Context, key string, size int64, body io.Reader, contentHash string) error

type ErrStore

type ErrStore struct {
	blob.Store
	PutErr           error
	CopyFromMaybeErr func() error
}

ErrStore is a blob.Store implementation useful for testing. PutErr and CopyFromMaybeErr will be passed on to buckets created with this store.

func (*ErrStore) Bucket

func (es *ErrStore) Bucket(ctx context.Context, name string) (blob.Bucket, error)

type Store

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

func (*Store) Bucket

func (s *Store) Bucket(ctx context.Context, name string) (blob.Bucket, error)

Jump to

Keyboard shortcuts

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