Documentation ¶
Index ¶
- func ComputeMerkleRoot(hashes []*chainhash.Hash) *chainhash.Hash
- func DisableLog()
- func GetLogger() btclog.Logger
- func HashMerkleBranches(left *chainhash.Hash, right *chainhash.Hash) *chainhash.Hash
- func Log(s string)
- func LogOnce(s string)
- func NewOutPointFromString(str string) *wire.OutPoint
- func OutPointLess(a, b wire.OutPoint) bool
- func UseLogger(logger btclog.Logger)
- func Warn(s string)
- type BaseManager
- func (nm *BaseManager) AppendChange(chg change.Change)
- func (nm *BaseManager) ClearCache()
- func (nm *BaseManager) Close() error
- func (nm *BaseManager) DecrementHeightTo(affectedNames [][]byte, height int32) ([][]byte, error)
- func (nm *BaseManager) Flush() error
- func (nm *BaseManager) Hash(name []byte) (*chainhash.Hash, int32)
- func (nm *BaseManager) Height() int32
- func (nm *BaseManager) IncrementHeightTo(height int32, temporary bool) ([][]byte, error)
- func (nm *BaseManager) IterateNames(predicate func(name []byte) bool)
- func (nm *BaseManager) NodeAt(height int32, name []byte) (*Node, error)
- type Cache
- type Claim
- type ClaimList
- type HashV2Manager
- type Manager
- type Node
- type NormalizingManager
- type Repo
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.
func HashMerkleBranches ¶
func NewOutPointFromString ¶
func OutPointLess ¶
Types ¶
type BaseManager ¶
type BaseManager struct {
// contains filtered or unexported fields
}
func NewBaseManager ¶
func NewBaseManager(repo Repo) (*BaseManager, error)
func (*BaseManager) AppendChange ¶
func (nm *BaseManager) AppendChange(chg change.Change)
func (*BaseManager) ClearCache ¶
func (nm *BaseManager) ClearCache()
func (*BaseManager) Close ¶
func (nm *BaseManager) Close() error
func (*BaseManager) DecrementHeightTo ¶
func (nm *BaseManager) DecrementHeightTo(affectedNames [][]byte, height int32) ([][]byte, error)
func (*BaseManager) Flush ¶
func (nm *BaseManager) Flush() error
func (*BaseManager) Height ¶
func (nm *BaseManager) Height() int32
func (*BaseManager) IncrementHeightTo ¶
func (nm *BaseManager) IncrementHeightTo(height int32, temporary bool) ([][]byte, error)
func (*BaseManager) IterateNames ¶
func (nm *BaseManager) IterateNames(predicate func(name []byte) bool)
type Claim ¶
type Claim struct { OutPoint wire.OutPoint ClaimID change.ClaimID Amount int64 // CreatedAt int32 // the very first block, unused at present AcceptedAt int32 // the latest update height ActiveAt int32 // AcceptedAt + actual delay VisibleAt int32 Status Status `msgpack:",omitempty"` Sequence int32 `msgpack:",omitempty"` }
Claim defines a structure of stake, which could be a Claim or Support.
type HashV2Manager ¶
type HashV2Manager struct {
Manager
}
type Manager ¶
type Manager interface { AppendChange(chg change.Change) IncrementHeightTo(height int32, temporary bool) ([][]byte, error) DecrementHeightTo(affectedNames [][]byte, height int32) ([][]byte, error) Height() int32 Close() error NodeAt(height int32, name []byte) (*Node, error) IterateNames(predicate func(name []byte) bool) Hash(name []byte) (*chainhash.Hash, int32) Flush() error ClearCache() }
func NewNormalizingManager ¶
type Node ¶
type Node struct { BestClaim *Claim // The claim that has most effective amount at the current height. TakenOverAt int32 // The height at when the current BestClaim took over. Claims ClaimList // List of all Claims. Supports ClaimList // List of all Supports, including orphaned ones. SupportSums map[string]int64 }
func (*Node) AdjustTo ¶
AdjustTo activates claims and computes takeovers until it reaches the specified height.
func (*Node) HasActiveBestClaim ¶
func (Node) NextUpdate ¶
NextUpdate returns the nearest height in the future that the node should be refreshed due to changes of claims or supports.
func (*Node) SortClaimsByBid ¶
func (n *Node) SortClaimsByBid()
type NormalizingManager ¶
type NormalizingManager struct { Manager // contains filtered or unexported fields }
func (*NormalizingManager) AppendChange ¶
func (nm *NormalizingManager) AppendChange(chg change.Change)
func (*NormalizingManager) DecrementHeightTo ¶
func (nm *NormalizingManager) DecrementHeightTo(affectedNames [][]byte, height int32) ([][]byte, error)
func (*NormalizingManager) IncrementHeightTo ¶
func (nm *NormalizingManager) IncrementHeightTo(height int32, temporary bool) ([][]byte, error)
type Repo ¶
type Repo interface { // AppendChanges saves changes into the repo. // The changes can belong to different nodes, but the chronological // order must be preserved for the same node. AppendChanges(changes []change.Change) error // LoadChanges loads changes of a node up to (includes) the specified height. // If no changes found, both returned slice and error will be nil. LoadChanges(name []byte) ([]change.Change, error) DropChanges(name []byte, finalHeight int32) error // Close closes the repo. Close() error // IterateChildren returns change sets for each of name.+ // Return false on f to stop the iteration. IterateChildren(name []byte, f func(changes []change.Change) bool) error // IterateAll iterates keys until the predicate function returns false IterateAll(predicate func(name []byte) bool) Flush() error }
Repo defines APIs for Node to access persistence layer.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.