Documentation
¶
Index ¶
- Constants
- func BlobFixtureSetFactory[T any](readerFactory ReaderFactory, storeName string, ...) fixtures.FixtureSetFactory
- func CreateKey() string
- func NewBlobFixtureWriter(ctx context.Context, config cfg.Config, logger log.Logger, ...) (fixtures.FixtureWriter, error)
- func NewBlobFixtureWriterWithInterfaces(logger log.Logger, batchRunner BatchRunner, reader FixtureReader, store Store) fixtures.FixtureWriter
- func NewLifecycleManager(settings *Settings, name string) reslife.LifeCycleerFactory
- func ProvideBatchRunner(name string) kernel.ModuleFactory
- func WithNamingStrategy(strategy NamingFactory)
- type Batch
- type BatchRunner
- type BatchRunnerChannels
- type BatchRunnerSettings
- type BlobFixture
- type CopyBatch
- type CopyObject
- type DataExporter
- type FixtureReader
- type LifecycleManager
- type Metadata
- type NamingFactory
- type Object
- type ReadCloser
- type ReadSeekerCloser
- type ReaderFactory
- type Service
- func (l *Service) CreateBucket(ctx context.Context) error
- func (s *Service) DeleteObjects(ctx context.Context, bucket string, objects []*types.Object) error
- func (s *Service) ListObjects(ctx context.Context, bucket string, prefix string) ([]types.Object, error)
- func (l *Service) Purge(ctx context.Context) error
- type Settings
- type Store
- func NewStore(ctx context.Context, config cfg.Config, logger log.Logger, name string) (Store, error)
- func NewStoreWithInterfaces(channels *BatchRunnerChannels, client gosoS3.Client, settings *Settings) Store
- func ProvideStore(ctx context.Context, config cfg.Config, logger log.Logger, name string) (Store, error)
- type StoreEntries
- type StoreEntry
- type StoreProviderFn
- type Stream
- type UrlBuilder
Constants ¶
const ( PrivateACL = types.ObjectCannedACLPrivate PublicReadACL = types.ObjectCannedACLPublicRead )
const FixtureProviderName = "blob"
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 NewBlobFixtureWriter ¶ added in v0.37.0
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 BatchRunner ¶
type BatchRunnerChannels ¶
type BatchRunnerChannels struct {
// contains filtered or unexported fields
}
func NewBatchRunnerChannels ¶
func NewBatchRunnerChannels(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)
}
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 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 ¶
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 (*Service) CreateBucket ¶ added in v0.37.0
func (*Service) DeleteObjects ¶
func (*Service) ListObjects ¶
type Settings ¶
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
type StoreEntries ¶ added in v0.50.0
type StoreEntries []StoreEntry
type StoreEntry ¶ added in v0.50.0
type StoreProviderFn ¶ added in v0.50.0
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 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 ¶
func NewUrlBuilder ¶
func NewUrlBuilder(config cfg.Config, name string) (UrlBuilder, error)