app

package
v0.0.0-...-2be76b0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppVersion        = 1
	DefaultKeyType    = "ed25519"
	DefaultBlocksKeep = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaronApp

type BaronApp struct {
	types.BaseApplication
	// contains filtered or unexported fields
}

BaronApp represents the Baron Chain ABCI application

func NewBaronApp

func NewBaronApp(cfg *Config) (*BaronApp, error)

NewBaronApp creates a new Baron Chain application instance

func (*BaronApp) CheckTx

CheckTx validates a transaction before adding it to the mempool

func (*BaronApp) DeliverTx

DeliverTx executes a transaction in the blockchain

func (*BaronApp) Info

func (app *BaronApp) Info(req types.RequestInfo) types.ResponseInfo

Info implements ABCI interface

func (*BaronApp) InitChain

InitChain initializes the blockchain with validators and initial app state

func (*BaronApp) PrepareProposal

PrepareProposal handles block proposal preparation

type Config

type Config struct {
	DataDir          string        `toml:"data_dir"`
	SnapshotInterval uint64        `toml:"snapshot_interval"`
	RetainBlocks     uint64        `toml:"retain_blocks"`
	KeyType          string        `toml:"key_type"`
	PersistInterval  uint64        `toml:"persist_interval"`
	ValidatorUpdates ValidatorMap  `toml:"validator_updates"`
	ProposalDelay    time.Duration `toml:"proposal_delay"`
	ProcessingDelay  time.Duration `toml:"processing_delay"`
	TransactionDelay time.Duration `toml:"transaction_delay"`
}

Config defines Baron Chain application configuration

type SnapshotMetadata

type SnapshotMetadata struct {
	Height    uint64 `json:"height"`
	Format    uint32 `json:"format"`
	Hash      []byte `json:"hash"`
	Chunks    uint32 `json:"chunks"`
	Timestamp int64  `json:"timestamp"`
	Version   string `json:"version"`
}

SnapshotMetadata represents snapshot metadata stored on disk

type SnapshotStore

type SnapshotStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

SnapshotStore manages state sync snapshots for Baron Chain

func NewSnapshotStore

func NewSnapshotStore(dir string) (*SnapshotStore, error)

NewSnapshotStore creates a new snapshot store instance

func (*SnapshotStore) Create

func (s *SnapshotStore) Create(state *State) (types.Snapshot, error)

Create creates a new snapshot of the current state

func (*SnapshotStore) List

func (s *SnapshotStore) List() ([]*types.Snapshot, error)

List returns available snapshots

func (*SnapshotStore) LoadChunk

func (s *SnapshotStore) LoadChunk(height uint64, format uint32, chunk uint32) ([]byte, error)

LoadChunk loads a specific chunk of a snapshot

type State

type State struct {
	sync.RWMutex
	Height  uint64            `json:"height"`
	Values  map[string]string `json:"values"`
	Hash    []byte            `json:"hash"`
	Version string            `json:"version"`
	// contains filtered or unexported fields
}

State represents Baron Chain's application state

func NewState

func NewState(cfg *StateConfig) (*State, error)

NewState creates a new Baron Chain state instance

func (*State) Commit

func (s *State) Commit() (height uint64, hash []byte, err error)

Commit commits state changes

func (*State) Export

func (s *State) Export() ([]byte, error)

Export exports state for snapshots

func (*State) Get

func (s *State) Get(key string) string

Get retrieves a value from state

func (*State) Import

func (s *State) Import(height uint64, data []byte) error

Import imports state from snapshots or genesis

func (*State) Rollback

func (s *State) Rollback() error

Rollback restores previous state

func (*State) Set

func (s *State) Set(key, value string) error

Set sets a value in state

type StateConfig

type StateConfig struct {
	DataDir         string
	PersistInterval uint64
	Logger          log.Logger
}

StateConfig holds state configuration

type ValidatorMap

type ValidatorMap map[string]map[string]uint8

Jump to

Keyboard shortcuts

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