index

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContractManager

type ContractManager interface {
	// UpdateChainState atomically updates the blockchain state of the
	// contract manager.
	UpdateChainState(tx contracts.UpdateStateTx, reverted []chain.RevertUpdate, applied []chain.ApplyUpdate) error
	// ProcessActions is called after the chain state is updated to
	// trigger additional actions related to contract lifecycle management.
	// This operation should not assume that it will be called for every
	// block. During syncing, it will be called at most once per batch.
	ProcessActions(index types.ChainIndex) error
}

A ContractManager manages the lifecycle and state of storage contracts

type Manager

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

A Manager manages the state of the blockchain and indexes consensus changes.

func NewManager

func NewManager(store Store, chain *chain.Manager, contracts ContractManager, wallet WalletManager, settings SettingsManager, volumes VolumeManager, opts ...Option) (*Manager, error)

NewManager creates a new Manager.

func (*Manager) Close

func (m *Manager) Close()

Close stops the manager.

func (*Manager) Tip

func (m *Manager) Tip() types.ChainIndex

Tip returns the current chain index.

type Option

type Option func(*Manager)

An Option is a functional option for the Manager.

func WithBatchSize

func WithBatchSize(bs int) Option

WithBatchSize sets the batch size for chain updates.

func WithLog

func WithLog(l *zap.Logger) Option

WithLog sets the logger for the Manager.

type SettingsManager

type SettingsManager interface {
	// UpdateChainState atomically updates the blockchain state of the
	// settings manager.
	UpdateChainState(tx settings.UpdateStateTx, reverted []chain.RevertUpdate, applied []chain.ApplyUpdate) error
	// ProcessActions is called after the chain state is updated to
	// trigger additional actions related to settings management.
	// This operation should not assume that it will be called for every
	// block. During syncing, it will be called at most once per batch.
	ProcessActions(index types.ChainIndex) error
}

A SettingsManager manages the host's settings and announcements

type Store

type Store interface {
	// ResetChainState resets the consensus state of the store. This
	// should only occur if the user has reset their consensus database to
	// sync from scratch.
	ResetChainState() error
	UpdateChainState(func(UpdateTx) error) error
	Tip() (types.ChainIndex, error)
}

A Store is a persistent store for the index manager.

type UpdateTx

type UpdateTx interface {
	wallet.UpdateTx
	contracts.UpdateStateTx
	settings.UpdateStateTx

	SetLastIndex(types.ChainIndex) error
}

An UpdateTx is a transaction that atomically updates the state of the index manager.

type VolumeManager

type VolumeManager interface {
	// ProcessActions is called to trigger additional actions related to
	// volume management. This operation should not assume that it will be
	// called for every block. During syncing, it will be called at most
	// once per batch
	ProcessActions(index types.ChainIndex) error
}

A VolumeManager manages the host's storage volumes

type WalletManager

type WalletManager interface {
	// UpdateChainState atomically updates the blockchain state of the
	// wallet manager.
	UpdateChainState(tx wallet.UpdateTx, reverted []chain.RevertUpdate, applied []chain.ApplyUpdate) error
}

A WalletManager manages the host's UTXOs and balance

Jump to

Keyboard shortcuts

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