Documentation ¶
Index ¶
- func New(ctx context.Context, cfg *GCSConfig, options ...option.ClientOption) (storage.EventStore, error)
- type GCSConfig
- func (c *GCSConfig) NewContextWithTimeout(parent context.Context, operation Operation) (context.Context, context.CancelFunc)
- func (c *GCSConfig) WithCompressor(compressor compression.Compressor) *GCSConfig
- func (c *GCSConfig) WithFolder(folder string) *GCSConfig
- func (c *GCSConfig) WithReadPolicy(readPolicy ReadPolicy) *GCSConfig
- func (c *GCSConfig) WithTimeout(timeout Timeout) *GCSConfig
- type GCSEventStore
- func (g *GCSEventStore) ListSourcesByKey(ctx context.Context, key string) ([]string, error)
- func (g *GCSEventStore) LookUp(ctx context.Context, key, source string) (*event.Message, error)
- func (g *GCSEventStore) LookUpByKey(ctx context.Context, key string) ([]*event.Message, error)
- func (g *GCSEventStore) Persist(ctx context.Context, key, source, content string) error
- type ObjectIterator
- type Operation
- type ReadPolicy
- type Timeout
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(ctx context.Context, cfg *GCSConfig, options ...option.ClientOption) (storage.EventStore, error)
Types ¶
type GCSConfig ¶
type GCSConfig struct { Bucket string Compressor compression.Compressor Folder *string ReadPolicy ReadPolicy Timeout Timeout }
func Config ¶
Config creates a default configuration, that - doesn't do compression/decompression when write & read to GCS - takes the earliest created object if there are multiple under the same key/source/ path - enforces universal 30s timeout in GCS requests
func (*GCSConfig) NewContextWithTimeout ¶
func (c *GCSConfig) NewContextWithTimeout( parent context.Context, operation Operation) (context.Context, context.CancelFunc)
NewContextWithTimeout generates a new context.Context with timeout from the parent context. If neither operation-specific timeout nor default timeout is found, return parent context without any operation.
func (*GCSConfig) WithCompressor ¶
func (c *GCSConfig) WithCompressor(compressor compression.Compressor) *GCSConfig
func (*GCSConfig) WithFolder ¶
func (*GCSConfig) WithReadPolicy ¶
func (c *GCSConfig) WithReadPolicy(readPolicy ReadPolicy) *GCSConfig
func (*GCSConfig) WithTimeout ¶
type GCSEventStore ¶
type GCSEventStore struct {
// contains filtered or unexported fields
}
GCSEventStore persists the contents in GCS, which requires consistent connections to Google Cloud.
func (*GCSEventStore) ListSourcesByKey ¶
func (*GCSEventStore) LookUp ¶
LookUp returns a single message by looking up the path `folder/key/source`.
func (*GCSEventStore) LookUpByKey ¶
LookUpByKey returns a list of messages by looking up the prefix `folder/key/`.
type ObjectIterator ¶
type ObjectIterator interface {
Next() (*gcs.ObjectAttrs, error)
}
type Operation ¶
type Operation string
const ( ListContents Operation = "ListContents" // operation that lists all content associated with a given key ReadContent Operation = "ReadContent" // operation that reads content associated with a key-source pair WriteContent Operation = "WriteContent" //operation to writes content associated with a key-source pair )
type ReadPolicy ¶
type ReadPolicy interface {
Apply(ObjectIterator) (*gcs.ObjectAttrs, error)
}
ReadPolicy defines the actions that the GCSEventStore takes when it got the object iterator via list query.
func TakeFirstCreated ¶
func TakeFirstCreated() ReadPolicy
func TakeLastCreated ¶
func TakeLastCreated() ReadPolicy