Documentation ¶
Index ¶
- Constants
- func ActivityTypePtr(v s.ActivityType) *s.ActivityType
- func AddSecondsToBaseTime(baseTimeInNanoSec int64, durationInSeconds int64) int64
- func AggregateYarpcOptions(ctx context.Context, opts ...yarpc.CallOption) []yarpc.CallOption
- func AwaitWaitGroup(wg *sync.WaitGroup, timeout time.Duration) bool
- func BoolDefault(v *bool) bool
- func BoolPtr(v bool) *bool
- func CQLTimestampToUnixNano(milliseconds int64) int64
- func CancelExternalWorkflowExecutionFailedCausePtr(t s.CancelExternalWorkflowExecutionFailedCause) *s.CancelExternalWorkflowExecutionFailedCause
- func ChildPolicyPtr(t s.ChildPolicy) *s.ChildPolicy
- func ChildWorkflowExecutionFailedCausePtr(t s.ChildWorkflowExecutionFailedCause) *s.ChildWorkflowExecutionFailedCause
- func CreateCassandraKeyspace(s *gocql.Session, keyspace string, replicas int, overwrite bool) (err error)
- func CreateHistoryServiceRetryPolicy() backoff.RetryPolicy
- func CreatePersistanceRetryPolicy() backoff.RetryPolicy
- func DecisionTaskFailedCausePtr(t s.DecisionTaskFailedCause) *s.DecisionTaskFailedCause
- func DecisionTypePtr(t s.DecisionType) *s.DecisionType
- func DropCassandraKeyspace(s *gocql.Session, keyspace string) (err error)
- func EventTypePtr(t s.EventType) *s.EventType
- func Float64Ptr(v float64) *float64
- func Int32Default(v *int32) int32
- func Int32Ptr(v int32) *int32
- func Int64Default(v *int64) int64
- func Int64Ptr(v int64) *int64
- func IntPtr(v int) *int
- func IsPersistenceTransientError(err error) bool
- func IsServiceNonRetryableError(err error) bool
- func IsValidContext(ctx context.Context) error
- func LoadCassandraSchema(dir string, fileNames []string, port int, keyspace string, override bool) (err error)
- func MergeDictoRight(src map[string]string, dest map[string]string)
- func MergeDicts(dic1 map[string]string, dic2 map[string]string) (resultDict map[string]string)
- func NewCassandraCluster(clusterHosts string, port int, user, password, dc string) *gocql.ClusterConfig
- func PrettyPrintHistory(history *workflow.History, logger bark.Logger)
- func SignalExternalWorkflowExecutionFailedCausePtr(t s.SignalExternalWorkflowExecutionFailedCause) *s.SignalExternalWorkflowExecutionFailedCause
- func StringDefault(v *string) string
- func StringPtr(v string) *string
- func TDeserialize(msg thrift.TStruct, b []byte) (err error)
- func TDeserializeString(msg thrift.TStruct, s string) (err error)
- func TListDeserialize(msgType reflect.Type, b []byte) (msgs []thrift.TStruct, err error)
- func TListSerialize(msgs []thrift.TStruct) (b []byte, err error)
- func TSerialize(msg thrift.TStruct) (b []byte, err error)
- func TSerializeString(msg thrift.TStruct) (s string, err error)
- func TaskListKindPtr(t s.TaskListKind) *s.TaskListKind
- func TaskListPtr(v s.TaskList) *s.TaskList
- func TimeoutTypePtr(t s.TimeoutType) *s.TimeoutType
- func Uint32Ptr(v uint32) *uint32
- func Uint64Ptr(v uint64) *uint64
- func UnixNanoToCQLTimestamp(timestamp int64) int64
- func WorkflowIDToHistoryShard(workflowID string, numberOfShards int) int
- func WorkflowTypePtr(t s.WorkflowType) *s.WorkflowType
- type Daemon
- type EncodingType
- type PProfInitializer
- type QueryTaskToken
- type RPCFactory
- type RWMutex
- type TaskToken
- type TaskTokenSerializer
- type TimeSource
- type TokenBucket
- type TokenBucketFactory
Constants ¶
const ( // FirstEventID is the id of the first event in the history FirstEventID int64 = 1 // EmptyEventID is the id of the empty event EmptyEventID int64 = -23 // EndEventID is the id of the end event, here we use the int64 max EndEventID int64 = 1<<63 - 1 )
const ( // FrontendServiceName is the name of the frontend service FrontendServiceName = "cadence-frontend" // HistoryServiceName is the name of the history service HistoryServiceName = "cadence-history" // MatchingServiceName is the name of the matching service MatchingServiceName = "cadence-matching" // WorkerServiceName is the name of the worker service WorkerServiceName = "cadence-worker" )
const ( // LibraryVersionHeaderName refers to the name of the // tchannel / http header that contains the client // library version LibraryVersionHeaderName = "cadence-client-library-version" // FeatureVersionHeaderName refers to the name of the // tchannel / http header that contains the client // feature version // the feature version sent from client represents the // feature set of the cadence client library support. // This can be used for client capibility check, on // Cadence server, for backward compatibility FeatureVersionHeaderName = "cadence-client-feature-version" // ClientImplHeaderName refers to the name of the // header that contains the client implementation ClientImplHeaderName = "cadence-client-name" )
Variables ¶
This section is empty.
Functions ¶
func ActivityTypePtr ¶
func ActivityTypePtr(v s.ActivityType) *s.ActivityType
ActivityTypePtr makes a copy and returns the pointer to a ActivityType.
func AddSecondsToBaseTime ¶
AddSecondsToBaseTime - Gets the UnixNano with given duration and base time.
func AggregateYarpcOptions ¶ added in v0.3.5
func AggregateYarpcOptions(ctx context.Context, opts ...yarpc.CallOption) []yarpc.CallOption
AggregateYarpcOptions aggregate the header information from context to existing yarpc call options
func AwaitWaitGroup ¶
AwaitWaitGroup calls Wait on the given wait Returns true if the Wait() call succeeded before the timeout Returns false if the Wait() did not return before the timeout
func BoolDefault ¶ added in v0.3.2
BoolDefault returns value if bool pointer is set otherwise default value of bool
func CQLTimestampToUnixNano ¶
CQLTimestampToUnixNano converts CQL timestamp to UnixNano
func CancelExternalWorkflowExecutionFailedCausePtr ¶ added in v0.3.2
func CancelExternalWorkflowExecutionFailedCausePtr(t s.CancelExternalWorkflowExecutionFailedCause) *s.CancelExternalWorkflowExecutionFailedCause
CancelExternalWorkflowExecutionFailedCausePtr makes a copy and returns the pointer to a CancelExternalWorkflowExecutionFailedCause.
func ChildPolicyPtr ¶ added in v0.3.2
func ChildPolicyPtr(t s.ChildPolicy) *s.ChildPolicy
ChildPolicyPtr makes a copy and returns the pointer to a ChildPolicy.
func ChildWorkflowExecutionFailedCausePtr ¶ added in v0.3.2
func ChildWorkflowExecutionFailedCausePtr(t s.ChildWorkflowExecutionFailedCause) *s.ChildWorkflowExecutionFailedCause
ChildWorkflowExecutionFailedCausePtr makes a copy and returns the pointer to a ChildWorkflowExecutionFailedCause.
func CreateCassandraKeyspace ¶
func CreateCassandraKeyspace(s *gocql.Session, keyspace string, replicas int, overwrite bool) (err error)
CreateCassandraKeyspace creates the keyspace using this session for given replica count
func CreateHistoryServiceRetryPolicy ¶
func CreateHistoryServiceRetryPolicy() backoff.RetryPolicy
CreateHistoryServiceRetryPolicy creates a retry policy for calls to history service
func CreatePersistanceRetryPolicy ¶
func CreatePersistanceRetryPolicy() backoff.RetryPolicy
CreatePersistanceRetryPolicy creates a retry policy for persistence layer operations
func DecisionTaskFailedCausePtr ¶ added in v0.3.2
func DecisionTaskFailedCausePtr(t s.DecisionTaskFailedCause) *s.DecisionTaskFailedCause
DecisionTaskFailedCausePtr makes a copy and returns the pointer to a DecisionTaskFailedCause.
func DecisionTypePtr ¶
func DecisionTypePtr(t s.DecisionType) *s.DecisionType
DecisionTypePtr makes a copy and returns the pointer to a DecisionType.
func DropCassandraKeyspace ¶
DropCassandraKeyspace drops the given keyspace, if it exists
func EventTypePtr ¶
EventTypePtr makes a copy and returns the pointer to a EventType.
func Float64Ptr ¶
Float64Ptr makes a copy and returns the pointer to an int64.
func Int32Default ¶ added in v0.3.2
Int32Default returns value if int32 pointer is set otherwise default value of int32
func Int64Default ¶ added in v0.3.2
Int64Default returns value if int64 pointer is set otherwise default value of int64
func IsPersistenceTransientError ¶
IsPersistenceTransientError checks if the error is a transient persistence error
func IsServiceNonRetryableError ¶
IsServiceNonRetryableError checks if the error is a non retryable error.
func IsValidContext ¶
IsValidContext checks that the thrift context is not expired on cancelled. Returns nil if the context is still valid. Otherwise, returns the result of ctx.Err()
func LoadCassandraSchema ¶
func LoadCassandraSchema( dir string, fileNames []string, port int, keyspace string, override bool, ) (err error)
LoadCassandraSchema loads the schema from the given .cql files on this keyspace
func MergeDictoRight ¶
MergeDictoRight copies the contents of src to dest
func MergeDicts ¶
MergeDicts creates a union of the two dicts
func NewCassandraCluster ¶
func NewCassandraCluster(clusterHosts string, port int, user, password, dc string) *gocql.ClusterConfig
NewCassandraCluster creates a cassandra cluster given comma separated list of clusterHosts
func PrettyPrintHistory ¶
PrettyPrintHistory prints history in human readable format
func SignalExternalWorkflowExecutionFailedCausePtr ¶ added in v0.3.6
func SignalExternalWorkflowExecutionFailedCausePtr(t s.SignalExternalWorkflowExecutionFailedCause) *s.SignalExternalWorkflowExecutionFailedCause
SignalExternalWorkflowExecutionFailedCausePtr makes a copy and returns the pointer to a SignalExternalWorkflowExecutionFailedCause.
func StringDefault ¶ added in v0.3.2
StringDefault returns value if string pointer is set otherwise default value of string
func TDeserialize ¶
TDeserialize is used to deserialize []byte to thrift TStruct
func TDeserializeString ¶
TDeserializeString is used to deserialize string to thrift TStruct
func TListDeserialize ¶
TListDeserialize is used to deserialize []byte to list of thrift TStruct
func TListSerialize ¶
TListSerialize is used to serialize list of thrift TStruct to []byte
func TSerialize ¶
TSerialize is used to serialize thrift TStruct to []byte
func TSerializeString ¶
TSerializeString is used to serialize thrift TStruct to string
func TaskListKindPtr ¶ added in v0.3.6
func TaskListKindPtr(t s.TaskListKind) *s.TaskListKind
TaskListKindPtr makes a copy and returns the pointer to a TaskListKind.
func TaskListPtr ¶
TaskListPtr makes a copy and returns the pointer to a TaskList.
func TimeoutTypePtr ¶ added in v0.3.2
func TimeoutTypePtr(t s.TimeoutType) *s.TimeoutType
TimeoutTypePtr makes a copy and returns the pointer to a TimeoutType.
func UnixNanoToCQLTimestamp ¶
UnixNanoToCQLTimestamp converts UnixNano to CQL timestamp
func WorkflowIDToHistoryShard ¶
WorkflowIDToHistoryShard is used to map workflowID to a shardID
func WorkflowTypePtr ¶
func WorkflowTypePtr(t s.WorkflowType) *s.WorkflowType
WorkflowTypePtr makes a copy and returns the pointer to a WorkflowType.
Types ¶
type Daemon ¶
type Daemon interface { Start() Stop() }
Daemon is the base interfaces implemented by background tasks within cherami
type EncodingType ¶
type EncodingType string
EncodingType is an enum that represents various data encoding types
const ( EncodingTypeJSON EncodingType = "json" EncodingTypeGob = "gob" )
Data encoding types
type PProfInitializer ¶ added in v0.3.5
type PProfInitializer interface {
Start() error
}
PProfInitializer initialize the pprof based on config
type QueryTaskToken ¶ added in v0.3.2
type QueryTaskToken struct { DomainID string `json:"domainId"` TaskList string `jaon:"taskList"` TaskID string `jaon:"taskId"` }
QueryTaskToken identifies a query task
type RPCFactory ¶ added in v0.3.2
type RPCFactory interface { CreateDispatcher() *yarpc.Dispatcher CreateDispatcherForOutbound(callerName, serviceName, hostName string) *yarpc.Dispatcher }
RPCFactory Creates a dispatcher that knows how to transport requests.
type RWMutex ¶ added in v0.3.3
type RWMutex interface { Lock(context.Context) error Unlock() RLock(context.Context) error RUnlock() }
RWMutex accepts a context in its Lock method. It blocks the goroutine until either the lock is acquired or the context is closed.
type TaskToken ¶
type TaskToken struct { DomainID string `json:"domainId"` WorkflowID string `json:"workflowId"` RunID string `json:"runId"` ScheduleID int64 `json:"scheduleId"` ScheduleAttempt int64 `json:"scheduleAttempt"` ActivityID string `json:"activityId"` }
TaskToken identifies a task
type TaskTokenSerializer ¶
type TaskTokenSerializer interface { Serialize(token *TaskToken) ([]byte, error) Deserialize(data []byte) (*TaskToken, error) SerializeQueryTaskToken(token *QueryTaskToken) ([]byte, error) DeserializeQueryTaskToken(data []byte) (*QueryTaskToken, error) }
TaskTokenSerializer serializes task tokens
func NewJSONTaskTokenSerializer ¶
func NewJSONTaskTokenSerializer() TaskTokenSerializer
NewJSONTaskTokenSerializer creates a new instance of TaskTokenSerializer
type TimeSource ¶
TimeSource is an interface for any entity that provides the current time. Its primarily used to mock out timesources in unit test
func NewRealTimeSource ¶
func NewRealTimeSource() TimeSource
NewRealTimeSource returns a time source that servers real wall clock time using CLOCK_REALTIME
type TokenBucket ¶
type TokenBucket interface { // TryConsume attempts to take count tokens from the // bucket. Returns true on success, false // otherwise along with the duration for the next refill TryConsume(count int) (bool, time.Duration) // Consume waits up to timeout duration to take count // tokens from the bucket. Returns true if count // tokens were acquired before timeout, false // otherwise Consume(count int, timeout time.Duration) bool }
TokenBucket is the interface for any implememtation of a token bucket rate limiter
func NewTokenBucket ¶
func NewTokenBucket(rps int, timeSource TimeSource) TokenBucket
NewTokenBucket creates and returns a new token bucket rate limiter that repelenishes the bucket every 100 milliseconds. Thread safe.
@param rps
Desired rate per second
Golang.org has an alternative implementation of the rate limiter. On benchmarking, golang's implementation was order of magnitude slower. In addition, it does a lot more than what we need. These are the benchmarks under different scenarios
BenchmarkTokenBucketParallel 50000000 40.7 ns/op BenchmarkGolangRateParallel 10000000 150 ns/op BenchmarkTokenBucketParallel-8 20000000 124 ns/op BenchmarkGolangRateParallel-8 10000000 208 ns/op BenchmarkTokenBucketParallel 50000000 37.8 ns/op BenchmarkGolangRateParallel 10000000 153 ns/op BenchmarkTokenBucketParallel-8 10000000 129 ns/op BenchmarkGolangRateParallel-8 10000000 208 ns/op
type TokenBucketFactory ¶
type TokenBucketFactory interface {
CreateTokenBucket(rps int, timeSource TimeSource) TokenBucket
}
TokenBucketFactory is an interface mainly used for injecting mock implementation of TokenBucket for unit testing
func NewTokenBucketFactory ¶
func NewTokenBucketFactory() TokenBucketFactory
NewTokenBucketFactory creates an instance of factory used for creating TokenBucket instances