archiver

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: MIT Imports: 12 Imported by: 2

Documentation

Overview

Package archiver is a generated GoMock package.

Index

Constants

View Source
const (
	// ArchiveNonRetriableErrorMsg is the log message when the Archive() method encounters a non-retriable error
	ArchiveNonRetriableErrorMsg = "Archive method encountered an non-retriable error."

	// ErrInvalidURI is the error reason for invalid URI
	ErrInvalidURI = "URI is invalid"
	// ErrInvalidArchiveRequest is the error reason for invalid archive request
	ErrInvalidArchiveRequest = "archive request is invalid"
	// ErrConstructHistoryIterator is the error reason for failing to construct history iterator
	ErrConstructHistoryIterator = "failed to construct history iterator"
	// ErrReadHistory is the error reason for failing to read history
	ErrReadHistory = "failed to read history batches"
	// ErrHistoryMutated is the error reason for mutated history
	ErrHistoryMutated = "history was mutated"
)

Variables

View Source
var (
	// ErrInvalidURIScheme is the error for invalid URI
	ErrInvalidURIScheme = errors.New("URI scheme is invalid")
	// ErrContextTimeout is the error for context timeout
	ErrContextTimeout = errors.New("archive aborted because context timed out")
	// ErrInvalidGetHistoryRequest is the error for invalid GetHistory request
	ErrInvalidGetHistoryRequest = &shared.BadRequestError{Message: "Get archived history request is invalid"}
	// ErrGetHistoryTokenCorrupted is the error for corrupted GetHistory token
	ErrGetHistoryTokenCorrupted = &shared.BadRequestError{Message: "Next page token is corrupted."}
	// ErrHistoryNotExist is the error for non-exist history
	ErrHistoryNotExist = &shared.BadRequestError{Message: "Requested workflow history does not exist."}
)
View Source
var (
	// ErrArchiveNonRetriable is the error every Archiver implementation should return when
	// a non-retriable error is encountered.
	// If errors of other types are returned, method might be retried by caller
	ErrArchiveNonRetriable = errors.New("archive method encountered a non-retriable error")
)

Functions

This section is empty.

Types

type ArchiveFeatureCatalog

type ArchiveFeatureCatalog struct {
	ProgressManager ProgressManager
}

ArchiveFeatureCatalog is a collection features for the Archive method of History/Visibility Archiver

func GetFeatureCatalog

func GetFeatureCatalog(opts ...ArchiveOption) *ArchiveFeatureCatalog

GetFeatureCatalog applies all the ArchiveOptions to the catalog and returns the catalog. It should be called inside the Archive method.

type ArchiveHistoryRequest

type ArchiveHistoryRequest struct {
	ShardID              int
	DomainID             string
	DomainName           string
	WorkflowID           string
	RunID                string
	EventStoreVersion    int32
	BranchToken          []byte
	NextEventID          int64
	CloseFailoverVersion int64
}

ArchiveHistoryRequest is request to Archive

type ArchiveOption

type ArchiveOption func(featureCatalog *ArchiveFeatureCatalog)

ArchiveOption is used to provide options for addding features to the Archive method of History/Visibility Archiver

func GetHeartbeatArchiveOption

func GetHeartbeatArchiveOption() ArchiveOption

GetHeartbeatArchiveOption returns an ArchiveOption for enabling heartbeating. It should be used when the Archive method is invoked inside an activity.

type ArchiveVisibilityRequest

type ArchiveVisibilityRequest struct{}

ArchiveVisibilityRequest is request to Archive

type GetHistoryRequest

type GetHistoryRequest struct {
	DomainID             string
	WorkflowID           string
	RunID                string
	CloseFailoverVersion *int64
	NextPageToken        []byte
	PageSize             int
}

GetHistoryRequest is the request to Get archived history

type GetHistoryResponse

type GetHistoryResponse struct {
	HistoryBatches []*shared.History
	NextPageToken  []byte
}

GetHistoryResponse is the response of Get archived history

type GetVisibilityRequest

type GetVisibilityRequest struct{}

GetVisibilityRequest is the request to Get archived visibility records

type GetVisibilityResponse

type GetVisibilityResponse struct{}

GetVisibilityResponse is the response of Get archived visibility records

type HistoryArchiver

type HistoryArchiver interface {
	Archive(ctx context.Context, URI string, request *ArchiveHistoryRequest, opts ...ArchiveOption) error
	Get(ctx context.Context, URI string, request *GetHistoryRequest) (*GetHistoryResponse, error)
	ValidateURI(URI string) error
}

HistoryArchiver is used to archive history and read archived history

type HistoryBlob

type HistoryBlob struct {
	Header *HistoryBlobHeader `json:"header"`
	Body   []*shared.History  `json:"body"`
}

HistoryBlob is the serializable data that forms the body of a blob

type HistoryBlobHeader

type HistoryBlobHeader struct {
	DomainName           *string `json:"domain_name,omitempty"`
	DomainID             *string `json:"domain_id,omitempty"`
	WorkflowID           *string `json:"workflow_id,omitempty"`
	RunID                *string `json:"run_id,omitempty"`
	IsLast               *bool   `json:"is_last,omitempty"`
	FirstFailoverVersion *int64  `json:"first_failover_version,omitempty"`
	LastFailoverVersion  *int64  `json:"last_failover_version,omitempty"`
	FirstEventID         *int64  `json:"first_event_id,omitempty"`
	LastEventID          *int64  `json:"last_event_id,omitempty"`
	EventCount           *int64  `json:"event_count,omitempty"`
}

HistoryBlobHeader is the header attached to all history blobs

type HistoryBootstrapContainer

type HistoryBootstrapContainer struct {
	HistoryManager   persistence.HistoryManager
	HistoryV2Manager persistence.HistoryV2Manager
	Logger           log.Logger
	MetricsClient    metrics.Client
}

HistoryBootstrapContainer contains components needed by all history Archiver implementations

type HistoryIterator

type HistoryIterator interface {
	Next() (*HistoryBlob, error)
	HasNext() bool
	GetState() ([]byte, error)
}

HistoryIterator is used to get history batches

func NewHistoryIterator

func NewHistoryIterator(
	request *ArchiveHistoryRequest,
	historyManager persistence.HistoryManager,
	historyV2Manager persistence.HistoryV2Manager,
	config *HistoryIteratorConfig,
	initialState []byte,
	sizeEstimator SizeEstimator,
) (HistoryIterator, error)

NewHistoryIterator returns a new HistoryIterator

type HistoryIteratorConfig

type HistoryIteratorConfig struct {
	HistoryPageSize          dynamicconfig.IntPropertyFnWithDomainFilter
	TargetHistoryBatchesSize dynamicconfig.IntPropertyFnWithDomainFilter
}

HistoryIteratorConfig cofigs the history iterator

type MockHistoryIterator

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

MockHistoryIterator is a mock of HistoryIterator interface

func NewMockHistoryIterator

func NewMockHistoryIterator(ctrl *gomock.Controller) *MockHistoryIterator

NewMockHistoryIterator creates a new mock instance

func (*MockHistoryIterator) EXPECT

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

func (*MockHistoryIterator) GetState

func (m *MockHistoryIterator) GetState() ([]byte, error)

GetState mocks base method

func (*MockHistoryIterator) HasNext

func (m *MockHistoryIterator) HasNext() bool

HasNext mocks base method

func (*MockHistoryIterator) Next

func (m *MockHistoryIterator) Next() (*HistoryBlob, error)

Next mocks base method

type MockHistoryIteratorMockRecorder

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

MockHistoryIteratorMockRecorder is the mock recorder for MockHistoryIterator

func (*MockHistoryIteratorMockRecorder) GetState

GetState indicates an expected call of GetState

func (*MockHistoryIteratorMockRecorder) HasNext

HasNext indicates an expected call of HasNext

func (*MockHistoryIteratorMockRecorder) Next

Next indicates an expected call of Next

type ProgressManager

type ProgressManager interface {
	RecordProgress(ctx context.Context, progress interface{}) error
	LoadProgress(ctx context.Context, valuePtr interface{}) error
}

ProgressManager is used to record and load archive progress

type SizeEstimator

type SizeEstimator interface {
	EstimateSize(v interface{}) (int, error)
}

SizeEstimator is used to estimate the size of any object

func NewJSONSizeEstimator

func NewJSONSizeEstimator() SizeEstimator

NewJSONSizeEstimator returns a new SizeEstimator which uses json encoding to estimate size

type VisibilityArchiver

type VisibilityArchiver interface {
	Archive(ctx context.Context, URI string, request *ArchiveVisibilityRequest, opts ...ArchiveOption) error
	Get(ctx context.Context, URI string, request *GetVisibilityRequest) (*GetVisibilityResponse, error)
	ValidateURI(URI string) error
}

VisibilityArchiver is used to archive visibility and read archived visibility

type VisibilityBootstrapContainer

type VisibilityBootstrapContainer struct{}

VisibilityBootstrapContainer contains components needed by all visibility Archiver implementations

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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