ledger

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(typeName string, factory Factory)

Register registers a ledger actor factory under the given type name. Typically called from init() in each ledger actor package.

Types

type Config

type Config struct {
	Actor []actor.Entry `yaml:"actor"`
}

Config contains ledger engine configuration.

type Engine

type Engine struct {
	engine.EngineBase
	// contains filtered or unexported fields
}

Engine manages ledger actors and orchestrates their lifecycle. Balance state is owned by individual InventoryActors which write to cache.

func NewEngine

func NewEngine(cat *catalog.Catalog, msgBus *msgbus.MsgBus, c *cache.Cache) *Engine

NewEngine creates a new ledger engine.

func (*Engine) GetConfiguredAccounts

func (e *Engine) GetConfiguredAccounts() []int

GetConfiguredAccounts returns the list of configured account IDs.

func (*Engine) Init

func (e *Engine) Init(config Config)

Init constructs actors from config and registers with the EventBus.

func (*Engine) NotifyReady

func (e *Engine) NotifyReady()

NotifyReady is called by each InventoryActor when its snapshot is received. When all inventory actors have reported ready, the engine notifies the system.

func (*Engine) ResolveWallet

func (e *Engine) ResolveWallet(name string) (accountID int, walletID int, walletType common.WalletType, err error)

func (*Engine) SetAccounts

func (e *Engine) SetAccounts(accountIDs []int, walletTypes map[int]common.WalletType)

SetAccounts sets the account IDs and their wallet types to track.

func (*Engine) SetExecutionRouter

func (e *Engine) SetExecutionRouter(router *adapter.ExecutionRouter)

SetExecutionRouter sets the execution router for subscribing and requesting balance snapshots.

func (*Engine) Start

func (e *Engine) Start()

Start triggers actors and requests initial balance snapshots for all accounts.

func (*Engine) Stop

func (e *Engine) Stop()

Stop stops the engine.

type Factory

type Factory func(handler any) actor.Actor

Factory is a constructor function that creates a ledger actor. The handler parameter is the ledger engine; each actor package defines its own interface and performs a type assertion.

Directories

Path Synopsis
actor

Jump to

Keyboard shortcuts

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