Documentation ¶
Overview ¶
Package isaacblock handles data of block.
Index ¶
- Variables
- func BlockItemFileName(t base.BlockItemType, hinttype hint.Type, compressFormat string) (string, error)
- func CleanBlockTempDirectory(root string) error
- func DefaultBlockItemFileName(t base.BlockItemType, hinttype hint.Type) (string, error)
- func FindHighestBlockItemFiles(p string, depth int) (height int64, lastpath string, _ error)
- func FindHighestDirectory(root string) (_ base.Height, directory string, found bool, _ error)
- func HeightFromDirectory(s string) (base.Height, error)
- func ImportBlocks(ctx context.Context, from, to base.Height, batchlimit int64, ...) error
- func IsValidAllBlockMapsFromLocalFS(readers *isaac.BlockItemReaders, last base.Height, networkID base.NetworkID) error
- func IsValidBlockFromLocalFS(itemf isaac.BlockItemReadersItemFunc, height base.Height, ...) error
- func IsValidBlocksFromStorage(itemf isaac.BlockItemReadersItemFunc, fromHeight, toHeight base.Height, ...) error
- func IsValidLastBlocks(readers *isaac.BlockItemReaders, remotes isaac.RemotesBlockItemReadFunc, ...) error
- func IsValidOperationsOfBlock(opstree fixedtree.Tree, ops []base.Operation, manifest base.Manifest, ...) error
- func IsValidStatesOfBlock(ststree fixedtree.Tree, sts []base.State, manifest base.Manifest, ...) error
- func NewDefaultItemReaderFunc(workerSize uint64) isaac.NewBlockItemReaderFunc
- func NewItemReader(t base.BlockItemType, enc encoder.Encoder, r *util.CompressedReader, ...) (isaac.BlockItemReader, error)
- func RemoveBlockFromLocalFS(root string, height base.Height) (bool, error)
- func RemoveBlocksFromLocalFS(root string, height base.Height) (bool, error)
- type BlockImporter
- type BlockMap
- func (BlockMap) Bytes() []byte
- func (m *BlockMap) DecodeJSON(b []byte, enc encoder.Encoder) error
- func (m BlockMap) IsValid(b []byte) error
- func (m BlockMap) Item(t base.BlockItemType) (base.BlockMapItem, bool)
- func (m BlockMap) Items(f func(base.BlockMapItem) bool)
- func (m BlockMap) Manifest() base.Manifest
- func (m BlockMap) MarshalJSON() ([]byte, error)
- func (m *BlockMap) SetItem(item base.BlockMapItem) error
- func (m *BlockMap) SetManifest(manifest base.Manifest)
- func (m *BlockMap) Sign(node base.Address, priv base.Privatekey, networkID base.NetworkID) error
- type BlockMapItem
- type DefaultStatesMerger
- func (sm *DefaultStatesMerger) Close() error
- func (sm *DefaultStatesMerger) CloseStates(ctx context.Context, beforeClose func(keyscount uint64) error, ...) error
- func (sm *DefaultStatesMerger) Len() int
- func (sm *DefaultStatesMerger) SetStates(ctx context.Context, index uint64, stvms []base.StateMergeValue, ...) error
- type ErrValidatedDifferentHeightBlockMaps
- func (er *ErrValidatedDifferentHeightBlockMaps) DatabaseHeight() base.Height
- func (er *ErrValidatedDifferentHeightBlockMaps) Errorf(format string, args ...interface{}) *ErrValidatedDifferentHeightBlockMaps
- func (er *ErrValidatedDifferentHeightBlockMaps) LocalFSHeight() base.Height
- func (er *ErrValidatedDifferentHeightBlockMaps) WithMessage(err error, format string, args ...interface{}) error
- func (er *ErrValidatedDifferentHeightBlockMaps) WithStack() *ErrValidatedDifferentHeightBlockMaps
- func (er *ErrValidatedDifferentHeightBlockMaps) Wrap(err error) error
- type FSWriter
- type ImportBlocksBlockItemFunc
- type ImportBlocksBlockMapFunc
- type ItemReader
- type LocalFSImporter
- type LocalFSWriter
- func (w *LocalFSWriter) Cancel() error
- func (w *LocalFSWriter) Save(ctx context.Context) (base.BlockMap, error)
- func (w *LocalFSWriter) SetACCEPTVoteproof(_ context.Context, vp base.ACCEPTVoteproof) error
- func (w *LocalFSWriter) SetINITVoteproof(_ context.Context, vp base.INITVoteproof) error
- func (w *LocalFSWriter) SetManifest(_ context.Context, m base.Manifest) error
- func (w *LocalFSWriter) SetOperation(_ context.Context, total, _ uint64, op base.Operation) error
- func (w *LocalFSWriter) SetOperationsTree(ctx context.Context, tr fixedtree.Tree) error
- func (w *LocalFSWriter) SetProposal(_ context.Context, pr base.ProposalSignFact) error
- func (w *LocalFSWriter) SetState(_ context.Context, total, _ uint64, st base.State) error
- func (w *LocalFSWriter) SetStatesTree(ctx context.Context, tr fixedtree.Tree) error
- type StatesMerger
- type SuffrageProof
- func (s *SuffrageProof) DecodeJSON(b []byte, enc encoder.Encoder) error
- func (s SuffrageProof) IsValid(b []byte) error
- func (s SuffrageProof) Map() base.BlockMap
- func (s SuffrageProof) MarshalJSON() ([]byte, error)
- func (s SuffrageProof) Proof() fixedtree.Proof
- func (s SuffrageProof) Prove(previousState base.State) error
- func (s SuffrageProof) State() base.State
- func (s SuffrageProof) Suffrage() (base.Suffrage, error)
- func (s SuffrageProof) SuffrageHeight() base.Height
- type SuffrageProofJSONMarshaler
- type SuffrageProofJSONUnmarshaler
- type Writer
- func (w *Writer) Cancel() error
- func (w *Writer) Manifest(ctx context.Context, previous base.Manifest) (base.Manifest, error)
- func (w *Writer) Save(ctx context.Context) (base.BlockMap, error)
- func (w *Writer) SetACCEPTVoteproof(_ context.Context, vp base.ACCEPTVoteproof) error
- func (w *Writer) SetINITVoteproof(_ context.Context, vp base.INITVoteproof) error
- func (w *Writer) SetOperationsSize(n uint64)
- func (w *Writer) SetProcessResult(_ context.Context, index uint64, op, facthash util.Hash, instate bool, ...) error
- func (w *Writer) SetStates(ctx context.Context, index uint64, states []base.StateMergeValue, ...) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrLastBlockMapOnlyInDatabase = util.NewIDError("last blockmap found in database, but not in local fs") ErrLastBlockMapOnlyInLocalFS = util.NewIDError("last blockmap found in local fs, but not in database") )
View Source
var BlockMapHint = hint.MustNewHint("blockmap-v0.0.1")
View Source
var BlockTempDirectoryPrefix = "temp"
View Source
var LocalFSWriterHint = hint.MustNewHint("block-localfs-writer-v0.0.1")
View Source
var SuffrageProofHint = hint.MustNewHint("suffrage-proof-v0.0.1")
Functions ¶
func BlockItemFileName ¶
func CleanBlockTempDirectory ¶
func FindHighestDirectory ¶
func ImportBlocks ¶
func ImportBlocks( ctx context.Context, from, to base.Height, batchlimit int64, readers *isaac.BlockItemReaders, blockMapf ImportBlocksBlockMapFunc, blockItemf ImportBlocksBlockItemFunc, newBlockImporter func(base.BlockMap) (isaac.BlockImporter, error), setLastVoteproofsFunc func([2]base.Voteproof, bool) error, mergeBlockWriterDatabasesf func(context.Context) error, ) error
func IsValidBlockFromLocalFS ¶
func IsValidLastBlocks ¶
func IsValidLastBlocks( readers *isaac.BlockItemReaders, remotes isaac.RemotesBlockItemReadFunc, db isaac.Database, networkID base.NetworkID, ) error
func IsValidStatesOfBlock ¶
func NewDefaultItemReaderFunc ¶
func NewDefaultItemReaderFunc(workerSize uint64) isaac.NewBlockItemReaderFunc
func NewItemReader ¶
func NewItemReader( t base.BlockItemType, enc encoder.Encoder, r *util.CompressedReader, workerSize uint64, ) (isaac.BlockItemReader, error)
func RemoveBlockFromLocalFS ¶
Types ¶
type BlockImporter ¶
type BlockImporter struct {
// contains filtered or unexported fields
}
func NewBlockImporter ¶
func (*BlockImporter) CancelImport ¶
func (im *BlockImporter) CancelImport(context.Context) error
func (*BlockImporter) WriteItem ¶
func (im *BlockImporter) WriteItem(t base.BlockItemType, ir isaac.BlockItemReader) error
type BlockMap ¶
type BlockMap struct { base.BaseNodeSign hint.BaseHinter // contains filtered or unexported fields }
func NewBlockMap ¶
func NewBlockMap() BlockMap
func (BlockMap) Item ¶
func (m BlockMap) Item(t base.BlockItemType) (base.BlockMapItem, bool)
func (BlockMap) MarshalJSON ¶
func (*BlockMap) SetManifest ¶
type BlockMapItem ¶
type BlockMapItem struct {
// contains filtered or unexported fields
}
func NewBlockMapItem ¶
func NewBlockMapItem(t base.BlockItemType, checksum string) BlockMapItem
func (BlockMapItem) Checksum ¶
func (item BlockMapItem) Checksum() string
func (BlockMapItem) IsValid ¶
func (item BlockMapItem) IsValid([]byte) error
func (BlockMapItem) MarshalJSON ¶
func (item BlockMapItem) MarshalJSON() ([]byte, error)
func (BlockMapItem) Type ¶
func (item BlockMapItem) Type() base.BlockItemType
func (*BlockMapItem) UnmarshalJSON ¶
func (item *BlockMapItem) UnmarshalJSON(b []byte) error
type DefaultStatesMerger ¶
type DefaultStatesMerger struct {
// contains filtered or unexported fields
}
func NewDefaultStatesMerger ¶
func NewDefaultStatesMerger( height base.Height, getStateFunc base.GetStateFunc, workersize int64, ) *DefaultStatesMerger
func (*DefaultStatesMerger) Close ¶
func (sm *DefaultStatesMerger) Close() error
func (*DefaultStatesMerger) CloseStates ¶
func (*DefaultStatesMerger) Len ¶
func (sm *DefaultStatesMerger) Len() int
type ErrValidatedDifferentHeightBlockMaps ¶
type ErrValidatedDifferentHeightBlockMaps struct { *util.IDError // contains filtered or unexported fields }
func (*ErrValidatedDifferentHeightBlockMaps) DatabaseHeight ¶
func (er *ErrValidatedDifferentHeightBlockMaps) DatabaseHeight() base.Height
func (*ErrValidatedDifferentHeightBlockMaps) Errorf ¶
func (er *ErrValidatedDifferentHeightBlockMaps) Errorf( format string, args ...interface{}, ) *ErrValidatedDifferentHeightBlockMaps
func (*ErrValidatedDifferentHeightBlockMaps) LocalFSHeight ¶
func (er *ErrValidatedDifferentHeightBlockMaps) LocalFSHeight() base.Height
func (*ErrValidatedDifferentHeightBlockMaps) WithMessage ¶
func (er *ErrValidatedDifferentHeightBlockMaps) WithMessage(err error, format string, args ...interface{}) error
func (*ErrValidatedDifferentHeightBlockMaps) WithStack ¶
func (er *ErrValidatedDifferentHeightBlockMaps) WithStack() *ErrValidatedDifferentHeightBlockMaps
func (*ErrValidatedDifferentHeightBlockMaps) Wrap ¶
func (er *ErrValidatedDifferentHeightBlockMaps) Wrap(err error) error
type FSWriter ¶
type FSWriter interface { SetProposal(context.Context, base.ProposalSignFact) error SetOperation(_ context.Context, total, index uint64, _ base.Operation) error SetOperationsTree(context.Context, fixedtree.Tree) error SetState(_ context.Context, total, index uint64, _ base.State) error SetStatesTree(context.Context, fixedtree.Tree) error SetManifest(context.Context, base.Manifest) error SetINITVoteproof(context.Context, base.INITVoteproof) error SetACCEPTVoteproof(context.Context, base.ACCEPTVoteproof) error Save(context.Context) (base.BlockMap, error) Cancel() error }
type ItemReader ¶
type ItemReader struct {
// contains filtered or unexported fields
}
func (*ItemReader) Decode ¶
func (r *ItemReader) Decode() (interface{}, error)
func (*ItemReader) DecodeItems ¶
func (*ItemReader) Encoder ¶
func (r *ItemReader) Encoder() encoder.Encoder
func (*ItemReader) Reader ¶
func (r *ItemReader) Reader() *util.CompressedReader
func (*ItemReader) Type ¶
func (r *ItemReader) Type() base.BlockItemType
type LocalFSImporter ¶
type LocalFSImporter struct {
// contains filtered or unexported fields
}
func NewLocalFSImporter ¶
func (*LocalFSImporter) Cancel ¶
func (l *LocalFSImporter) Cancel() error
func (*LocalFSImporter) Save ¶
func (l *LocalFSImporter) Save() error
func (*LocalFSImporter) WriteItem ¶
func (l *LocalFSImporter) WriteItem( t base.BlockItemType, enc hint.Hint, compressFormat string, ) (io.WriteCloser, error)
type LocalFSWriter ¶
type LocalFSWriter struct { hint.BaseHinter // contains filtered or unexported fields }
func NewLocalFSWriter ¶
func (*LocalFSWriter) Cancel ¶
func (w *LocalFSWriter) Cancel() error
func (*LocalFSWriter) SetACCEPTVoteproof ¶
func (w *LocalFSWriter) SetACCEPTVoteproof(_ context.Context, vp base.ACCEPTVoteproof) error
func (*LocalFSWriter) SetINITVoteproof ¶
func (w *LocalFSWriter) SetINITVoteproof(_ context.Context, vp base.INITVoteproof) error
func (*LocalFSWriter) SetManifest ¶
func (*LocalFSWriter) SetOperation ¶
func (*LocalFSWriter) SetOperationsTree ¶
func (*LocalFSWriter) SetProposal ¶
func (w *LocalFSWriter) SetProposal(_ context.Context, pr base.ProposalSignFact) error
func (*LocalFSWriter) SetStatesTree ¶
type StatesMerger ¶
type StatesMerger interface { SetStates(_ context.Context, opindex uint64, _ []base.StateMergeValue, operationfacthash util.Hash) error CloseStates( _ context.Context, beforeClose func(keyscount uint64) error, oneState func(newState base.State, total, index uint64) error, ) error Len() int Close() error }
type SuffrageProof ¶
type SuffrageProof struct { hint.BaseHinter // contains filtered or unexported fields }
func NewSuffrageProof ¶
func (*SuffrageProof) DecodeJSON ¶
func (s *SuffrageProof) DecodeJSON(b []byte, enc encoder.Encoder) error
func (SuffrageProof) IsValid ¶
func (s SuffrageProof) IsValid(b []byte) error
func (SuffrageProof) Map ¶
func (s SuffrageProof) Map() base.BlockMap
func (SuffrageProof) MarshalJSON ¶
func (s SuffrageProof) MarshalJSON() ([]byte, error)
func (SuffrageProof) Proof ¶
func (s SuffrageProof) Proof() fixedtree.Proof
func (SuffrageProof) Prove ¶
func (s SuffrageProof) Prove(previousState base.State) error
Prove should be called after IsValid().
func (SuffrageProof) State ¶
func (s SuffrageProof) State() base.State
func (SuffrageProof) SuffrageHeight ¶
func (s SuffrageProof) SuffrageHeight() base.Height
type SuffrageProofJSONUnmarshaler ¶
type SuffrageProofJSONUnmarshaler struct { Map json.RawMessage `json:"map"` State json.RawMessage `json:"state"` Proof fixedtree.Proof `json:"proof"` }
type Writer ¶
func NewWriter ¶
func NewWriter( proposal base.ProposalSignFact, getStateFunc base.GetStateFunc, db isaac.BlockWriteDatabase, mergeDatabase func(isaac.BlockWriteDatabase) error, fswriter FSWriter, workersize int64, ) *Writer
func (*Writer) SetACCEPTVoteproof ¶
func (*Writer) SetINITVoteproof ¶
func (*Writer) SetOperationsSize ¶
func (*Writer) SetProcessResult ¶
Click to show internal directories.
Click to hide internal directories.