View Source CorrelationVector (ex_correlation_vector v0.1.0)

Link to this section Summary

Functions

Creates a new correlation vector by extending an existing value. This should be done at the entry point of an operation.

Increments the current extension by one. Do this before passing the value to an outbound message header.

Is the correlation vector immutable? Works on strings and structs.

Creates a new CorrelationVector of the given version

Parses a correlation vector into struct

Gets the value of the correlation vector as a string.

Link to this section Types

@type t() :: %CorrelationVector{
  base_vector: String.t(),
  extension: number(),
  immutable: boolean(),
  version: module()
}

Link to this section Functions

@spec extend(String.t()) :: {:ok, t()} | {:error, reason :: String.t()}

Creates a new correlation vector by extending an existing value. This should be done at the entry point of an operation.

Works on parsed and string CVs

This function wil return {:ok, cv} or {:error, reason}. If you just want to extend or create a new one use safe_extend/1

@spec increment(t()) :: t()

Increments the current extension by one. Do this before passing the value to an outbound message header.

@spec infer_version(String.t()) :: {:ok, module()} | :error
@spec is_immutable?(t() | String.t()) :: boolean()

Is the correlation vector immutable? Works on strings and structs.

Link to this function

is_oversized?(base_vector, extension, version)

View Source
@spec new(map() | keyword()) :: t()

Creates a new CorrelationVector of the given version

@spec parse(String.t()) :: {:ok, t()}

Parses a correlation vector into struct

This function wil return {:ok, cv} or {:error, reason}. If you just want to parse or create a new one on failure use safe_parse/1

@spec safe_extend(String.t()) :: t()

See extend/1

@spec safe_parse(String.t()) :: t()

See safe_parse/1

Link to this function

size(base_vector, extension)

View Source
@spec value(t()) :: String.t()

Gets the value of the correlation vector as a string.