Documentation
¶
Index ¶
- Constants
- Variables
- func BalanceInternalKey(organizationID, ledgerID uuid.UUID, key string) string
- func ExtractMongoPortAndParameters(port, parameters string, logger libLog.Logger) (string, string)
- func FullJitter(baseDelay time.Duration) time.Duration
- func GenericInternalKey(name, contextName, organizationID, ledgerID, key string) string
- func IdempotencyReverseKey(organizationID, ledgerID uuid.UUID, transactionID string) string
- func NextBackoff(current time.Duration) time.Duration
- func RedisConsumerLockKey(organizationID, ledgerID uuid.UUID, transactionID string) string
- func SanitizeAccountAliases(parserDSL *libTransaction.Transaction)
- func TransactionInternalKey(organizationID, ledgerID uuid.UUID, key string) string
Constants ¶
const ( MaxRetries = 5 InitialBackoff = 500 * time.Millisecond MaxBackoff = 10 * time.Second BackoffFactor = 2.0 )
const BalanceSyncLockPrefix = "lock:{transactions}:balance-sync:"
const BalanceSyncScheduleKey = "schedule:{transactions}:balance-sync"
Variables ¶
var (
BalanceSynced = metrics.Metric{
Name: "balance_synced",
Unit: "1",
Description: "Measures the number of balances synced.",
}
)
Functions ¶
func BalanceInternalKey ¶ added in v3.3.6
BalanceInternalKey returns a key with the following format to be used on redis cluster: "balance:{contextName}:organizationID:ledgerID:key"
func ExtractMongoPortAndParameters ¶ added in v3.4.8
ExtractMongoPortAndParameters handles backward compatibility for MongoDB connection configuration. MONGO_PORT=5703/replicaSet=rs0&authSource=admin&directConnection=true
This function extracts the actual port and parameters from such configurations. If MONGO_PARAMETERS is already set, it takes precedence over embedded parameters.
DEPRECATED: This backward compatibility for embedded parameters in MONGO_PORT will be removed in Midaz 4.0.0. Update environment variables to use the MONGO_PARAMETERS environment variable.
func FullJitter ¶
FullJitter returns a random delay between [0, baseDelay], capped by MaxBackoff.
func GenericInternalKey ¶ added in v3.3.6
GenericInternalKey returns a key with the following format to be used on redis cluster: "name:{contextName}:organizationID:ledgerID:key"
func IdempotencyReverseKey ¶ added in v3.3.11
IdempotencyReverseKey returns a key with the following format to be used on redis cluster: "idempotency_reverse:{organizationID:ledgerID}:transactionID" This key maps a transactionID to its idempotency key for reverse lookups.
func NextBackoff ¶
NextBackoff calculates the next exponential backoff, respecting the MaxBackoff capped.
func RedisConsumerLockKey ¶ added in v3.3.11
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.
Types ¶
This section is empty.