archiver

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: May 8, 2019 License: MIT Imports: 32 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertHeaderToTags

func ConvertHeaderToTags(header *HistoryBlobHeader) (map[string]string, error)

ConvertHeaderToTags converts header into metadata tags for blob

func IsLast

func IsLast(tags map[string]string) bool

IsLast returns true if tags indicate blob is the last blob in archived history, false otherwise

func NewHistoryBlobKey

func NewHistoryBlobKey(domainID, workflowID, runID string, pageToken int) (blob.Key, error)

NewHistoryBlobKey returns a key for history blob

func NewReplayMetricsClient

func NewReplayMetricsClient(client metrics.Client, ctx workflow.Context) metrics.Client

NewReplayMetricsClient creates a metrics client which is aware of cadence's replay mode

func StringPageToken

func StringPageToken(pageToken int) string

StringPageToken converts input blob page token to string form

Types

type ArchiveRequest

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

ArchiveRequest is request to Archive

type Archiver

type Archiver interface {
	Start()
	Finished() []uint64
}

Archiver is used to process archival requests

func NewArchiver

func NewArchiver(
	ctx workflow.Context,
	logger log.Logger,
	metricsClient metrics.Client,
	concurrency int,
	requestCh workflow.Channel,
) Archiver

NewArchiver returns a new Archiver

type BootstrapContainer

type BootstrapContainer struct {
	PublicClient      workflowserviceclient.Interface
	MetricsClient     metrics.Client
	Logger            log.Logger
	ClusterMetadata   cluster.Metadata
	HistoryManager    persistence.HistoryManager
	HistoryV2Manager  persistence.HistoryV2Manager
	Blobstore         blobstore.Client
	DomainCache       cache.DomainCache
	Config            *Config
	HistoryBlobReader HistoryBlobReader // this is only set in testing code
}

BootstrapContainer contains everything need for bootstrapping

type Client

type Client interface {
	Archive(*ArchiveRequest) error
}

Client is used to archive workflow histories

func NewClient

func NewClient(
	metricsClient metrics.Client,
	logger log.Logger,
	publicClient workflowserviceclient.Interface,
	numWorkflows dynamicconfig.IntPropertyFn,
) Client

NewClient creates a new Client

type ClientMock

type ClientMock struct {
	mock.Mock
}

ClientMock is an autogenerated mock type for the Client type

func (*ClientMock) Archive

func (_m *ClientMock) Archive(_a0 *ArchiveRequest) error

Archive provides a mock function with given fields: _a0

type ClientWorker

type ClientWorker interface {
	Start() error
	Stop()
}

ClientWorker is a cadence client worker

func NewClientWorker

func NewClientWorker(container *BootstrapContainer) ClientWorker

NewClientWorker returns a new ClientWorker

type Config

type Config struct {
	EnableArchivalCompression                 dynamicconfig.BoolPropertyFnWithDomainFilter
	HistoryPageSize                           dynamicconfig.IntPropertyFnWithDomainFilter
	TargetArchivalBlobSize                    dynamicconfig.IntPropertyFnWithDomainFilter
	ArchiverConcurrency                       dynamicconfig.IntPropertyFn
	ArchivalsPerIteration                     dynamicconfig.IntPropertyFn
	DeterministicConstructionCheckProbability dynamicconfig.FloatPropertyFn
}

Config for ClientWorker

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"`
	CurrentPageToken     *int    `json:"current_page_token,omitempty"`
	NextPageToken        *int    `json:"next_page_token,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"`
	UploadDateTime       *string `json:"upload_date_time,omitempty"`
	UploadCluster        *string `json:"upload_cluster,omitempty"`
	EventCount           *int64  `json:"event_count,omitempty"`
	CloseFailoverVersion *int64  `json:"close_failover_version,omitempty"`
}

HistoryBlobHeader is the header attached to all history blobs

type HistoryBlobIterator

type HistoryBlobIterator interface {
	Next() (*HistoryBlob, error)
	HasNext() bool
}

HistoryBlobIterator is used to get history blobs

func NewHistoryBlobIterator

func NewHistoryBlobIterator(
	request ArchiveRequest,
	container *BootstrapContainer,
	domainName string,
	clusterName string,
) HistoryBlobIterator

NewHistoryBlobIterator returns a new HistoryBlobIterator

type HistoryBlobIteratorMock

type HistoryBlobIteratorMock struct {
	mock.Mock
}

HistoryBlobIteratorMock is an autogenerated mock type for the HistoryBlobIterator type

func (*HistoryBlobIteratorMock) HasNext

func (_m *HistoryBlobIteratorMock) HasNext() bool

HasNext provides a mock function with given fields:

func (*HistoryBlobIteratorMock) Next

func (_m *HistoryBlobIteratorMock) Next() (*HistoryBlob, error)

Next provides a mock function with given fields:

type HistoryBlobReader

type HistoryBlobReader interface {
	GetBlob(pageToken int) (*HistoryBlob, error)
}

HistoryBlobReader is used to read history blobs

func NewHistoryBlobReader

func NewHistoryBlobReader(itr HistoryBlobIterator) HistoryBlobReader

NewHistoryBlobReader returns a new HistoryBlobReader

type HistoryBlobReaderMock

type HistoryBlobReaderMock struct {
	mock.Mock
}

HistoryBlobReaderMock is an autogenerated mock type for the HistoryBlobReader type

func (*HistoryBlobReaderMock) GetBlob

func (_m *HistoryBlobReaderMock) GetBlob(pageToken int) (*HistoryBlob, error)

GetBlob provides a mock function with given fields: pageToken

type MockArchiver

type MockArchiver struct {
	mock.Mock
}

MockArchiver is an autogenerated mock type for the Archiver type

func (*MockArchiver) Finished

func (_m *MockArchiver) Finished() []uint64

Finished provides a mock function with given fields:

func (*MockArchiver) Start

func (_m *MockArchiver) Start()

Start provides a mock function with given fields:

type Pump

type Pump interface {
	Run() PumpResult
}

Pump pumps archival requests into request channel

func NewPump

func NewPump(
	ctx workflow.Context,
	logger log.Logger,
	metricsClient metrics.Client,
	carryover []ArchiveRequest,
	timeout time.Duration,
	requestLimit int,
	requestCh workflow.Channel,
	signalCh workflow.Channel,
) Pump

NewPump returns a new Pump

type PumpMock

type PumpMock struct {
	mock.Mock
}

PumpMock is an autogenerated mock type for the Pump type

func (*PumpMock) Run

func (_m *PumpMock) Run() PumpResult

Run provides a mock function with given fields:

type PumpResult

type PumpResult struct {
	PumpedHashes          []uint64
	UnhandledCarryover    []ArchiveRequest
	TimeoutWithoutSignals bool
}

PumpResult is the result of pumping requests into request channel

Jump to

Keyboard shortcuts

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