Documentation ¶
Index ¶
- Constants
- func AdvertiseInHyperbahn(ch *tchannel.Channel, bootstrapFile string) *hyperbahn.Client
- func AwaitWaitGroup(wg *sync.WaitGroup, timeout time.Duration) bool
- func BoolPtr(v bool) *bool
- func CalculateRate(last, curr SequenceNumber, lastTime, currTime UnixNanoTime) float64
- func CheramiConsumerGroupStatusPtr(status cherami.ConsumerGroupStatus) *cherami.ConsumerGroupStatus
- func CheramiDestinationStatusPtr(status cherami.DestinationStatus) *cherami.DestinationStatus
- func CheramiDestinationTypePtr(destType cherami.DestinationType) *cherami.DestinationType
- func CheramiInputHostCommandTypePtr(cmdType cherami.InputHostCommandType) *cherami.InputHostCommandType
- func CheramiOutputHostCommandTypePtr(cmdType cherami.OutputHostCommandType) *cherami.OutputHostCommandType
- func CheramiStatusPtr(status cherami.Status) *cherami.Status
- func CreateHyperbahnClient(ch *tchannel.Channel, bootstrapFile string) *hyperbahn.Client
- func CreateTChannel(service string) *tchannel.Channel
- func Float64Ptr(v float64) *float64
- func FmtAckID(s string) string
- func FmtCnsPth(s string) string
- func FmtCnsm(s string) string
- func FmtCtrl(s string) string
- func FmtDLQID(s string) string
- func FmtDst(s string) string
- func FmtDstPth(s string) string
- func FmtExt(s string) string
- func FmtFrnt(s string) string
- func FmtHostIP(s string) string
- func FmtHostPort(s string) string
- func FmtIn(s string) string
- func FmtInPubConnID(s int) string
- func FmtInPutAckID(s string) string
- func FmtInReplicaHost(s string) string
- func FmtMsgID(s string) string
- func FmtOut(s string) string
- func FmtReconfigureID(s string) string
- func FmtService(s string) string
- func FmtStor(s string) string
- func GetConnectionKey(host *cherami.HostAddress) string
- func GetDateTag() string
- func GetDirectoryName(path string) (string, error)
- func GetRandInt64(min int64, max int64) int64
- func Int32Ptr(v int32) *int32
- func Int64Ptr(v int64) *int64
- func IntPtr(v int) *int
- func IsRetryableTChanErr(err error) bool
- func MinInt(a, b int) int
- func ShortenGUIDString(s string) string
- func SpinWaitOnCondition(condition ConditionFunc, timeout time.Duration) bool
- func SplitHostPort(hostPort string) (string, int, error)
- 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 UUIDHashCode(key string) uint32
- func Uint32Ptr(v uint32) *uint32
- func Uint64Ptr(v uint64) *uint64
- func ValidateTimeout(t time.Duration) error
- type ConditionFunc
- type GeometricRollingAverage
- type Seconds
- type SequenceNumber
- type UnixNanoTime
Constants ¶
const ( // ClientVersion is current client library's version // It uses Semantic Versions MAJOR.MINOR.PATCH (https://blog.gopheracademy.com/advent-2015/semver/) // ClientVersion needs to be updated to reflect client library changes: // 1. MAJOR version when you make incompatible API changes, // 2. MINOR version when you add functionality in a backwards-compatible manner, and // 3. PATCH version when you make backwards-compatible bug fixes. ClientVersion = "0.1.0" // HeaderClientVersion is the name of thrift context header contains client version HeaderClientVersion = "client-version" // HeaderUserName is the name of thrift context header contains current user name HeaderUserName = "user-name" // HeaderHostName is the name of thrift context header contains current host name HeaderHostName = "host-name" // SequenceBegin refers to the beginning of an extent SequenceBegin = 0 // SequenceEnd refers to the end of an extent SequenceEnd = math.MaxInt64 // UUIDStringLength is the length of an UUID represented as a hex string UUIDStringLength = 36 // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx // InputServiceName refers to the name of the cherami in service InputServiceName = "cherami-inputhost" // OutputServiceName refers to the name of the cherami out service OutputServiceName = "cherami-outputhost" // FrontendServiceName refers to the name of the cherami frontend service FrontendServiceName = "cherami-frontendhost" // FrontendStagingServiceName refers to the name of the cherami staging frontend service FrontendStagingServiceName = "cherami-frontendhost-staging" // ControllerServiceName refers to the name of the cherami controller service ControllerServiceName = "cherami-controllerhost" // StoreServiceName refers to the name of the cherami store service StoreServiceName = "cherami-storehost" // EndpointOpenPublisherStream is websocket endpoint name for OpenPublisherStream EndpointOpenPublisherStream = "open_publisher_stream" // EndpointOpenConsumerStream is websocket endpoint name for OpenConsumerStream EndpointOpenConsumerStream = "open_consumer_stream" // EndpointOpenAppendStream is websocket endpoint name for OpenAppendStream EndpointOpenAppendStream = "open_append_stream" // EndpointOpenReadStream is websocket endpoint name for OpenReadStream EndpointOpenReadStream = "open_read_stream" // EndpointOpenReplicationRemoteReadStream is websocket endpoint name for OpenReplicationRemoteReadStream EndpointOpenReplicationRemoteReadStream = "open_replication_remote_read_stream" // EndpointOpenReplicationReadStream is websocket endpoint name for OpenReplicationReadStream EndpointOpenReplicationReadStream = "open_replication_read_stream" // HTTPHandlerPattern is pattern format for http handler, eg "/endpoint" HTTPHandlerPattern = "/%s" // WSUrlFormat is url format for websocket, eg "ws://host:port/endpoint" WSUrlFormat = "ws://%s/%s" )
const TagAckID = `ackID`
TagAckID is the logging tag for AckId
const TagCnsPth = `cnsPth`
TagCnsPth is the logging tag for Consumer group Path
const TagCnsm = `cnsmID`
TagCnsm is the logging tag for Consumer Group UUID
const TagCtrl = `ctrlID`
TagCtrl is the logging tag for Extent Controller UUID
const TagDLQID = `dlqID`
TagDLQID is the logging tag for a Dead Letter Queue destination UUID
const TagDst = `destID`
TagDst is the tag for Destination UUID
const TagDstPth = `dstPth`
TagDstPth is the logging tag for Destination Path
const TagErr = `err`
TagErr is the tag for error object message
const TagExt = `extnID`
TagExt is the logging tag for Extent UUID
const TagFrnt = `frntID`
TagFrnt is the logging tag for Frontend UUID
const TagHostIP = `hostIP`
TagHostIP is the logging tag for host IP
const TagHostPort = "hostport"
TagHostPort is the log tag for hostport
const TagHosts = "hosts"
TagHosts is the log tag for list of hosts
const TagIn = `inhoID`
TagIn is the logging tag for Inputhost UUID
const TagInPubConnID = `inPubConnID`
TagInPubConnID is the logging tag for input pubconnection ID
const TagInPutAckID = `inPutAckID`
TagInPutAckID is the logging tag for PutMessageAck ID
const TagInReplicaHost = `inReplicaHost`
TagInReplicaHost is the logging tag for replica host on input
const TagMsgID = `msgID`
TagMsgID is the logging tag for MsgId
const TagOut = `outhID`
TagOut is the logging tag for Outputhost UUID
const TagReconfigureID = `reconfigID`
TagReconfigureID is the logging tag for reconfiguration identifiers
const TagReconfigureType = `reconfigType`
TagReconfigureType is the logging tag for reconfiguration type
const TagService = "service"
TagService is the log tag for the service
const TagStor = `storID`
TagStor is the logging tag for StoreHost UUID
const TagUpdateUUID = `updateUUID`
TagUpdateUUID is the logging tag for reconfiguration update UUIDs
Variables ¶
This section is empty.
Functions ¶
func AdvertiseInHyperbahn ¶
AdvertiseInHyperbahn advertises this node in Hyperbahn
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 CalculateRate ¶
func CalculateRate(last, curr SequenceNumber, lastTime, currTime UnixNanoTime) float64
CalculateRate does a simple rate calculation
func CheramiConsumerGroupStatusPtr ¶
func CheramiConsumerGroupStatusPtr(status cherami.ConsumerGroupStatus) *cherami.ConsumerGroupStatus
CheramiConsumerGroupStatusPtr makes a copy and returns the pointer to a CheramiConsumerGroupStatus.
func CheramiDestinationStatusPtr ¶
func CheramiDestinationStatusPtr(status cherami.DestinationStatus) *cherami.DestinationStatus
CheramiDestinationStatusPtr makes a copy and returns the pointer to a CheramiDestinationStatus.
func CheramiDestinationTypePtr ¶
func CheramiDestinationTypePtr(destType cherami.DestinationType) *cherami.DestinationType
CheramiDestinationTypePtr makes a copy and returns the pointer to a CheramiDestinationType.
func CheramiInputHostCommandTypePtr ¶
func CheramiInputHostCommandTypePtr(cmdType cherami.InputHostCommandType) *cherami.InputHostCommandType
CheramiInputHostCommandTypePtr makes a copy and returns the pointer to a CheramiInputHostCommandType.
func CheramiOutputHostCommandTypePtr ¶
func CheramiOutputHostCommandTypePtr(cmdType cherami.OutputHostCommandType) *cherami.OutputHostCommandType
CheramiOutputHostCommandTypePtr makes a copy and returns the pointer to a CheramiOutputHostCommandType.
func CheramiStatusPtr ¶
CheramiStatusPtr makes a copy and returns the pointer to a CheramiStatus.
func CreateHyperbahnClient ¶
CreateHyperbahnClient returns a hyperbahn client
func CreateTChannel ¶
func CreateTChannel(service string) *tchannel.Channel
CreateTChannel creates the top level TChannel object for the specified servicer
func Float64Ptr ¶
Float64Ptr makes a copy and returns the pointer to an int64.
func FmtHostPort ¶
FmtHostPort formats a string to be used with TagHostPort
func FmtInPubConnID ¶
FmtInPubConnID formats an int to be used with TagInPubConnID
func FmtInPutAckID ¶
FmtInPutAckID formats a string to be used with TagInPutAckID
func FmtInReplicaHost ¶
FmtInReplicaHost formats a string to be used with TagInReplicaHost
func FmtReconfigureID ¶
FmtReconfigureID formats a string to be used with TagReconfigureID
func FmtService ¶
FmtService formats a string to be used with TagService
func GetConnectionKey ¶
func GetConnectionKey(host *cherami.HostAddress) string
GetConnectionKey is used to create a key used by connections for looking up connections
func GetDateTag ¶
func GetDateTag() string
GetDateTag returns the current date used for tagging daily metric
func GetDirectoryName ¶
GetDirectoryName function gives the directory name given a path used for destination or consumer groups
func GetRandInt64 ¶
GetRandInt64 is used to get a 64 bit random number between min and max
func IsRetryableTChanErr ¶
IsRetryableTChanErr returns true if the given tchannel error is a retryable error.
func ShortenGUIDString ¶
ShortenGUIDString takes a string with one or more GUIDs and elides them to make it more human readable. It turns "354754bd-b73e-4d20-8021-ab93a3d145c0:67af70c5-f45e-4b3d-9d20-6758195e2ff4:3:2" into "354754bd:67af70c5:3:2"
func SpinWaitOnCondition ¶
func SpinWaitOnCondition(condition ConditionFunc, timeout time.Duration) bool
SpinWaitOnCondition busy waits for a given condition to be true until the timeout Returns true if the condition was satisfied, false on timeout
func SplitHostPort ¶
SplitHostPort takes a x.x.x.x:yyyy string and split it into host and ports
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 UUIDHashCode ¶
UUIDHashCode is a hash function for hashing string uuid if the uuid is malformed, then the hash function always returns 0 as the hash value
func ValidateTimeout ¶
ValidateTimeout returns an error if the passed timeout is unreasonable
Types ¶
type ConditionFunc ¶
type ConditionFunc func() bool
ConditionFunc represents an expression that evaluates to true on when some condition is satisfied and false otherwise
type GeometricRollingAverage ¶
type GeometricRollingAverage float64
GeometricRollingAverage is the value of a geometrically diminishing rolling average
func (*GeometricRollingAverage) GetGeometricRollingAverage ¶
func (avg *GeometricRollingAverage) GetGeometricRollingAverage() float64
GetGeometricRollingAverage returns the result of the geometric rolling average
func (*GeometricRollingAverage) SetGeometricRollingAverage ¶
func (avg *GeometricRollingAverage) SetGeometricRollingAverage(val float64)
SetGeometricRollingAverage adds a value to the geometric rolling average
type Seconds ¶
type Seconds float64
Seconds is time as seconds, either relative or absolute since the epoch
func DurationToSeconds ¶
DurationToSeconds converts a time.Duration to Seconds
type SequenceNumber ¶
type SequenceNumber int64
SequenceNumber is an int64 number represents the sequence of messages in Extent
type UnixNanoTime ¶
type UnixNanoTime int64
UnixNanoTime is Unix time as nanoseconds since Jan 1st, 1970, 00:00 GMT
func (UnixNanoTime) ToSeconds ¶
func (u UnixNanoTime) ToSeconds() Seconds
ToSeconds turns a relative or absolute UnixNanoTime to float Seconds