Documentation
¶
Overview ¶
Package types is a generated GoMock package.
Package types is a generated GoMock package.
Package types is a generated GoMock package.
Index ¶
- type Client
- type Consumer
- type ConsumerFactory
- type DispatchPolicy
- type Item
- type ItemPartitions
- type ItemToPersist
- type MockConsumer
- type MockConsumerFactory
- type MockConsumerFactoryMockRecorder
- type MockConsumerMockRecorder
- type MockItem
- type MockItemMockRecorder
- type MockItemPartitions
- type MockItemPartitionsMockRecorder
- type MockItemToPersist
- func (m *MockItemToPersist) EXPECT() *MockItemToPersistMockRecorder
- func (m *MockItemToPersist) GetAttribute(key string) any
- func (m *MockItemToPersist) GetPartitionKeys() []string
- func (m *MockItemToPersist) GetPartitionValue(key string) any
- func (m *MockItemToPersist) Offset() int64
- func (m *MockItemToPersist) String() string
- type MockItemToPersistMockRecorder
- func (mr *MockItemToPersistMockRecorder) GetAttribute(key any) *gomock.Call
- func (mr *MockItemToPersistMockRecorder) GetPartitionKeys() *gomock.Call
- func (mr *MockItemToPersistMockRecorder) GetPartitionValue(key any) *gomock.Call
- func (mr *MockItemToPersistMockRecorder) Offset() *gomock.Call
- func (mr *MockItemToPersistMockRecorder) String() *gomock.Call
- type MockPersister
- func (m *MockPersister) CommitOffsets(ctx context.Context, offsets *Offsets) error
- func (m *MockPersister) EXPECT() *MockPersisterMockRecorder
- func (m *MockPersister) Fetch(ctx context.Context, partitions ItemPartitions, pageInfo PageInfo) ([]Item, error)
- func (m *MockPersister) GetOffsets(ctx context.Context) (*Offsets, error)
- func (m *MockPersister) Persist(ctx context.Context, items []ItemToPersist) error
- type MockPersisterMockRecorder
- func (mr *MockPersisterMockRecorder) CommitOffsets(ctx, offsets any) *gomock.Call
- func (mr *MockPersisterMockRecorder) Fetch(ctx, partitions, pageInfo any) *gomock.Call
- func (mr *MockPersisterMockRecorder) GetOffsets(ctx any) *gomock.Call
- func (mr *MockPersisterMockRecorder) Persist(ctx, items any) *gomock.Call
- type NodePolicy
- type NodePolicyCollection
- type Offsets
- type PageInfo
- type Persister
- type SplitPolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// Enqueue adds an item to the queue
Enqueue(context.Context, []Item) ([]ItemToPersist, error)
// Ack marks the item as processed.
// Out of order acks are supported.
// Acking an item that has not been dequeued will have no effect.
// Queue's committed offset is updated to the last ack'ed item's offset periodically until there's a gap (un-acked item).
// In other words, all items up to the committed offset are ack'ed.
// Ack'ed item might still be returned from Dequeue if its offset is higher than last committed offset before process restarts.
Ack(context.Context, Item) error
// Nack negatively acknowledges an item in the queue
// Nack'ing an already ack'ed item will have no effect.
Nack(context.Context, Item) error
// Start the client. It will
// - fetch the last committed offsets from the persister,
// - start corresponding consumers
// - dispatch items starting from those offsets.
Start(context.Context) error
// Stop the client. It will
// - stop all consumers
// - persist the last committed offsets
Stop(context.Context) error
}
type ConsumerFactory ¶
type ConsumerFactory interface {
// New creates a new consumer with the given partitions or returns an existing consumer
// to process the given partitions
// Consumer lifecycle is managed by the factory so the returned consumer must be started.
New(ItemPartitions) (Consumer, error)
// Stop stops all consumers created by this factory
Stop(context.Context) error
}
type DispatchPolicy ¶
type DispatchPolicy struct {
// DispatchRPS is the rate limit for items dequeued from the node to be pushed to processors.
// All nodes inherit the DispatchRPS from the parent node as is (not distributed to children).
// If parent has 100 rps limit, then all curent and to-be-created children will have 100 rps limit.
DispatchRPS int64 `json:"dispatchRPS,omitempty"`
// Concurrency is the maximum number of items to be processed concurrently.
Concurrency int `json:"concurrency,omitempty"`
}
func (DispatchPolicy) String ¶
func (dp DispatchPolicy) String() string
type Item ¶
type Item interface {
// GetAttribute returns the value of the attribute key.
// Value can be any type. It's up to the client to interpret the value.
// Attribute keys used as partition keys will be converted to string because they are used as node
// identifiers in the queue tree.
GetAttribute(key string) any
// Offset returns the offset of the item in the queue. e.g. monotonically increasing sequence number or a timestamp
Offset() int64
// String returns a human friendly representation of the item for logging purposes
String() string
}
type ItemPartitions ¶
type ItemPartitions interface {
// GetPartitionKeys returns the partition keys ordered by their level in the tree
GetPartitionKeys() []string
// GetPartitionValue returns the partition value to determine the target queue
// e.g.
// Below example demonstrates that item is in a catch-all queue for sub-type
// Item.GetAttribute("sub-type") returns "timer"
// ItemPartitions.GetPartitionValue("sub-type") returns "*"
//
GetPartitionValue(key string) any
// String returns a human friendly representation of the item for logging purposes
String() string
}
func NewItemPartitions ¶
func NewItemPartitions(partitionKeys []string, partitionMap map[string]any) ItemPartitions
type ItemToPersist ¶
type ItemToPersist interface {
Item
ItemPartitions
}
func NewItemToPersist ¶
func NewItemToPersist(item Item, itemPartitions ItemPartitions) ItemToPersist
type MockConsumer ¶
type MockConsumer struct {
// contains filtered or unexported fields
}
MockConsumer is a mock of Consumer interface.
func NewMockConsumer ¶
func NewMockConsumer(ctrl *gomock.Controller) *MockConsumer
NewMockConsumer creates a new mock instance.
func (*MockConsumer) EXPECT ¶
func (m *MockConsumer) EXPECT() *MockConsumerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockConsumer) Process ¶
func (m *MockConsumer) Process(arg0 context.Context, arg1 Item) error
Process mocks base method.
type MockConsumerFactory ¶
type MockConsumerFactory struct {
// contains filtered or unexported fields
}
MockConsumerFactory is a mock of ConsumerFactory interface.
func NewMockConsumerFactory ¶
func NewMockConsumerFactory(ctrl *gomock.Controller) *MockConsumerFactory
NewMockConsumerFactory creates a new mock instance.
func (*MockConsumerFactory) EXPECT ¶
func (m *MockConsumerFactory) EXPECT() *MockConsumerFactoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockConsumerFactory) New ¶
func (m *MockConsumerFactory) New(arg0 ItemPartitions) (Consumer, error)
New mocks base method.
type MockConsumerFactoryMockRecorder ¶
type MockConsumerFactoryMockRecorder struct {
// contains filtered or unexported fields
}
MockConsumerFactoryMockRecorder is the mock recorder for MockConsumerFactory.
type MockConsumerMockRecorder ¶
type MockConsumerMockRecorder struct {
// contains filtered or unexported fields
}
MockConsumerMockRecorder is the mock recorder for MockConsumer.
func (*MockConsumerMockRecorder) Process ¶
func (mr *MockConsumerMockRecorder) Process(arg0, arg1 any) *gomock.Call
Process indicates an expected call of Process.
type MockItem ¶
type MockItem struct {
// contains filtered or unexported fields
}
MockItem is a mock of Item interface.
func NewMockItem ¶
func NewMockItem(ctrl *gomock.Controller) *MockItem
NewMockItem creates a new mock instance.
func (*MockItem) EXPECT ¶
func (m *MockItem) EXPECT() *MockItemMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockItem) GetAttribute ¶
GetAttribute mocks base method.
type MockItemMockRecorder ¶
type MockItemMockRecorder struct {
// contains filtered or unexported fields
}
MockItemMockRecorder is the mock recorder for MockItem.
func (*MockItemMockRecorder) GetAttribute ¶
func (mr *MockItemMockRecorder) GetAttribute(key any) *gomock.Call
GetAttribute indicates an expected call of GetAttribute.
func (*MockItemMockRecorder) Offset ¶
func (mr *MockItemMockRecorder) Offset() *gomock.Call
Offset indicates an expected call of Offset.
func (*MockItemMockRecorder) String ¶
func (mr *MockItemMockRecorder) String() *gomock.Call
String indicates an expected call of String.
type MockItemPartitions ¶
type MockItemPartitions struct {
// contains filtered or unexported fields
}
MockItemPartitions is a mock of ItemPartitions interface.
func NewMockItemPartitions ¶
func NewMockItemPartitions(ctrl *gomock.Controller) *MockItemPartitions
NewMockItemPartitions creates a new mock instance.
func (*MockItemPartitions) EXPECT ¶
func (m *MockItemPartitions) EXPECT() *MockItemPartitionsMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockItemPartitions) GetPartitionKeys ¶
func (m *MockItemPartitions) GetPartitionKeys() []string
GetPartitionKeys mocks base method.
func (*MockItemPartitions) GetPartitionValue ¶
func (m *MockItemPartitions) GetPartitionValue(key string) any
GetPartitionValue mocks base method.
func (*MockItemPartitions) String ¶
func (m *MockItemPartitions) String() string
String mocks base method.
type MockItemPartitionsMockRecorder ¶
type MockItemPartitionsMockRecorder struct {
// contains filtered or unexported fields
}
MockItemPartitionsMockRecorder is the mock recorder for MockItemPartitions.
func (*MockItemPartitionsMockRecorder) GetPartitionKeys ¶
func (mr *MockItemPartitionsMockRecorder) GetPartitionKeys() *gomock.Call
GetPartitionKeys indicates an expected call of GetPartitionKeys.
func (*MockItemPartitionsMockRecorder) GetPartitionValue ¶
func (mr *MockItemPartitionsMockRecorder) GetPartitionValue(key any) *gomock.Call
GetPartitionValue indicates an expected call of GetPartitionValue.
func (*MockItemPartitionsMockRecorder) String ¶
func (mr *MockItemPartitionsMockRecorder) String() *gomock.Call
String indicates an expected call of String.
type MockItemToPersist ¶
type MockItemToPersist struct {
// contains filtered or unexported fields
}
MockItemToPersist is a mock of ItemToPersist interface.
func NewMockItemToPersist ¶
func NewMockItemToPersist(ctrl *gomock.Controller) *MockItemToPersist
NewMockItemToPersist creates a new mock instance.
func (*MockItemToPersist) EXPECT ¶
func (m *MockItemToPersist) EXPECT() *MockItemToPersistMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockItemToPersist) GetAttribute ¶
func (m *MockItemToPersist) GetAttribute(key string) any
GetAttribute mocks base method.
func (*MockItemToPersist) GetPartitionKeys ¶
func (m *MockItemToPersist) GetPartitionKeys() []string
GetPartitionKeys mocks base method.
func (*MockItemToPersist) GetPartitionValue ¶
func (m *MockItemToPersist) GetPartitionValue(key string) any
GetPartitionValue mocks base method.
func (*MockItemToPersist) Offset ¶
func (m *MockItemToPersist) Offset() int64
Offset mocks base method.
func (*MockItemToPersist) String ¶
func (m *MockItemToPersist) String() string
String mocks base method.
type MockItemToPersistMockRecorder ¶
type MockItemToPersistMockRecorder struct {
// contains filtered or unexported fields
}
MockItemToPersistMockRecorder is the mock recorder for MockItemToPersist.
func (*MockItemToPersistMockRecorder) GetAttribute ¶
func (mr *MockItemToPersistMockRecorder) GetAttribute(key any) *gomock.Call
GetAttribute indicates an expected call of GetAttribute.
func (*MockItemToPersistMockRecorder) GetPartitionKeys ¶
func (mr *MockItemToPersistMockRecorder) GetPartitionKeys() *gomock.Call
GetPartitionKeys indicates an expected call of GetPartitionKeys.
func (*MockItemToPersistMockRecorder) GetPartitionValue ¶
func (mr *MockItemToPersistMockRecorder) GetPartitionValue(key any) *gomock.Call
GetPartitionValue indicates an expected call of GetPartitionValue.
func (*MockItemToPersistMockRecorder) Offset ¶
func (mr *MockItemToPersistMockRecorder) Offset() *gomock.Call
Offset indicates an expected call of Offset.
func (*MockItemToPersistMockRecorder) String ¶
func (mr *MockItemToPersistMockRecorder) String() *gomock.Call
String indicates an expected call of String.
type MockPersister ¶
type MockPersister struct {
// contains filtered or unexported fields
}
MockPersister is a mock of Persister interface.
func NewMockPersister ¶
func NewMockPersister(ctrl *gomock.Controller) *MockPersister
NewMockPersister creates a new mock instance.
func (*MockPersister) CommitOffsets ¶
func (m *MockPersister) CommitOffsets(ctx context.Context, offsets *Offsets) error
CommitOffsets mocks base method.
func (*MockPersister) EXPECT ¶
func (m *MockPersister) EXPECT() *MockPersisterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockPersister) Fetch ¶
func (m *MockPersister) Fetch(ctx context.Context, partitions ItemPartitions, pageInfo PageInfo) ([]Item, error)
Fetch mocks base method.
func (*MockPersister) GetOffsets ¶
func (m *MockPersister) GetOffsets(ctx context.Context) (*Offsets, error)
GetOffsets mocks base method.
func (*MockPersister) Persist ¶
func (m *MockPersister) Persist(ctx context.Context, items []ItemToPersist) error
Persist mocks base method.
type MockPersisterMockRecorder ¶
type MockPersisterMockRecorder struct {
// contains filtered or unexported fields
}
MockPersisterMockRecorder is the mock recorder for MockPersister.
func (*MockPersisterMockRecorder) CommitOffsets ¶
func (mr *MockPersisterMockRecorder) CommitOffsets(ctx, offsets any) *gomock.Call
CommitOffsets indicates an expected call of CommitOffsets.
func (*MockPersisterMockRecorder) Fetch ¶
func (mr *MockPersisterMockRecorder) Fetch(ctx, partitions, pageInfo any) *gomock.Call
Fetch indicates an expected call of Fetch.
func (*MockPersisterMockRecorder) GetOffsets ¶
func (mr *MockPersisterMockRecorder) GetOffsets(ctx any) *gomock.Call
GetOffsets indicates an expected call of GetOffsets.
type NodePolicy ¶
type NodePolicy struct {
// The path to the node
// Root node has empty path "".
// "/" is used as path separator.
// "*" means the policy applies to the special catch-all node
// "." means the policy applies to all nodes in the specified level except the catch-all node
Path string `json:"path,omitempty"`
SplitPolicy *SplitPolicy `json:"splitPolicy,omitempty"`
// DispatchPolicy is enforced at the leaf node level.
DispatchPolicy *DispatchPolicy `json:"dispatchPolicy,omitempty"`
}
func (NodePolicy) Merge ¶
func (np NodePolicy) Merge(other NodePolicy) (NodePolicy, error)
Merge merges two NodePolicy objects by marshalling/unmarshalling them. Any field in the other policy will override the field in the current policy.
func (NodePolicy) String ¶
func (np NodePolicy) String() string
type NodePolicyCollection ¶
type NodePolicyCollection struct {
// contains filtered or unexported fields
}
func NewNodePolicyCollection ¶
func NewNodePolicyCollection(policies []NodePolicy) NodePolicyCollection
func (NodePolicyCollection) GetMergedPolicyForNode ¶
func (npc NodePolicyCollection) GetMergedPolicyForNode(path string) (NodePolicy, error)
func (NodePolicyCollection) GetPolicies ¶
func (npc NodePolicyCollection) GetPolicies() []NodePolicy
type Offsets ¶
type Offsets struct {
}
Offsets encapsulates the whole queue tree state including the offsets of each leaf node
type SplitPolicy ¶
type SplitPolicy struct {
// Disabled is used to disable the split policy for the node.
Disabled bool `json:"disabled,omitempty"`
// PredefinedSplits is a list of predefined splits for the attribute key
// Child nodes for these attributes will be created during initialization
PredefinedSplits []any `json:"predefinedSplits,omitempty"`
}
func (SplitPolicy) String ¶
func (sp SplitPolicy) String() string