types

package
v0.43.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const CurrentFormat uint32 = 1

CurrentFormat is the currently used format for snapshots. Snapshots using the same format must be identical across all nodes for a given height, so this must be bumped when the binary snapshot output changes.

Variables

View Source
var (
	// ErrUnknownFormat is returned when an unknown format is used.
	ErrUnknownFormat = errors.New("unknown snapshot format")

	// ErrChunkHashMismatch is returned when chunk hash verification failed.
	ErrChunkHashMismatch = errors.New("chunk hash verification failed")

	// ErrInvalidMetadata is returned when the snapshot metadata is invalid.
	ErrInvalidMetadata = errors.New("invalid snapshot metadata")
)
View Source
var (
	ErrInvalidLengthSnapshot        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowSnapshot          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupSnapshot = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	ChunkHashes [][]byte `protobuf:"bytes,1,rep,name=chunk_hashes,json=chunkHashes,proto3" json:"chunk_hashes,omitempty"`
}

Metadata contains SDK-specific snapshot metadata.

func (*Metadata) Descriptor

func (*Metadata) Descriptor() ([]byte, []int)

func (*Metadata) GetChunkHashes

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

func (*Metadata) Marshal

func (m *Metadata) Marshal() (dAtA []byte, err error)

func (*Metadata) MarshalTo

func (m *Metadata) MarshalTo(dAtA []byte) (int, error)

func (*Metadata) MarshalToSizedBuffer

func (m *Metadata) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Metadata) ProtoMessage

func (*Metadata) ProtoMessage()

func (*Metadata) Reset

func (m *Metadata) Reset()

func (*Metadata) Size

func (m *Metadata) Size() (n int)

func (*Metadata) String

func (m *Metadata) String() string

func (*Metadata) Unmarshal

func (m *Metadata) Unmarshal(dAtA []byte) error

func (*Metadata) XXX_DiscardUnknown

func (m *Metadata) XXX_DiscardUnknown()

func (*Metadata) XXX_Marshal

func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Metadata) XXX_Merge

func (m *Metadata) XXX_Merge(src proto.Message)

func (*Metadata) XXX_Size

func (m *Metadata) XXX_Size() int

func (*Metadata) XXX_Unmarshal

func (m *Metadata) XXX_Unmarshal(b []byte) error

type Snapshot

type Snapshot struct {
	Height   uint64   `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
	Format   uint32   `protobuf:"varint,2,opt,name=format,proto3" json:"format,omitempty"`
	Chunks   uint32   `protobuf:"varint,3,opt,name=chunks,proto3" json:"chunks,omitempty"`
	Hash     []byte   `protobuf:"bytes,4,opt,name=hash,proto3" json:"hash,omitempty"`
	Metadata Metadata `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata"`
}

Snapshot contains Tendermint state sync snapshot info.

func SnapshotFromABCI

func SnapshotFromABCI(in *abci.Snapshot) (Snapshot, error)

Converts an ABCI snapshot to a snapshot. Mainly to decode the SDK metadata.

func (*Snapshot) Descriptor

func (*Snapshot) Descriptor() ([]byte, []int)

func (*Snapshot) GetChunks

func (m *Snapshot) GetChunks() uint32

func (*Snapshot) GetFormat

func (m *Snapshot) GetFormat() uint32

func (*Snapshot) GetHash

func (m *Snapshot) GetHash() []byte

func (*Snapshot) GetHeight

func (m *Snapshot) GetHeight() uint64

func (*Snapshot) GetMetadata

func (m *Snapshot) GetMetadata() Metadata

func (*Snapshot) Marshal

func (m *Snapshot) Marshal() (dAtA []byte, err error)

func (*Snapshot) MarshalTo

func (m *Snapshot) MarshalTo(dAtA []byte) (int, error)

func (*Snapshot) MarshalToSizedBuffer

func (m *Snapshot) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Snapshot) ProtoMessage

func (*Snapshot) ProtoMessage()

func (*Snapshot) Reset

func (m *Snapshot) Reset()

func (*Snapshot) Size

func (m *Snapshot) Size() (n int)

func (*Snapshot) String

func (m *Snapshot) String() string

func (Snapshot) ToABCI

func (s Snapshot) ToABCI() (abci.Snapshot, error)

Converts a Snapshot to its ABCI representation. Mainly to encode the SDK metadata.

func (*Snapshot) Unmarshal

func (m *Snapshot) Unmarshal(dAtA []byte) error

func (*Snapshot) XXX_DiscardUnknown

func (m *Snapshot) XXX_DiscardUnknown()

func (*Snapshot) XXX_Marshal

func (m *Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Snapshot) XXX_Merge

func (m *Snapshot) XXX_Merge(src proto.Message)

func (*Snapshot) XXX_Size

func (m *Snapshot) XXX_Size() int

func (*Snapshot) XXX_Unmarshal

func (m *Snapshot) XXX_Unmarshal(b []byte) error

type Snapshotter

type Snapshotter interface {
	// Snapshot creates a state snapshot, returning a channel of snapshot chunk readers.
	Snapshot(height uint64, format uint32) (<-chan io.ReadCloser, error)

	// Restore restores a state snapshot, taking snapshot chunk readers as input.
	// If the ready channel is non-nil, it returns a ready signal (by being closed) once the
	// restorer is ready to accept chunks.
	Restore(height uint64, format uint32, chunks <-chan io.ReadCloser, ready chan<- struct{}) error
}

Snapshotter is something that can create and restore snapshots, consisting of streamed binary chunks - all of which must be read from the channel and closed. If an unsupported format is given, it must return ErrUnknownFormat (possibly wrapped with fmt.Errorf).

Jump to

Keyboard shortcuts

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