Documentation ¶
Overview ¶
Package correlationvector contains library functions to manipulate CorrelationVectors.
Package correlationvector contains library functions to manipulate CorrelationVectors.
Index ¶
- Constants
- Variables
- type CorrelationVector
- func Extend(correlationVector string) (*CorrelationVector, error)
- func NewCorrelationVector() *CorrelationVector
- func NewCorrelationVectorWithVersion(version Version) (*CorrelationVector, error)
- func Parse(correlationVector string) (*CorrelationVector, error)
- func Spin(correlationVector string) (*CorrelationVector, error)
- func SpinWithParameters(correlationVector string, parameters *SpinParameters) (*CorrelationVector, error)
- type SpinCounterInterval
- type SpinCounterPeriodicity
- type SpinEntropy
- type SpinParameters
- type Version
Constants ¶
const ( // MaxVectorLength is the max length of a V1 correlation vector MaxVectorLength int = 63 // MaxVectorLengthV2 is the max length of a V2 correlation vector MaxVectorLengthV2 int = 127 // BaseLength is the max length of a V1 correlation vector base BaseLength int = 16 // BaseLengthV2 is the max length of a V2 correlation vector base BaseLengthV2 int = 22 // CVTerminator sign for a correlation vector CVTerminator string = "!" )
Variables ¶
var ValidateCorrelationVectorDuringCreation = false
ValidateCorrelationVectorDuringCreation indicates whether or not to validate the correlation vector on creation.
Functions ¶
This section is empty.
Types ¶
type CorrelationVector ¶
type CorrelationVector struct {
// contains filtered or unexported fields
}
CorrelationVector represents a lightweight vector for identifying and measuring causality.
func Extend ¶
func Extend(correlationVector string) (*CorrelationVector, error)
Extend creates a new correlation vector by extending an existing value. this should be done at the entry point of an operation.
func NewCorrelationVector ¶
func NewCorrelationVector() *CorrelationVector
NewCorrelationVector initializes a new instance of the CorrelationVector struct. This should only be called when no correlation vector was found in the message header.
func NewCorrelationVectorWithVersion ¶
func NewCorrelationVectorWithVersion(version Version) (*CorrelationVector, error)
NewCorrelationVectorWithVersion initializes a new instance of the CorrelationVector struct of the given protocol version. This should only be called when no correlation vector was found in the message header.
func Parse ¶
func Parse(correlationVector string) (*CorrelationVector, error)
Parse creates a new correlation vector by parsing its string representation.
func Spin ¶
func Spin(correlationVector string) (*CorrelationVector, error)
Spin creates a new correlation vector by applying the Spin operator to an existing value. This should be done at the entry point of an operation.
func SpinWithParameters ¶
func SpinWithParameters(correlationVector string, parameters *SpinParameters) (*CorrelationVector, error)
SpinWithParameters creates a new correlation vector by applying the Spin operator to an existing value. This should be done at the entry point of an operation.
func (*CorrelationVector) Increment ¶
func (cv *CorrelationVector) Increment() string
Increment increments the current extension by one. Do this before passing the value to an outbound message header.
func (*CorrelationVector) Value ¶
func (cv *CorrelationVector) Value() string
Value gets the value of the correlation vector as a string.
func (*CorrelationVector) Version ¶
func (cv *CorrelationVector) Version() Version
Version gets the version of the correlation vector protocol.
type SpinCounterInterval ¶
type SpinCounterInterval int
SpinCounterInterval is the interval (proportional to time) by which the counter increments.
const ( // CoarseInterval drops the 24 least significant bits in time.Now().NanoSeconds() / 100 // resulting in a counter that increments every 1.67 seconds. CoarseInterval SpinCounterInterval = iota // FineInterval drops the 16 least significant bits in time.Now().NanoSeconds() / 100 // resulting in a counter that increments every 6.5 milliseconds. FineInterval SpinCounterInterval = iota )
type SpinCounterPeriodicity ¶
type SpinCounterPeriodicity int
SpinCounterPeriodicity configures how frequently the counter wraps around to zero, as determined by the amount of space to store the counter.
const ( // NoPeriodicity does not store a counter as part of the spin value. NoPeriodicity SpinCounterPeriodicity = iota // ShortPeriodicity stores the counter using 16 bits. ShortPeriodicity SpinCounterPeriodicity = iota // MediumPeriodicity stores the counter using 24 bits. MediumPeriodicity SpinCounterPeriodicity = iota // LongPeriodicity stores the counter using 32 bits. LongPeriodicity SpinCounterPeriodicity = iota )
type SpinEntropy ¶
type SpinEntropy int
SpinEntropy is the number of bytes to use for entropy. Valid values from a minimum of 0 to a maximum of 4.
const ( // NoEntropy does not generate entropy as part of the spin value. NoEntropy SpinEntropy = 0 // OneEntropy generate entropy using 8 bits. OneEntropy SpinEntropy = 1 // TwoEntropy generate entropy using 16 bits. TwoEntropy SpinEntropy = 2 // ThreeEntropy generate entropy using 24 bits. ThreeEntropy SpinEntropy = 3 // FourEntropy generate entropy using 32 bits. FourEntropy SpinEntropy = 4 )
type SpinParameters ¶
type SpinParameters struct { Interval SpinCounterInterval Periodicity SpinCounterPeriodicity Entropy SpinEntropy }
SpinParameters stores parameters used by the CorrelationVector Spin operator.