infra

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DeliveryMQ *mqinfra.MQInfraConfig
	LogMQ      *mqinfra.MQInfraConfig
}

func (*Config) SetSensiblePolicyDefaults

func (cfg *Config) SetSensiblePolicyDefaults()

type Infra added in v0.4.0

type Infra struct {
	// contains filtered or unexported fields
}

func NewInfra added in v0.4.0

func NewInfra(cfg Config, redisClient *redis.Client) Infra

func NewInfraWithProvider added in v0.4.0

func NewInfraWithProvider(lock Lock, provider InfraProvider) *Infra

NewInfraWithProvider creates an Infra instance with custom lock and provider (for testing)

func (*Infra) Declare added in v0.4.0

func (infra *Infra) Declare(ctx context.Context) error

func (*Infra) Teardown added in v0.4.0

func (infra *Infra) Teardown(ctx context.Context) error

type InfraProvider added in v0.4.0

type InfraProvider interface {
	Exist(ctx context.Context) (bool, error)
	Declare(ctx context.Context) error
	Teardown(ctx context.Context) error
}

InfraProvider handles the actual infrastructure operations

type Lock added in v0.4.0

type Lock interface {
	AttemptLock(ctx context.Context) (bool, error)
	Unlock(ctx context.Context) (bool, error)
}

func NewRedisLock added in v0.4.0

func NewRedisLock(client *redis.Client, opts ...LockOption) Lock

NewRedisLock creates a new Redis-based distributed lock

type LockOption added in v0.4.0

type LockOption func(*redisLock)

LockOption configures a redisLock

func LockWithKey added in v0.4.0

func LockWithKey(key string) LockOption

LockWithKey sets a custom key for the lock

func LockWithTTL added in v0.4.0

func LockWithTTL(ttl time.Duration) LockOption

LockWithTTL sets a custom TTL for the lock

Jump to

Keyboard shortcuts

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