shard

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package shard is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrShardClosed is returned when shard is closed and a req cannot be processed
	ErrShardClosed = errors.New("shard closed")
)

Functions

func CreateShardOwnershipLostError

func CreateShardOwnershipLostError(
	currentHost string,
	ownerHost string,
) *h.ShardOwnershipLostError

CreateShardOwnershipLostError creates a new shard ownership lost error

func IsShardOwnershiptLostError

func IsShardOwnershiptLostError(err error) bool

IsShardOwnershiptLostError checks if a given error is shard ownership lost error

Types

type Context

type Context interface {
	GetShardID() int
	GetService() resource.Resource
	GetExecutionManager() persistence.ExecutionManager
	GetHistoryManager() persistence.HistoryManager
	GetDomainCache() cache.DomainCache
	GetClusterMetadata() cluster.Metadata
	GetConfig() *config.Config
	GetEventsCache() events.Cache
	GetLogger() log.Logger
	GetThrottledLogger() log.Logger
	GetMetricsClient() metrics.Client
	GetTimeSource() clock.TimeSource
	PreviousShardOwnerWasDifferent() bool

	GetEngine() engine.Engine
	SetEngine(engine.Engine)

	GenerateTransferTaskID() (int64, error)
	GenerateTransferTaskIDs(number int) ([]int64, error)

	GetTransferMaxReadLevel() int64
	UpdateTimerMaxReadLevel(cluster string) time.Time

	SetCurrentTime(cluster string, currentTime time.Time)
	GetCurrentTime(cluster string) time.Time
	GetLastUpdatedTime() time.Time
	GetTimerMaxReadLevel(cluster string) time.Time

	GetTransferAckLevel() int64
	UpdateTransferAckLevel(ackLevel int64) error
	GetTransferClusterAckLevel(cluster string) int64
	UpdateTransferClusterAckLevel(cluster string, ackLevel int64) error

	GetReplicatorAckLevel() int64
	UpdateReplicatorAckLevel(ackLevel int64) error
	GetReplicatorDLQAckLevel(sourceCluster string) int64
	UpdateReplicatorDLQAckLevel(sourCluster string, ackLevel int64) error

	GetClusterReplicationLevel(cluster string) int64
	UpdateClusterReplicationLevel(cluster string, lastTaskID int64) error

	GetTimerAckLevel() time.Time
	UpdateTimerAckLevel(ackLevel time.Time) error
	GetTimerClusterAckLevel(cluster string) time.Time
	UpdateTimerClusterAckLevel(cluster string, ackLevel time.Time) error

	UpdateTransferFailoverLevel(failoverID string, level persistence.TransferFailoverLevel) error
	DeleteTransferFailoverLevel(failoverID string) error
	GetAllTransferFailoverLevels() map[string]persistence.TransferFailoverLevel

	UpdateTimerFailoverLevel(failoverID string, level persistence.TimerFailoverLevel) error
	DeleteTimerFailoverLevel(failoverID string) error
	GetAllTimerFailoverLevels() map[string]persistence.TimerFailoverLevel

	GetDomainNotificationVersion() int64
	UpdateDomainNotificationVersion(domainNotificationVersion int64) error

	CreateWorkflowExecution(request *persistence.CreateWorkflowExecutionRequest) (*persistence.CreateWorkflowExecutionResponse, error)
	UpdateWorkflowExecution(request *persistence.UpdateWorkflowExecutionRequest) (*persistence.UpdateWorkflowExecutionResponse, error)
	ConflictResolveWorkflowExecution(request *persistence.ConflictResolveWorkflowExecutionRequest) error
	ResetWorkflowExecution(request *persistence.ResetWorkflowExecutionRequest) error
	AppendHistoryV2Events(request *persistence.AppendHistoryNodesRequest, domainID string, execution shared.WorkflowExecution) (int, error)

	ReplicateFailoverMarkers(makers []*persistence.FailoverMarkerTask) error
	AddingPendingFailoverMarker(*replicator.FailoverMarkerAttributes) error
	ValidateAndUpdateFailoverMarkers() ([]*replicator.FailoverMarkerAttributes, error)
}

Context represents a history engine shard

type Controller

type Controller interface {
	common.Daemon

	// PrepareToStop starts the graceful shutdown process for controller
	PrepareToStop()

	GetEngine(workflowID string) (engine.Engine, error)
	GetEngineForShard(shardID int) (engine.Engine, error)
	RemoveEngineForShard(shardID int)

	// Following methods describes the current status of the controller
	// TODO: consider converting to a unified describe method
	Status() int32
	NumShards() int
	ShardIDs() []int32
}

Controller controls history service shards

func NewShardController

func NewShardController(
	resource resource.Resource,
	factory EngineFactory,
	config *config.Config,
) Controller

NewShardController creates a new shard controller

type EngineFactory

type EngineFactory interface {
	CreateEngine(Context) engine.Engine
}

EngineFactory is used to create an instance of sharded history engine

type MockController

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

MockController is a mock of Controller interface

func NewMockController

func NewMockController(ctrl *gomock.Controller) *MockController

NewMockController creates a new mock instance

func (*MockController) EXPECT

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

func (*MockController) GetEngine

func (m *MockController) GetEngine(workflowID string) (engine.Engine, error)

GetEngine mocks base method

func (*MockController) GetEngineForShard

func (m *MockController) GetEngineForShard(shardID int) (engine.Engine, error)

GetEngineForShard mocks base method

func (*MockController) NumShards

func (m *MockController) NumShards() int

NumShards mocks base method

func (*MockController) PrepareToStop

func (m *MockController) PrepareToStop()

PrepareToStop mocks base method

func (*MockController) RemoveEngineForShard

func (m *MockController) RemoveEngineForShard(shardID int)

RemoveEngineForShard mocks base method

func (*MockController) ShardIDs

func (m *MockController) ShardIDs() []int32

ShardIDs mocks base method

func (*MockController) Start

func (m *MockController) Start()

Start mocks base method

func (*MockController) Status

func (m *MockController) Status() int32

Status mocks base method

func (*MockController) Stop

func (m *MockController) Stop()

Stop mocks base method

type MockControllerMockRecorder

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

MockControllerMockRecorder is the mock recorder for MockController

func (*MockControllerMockRecorder) GetEngine

func (mr *MockControllerMockRecorder) GetEngine(workflowID interface{}) *gomock.Call

GetEngine indicates an expected call of GetEngine

func (*MockControllerMockRecorder) GetEngineForShard

func (mr *MockControllerMockRecorder) GetEngineForShard(shardID interface{}) *gomock.Call

GetEngineForShard indicates an expected call of GetEngineForShard

func (*MockControllerMockRecorder) NumShards

func (mr *MockControllerMockRecorder) NumShards() *gomock.Call

NumShards indicates an expected call of NumShards

func (*MockControllerMockRecorder) PrepareToStop

func (mr *MockControllerMockRecorder) PrepareToStop() *gomock.Call

PrepareToStop indicates an expected call of PrepareToStop

func (*MockControllerMockRecorder) RemoveEngineForShard

func (mr *MockControllerMockRecorder) RemoveEngineForShard(shardID interface{}) *gomock.Call

RemoveEngineForShard indicates an expected call of RemoveEngineForShard

func (*MockControllerMockRecorder) ShardIDs

func (mr *MockControllerMockRecorder) ShardIDs() *gomock.Call

ShardIDs indicates an expected call of ShardIDs

func (*MockControllerMockRecorder) Start

func (mr *MockControllerMockRecorder) Start() *gomock.Call

Start indicates an expected call of Start

func (*MockControllerMockRecorder) Status

func (mr *MockControllerMockRecorder) Status() *gomock.Call

Status indicates an expected call of Status

func (*MockControllerMockRecorder) Stop

Stop indicates an expected call of Stop

type MockEngineFactory

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

MockEngineFactory is a mock of EngineFactory interface

func NewMockEngineFactory

func NewMockEngineFactory(ctrl *gomock.Controller) *MockEngineFactory

NewMockEngineFactory creates a new mock instance

func (*MockEngineFactory) CreateEngine

func (m *MockEngineFactory) CreateEngine(arg0 Context) engine.Engine

CreateEngine mocks base method

func (*MockEngineFactory) EXPECT

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

type MockEngineFactoryMockRecorder

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

MockEngineFactoryMockRecorder is the mock recorder for MockEngineFactory

func (*MockEngineFactoryMockRecorder) CreateEngine

func (mr *MockEngineFactoryMockRecorder) CreateEngine(arg0 interface{}) *gomock.Call

CreateEngine indicates an expected call of CreateEngine

type TestContext

type TestContext struct {
	Resource        *resource.Test
	MockEventsCache *events.MockCache
	// contains filtered or unexported fields
}

TestContext is a test implementation for shard Context interface

func NewTestContext

func NewTestContext(
	ctrl *gomock.Controller,
	shardInfo *persistence.ShardInfo,
	config *config.Config,
) *TestContext

NewTestContext create a new shardContext for test

func (TestContext) AddingPendingFailoverMarker added in v0.14.0

func (s TestContext) AddingPendingFailoverMarker(
	marker *replicator.FailoverMarkerAttributes,
) error

func (TestContext) AppendHistoryV2Events

func (s TestContext) AppendHistoryV2Events(
	request *persistence.AppendHistoryNodesRequest, domainID string, execution shared.WorkflowExecution) (int, error)

func (TestContext) ConflictResolveWorkflowExecution

func (s TestContext) ConflictResolveWorkflowExecution(
	request *persistence.ConflictResolveWorkflowExecutionRequest,
) error

func (TestContext) CreateWorkflowExecution

func (s TestContext) CreateWorkflowExecution(
	request *persistence.CreateWorkflowExecutionRequest,
) (*persistence.CreateWorkflowExecutionResponse, error)

func (TestContext) DeleteTimerFailoverLevel

func (s TestContext) DeleteTimerFailoverLevel(failoverID string) error

func (TestContext) DeleteTransferFailoverLevel

func (s TestContext) DeleteTransferFailoverLevel(failoverID string) error

func (*TestContext) Finish

func (s *TestContext) Finish(
	t mock.TestingT,
)

Finish checks whether expectations are met

func (TestContext) GenerateTransferTaskID

func (s TestContext) GenerateTransferTaskID() (int64, error)

func (TestContext) GenerateTransferTaskIDs

func (s TestContext) GenerateTransferTaskIDs(number int) ([]int64, error)

func (TestContext) GetAllTimerFailoverLevels

func (s TestContext) GetAllTimerFailoverLevels() map[string]persistence.TimerFailoverLevel

func (TestContext) GetAllTransferFailoverLevels

func (s TestContext) GetAllTransferFailoverLevels() map[string]persistence.TransferFailoverLevel

func (TestContext) GetClusterReplicationLevel

func (s TestContext) GetClusterReplicationLevel(cluster string) int64

func (TestContext) GetConfig

func (s TestContext) GetConfig() *config.Config

func (TestContext) GetCurrentTime

func (s TestContext) GetCurrentTime(cluster string) time.Time

func (TestContext) GetDomainNotificationVersion

func (s TestContext) GetDomainNotificationVersion() int64

func (TestContext) GetEngine

func (s TestContext) GetEngine() engine.Engine

func (TestContext) GetEventsCache

func (s TestContext) GetEventsCache() events.Cache

func (TestContext) GetExecutionManager

func (s TestContext) GetExecutionManager() persistence.ExecutionManager

func (TestContext) GetLastUpdatedTime

func (s TestContext) GetLastUpdatedTime() time.Time

func (TestContext) GetLogger

func (s TestContext) GetLogger() log.Logger

func (TestContext) GetReplicatorAckLevel

func (s TestContext) GetReplicatorAckLevel() int64

func (TestContext) GetReplicatorDLQAckLevel

func (s TestContext) GetReplicatorDLQAckLevel(sourceCluster string) int64

func (TestContext) GetService

func (s TestContext) GetService() resource.Resource

func (TestContext) GetShardID

func (s TestContext) GetShardID() int

func (TestContext) GetThrottledLogger

func (s TestContext) GetThrottledLogger() log.Logger

func (TestContext) GetTimerAckLevel

func (s TestContext) GetTimerAckLevel() time.Time

func (TestContext) GetTimerClusterAckLevel

func (s TestContext) GetTimerClusterAckLevel(cluster string) time.Time

func (TestContext) GetTimerMaxReadLevel

func (s TestContext) GetTimerMaxReadLevel(cluster string) time.Time

func (TestContext) GetTransferAckLevel

func (s TestContext) GetTransferAckLevel() int64

func (TestContext) GetTransferClusterAckLevel

func (s TestContext) GetTransferClusterAckLevel(cluster string) int64

func (TestContext) GetTransferMaxReadLevel

func (s TestContext) GetTransferMaxReadLevel() int64

func (TestContext) PreviousShardOwnerWasDifferent

func (s TestContext) PreviousShardOwnerWasDifferent() bool

func (TestContext) ReplicateFailoverMarkers added in v0.14.0

func (s TestContext) ReplicateFailoverMarkers(
	markers []*persistence.FailoverMarkerTask,
) error

func (TestContext) ResetWorkflowExecution

func (s TestContext) ResetWorkflowExecution(request *persistence.ResetWorkflowExecutionRequest) error

func (TestContext) SetCurrentTime

func (s TestContext) SetCurrentTime(cluster string, currentTime time.Time)

func (TestContext) SetEngine

func (s TestContext) SetEngine(engine engine.Engine)

func (*TestContext) SetEventsCache

func (s *TestContext) SetEventsCache(
	eventsCache events.Cache,
)

SetEventsCache is a test hook for setting events cache

func (*TestContext) ShardInfo

func (s *TestContext) ShardInfo() *persistence.ShardInfo

ShardInfo is a test hook for getting shard info

func (TestContext) UpdateClusterReplicationLevel

func (s TestContext) UpdateClusterReplicationLevel(cluster string, lastTaskID int64) error

func (TestContext) UpdateDomainNotificationVersion

func (s TestContext) UpdateDomainNotificationVersion(domainNotificationVersion int64) error

func (TestContext) UpdateReplicatorAckLevel

func (s TestContext) UpdateReplicatorAckLevel(ackLevel int64) error

func (TestContext) UpdateReplicatorDLQAckLevel

func (s TestContext) UpdateReplicatorDLQAckLevel(
	sourceCluster string,
	ackLevel int64,
) error

func (TestContext) UpdateTimerAckLevel

func (s TestContext) UpdateTimerAckLevel(ackLevel time.Time) error

func (TestContext) UpdateTimerClusterAckLevel

func (s TestContext) UpdateTimerClusterAckLevel(cluster string, ackLevel time.Time) error

func (TestContext) UpdateTimerFailoverLevel

func (s TestContext) UpdateTimerFailoverLevel(failoverID string, level persistence.TimerFailoverLevel) error

func (TestContext) UpdateTimerMaxReadLevel

func (s TestContext) UpdateTimerMaxReadLevel(cluster string) time.Time

func (TestContext) UpdateTransferAckLevel

func (s TestContext) UpdateTransferAckLevel(ackLevel int64) error

func (TestContext) UpdateTransferClusterAckLevel

func (s TestContext) UpdateTransferClusterAckLevel(cluster string, ackLevel int64) error

func (TestContext) UpdateTransferFailoverLevel

func (s TestContext) UpdateTransferFailoverLevel(failoverID string, level persistence.TransferFailoverLevel) error

func (TestContext) UpdateWorkflowExecution

func (s TestContext) UpdateWorkflowExecution(
	request *persistence.UpdateWorkflowExecutionRequest,
) (*persistence.UpdateWorkflowExecutionResponse, error)

func (TestContext) ValidateAndUpdateFailoverMarkers added in v0.14.0

func (s TestContext) ValidateAndUpdateFailoverMarkers() ([]*replicator.FailoverMarkerAttributes, error)

Jump to

Keyboard shortcuts

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