bucketlifecycle

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MessageBucketReady = "bucket.ready"

Variables

View Source
var (
	ErrBucketNotFound     = errors.New("bucket not found")
	ErrBucketNotEmpty     = errors.New("bucket not empty")
	ErrDeleteNotSupported = errors.New("bucket deletion is not supported")
	ErrOwnerNotFound      = errors.New("bucket owner not found")
)

Functions

func ValidateProvisionInput

func ValidateProvisionInput(input ProvisionInput) error

Types

type BucketReady

type BucketReady struct{ BucketID int64 }

func (BucketReady) MessageType

func (BucketReady) MessageType() string

type CreateOptions

type CreateOptions struct {
	Name                      string
	ACL                       []byte
	OwnerAccessKey            *string
	DefaultCopies             *int
	MinimumDurableCopies      *int
	ProviderSelectionStrategy providerselect.Strategy
}

type DeleteOptions

type DeleteOptions struct {
	Recursive bool
}

type ProvisionInput

type ProvisionInput struct {
	BucketID int64 `json:"bucket_id"`
	Copies   int   `json:"copies"`
}

ProvisionInput identifies the bucket whose provider storage must be ready for a replica target. The target is the task's generation, so raising it schedules a fresh run instead of colliding with the completed one that provisioned the smaller target.

This is only sound while the target can never go down: a target that returned to an earlier value would name a round that already completed, and the slots opened for it would never be provisioned. Whoever implements lowering has to replace it with a monotonic generation first.

type Service

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

Service coordinates bucket lifecycle operations shared by multiple entrypoints.

func New

func New(repos *repository.Repositories, c cache.Cache, defaultCopies int, logger *slog.Logger) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, name string) (*model.Bucket, error)

func (*Service) CreateWithACL

func (s *Service) CreateWithACL(ctx context.Context, name string, acl []byte) (*model.Bucket, error)

func (*Service) CreateWithOptions

func (s *Service) CreateWithOptions(ctx context.Context, options CreateOptions) (*model.Bucket, error)

func (*Service) Delete

func (s *Service) Delete(_ context.Context, _ string, _ DeleteOptions) (*model.Bucket, error)

func (*Service) EnsureCacheBucketDir

func (s *Service) EnsureCacheBucketDir(ctx context.Context, name string)

func (*Service) ScheduleProvision

func (s *Service) ScheduleProvision(ctx context.Context, repos *repository.Repositories, bucket *model.Bucket) error

ScheduleProvision enqueues provisioning for the bucket's current replica target. It is idempotent per target: raising the target schedules the slots that were just opened, lowering it schedules a run that finds nothing to do.

func (*Service) SetTaskService

func (s *Service) SetTaskService(service *taskengine.Service)

Jump to

Keyboard shortcuts

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