As we work towards introducing consumer groups to the repository we need a more generic name for the persistence layer for storing checkpoints and leases for given shards. * Rename `checkpoint` to `store`
41 lines
934 B
Go
41 lines
934 B
Go
package consumer
|
|
|
|
import "github.com/aws/aws-sdk-go/service/kinesis/kinesisiface"
|
|
|
|
// Option is used to override defaults when creating a new Consumer
|
|
type Option func(*Consumer)
|
|
|
|
// WithStorage overrides the default storage
|
|
func WithStorage(store Store) Option {
|
|
return func(c *Consumer) {
|
|
c.store = store
|
|
}
|
|
}
|
|
|
|
// WithLogger overrides the default logger
|
|
func WithLogger(logger Logger) Option {
|
|
return func(c *Consumer) {
|
|
c.logger = logger
|
|
}
|
|
}
|
|
|
|
// WithCounter overrides the default counter
|
|
func WithCounter(counter Counter) Option {
|
|
return func(c *Consumer) {
|
|
c.counter = counter
|
|
}
|
|
}
|
|
|
|
// WithClient overrides the default client
|
|
func WithClient(client kinesisiface.KinesisAPI) Option {
|
|
return func(c *Consumer) {
|
|
c.client = client
|
|
}
|
|
}
|
|
|
|
// WithShardIteratorType overrides the starting point for the consumer
|
|
func WithShardIteratorType(t string) Option {
|
|
return func(c *Consumer) {
|
|
c.initialShardIteratorType = t
|
|
}
|
|
}
|