Documentation ¶
Index ¶
- Constants
- Variables
- type Metadata
- func (*Metadata) Descriptor() ([]byte, []int)
- func (m *Metadata) GetChunkHashes() [][]byte
- func (m *Metadata) Marshal() (dAtA []byte, err error)
- func (m *Metadata) MarshalTo(dAtA []byte) (int, error)
- func (m *Metadata) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Metadata) ProtoMessage()
- func (m *Metadata) Reset()
- func (m *Metadata) Size() (n int)
- func (m *Metadata) String() string
- func (m *Metadata) Unmarshal(dAtA []byte) error
- func (m *Metadata) XXX_DiscardUnknown()
- func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Metadata) XXX_Merge(src proto.Message)
- func (m *Metadata) XXX_Size() int
- func (m *Metadata) XXX_Unmarshal(b []byte) error
- type Snapshot
- func (*Snapshot) Descriptor() ([]byte, []int)
- func (m *Snapshot) GetChunks() uint32
- func (m *Snapshot) GetFormat() uint32
- func (m *Snapshot) GetHash() []byte
- func (m *Snapshot) GetHeight() uint64
- func (m *Snapshot) GetMetadata() Metadata
- func (m *Snapshot) Marshal() (dAtA []byte, err error)
- func (m *Snapshot) MarshalTo(dAtA []byte) (int, error)
- func (m *Snapshot) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Snapshot) ProtoMessage()
- func (m *Snapshot) Reset()
- func (m *Snapshot) Size() (n int)
- func (m *Snapshot) String() string
- func (s Snapshot) ToABCI() (abci.Snapshot, error)
- func (m *Snapshot) Unmarshal(dAtA []byte) error
- func (m *Snapshot) XXX_DiscardUnknown()
- func (m *Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Snapshot) XXX_Merge(src proto.Message)
- func (m *Snapshot) XXX_Size() int
- func (m *Snapshot) XXX_Unmarshal(b []byte) error
- type Snapshotter
Constants ¶
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 ¶
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") )
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) GetChunkHashes ¶
func (*Metadata) MarshalToSizedBuffer ¶
func (*Metadata) ProtoMessage ¶
func (*Metadata) ProtoMessage()
func (*Metadata) XXX_DiscardUnknown ¶
func (m *Metadata) XXX_DiscardUnknown()
func (*Metadata) XXX_Marshal ¶
func (*Metadata) XXX_Unmarshal ¶
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 ¶
Converts an ABCI snapshot to a snapshot. Mainly to decode the SDK metadata.
func (*Snapshot) Descriptor ¶
func (*Snapshot) GetMetadata ¶
func (*Snapshot) MarshalToSizedBuffer ¶
func (*Snapshot) ProtoMessage ¶
func (*Snapshot) ProtoMessage()
func (Snapshot) ToABCI ¶
Converts a Snapshot to its ABCI representation. Mainly to encode the SDK metadata.
func (*Snapshot) XXX_DiscardUnknown ¶
func (m *Snapshot) XXX_DiscardUnknown()
func (*Snapshot) XXX_Marshal ¶
func (*Snapshot) XXX_Unmarshal ¶
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).