blob

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

func CreateKey

func CreateKey() string

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) *BatchRunnerChannels

func ProvideBatchRunnerChannels

func ProvideBatchRunnerChannels(config cfg.Config) *BatchRunnerChannels

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 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 NamingFactory

type NamingFactory func() string

func DefaultNamingStrategy

func DefaultNamingStrategy() NamingFactory

type Object

type Object struct {
	ACL  types.ObjectCannedACL
	Body Stream

	ContentEncoding *string
	ContentType     *string

	Error error

	Exists bool
	Key    *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 Service

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

func NewService

func NewService(ctx context.Context, config cfg.Config, logger log.Logger, name string) (*Service, 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)

type Settings

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

type Store

type Store interface {
	BucketName() string
	Copy(batch CopyBatch)
	CopyOne(obj *CopyObject) error
	CreateBucket(ctx context.Context) error
	Delete(batch Batch)
	DeleteBucket(ctx context.Context) error
	DeleteOne(obj *Object) 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)

func NewStoreWithInterfaces

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

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