repository

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrS3ClientNil is returned when s3 client is nil
	ErrS3ClientNil = errors.New("s3: AWS S3 Client is nil")

	// ErrOptionWithBucketNil is returned when WitBucket option is nil
	ErrOptionWithBucketNil = errors.New("s3: option WithBucket is nil")

	// ErrOptionWithKeyNil is returned when WithKey option is nil
	ErrOptionWithKeyNil = errors.New("s3: option WithKey is nil")

	// ErrStateNil is returned when state is nil
	ErrStateNil = errors.New("s3: state is nil")
)

Functions

This section is empty.

Types

type DiskRepository

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

DiskRepository represents a disk based state repository and implement core.StateRepository interface

func NewDiskRepository

func NewDiskRepository(stateFile io.ReadWriter) (*DiskRepository, error)

NewDiskRepository creates a new disk based state repository

func (*DiskRepository) GetState

func (dr *DiskRepository) GetState(_ context.Context) (*model.State, error)

GetState returns the state from the state file

func (*DiskRepository) SetState

func (dr *DiskRepository) SetState(_ context.Context, state *model.State) error

SetState sets the state in the state file

type ErrReadingStateFile added in v0.0.14

type ErrReadingStateFile struct {
	Message string
}

ErrReadingStateFile, the state file is empty.

func (*ErrReadingStateFile) Error added in v0.0.14

func (e *ErrReadingStateFile) Error() string

func (*ErrReadingStateFile) ErrorCode added in v0.0.14

func (e *ErrReadingStateFile) ErrorCode() string

func (*ErrReadingStateFile) ErrorMessage added in v0.0.14

func (e *ErrReadingStateFile) ErrorMessage() string

type ErrStateFileEmpty added in v0.0.14

type ErrStateFileEmpty struct {
	Message string
}

ErrStateFileEmpty, the state file is empty.

func (*ErrStateFileEmpty) Error added in v0.0.14

func (e *ErrStateFileEmpty) Error() string

func (*ErrStateFileEmpty) ErrorCode added in v0.0.14

func (e *ErrStateFileEmpty) ErrorCode() string

func (*ErrStateFileEmpty) ErrorMessage added in v0.0.14

func (e *ErrStateFileEmpty) ErrorMessage() string

type ErrStateFileNil

type ErrStateFileNil struct {
	Message string
}

ErrStateFileNil, the state file is empty.

func (*ErrStateFileNil) Error added in v0.0.14

func (e *ErrStateFileNil) Error() string

func (*ErrStateFileNil) ErrorCode added in v0.0.14

func (e *ErrStateFileNil) ErrorCode() string

func (*ErrStateFileNil) ErrorMessage added in v0.0.14

func (e *ErrStateFileNil) ErrorMessage() string

type S3ClientAPI

type S3ClientAPI interface {
	GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)
	PutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error)
}

S3ClientAPI is an interface to consume S3 client methods

type S3Repository

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

S3Repository represent a repository that stores state in S3 and implements model.Repository interface

func NewS3Repository

func NewS3Repository(client S3ClientAPI, opts ...S3RepositoryOption) (*S3Repository, error)

NewS3Repository returns a new S3Repository

func (*S3Repository) GetState

func (r *S3Repository) GetState(ctx context.Context) (*model.State, error)

GetState returns the state from the repository

func (*S3Repository) SetState

func (r *S3Repository) SetState(ctx context.Context, state *model.State) error

SetState sets the state in the given repository

type S3RepositoryOption

type S3RepositoryOption func(*S3Repository)

S3RepositoryOption is a function that can be used to configure a S3Repository using the functional options pattern.

func WithBucket

func WithBucket(bucket string) S3RepositoryOption

WithBucket sets the name for the S3 Bucket.

func WithKey

func WithKey(key string) S3RepositoryOption

WithKey sets the key for the S3 Bucket.

Jump to

Keyboard shortcuts

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