Documentation ¶
Index ¶
- Constants
- func GetVersion(file ioutil.SectionReader) (uint64, error)
- type CollectOptions
- type Collector
- type Header
- func (v *Header) Copy() *Header
- func (v *Header) CopyAsInterface() interface{}
- func (v *Header) Equal(u *Header) bool
- func (v *Header) IsValid() error
- func (v *Header) MarshalBinary() ([]byte, error)
- func (v *Header) MarshalJSON() ([]byte, error)
- func (v *Header) UnmarshalBinary(data []byte) error
- func (v *Header) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *Header) UnmarshalJSON(data []byte) error
- type IndexReader
- type Indexer
- type Reader
- type RecordEntry
- func (v *RecordEntry) Copy() *RecordEntry
- func (v *RecordEntry) CopyAsInterface() interface{}
- func (v *RecordEntry) Equal(u *RecordEntry) bool
- func (v *RecordEntry) IsValid() error
- func (v *RecordEntry) MarshalBinary() ([]byte, error)
- func (v *RecordEntry) MarshalJSON() ([]byte, error)
- func (v *RecordEntry) UnmarshalBinary(data []byte) error
- func (v *RecordEntry) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *RecordEntry) UnmarshalJSON(data []byte) error
- type RecordIndexEntry
- type RecordReader
- type SectionType
- type Store
- type Writer
Constants ¶
const Version2 = 2
Variables ¶
This section is empty.
Functions ¶
func GetVersion ¶ added in v1.2.0
func GetVersion(file ioutil.SectionReader) (uint64, error)
Types ¶
type CollectOptions ¶ added in v1.2.0
type Header ¶
type Header struct { // Version is the snapshot format version. Version uint64 `json:"version,omitempty" form:"version" query:"version" validate:"required"` // RootHash is the snapshot's root hash. RootHash [32]byte `json:"rootHash,omitempty" form:"rootHash" query:"rootHash" validate:"required"` // SystemLedger is the partition's system ledger. SystemLedger *protocol.SystemLedger `json:"systemLedger,omitempty" form:"systemLedger" query:"systemLedger" validate:"required"` // contains filtered or unexported fields }
func (*Header) CopyAsInterface ¶
func (v *Header) CopyAsInterface() interface{}
func (*Header) MarshalBinary ¶
func (*Header) MarshalJSON ¶
func (*Header) UnmarshalBinary ¶
func (*Header) UnmarshalJSON ¶
type IndexReader ¶
type IndexReader struct { Count int // contains filtered or unexported fields }
func (*IndexReader) Read ¶
func (i *IndexReader) Read(n int) (*RecordIndexEntry, error)
type Indexer ¶ added in v1.2.0
type Indexer struct {
// contains filtered or unexported fields
}
func (*Indexer) Write ¶ added in v1.2.0
func (i *Indexer) Write(e RecordIndexEntry) error
type Reader ¶
type Reader struct { Sections []*sectionReader Header *Header }
func Open ¶
func Open(file ioutil.SectionReader) (*Reader, error)
Open opens a snapshot file for reading.
func (*Reader) OpenRecords ¶
func (r *Reader) OpenRecords(i int) (*RecordReader, error)
type RecordEntry ¶
type RecordEntry struct { Key *record.Key `json:"key,omitempty" form:"key" query:"key" validate:"required"` Value []byte `json:"value,omitempty" form:"value" query:"value" validate:"required"` // contains filtered or unexported fields }
func (*RecordEntry) Copy ¶
func (v *RecordEntry) Copy() *RecordEntry
func (*RecordEntry) CopyAsInterface ¶
func (v *RecordEntry) CopyAsInterface() interface{}
func (*RecordEntry) Equal ¶
func (v *RecordEntry) Equal(u *RecordEntry) bool
func (*RecordEntry) IsValid ¶
func (v *RecordEntry) IsValid() error
func (*RecordEntry) MarshalBinary ¶
func (v *RecordEntry) MarshalBinary() ([]byte, error)
func (*RecordEntry) MarshalJSON ¶
func (v *RecordEntry) MarshalJSON() ([]byte, error)
func (*RecordEntry) UnmarshalBinary ¶
func (v *RecordEntry) UnmarshalBinary(data []byte) error
func (*RecordEntry) UnmarshalBinaryFrom ¶
func (v *RecordEntry) UnmarshalBinaryFrom(rd io.Reader) error
func (*RecordEntry) UnmarshalJSON ¶
func (v *RecordEntry) UnmarshalJSON(data []byte) error
type RecordIndexEntry ¶
type RecordReader ¶
type RecordReader struct {
// contains filtered or unexported fields
}
func (*RecordReader) Read ¶
func (r *RecordReader) Read() (*RecordEntry, error)
type SectionType ¶
type SectionType uint64
SectionType is the type of a snapshot section.
const SectionTypeAccountsV1 SectionType = 2
SectionTypeAccountsV1 contains accounts (v1).
const SectionTypeBPT SectionType = 9
SectionTypeBPT contains the BPT.
const SectionTypeGzTransactionsV1 SectionType = 5
SectionTypeGzTransactionsV1 contains gzipped transactions (v1).
const SectionTypeHeader SectionType = 1
SectionTypeHeader is the snapshot's header.
const SectionTypeRecordIndex SectionType = 8
SectionTypeRecordIndex indexes record keys, including the offset and section number.
const SectionTypeRecords SectionType = 7
SectionTypeRecords contains records stored as (key, record) pairs.
const SectionTypeSignaturesV1 SectionType = 4
SectionTypeSignaturesV1 contains signatures (v1).
const SectionTypeSnapshot SectionType = 6
SectionTypeSnapshot contains another snapshot.
const SectionTypeTransactionsV1 SectionType = 3
SectionTypeTransactionsV1 contains transactions (v1).
func SectionTypeByName ¶
func SectionTypeByName(name string) (SectionType, bool)
SectionTypeByName returns the named Section Type.
func (SectionType) GetEnumValue ¶
func (v SectionType) GetEnumValue() uint64
GetEnumValue returns the value of the Section Type
func (SectionType) MarshalJSON ¶
func (v SectionType) MarshalJSON() ([]byte, error)
MarshalJSON marshals the Section Type to JSON as a string.
func (*SectionType) SetEnumValue ¶
func (v *SectionType) SetEnumValue(id uint64) bool
SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.
func (SectionType) String ¶
func (v SectionType) String() string
String returns the name of the Section Type.
func (*SectionType) UnmarshalJSON ¶
func (v *SectionType) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the Section Type from JSON as a string.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
func Create ¶
func Create(file io.WriteSeeker) (*Writer, error)
Create opens a snapshot file for writing.
func (*Writer) OpenRaw ¶
func (w *Writer) OpenRaw(typ SectionType) (*sectionWriter, error)