sysworkflow

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2019 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SystemDomainName is domain name for all system workflows
	SystemDomainName = "cadence-system"
)

Variables

This section is empty.

Functions

func ArchivalDeleteHistoryActivity added in v0.5.3

func ArchivalDeleteHistoryActivity(ctx context.Context, request ArchiveRequest) error

ArchivalDeleteHistoryActivity deletes the workflow execution history from persistence. All retryable errors are retried forever. If an error is returned it is of type archivalActivityNonRetryableErr.

func ArchivalUploadActivity added in v0.5.3

func ArchivalUploadActivity(ctx context.Context, request ArchiveRequest) error

ArchivalUploadActivity does the following three things: 1. Read history from persistence 2. Construct blobs 3. Upload blobs It is assumed that history is immutable when this activity is running. Under this assumption this activity is idempotent. If an error is returned it will be of type archivalActivityNonRetryableErr. All retryable errors are retried forever.

func ArchiveSystemWorkflow added in v0.5.3

func ArchiveSystemWorkflow(ctx workflow.Context, carryoverRequests []ArchiveRequest) error

ArchiveSystemWorkflow is the system workflow which archives and deletes history

func ConvertHeaderToTags added in v0.5.2

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

ConvertHeaderToTags converts header into metadata tags for blob

func NewHistoryBlobKey added in v0.5.2

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

NewHistoryBlobKey returns a key for history blob

func NewReplayBarkLogger added in v0.5.3

func NewReplayBarkLogger(logger bark.Logger, ctx workflow.Context, enableLogInReplay bool) bark.Logger

NewReplayBarkLogger creates a bark logger which is aware of cadence's replay mode

func NewReplayMetricsClient added in v0.5.3

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 added in v0.5.4

func StringPageToken(pageToken int) string

StringPageToken converts input blob page token to string form

Types

type ArchivalClient

type ArchivalClient interface {
	Archive(*ArchiveRequest) error
}

ArchivalClient is used to archive workflow histories

func NewArchivalClient

func NewArchivalClient(
	publicClient public.Client,
	numSWFn dynamicconfig.IntPropertyFn,
) ArchivalClient

NewArchivalClient creates a new ArchivalClient

type ArchivalClientMock added in v0.5.3

type ArchivalClientMock struct {
	mock.Mock
}

ArchivalClientMock is an autogenerated mock type for the ArchivalClient type

func (*ArchivalClientMock) Archive added in v0.5.3

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

Archive provides a mock function with given fields: _a0

type ArchiveRequest

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

ArchiveRequest is request to Archive

type Config

type Config struct {
	EnableArchivalCompression dynamicconfig.BoolPropertyFnWithDomainFilter
	HistoryPageSize           dynamicconfig.IntPropertyFnWithDomainFilter
	TargetArchivalBlobSize    dynamicconfig.IntPropertyFnWithDomainFilter
}

Config for SysWorker

type HistoryBlob added in v0.5.2

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 added in v0.5.2

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"`
	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 added in v0.5.3

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

HistoryBlobIterator is used to get history blobs

func NewHistoryBlobIterator added in v0.5.3

func NewHistoryBlobIterator(
	logger bark.Logger,
	metricsClient metrics.Client,
	request ArchiveRequest,
	container *SysWorkerContainer,
	domainName string,
	clusterName string,
) HistoryBlobIterator

NewHistoryBlobIterator returns a new HistoryBlobIterator

type HistoryBlobIteratorMock added in v0.5.3

type HistoryBlobIteratorMock struct {
	mock.Mock
}

HistoryBlobIteratorMock is an autogenerated mock type for the HistoryBlobIterator type

func (*HistoryBlobIteratorMock) HasNext added in v0.5.3

func (_m *HistoryBlobIteratorMock) HasNext() bool

HasNext provides a mock function with given fields:

func (*HistoryBlobIteratorMock) Next added in v0.5.3

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

Next provides a mock function with given fields:

type SysWorker

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

SysWorker is a cadence client worker which enables running arbitrary system workflows

func NewSysWorker

func NewSysWorker(container *SysWorkerContainer) SysWorker

NewSysWorker returns a new SysWorker

type SysWorkerContainer added in v0.5.3

type SysWorkerContainer struct {
	PublicClient     public.Client
	MetricsClient    metrics.Client
	Logger           bark.Logger
	ClusterMetadata  cluster.Metadata
	HistoryManager   persistence.HistoryManager
	HistoryV2Manager persistence.HistoryV2Manager
	Blobstore        blobstore.Client
	DomainCache      cache.DomainCache
	Config           *Config

	HistoryBlobIterator HistoryBlobIterator // this is only set in testing code
}

SysWorkerContainer contains everything needed to bootstrap SysWorker and all hosted system workflows

Jump to

Keyboard shortcuts

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