archive

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WriteBlockSource = "archive"
)

Variables

View Source
var (
	// Error Info
	ErrBlockRange = errors.New("block range error: from is greater than or equal to to")
)

Functions

func CreateBackup

func CreateBackup(
	conn *grpc.ClientConn,
	logger hclog.Logger,
	from uint64,
	to *uint64,
	outPath string,
	overwriteFile bool,
	enableZstdCompression bool,
	zstdLevel int,
) (resFrom uint64, resTo uint64, err error)

CreateBackup fetches blockchain data with the specific range via gRPC and save this data as binary archive to given path

func RestoreChain

func RestoreChain(log hclog.Logger, chain blockchainInterface, filePath string) error

RestoreChain reads blocks from the archive and write to the chain

Types

type Metadata

type Metadata struct {
	Latest     uint64
	LatestHash types.Hash
}

Metadata is the data stored in the beginning of backup

func (*Metadata) MarshalRLP

func (m *Metadata) MarshalRLP() []byte

MarshalRLP returns RLP encoded bytes

func (*Metadata) MarshalRLPTo

func (m *Metadata) MarshalRLPTo(dst []byte) []byte

MarshalRLPTo sets RLP encoded bytes to given byte slice

func (*Metadata) MarshalRLPWith

func (m *Metadata) MarshalRLPWith(arena *fastrlp.Arena) *fastrlp.Value

MarshalRLPWith appends own field into arena for encode

func (*Metadata) UnmarshalRLP

func (m *Metadata) UnmarshalRLP(input []byte) error

UnmarshalRLP unmarshals and sets the fields from RLP encoded bytes

func (*Metadata) UnmarshalRLPFrom

func (m *Metadata) UnmarshalRLPFrom(p *fastrlp.Parser, v *fastrlp.Value) error

UnmarshalRLPFrom sets the fields from parsed RLP encoded value

Jump to

Keyboard shortcuts

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