Documentation ¶
Overview ¶
Package consumer provides all aspects of the arrebato server for managing consumers. Primarily the storage of consumer indexes. Consumer indexes indicate the location within a topic for a given consumer identifier.
Index ¶
- Variables
- type BoltStore
- func (bs *BoltStore) GetTopicIndex(_ context.Context, topic, consumerID string) (*consumer.TopicIndex, error)
- func (bs *BoltStore) Indexes(ctx context.Context) (map[string]map[string]uint64, error)
- func (bs *BoltStore) Prune(ctx context.Context, topicName string, before time.Time) ([]string, error)
- func (bs *BoltStore) SetTopicIndex(_ context.Context, c *consumer.TopicIndex) error
- type Executor
- type GRPC
- type Handler
- type Manager
- type MetricExporter
- type MetricSource
Constants ¶
This section is empty.
Variables ¶
var ErrNoTopic = errors.New("no topic")
ErrNoTopic is the error given when attempting to perform an action against a topic that does not exist.
Functions ¶
This section is empty.
Types ¶
type BoltStore ¶
type BoltStore struct {
// contains filtered or unexported fields
}
The BoltStore type is responsible for maintaining the state of consumers within a boltdb database.
func NewBoltStore ¶
NewBoltStore returns a new instance of the BoltStore type that will persist and query consumer state from a boltdb instance.
func (*BoltStore) GetTopicIndex ¶
func (bs *BoltStore) GetTopicIndex(_ context.Context, topic, consumerID string) (*consumer.TopicIndex, error)
GetTopicIndex returns the current index in a topic for a consumer identifier. Returns a zero index if the consumer does not exist. Or ErrNoTopic if the topic does not exist.
func (*BoltStore) Indexes ¶
Indexes returns the current consumer index of every consumer for every topic. The initial map is keyed by topic name, the nested map is keyed by consumer identifier.
type Executor ¶
type Executor interface { // Execute should perform actions corresponding to the provided command. The returned error should correspond // to the issue relevant to the command. Execute(ctx context.Context, cmd command.Command) error }
The Executor interface describes types that execute commands related to Topic data.
type GRPC ¶
type GRPC struct {
// contains filtered or unexported fields
}
The GRPC type is a consumersvc.ConsumerServiceServer implementation that handles inbound gRPC requests to manage consumer state.
func NewGRPC ¶
NewGRPC returns a new instance of the GRPC type that will modify consumer data via commands sent to the Executor.
func (*GRPC) Register ¶
func (svr *GRPC) Register(registrar grpc.ServiceRegistrar, healthServer *health.Server)
Register the GRPC service onto the grpc.ServiceRegistrar.
func (*GRPC) SetTopicIndex ¶
func (svr *GRPC) SetTopicIndex(ctx context.Context, request *consumersvc.SetTopicIndexRequest) (*consumersvc.SetTopicIndexResponse, error)
SetTopicIndex handles an inbound gRPC request to set the current position of a consumer on a topic. Returns a codes.FailedPrecondition error code if this server is not the leader, or a codes.NotFound error code if the presented topic does not exist.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
The Handler type is responsible for handling commands sent to the server regarding consumer state.
func NewHandler ¶
NewHandler returns a new instance of the Handler type that will handle inbound commands regarding consumers.
func (*Handler) SetTopicIndex ¶
func (h *Handler) SetTopicIndex(ctx context.Context, cmd *consumercmd.SetTopicIndex) error
SetTopicIndex handles a command that modifies the current index for a consumer on a topic.
type MetricExporter ¶
type MetricExporter struct {
// contains filtered or unexported fields
}
The MetricExporter type is used to export metrics regarding the state of consumers within the data store.
func NewMetricExporter ¶
func NewMetricExporter(source MetricSource) *MetricExporter
NewMetricExporter returns a new instance of the MetricExporter type that will obtain statistics to export as metrics from the MetricSource implementation.