Documentation ¶
Overview ¶
Package isaacblock handles data of block.
Index ¶
- Variables
- func BlockFileName(t base.BlockMapItemType, hinttype string) (string, error)
- func CleanBlockTempDirectory(root string) error
- func FindHighestDirectory(root string) (highest string, found bool, _ error)
- func HeightDirectory(height base.Height) string
- func HeightFromDirectory(s string) (base.Height, error)
- func LoadBlockReader(readers *BlockReaders, encs *encoder.Encoders, writerhint, enchint hint.Hint, ...) (isaac.BlockReader, error)
- func LoadRawItems(f io.Reader, decode func([]byte) (interface{}, error), ...) error
- func LoadRawItemsWithWorker(f io.Reader, num uint64, decode func([]byte) (interface{}, error), ...) error
- func LoadTree(enc encoder.Encoder, item base.BlockMapItem, f io.Reader, ...) (tr fixedtree.Tree, err error)
- func LoadTreeHint(br *bufio.Reader) (ht hint.Hint, _ error)
- func LoadVoteproofsFromReader(r io.Reader, num uint64, decode func([]byte) (interface{}, error)) ([]base.Voteproof, error)
- func RemoveBlocksFromLocalFS(root string, height base.Height) (bool, error)
- type BlockImporter
- func (im *BlockImporter) CancelImport(context.Context) error
- func (im *BlockImporter) Reader() (isaac.BlockReader, error)
- func (im *BlockImporter) Save(context.Context) (func(context.Context) error, error)
- func (im *BlockImporter) WriteItem(t base.BlockMapItemType, r io.Reader) error
- func (im *BlockImporter) WriteMap(m base.BlockMap) error
- type BlockMap
- func (BlockMap) Bytes() []byte
- func (m *BlockMap) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (m BlockMap) Encoder() hint.Hint
- func (m BlockMap) IsValid(b []byte) error
- func (m BlockMap) Item(t base.BlockMapItemType) (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
- func (m BlockMap) Writer() hint.Hint
- type BlockMapItem
- func (item BlockMapItem) Checksum() string
- func (item BlockMapItem) IsValid([]byte) error
- func (item BlockMapItem) MarshalJSON() ([]byte, error)
- func (item BlockMapItem) Num() uint64
- func (item BlockMapItem) Type() base.BlockMapItemType
- func (item BlockMapItem) URL() *url.URL
- func (item *BlockMapItem) UnmarshalJSON(b []byte) error
- type BlockReaders
- type FSWriter
- type LocalFSImporter
- type LocalFSReader
- func (r *LocalFSReader) BlockMap() (base.BlockMap, bool, error)
- func (r *LocalFSReader) ChecksumReader(t base.BlockMapItemType) (util.ChecksumReader, bool, error)
- func (r *LocalFSReader) Close() error
- func (r *LocalFSReader) Item(t base.BlockMapItemType) (item interface{}, found bool, _ error)
- func (r *LocalFSReader) Items(f func(base.BlockMapItem, interface{}, bool, error) bool) error
- func (r *LocalFSReader) Reader(t base.BlockMapItemType) (io.ReadCloser, bool, error)
- func (r *LocalFSReader) UncompressedReader(t base.BlockMapItemType) (io.ReadCloser, bool, error)
- 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, _ uint64, op base.Operation) error
- func (w *LocalFSWriter) SetOperationsTree(ctx context.Context, tw *fixedtree.Writer) error
- func (w *LocalFSWriter) SetProposal(_ context.Context, pr base.ProposalSignFact) error
- func (w *LocalFSWriter) SetState(_ context.Context, _ uint64, st base.State) error
- func (w *LocalFSWriter) SetStatesTree(ctx context.Context, tw *fixedtree.Writer) (tr fixedtree.Tree, err error)
- type NewBlockReaderFunc
- type SuffrageProof
- func (s SuffrageProof) ACCEPTVoteproof() base.ACCEPTVoteproof
- func (s *SuffrageProof) DecodeJSON(b []byte, enc *jsonenc.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(ctx context.Context, vp base.ACCEPTVoteproof) error
- func (w *Writer) SetINITVoteproof(ctx 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) SetState(_ context.Context, stv base.StateMergeValue, operation base.Operation) error
- func (w *Writer) SetStates(ctx context.Context, index uint64, states []base.StateMergeValue, ...) error
Constants ¶
This section is empty.
Variables ¶
View Source
var BlockDirectoryHeightFormat = "%021s"
View Source
var BlockMapHint = hint.MustNewHint("blockmap-v0.0.1")
View Source
var (
BlockTempDirectoryPrefix = "temp"
)
View Source
var (
LocalBlockMapScheme = "file+block"
)
View Source
var LocalFSWriterHint = hint.MustNewHint("local-block-fs-writer-v0.0.1")
View Source
var SuffrageProofHint = hint.MustNewHint("suffrage-proof-v0.0.1")
Functions ¶
func BlockFileName ¶
func BlockFileName(t base.BlockMapItemType, hinttype string) (string, error)
func CleanBlockTempDirectory ¶
func FindHighestDirectory ¶
func HeightDirectory ¶
func LoadBlockReader ¶
func LoadBlockReader( readers *BlockReaders, encs *encoder.Encoders, writerhint, enchint hint.Hint, height base.Height, ) (isaac.BlockReader, error)
func LoadRawItems ¶
func LoadRawItemsWithWorker ¶
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) Reader ¶
func (im *BlockImporter) Reader() (isaac.BlockReader, error)
func (*BlockImporter) WriteItem ¶
func (im *BlockImporter) WriteItem(t base.BlockMapItemType, r io.Reader) error
type BlockMap ¶
type BlockMap struct { base.BaseNodeSign hint.BaseHinter // contains filtered or unexported fields }
func NewBlockMap ¶
func (BlockMap) Item ¶
func (m BlockMap) Item(t base.BlockMapItemType) (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.BlockMapItemType, u url.URL, checksum string, num uint64) BlockMapItem
func NewLocalBlockMapItem ¶
func NewLocalBlockMapItem(t base.BlockMapItemType, checksum string, num uint64) 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) Num ¶
func (item BlockMapItem) Num() uint64
func (BlockMapItem) Type ¶
func (item BlockMapItem) Type() base.BlockMapItemType
func (BlockMapItem) URL ¶
func (item BlockMapItem) URL() *url.URL
func (*BlockMapItem) UnmarshalJSON ¶
func (item *BlockMapItem) UnmarshalJSON(b []byte) error
type BlockReaders ¶
type BlockReaders struct {
*hint.CompatibleSet // NOTE handles NewBlockReaderFunc
}
func NewBlockReaders ¶
func NewBlockReaders() *BlockReaders
func (*BlockReaders) Find ¶
func (rs *BlockReaders) Find(writerhint hint.Hint) NewBlockReaderFunc
type FSWriter ¶
type FSWriter interface { SetProposal(context.Context, base.ProposalSignFact) error SetOperation(context.Context, uint64, base.Operation) error SetOperationsTree(context.Context, *fixedtree.Writer) error SetState(context.Context, uint64, base.State) error SetStatesTree(context.Context, *fixedtree.Writer) (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 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.BlockMapItemType) (io.WriteCloser, error)
type LocalFSReader ¶
type LocalFSReader struct {
// contains filtered or unexported fields
}
func NewLocalFSReader ¶
func NewLocalFSReader(root string, enc encoder.Encoder) (*LocalFSReader, error)
func (*LocalFSReader) ChecksumReader ¶
func (r *LocalFSReader) ChecksumReader(t base.BlockMapItemType) (util.ChecksumReader, bool, error)
func (*LocalFSReader) Close ¶
func (r *LocalFSReader) Close() error
func (*LocalFSReader) Item ¶
func (r *LocalFSReader) Item(t base.BlockMapItemType) (item interface{}, found bool, _ error)
func (*LocalFSReader) Items ¶
func (r *LocalFSReader) Items(f func(base.BlockMapItem, interface{}, bool, error) bool) error
func (*LocalFSReader) Reader ¶
func (r *LocalFSReader) Reader(t base.BlockMapItemType) (io.ReadCloser, bool, error)
func (*LocalFSReader) UncompressedReader ¶
func (r *LocalFSReader) UncompressedReader(t base.BlockMapItemType) (io.ReadCloser, bool, error)
type LocalFSWriter ¶
type LocalFSWriter struct { hint.BaseHinter sync.Mutex // 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 NewBlockReaderFunc ¶
type SuffrageProof ¶
type SuffrageProof struct { hint.BaseHinter // contains filtered or unexported fields }
func NewSuffrageProof ¶
func NewSuffrageProof( m base.BlockMap, st base.State, proof fixedtree.Proof, voteproof base.ACCEPTVoteproof, ) SuffrageProof
func (SuffrageProof) ACCEPTVoteproof ¶
func (s SuffrageProof) ACCEPTVoteproof() base.ACCEPTVoteproof
func (*SuffrageProof) DecodeJSON ¶
func (s *SuffrageProof) DecodeJSON(b []byte, enc *jsonenc.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 SuffrageProofJSONMarshaler ¶
type SuffrageProofJSONMarshaler struct { Map base.BlockMap `json:"map"` State base.State `json:"state"` Voteproof base.ACCEPTVoteproof `json:"voteproof"` Proof fixedtree.Proof `json:"proof"` hint.BaseHinter }
type SuffrageProofJSONUnmarshaler ¶
type SuffrageProofJSONUnmarshaler struct { Map json.RawMessage `json:"map"` State json.RawMessage `json:"state"` Proof fixedtree.Proof `json:"proof"` Voteproof json.RawMessage `json:"voteproof"` }
type Writer ¶
func NewWriter ¶
func NewWriter( proposal base.ProposalSignFact, getStateFunc base.GetStateFunc, db isaac.BlockWriteDatabase, mergeDatabase func(isaac.BlockWriteDatabase) error, fswriter FSWriter, ) *Writer
func (*Writer) SetACCEPTVoteproof ¶
func (*Writer) SetINITVoteproof ¶
func (*Writer) SetOperationsSize ¶
func (*Writer) SetProcessResult ¶
Click to show internal directories.
Click to hide internal directories.