blob

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const FixtureProviderName = "blob"
View Source
const MetadataKey = "blob.stores"

Variables

This section is empty.

Functions

func BlobFixtureSetFactory added in v0.37.0

func BlobFixtureSetFactory[T any](readerFactory ReaderFactory, storeName string, options ...fixtures.FixtureSetOption) fixtures.FixtureSetFactory

func CreateKey

func CreateKey() string

func NewBlobFixtureWriter added in v0.37.0

func NewBlobFixtureWriter(ctx context.Context, config cfg.Config, logger log.Logger, readerFactory ReaderFactory, storeName string) (fixtures.FixtureWriter, error)

func NewBlobFixtureWriterWithInterfaces added in v0.37.0

func NewBlobFixtureWriterWithInterfaces(logger log.Logger, batchRunner BatchRunner, reader FixtureReader, store Store) fixtures.FixtureWriter

func NewLifecycleManager added in v0.37.0

func NewLifecycleManager(settings *Settings, name string) reslife.LifeCycleerFactory

func ProvideBatchRunner

func ProvideBatchRunner(name string) kernel.ModuleFactory

func WithNamingStrategy

func WithNamingStrategy(strategy NamingFactory)

Types

type Batch

type Batch []*Object

type BatchRunner

type BatchRunner interface {
	Run(ctx context.Context) error
}

func NewBatchRunner

func NewBatchRunner(ctx context.Context, config cfg.Config, logger log.Logger, name string) (BatchRunner, error)

type BatchRunnerChannels

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

func NewBatchRunnerChannels

func NewBatchRunnerChannels(config cfg.Config, name string) (*BatchRunnerChannels, error)

func ProvideBatchRunnerChannels

func ProvideBatchRunnerChannels(ctx context.Context, config cfg.Config, name string) (*BatchRunnerChannels, error)

type BatchRunnerSettings

type BatchRunnerSettings struct {
	ClientName        string `cfg:"client_name" default:"default"`
	CopyRunnerCount   int    `cfg:"copy_runner_count" default:"10"`
	DeleteRunnerCount int    `cfg:"delete_runner_count" default:"10"`
	ReaderRunnerCount int    `cfg:"reader_runner_count" default:"10"`
	WriterRunnerCount int    `cfg:"writer_runner_count" default:"10"`
}

type BlobFixture added in v0.37.0

type BlobFixture struct{}

BlobFixture is a dummy struct for writing nicely typed fixture sets, even though the blob fixture loader works a bit differently

type CopyBatch

type CopyBatch []*CopyObject

type CopyObject

type CopyObject struct {
	ACL types.ObjectCannedACL

	ContentEncoding *string
	ContentType     *string

	Error error

	Key *string

	SourceBucket *string
	SourceKey    *string
	// contains filtered or unexported fields
}

func (*CopyObject) GetFullKey

func (o *CopyObject) GetFullKey() string

type DataExporter added in v0.50.0

type DataExporter interface {
	ExportAllObjects(ctx context.Context) (StoreEntries, error)
}

func ProvideDataExporter added in v0.50.0

func ProvideDataExporter(ctx context.Context, config cfg.Config, logger log.Logger, storeName string) (DataExporter, error)

type FixtureReader added in v0.48.0

type FixtureReader interface {
	Chan() <-chan *Object
	Run(ctx context.Context) error
	Stop()
	Source() string
}

FixtureReader provides a channel of Object that can be iterated over for writing fixtures

type LifecycleManager added in v0.37.0

type LifecycleManager interface {
	reslife.LifeCycleer
	reslife.Creator
	reslife.Registerer
	reslife.Purger
}

type Metadata added in v0.38.3

type Metadata struct {
	AwsClientName string `json:"aws_client_name"`
	Bucket        string `json:"bucket"`
	Name          string `json:"name"`
	Prefix        string `json:"prefix"`
}

type NamingFactory

type NamingFactory func() string

func DefaultNamingStrategy

func DefaultNamingStrategy() NamingFactory

type Object

type Object struct {
	ACL  types.ObjectCannedACL
	Body Stream

	Bucket *string

	ContentEncoding *string
	ContentType     *string

	Error error

	Exists bool
	Key    *string
	Prefix *string
	// contains filtered or unexported fields
}

func (*Object) GetFullKey

func (o *Object) GetFullKey() string

type ReadCloser

type ReadCloser interface {
	io.ReadCloser
}

type ReadSeekerCloser

type ReadSeekerCloser interface {
	io.ReadSeeker
	io.Closer
}

A reader that we can close and that can seek

func CloseOnce

func CloseOnce(reader io.ReadSeeker) ReadSeekerCloser

CloseOnce wraps a reader and provide a closer. Can be called more than once. If the reader does not implement closer, it ignores calls to close.

type ReaderFactory added in v0.48.0

type ReaderFactory func(ctx context.Context, config cfg.Config, logger log.Logger, storeName string) (FixtureReader, error)

func NewFileReader added in v0.48.0

func NewFileReader(basePath string) ReaderFactory

NewFileReader creates a new fileReader for the given base path

type Service

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

func NewService

func NewService(ctx context.Context, config cfg.Config, logger log.Logger, settings *Settings) (*Service, error)

func (*Service) CreateBucket added in v0.37.0

func (l *Service) CreateBucket(ctx context.Context) error

func (*Service) DeleteObjects

func (s *Service) DeleteObjects(ctx context.Context, bucket string, objects []*types.Object) error

func (*Service) ListObjects

func (s *Service) ListObjects(ctx context.Context, bucket string, prefix string) ([]types.Object, error)

func (*Service) Purge added in v0.37.0

func (l *Service) Purge(ctx context.Context) error

type Settings

type Settings struct {
	cfg.AppId
	Bucket     string `cfg:"bucket"`
	Region     string `cfg:"region"`
	ClientName string `cfg:"client_name" default:"default"`
	Prefix     string `cfg:"prefix"`
}

func ReadStoreSettings added in v0.38.3

func ReadStoreSettings(config cfg.Config, name string) (*Settings, error)

type Store

type Store interface {
	BucketName() string
	Copy(batch CopyBatch)
	CopyOne(obj *CopyObject) error
	Delete(batch Batch)
	DeletePrefix(ctx context.Context, prefix string) error
	DeleteBucket(ctx context.Context) error
	DeleteOne(obj *Object) error
	ListObjects(ctx context.Context, prefix string) (Batch, error)
	Read(batch Batch)
	ReadOne(obj *Object) error
	Write(batch Batch) error
	WriteOne(obj *Object) error
}

func NewStore

func NewStore(ctx context.Context, config cfg.Config, logger log.Logger, name string) (Store, error)

NewStore creates a new S3 store with the given configuration and logger.

func NewStoreWithInterfaces

func NewStoreWithInterfaces(channels *BatchRunnerChannels, client gosoS3.Client, settings *Settings) Store

func ProvideStore added in v0.50.0

func ProvideStore(ctx context.Context, config cfg.Config, logger log.Logger, name string) (Store, error)

type StoreEntries added in v0.50.0

type StoreEntries []StoreEntry

type StoreEntry added in v0.50.0

type StoreEntry struct {
	Key  string `json:"key"`
	Body []byte `json:"body"`
}

type StoreProviderFn added in v0.50.0

type StoreProviderFn func(storeName string) (Store, error)

type Stream

type Stream interface {
	// Read all data and close the reader.
	ReadAll() ([]byte, error)
	// Extract a reader you have to close yourself. Calling this multiple times might return
	// the same object.
	AsReader() ReadSeekerCloser
}

A stream is a source of bytes you can either get as a full []byte or stream as a reader.

func StreamBytes

func StreamBytes(data []byte) Stream

Use a []byte as stream

func StreamReader

func StreamReader(reader ReadCloser) Stream

Use a reader as a stream. If the reader does not implement Seek, we provide a dummy implementation.

type UrlBuilder

type UrlBuilder interface {
	GetAbsoluteUrl(path string) (string, error)
}

func NewUrlBuilder

func NewUrlBuilder(config cfg.Config, name string) (UrlBuilder, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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