snapshotcreator

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2023 License: Apache-2.0, BSD-2-Clause Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSnapshot

func CreateSnapshot(opts ...options.Option[Options]) error

func KeyValues

func KeyValues[K comparable, V any](in map[K]V) ([]K, []V)

func WithAttestAll

func WithAttestAll(attestAll bool) options.Option[Options]

WithAttestAll indicates if all node should be included in attestations.

func WithDatabaseVersion

func WithDatabaseVersion(databaseVersion database.Version) options.Option[Options]

WithDatabaseVersion sets the database version to use for the snapshot.

func WithFilePath

func WithFilePath(filePath string) options.Option[Options]

func WithGenesisSeed

func WithGenesisSeed(masterSeed []byte) options.Option[Options]

func WithGenesisTokenAmount

func WithGenesisTokenAmount(genesisTokenAmount uint64) options.Option[Options]

WithGenesisTokenAmount sets the amount of tokens left on the Genesis, pledged to Peer Master.

func WithGenesisUnixTime

func WithGenesisUnixTime(unixTime int64) options.Option[Options]

WithGenesisUnixTime provides the genesis time of the snapshot.

func WithInitialAttestationsBase58

func WithInitialAttestationsBase58(initialAttestationBase58 []string) options.Option[Options]

WithInitialAttestationsBase58 sets the initial attestation node to use for the snapshot based on provided public keys in base58.

func WithInitialAttestationsPublicKey

func WithInitialAttestationsPublicKey(initialAttestation []ed25519.PublicKey) options.Option[Options]

WithInitialAttestationsPublicKey sets the initial attestation node public key to use for the snapshot.

func WithLedgerProvider

func WithLedgerProvider(ledgerProvider module.Provider[*engine.Engine, ledger.Ledger]) options.Option[Options]

WithLedgerProvider sets the MemPool to use for the snapshot.

func WithPeersAmountsPledged

func WithPeersAmountsPledged(peersAmountsPledged []uint64) options.Option[Options]

WithPeersAmountsPledged sets the amount of tokens to be pledged to the peers.

func WithPeersPublicKeys

func WithPeersPublicKeys(peersPublicKey []ed25519.PublicKey) options.Option[Options]

func WithPeersPublicKeysBase58

func WithPeersPublicKeysBase58(peersPublicKeyBase58 []string) options.Option[Options]

WithPeersPublicKeysBase58 sets the public keys of the peers based on provided base58 encoded public keys.

func WithPeersSeedBase58

func WithPeersSeedBase58(peersSeedBase58 []string) options.Option[Options]

WithPeersSeedBase58 sets the seed of the peers to be used in the snapshot.

func WithPledgeIDs

func WithPledgeIDs(pledgeIDs map[ed25519.PublicKey]uint64) options.Option[Options]

WithPledgeIDs sets the public keys and pledge amounts to use for the snapshot.

func WithSlotDuration

func WithSlotDuration(duration int64) options.Option[Options]

WithSlotDuration defines the duration in seconds of each slot.

func WithTotalTokensPledged

func WithTotalTokensPledged(totalTokensPledged uint64) options.Option[Options]

WithTotalTokensPledged sets the total amount of tokens pledged from genesis to the peers, if not provided all genesis tokens will be distributed equally.

Types

type Options

type Options struct {
	// FilePath is the path to the snapshot file.
	FilePath string
	// GenesisSeed is the seed of the PeerMaster node where the genesis pledge goes to.
	GenesisSeed []byte
	// GenesisTokenAmount is the amount of tokens left on the Genesis, pledged to Peer Master.
	GenesisTokenAmount uint64
	// TotalTokensPledged is the total amount of tokens pledged from genesis to the peers.
	// If provided mana will be distributed equally.
	TotalTokensPledged uint64
	// PeersSeedBase58 is a slice of Seeds encoded in Base58, one entry per peer.
	PeersSeedBase58 []string
	// PeersPublicKey is a slice of public keys, one entry per peer.
	PeersPublicKey []ed25519.PublicKey
	// PeersAmountsPledged is a slice of amounts to be pledged to the peers, one entry per peer.
	PeersAmountsPledged []uint64
	// InitialAttestationsPublicKey indicates which node public key should be included in the first commitment.
	InitialAttestationsPublicKey []ed25519.PublicKey
	// AttestAll indicates that all nodes will be included in the attestation.
	AttestAll bool
	// GenesisUnixTime provides the genesis time of the snapshot.
	GenesisUnixTime int64
	// SlotDuration defines the duration in seconds of each slot.
	SlotDuration int64

	DataBaseVersion database.Version

	LedgerProvider module.Provider[*engine.Engine, ledger.Ledger]
}

Options stores the details about snapshots created for integration tests

func NewOptions

func NewOptions(opts ...options.Option[Options]) *Options

Jump to

Keyboard shortcuts

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