Documentation
¶
Overview ¶
Package objectstorage provides configuration and utilities for object storage operations.
Package objectstorage provides an object storage-based implementation of worker.Publisher and worker.Consumer using Go Cloud Development Kit (CDK) blob storage abstraction.
Index ¶
- func GenerateTaskID() string
- func GenerateTaskKey(taskID string) string
- func ParseTimestampFromKey(key string) (int64, error)
- type Consumer
- type Option
- func WithIntervalExpFactor(factor float64) Option
- func WithMaxInterval(interval time.Duration) Option
- func WithMaxItemsToReadAtOnce(maxItems int) Option
- func WithMinInterval(interval time.Duration) Option
- func WithPrefix(prefix string) Option
- func WithProcessingTimeout(timeout time.Duration) Option
- func WithRetryAttempts(attempts int) Option
- type Publisher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateTaskID ¶
func GenerateTaskID() string
GenerateTaskID creates a new UUID for task identification.
func GenerateTaskKey ¶
GenerateTaskKey creates a timestamp-based key for task storage. Format: {timestamp_nanos}_{task_id} This ensures lexicographic ordering for FIFO processing and collision resistance.
func ParseTimestampFromKey ¶
ParseTimestampFromKey extracts the timestamp from a task key. Returns the timestamp in nanoseconds and any parsing error.
Types ¶
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer implements worker.Consumer using object storage via Go CDK blob.Bucket.
func NewConsumer ¶
func NewConsumer( ctx context.Context, bucket *blob.Bucket, messageFormat worker.MessageFormat, opts ...Option, ) (*Consumer, error)
NewConsumer creates a new object storage consumer that implements worker.Consumer. It accepts a context, Go CDK blob.Bucket, message format, and optional configuration.
type Option ¶
type Option func(*config)
Option is a function that configures the object storage config.
func WithIntervalExpFactor ¶
WithIntervalExpFactor sets the exponential factor to multiply the interval by when no tasks are found.
func WithMaxInterval ¶
WithMaxInterval sets the maximum duration for exponential backoff polling interval.
func WithMaxItemsToReadAtOnce ¶
WithMaxItemsToReadAtOnce sets the maximum number of items to read in one batch.
func WithMinInterval ¶
WithMinInterval sets the minimum duration for exponential backoff polling interval.
func WithProcessingTimeout ¶
WithProcessingTimeout sets the processing timeout for task batches.
func WithRetryAttempts ¶
WithRetryAttempts sets the number of retry attempts for failed operations.
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher implements worker.Publisher using object storage via Go CDK blob.Bucket.
func NewPublisher ¶
func NewPublisher(bucket *blob.Bucket, messageFormat worker.MessageFormat, opts ...Option) (*Publisher, error)
NewPublisher creates a new object storage publisher that implements worker.Publisher. It accepts a Go CDK blob.Bucket for storage abstraction and optional configuration.