utils

package
v3.3.15 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	MaxRetries     = 5
	InitialBackoff = 500 * time.Millisecond
	MaxBackoff     = 10 * time.Second
	BackoffFactor  = 2.0
)

Variables

This section is empty.

Functions

func BalanceInternalKey added in v3.3.6

func BalanceInternalKey(organizationID, ledgerID uuid.UUID, key string) string

BalanceInternalKey returns a key with the following format to be used on redis cluster: "balance:{contextName}:organizationID:ledgerID:key"

func FullJitter

func FullJitter(baseDelay time.Duration) time.Duration

FullJitter returns a random delay between [0, baseDelay], capped by MaxBackoff.

func GenericInternalKey added in v3.3.6

func GenericInternalKey(name, contextName, organizationID, ledgerID, key string) string

GenericInternalKey returns a key with the following format to be used on redis cluster: "name:{contextName}:organizationID:ledgerID:key"

func NextBackoff

func NextBackoff(current time.Duration) time.Duration

NextBackoff calculates the next exponential backoff, respecting the MaxBackoff capped.

func RedisConsumerLockKey added in v3.3.11

func RedisConsumerLockKey(organizationID, ledgerID uuid.UUID, transactionID string) string

RedisConsumerLockKey returns a key with the following format to be used on redis cluster: "redis_consumer_lock:{organizationID:ledgerID}:transactionID" This key is used to prevent duplicate processing of the same transaction across multiple pods.

func SanitizeAccountAliases added in v3.3.13

func SanitizeAccountAliases(parserDSL *libTransaction.Transaction)

SanitizeAccountAliases cleans the AccountAlias fields in a Transaction's FromTo entries. This is necessary because HandleAccountFields mutates aliases in-place using ConcatAlias, producing formats like "0#@alias#key". SplitAlias extracts the original alias back.

func TransactionInternalKey added in v3.3.6

func TransactionInternalKey(organizationID, ledgerID uuid.UUID, key string) string

TransactionInternalKey returns a key with the following format to be used on redis cluster: "transaction:{contextName}:organizationID:ledgerID:key"

func WriteBehindTransactionKey added in v3.3.15

func WriteBehindTransactionKey(organizationID, ledgerID uuid.UUID, transactionID string) string

WriteBehindTransactionKey returns a key with the following format to be used on redis cluster: "wb_transaction:{organizationID:ledgerID:transactionID}" This key is used to store transaction data in the write-behind cache before persistence. The transactionID is included inside the hash tag so keys distribute evenly across Redis Cluster slots. Co-location via {orgID:ledgerID} is not needed here because write-behind keys are always accessed individually (SET/GET/DEL), never in multi-key operations.

Types

This section is empty.

Jump to

Keyboard shortcuts

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