queue

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package queue is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DomainFilter

type DomainFilter struct {
	DomainIDs map[string]struct{}
	// by default, a DomainFilter matches domains listed in the Domains field
	// if reverseMatch is true then the DomainFilter matches domains that are
	// not in the Domains field.
	ReverseMatch bool
}

DomainFilter filters domain

func NewDomainFilter

func NewDomainFilter(
	domainIDs map[string]struct{},
	reverseMatch bool,
) DomainFilter

NewDomainFilter creates a new domain filter

func (DomainFilter) Exclude

func (f DomainFilter) Exclude(domainIDs map[string]struct{}) DomainFilter

Exclude removes domainIDs from the domainID set specified by the filter

func (DomainFilter) Filter

func (f DomainFilter) Filter(domainID string) bool

Filter returns true if domainID is in the domainID set specified by the filter

func (DomainFilter) Include

func (f DomainFilter) Include(domainIDs map[string]struct{}) DomainFilter

Include adds more domainIDs to the domainID set specified by the filter

func (DomainFilter) Merge

Merge merges the domainID sets specified by two domain filters

type MockProcessingQueue

type MockProcessingQueue struct {
	// contains filtered or unexported fields
}

MockProcessingQueue is a mock of ProcessingQueue interface

func NewMockProcessingQueue

func NewMockProcessingQueue(ctrl *gomock.Controller) *MockProcessingQueue

NewMockProcessingQueue creates a new mock instance

func (*MockProcessingQueue) AddTasks

func (m *MockProcessingQueue) AddTasks(arg0 map[task.Key]task.Task, arg1 bool)

AddTasks mocks base method

func (*MockProcessingQueue) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockProcessingQueue) Merge

Merge mocks base method

func (*MockProcessingQueue) Split

Split mocks base method

func (*MockProcessingQueue) State

State mocks base method

func (*MockProcessingQueue) UpdateAckLevel

func (m *MockProcessingQueue) UpdateAckLevel()

UpdateAckLevel mocks base method

type MockProcessingQueueCollection

type MockProcessingQueueCollection struct {
	// contains filtered or unexported fields
}

MockProcessingQueueCollection is a mock of ProcessingQueueCollection interface

func NewMockProcessingQueueCollection

func NewMockProcessingQueueCollection(ctrl *gomock.Controller) *MockProcessingQueueCollection

NewMockProcessingQueueCollection creates a new mock instance

func (*MockProcessingQueueCollection) ActiveQueue

ActiveQueue mocks base method

func (*MockProcessingQueueCollection) AddTasks

func (m *MockProcessingQueueCollection) AddTasks(arg0 map[task.Key]task.Task, arg1 bool)

AddTasks mocks base method

func (*MockProcessingQueueCollection) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockProcessingQueueCollection) Level

Level mocks base method

func (*MockProcessingQueueCollection) Merge

Merge mocks base method

func (*MockProcessingQueueCollection) Queues

Queues mocks base method

func (*MockProcessingQueueCollection) Split

Split mocks base method

type MockProcessingQueueCollectionMockRecorder

type MockProcessingQueueCollectionMockRecorder struct {
	// contains filtered or unexported fields
}

MockProcessingQueueCollectionMockRecorder is the mock recorder for MockProcessingQueueCollection

func (*MockProcessingQueueCollectionMockRecorder) ActiveQueue

ActiveQueue indicates an expected call of ActiveQueue

func (*MockProcessingQueueCollectionMockRecorder) AddTasks

func (mr *MockProcessingQueueCollectionMockRecorder) AddTasks(arg0, arg1 interface{}) *gomock.Call

AddTasks indicates an expected call of AddTasks

func (*MockProcessingQueueCollectionMockRecorder) Level

Level indicates an expected call of Level

func (*MockProcessingQueueCollectionMockRecorder) Merge

func (mr *MockProcessingQueueCollectionMockRecorder) Merge(arg0 interface{}) *gomock.Call

Merge indicates an expected call of Merge

func (*MockProcessingQueueCollectionMockRecorder) Queues

Queues indicates an expected call of Queues

func (*MockProcessingQueueCollectionMockRecorder) Split

func (mr *MockProcessingQueueCollectionMockRecorder) Split(arg0 interface{}) *gomock.Call

Split indicates an expected call of Split

type MockProcessingQueueManager

type MockProcessingQueueManager struct {
	// contains filtered or unexported fields
}

MockProcessingQueueManager is a mock of ProcessingQueueManager interface

func NewMockProcessingQueueManager

func NewMockProcessingQueueManager(ctrl *gomock.Controller) *MockProcessingQueueManager

NewMockProcessingQueueManager creates a new mock instance

func (*MockProcessingQueueManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockProcessingQueueManager) NotifyNewTasks

func (m *MockProcessingQueueManager) NotifyNewTasks(arg0 []persistence.Task)

NotifyNewTasks mocks base method

func (*MockProcessingQueueManager) Start

func (m *MockProcessingQueueManager) Start()

Start mocks base method

func (*MockProcessingQueueManager) Stop

func (m *MockProcessingQueueManager) Stop()

Stop mocks base method

type MockProcessingQueueManagerMockRecorder

type MockProcessingQueueManagerMockRecorder struct {
	// contains filtered or unexported fields
}

MockProcessingQueueManagerMockRecorder is the mock recorder for MockProcessingQueueManager

func (*MockProcessingQueueManagerMockRecorder) NotifyNewTasks

func (mr *MockProcessingQueueManagerMockRecorder) NotifyNewTasks(arg0 interface{}) *gomock.Call

NotifyNewTasks indicates an expected call of NotifyNewTasks

func (*MockProcessingQueueManagerMockRecorder) Start

Start indicates an expected call of Start

func (*MockProcessingQueueManagerMockRecorder) Stop

Stop indicates an expected call of Stop

type MockProcessingQueueMockRecorder

type MockProcessingQueueMockRecorder struct {
	// contains filtered or unexported fields
}

MockProcessingQueueMockRecorder is the mock recorder for MockProcessingQueue

func (*MockProcessingQueueMockRecorder) AddTasks

func (mr *MockProcessingQueueMockRecorder) AddTasks(arg0, arg1 interface{}) *gomock.Call

AddTasks indicates an expected call of AddTasks

func (*MockProcessingQueueMockRecorder) Merge

func (mr *MockProcessingQueueMockRecorder) Merge(arg0 interface{}) *gomock.Call

Merge indicates an expected call of Merge

func (*MockProcessingQueueMockRecorder) Split

func (mr *MockProcessingQueueMockRecorder) Split(arg0 interface{}) *gomock.Call

Split indicates an expected call of Split

func (*MockProcessingQueueMockRecorder) State

State indicates an expected call of State

func (*MockProcessingQueueMockRecorder) UpdateAckLevel

func (mr *MockProcessingQueueMockRecorder) UpdateAckLevel() *gomock.Call

UpdateAckLevel indicates an expected call of UpdateAckLevel

type MockProcessingQueueSplitPolicy

type MockProcessingQueueSplitPolicy struct {
	// contains filtered or unexported fields
}

MockProcessingQueueSplitPolicy is a mock of ProcessingQueueSplitPolicy interface

func NewMockProcessingQueueSplitPolicy

func NewMockProcessingQueueSplitPolicy(ctrl *gomock.Controller) *MockProcessingQueueSplitPolicy

NewMockProcessingQueueSplitPolicy creates a new mock instance

func (*MockProcessingQueueSplitPolicy) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockProcessingQueueSplitPolicy) Evaluate

Evaluate mocks base method

type MockProcessingQueueSplitPolicyMockRecorder

type MockProcessingQueueSplitPolicyMockRecorder struct {
	// contains filtered or unexported fields
}

MockProcessingQueueSplitPolicyMockRecorder is the mock recorder for MockProcessingQueueSplitPolicy

func (*MockProcessingQueueSplitPolicyMockRecorder) Evaluate

func (mr *MockProcessingQueueSplitPolicyMockRecorder) Evaluate(arg0 interface{}) *gomock.Call

Evaluate indicates an expected call of Evaluate

type MockProcessingQueueState

type MockProcessingQueueState struct {
	// contains filtered or unexported fields
}

MockProcessingQueueState is a mock of ProcessingQueueState interface

func NewMockProcessingQueueState

func NewMockProcessingQueueState(ctrl *gomock.Controller) *MockProcessingQueueState

NewMockProcessingQueueState creates a new mock instance

func (*MockProcessingQueueState) AckLevel

func (m *MockProcessingQueueState) AckLevel() task.Key

AckLevel mocks base method

func (*MockProcessingQueueState) DomainFilter

func (m *MockProcessingQueueState) DomainFilter() DomainFilter

DomainFilter mocks base method

func (*MockProcessingQueueState) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockProcessingQueueState) Level

func (m *MockProcessingQueueState) Level() int

Level mocks base method

func (*MockProcessingQueueState) MaxLevel

func (m *MockProcessingQueueState) MaxLevel() task.Key

MaxLevel mocks base method

func (*MockProcessingQueueState) ReadLevel

func (m *MockProcessingQueueState) ReadLevel() task.Key

ReadLevel mocks base method

type MockProcessingQueueStateMockRecorder

type MockProcessingQueueStateMockRecorder struct {
	// contains filtered or unexported fields
}

MockProcessingQueueStateMockRecorder is the mock recorder for MockProcessingQueueState

func (*MockProcessingQueueStateMockRecorder) AckLevel

AckLevel indicates an expected call of AckLevel

func (*MockProcessingQueueStateMockRecorder) DomainFilter

func (mr *MockProcessingQueueStateMockRecorder) DomainFilter() *gomock.Call

DomainFilter indicates an expected call of DomainFilter

func (*MockProcessingQueueStateMockRecorder) Level

Level indicates an expected call of Level

func (*MockProcessingQueueStateMockRecorder) MaxLevel

MaxLevel indicates an expected call of MaxLevel

func (*MockProcessingQueueStateMockRecorder) ReadLevel

ReadLevel indicates an expected call of ReadLevel

type ProcessingQueue

type ProcessingQueue interface {
	State() ProcessingQueueState
	Split(ProcessingQueueSplitPolicy) []ProcessingQueue
	Merge(ProcessingQueue) []ProcessingQueue
	AddTasks(map[task.Key]task.Task, bool)
	UpdateAckLevel()
}

ProcessingQueue is responsible for keeping track of the state of tasks within the scope defined by its state; it can also be split into multiple ProcessingQueues with non-overlapping scope or be merged with another ProcessingQueue

func NewProcessingQueue

func NewProcessingQueue(
	state ProcessingQueueState,
	logger log.Logger,
	metricsClient metrics.Client,
) ProcessingQueue

NewProcessingQueue creates a new processing queue based on its state

type ProcessingQueueCollection

type ProcessingQueueCollection interface {
	Level() int
	Queues() []ProcessingQueue
	ActiveQueue() ProcessingQueue
	AddTasks(map[task.Key]task.Task, bool)
	UpdateAckLevels()
	Split(ProcessingQueueSplitPolicy) []ProcessingQueue
	Merge([]ProcessingQueue)
}

ProcessingQueueCollection manages a list of non-overlapping ProcessingQueues and keep track of the current active ProcessingQueue

func NewProcessingQueueCollection

func NewProcessingQueueCollection(
	level int,
	queues []ProcessingQueue,
) ProcessingQueueCollection

NewProcessingQueueCollection creates a new collection for non-overlapping queues

type ProcessingQueueManager

type ProcessingQueueManager interface {
	common.Daemon

	NotifyNewTasks([]persistence.Task)
}

ProcessingQueueManager manages a set of ProcessingQueueCollection and controls the event loop for loading tasks, updating and persisting ProcessingQueueStates, spliting/merging ProcessingQueue, etc.

type ProcessingQueueSplitPolicy

type ProcessingQueueSplitPolicy interface {
	Evaluate(ProcessingQueue) []ProcessingQueueState
}

ProcessingQueueSplitPolicy determines if one ProcessingQueue should be split into multiple ProcessingQueues

func NewAggregatedSplitPolicy

func NewAggregatedSplitPolicy(
	policies ...ProcessingQueueSplitPolicy,
) ProcessingQueueSplitPolicy

NewAggregatedSplitPolicy creates a new processing queue split policy that which combines other policies. Policies are evaluated in the order they passed in, and if one policy returns an non-empty result, that result will be returned as is and policies after that one will not be evaluated

func NewPendingTaskSplitPolicy

func NewPendingTaskSplitPolicy(
	pendingTaskThreshold map[int]int,
	lookAheadFunc lookAheadFunc,
	maxNewQueueLevel int,
) ProcessingQueueSplitPolicy

NewPendingTaskSplitPolicy creates a new processing queue split policy based on the number of pending tasks

func NewSelectedDomainSplitPolicy

func NewSelectedDomainSplitPolicy(
	domainIDs map[string]struct{},
	newQueueLevel int,
) ProcessingQueueSplitPolicy

NewSelectedDomainSplitPolicy creates a new processing queue split policy that splits out specific domainIDs

func NewStuckTaskSplitPolicy

func NewStuckTaskSplitPolicy(
	attemptThreshold map[int]int,
	maxNewQueueLevel int,
) ProcessingQueueSplitPolicy

NewStuckTaskSplitPolicy creates a new processing queue split policy based on the number of task attempts tasks

type ProcessingQueueState

type ProcessingQueueState interface {
	Level() int
	AckLevel() task.Key
	ReadLevel() task.Key
	MaxLevel() task.Key
	DomainFilter() DomainFilter
}

ProcessingQueueState indicates the scope of a task processing queue and its current progress

func NewProcessingQueueState

func NewProcessingQueueState(
	level int,
	ackLevel task.Key,
	maxLevel task.Key,
	domainFilter DomainFilter,
) ProcessingQueueState

NewProcessingQueueState creates a new state instance for processing queue readLevel will be set to the same value as ackLevel

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL