Documentation ¶
Index ¶
- Constants
- Variables
- type BCNType
- type BcMessage
- func (*BcMessage) Descriptor() ([]byte, []int)
- func (m *BcMessage) GetData() []byte
- func (m *BcMessage) GetType() BcMessageType
- func (*BcMessage) ProtoMessage()
- func (m *BcMessage) Reset()
- func (m *BcMessage) String() string
- func (m *BcMessage) XXX_DiscardUnknown()
- func (m *BcMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *BcMessage) XXX_Merge(src proto.Message)
- func (m *BcMessage) XXX_Size() int
- func (m *BcMessage) XXX_Unmarshal(b []byte) error
- type BcMessageType
- type BlockCache
- type BlockCacheImpl
- func (bc *BlockCacheImpl) Add(blk *block.Block) *BlockCacheNode
- func (bc *BlockCacheImpl) AddGenesis(blk *block.Block)
- func (bc *BlockCacheImpl) AddNodeToWAL(bcn *BlockCacheNode)
- func (bc *BlockCacheImpl) Del(bcn *BlockCacheNode)
- func (bc *BlockCacheImpl) Draw() string
- func (bc *BlockCacheImpl) GetBlockByHash(hash []byte) (*block.Block, error)
- func (bc *BlockCacheImpl) GetBlockByNumber(num int64) (*block.Block, error)
- func (bc *BlockCacheImpl) Head() *BlockCacheNode
- func (bc *BlockCacheImpl) Link(bcn *BlockCacheNode)
- func (bc *BlockCacheImpl) LinkedRoot() *BlockCacheNode
- func (bc *BlockCacheImpl) Recover(p ConAlgo) (err error)
- func (bc *BlockCacheImpl) SetHead(n *BlockCacheNode)
- func (bc *BlockCacheImpl) SetLinkedRoot(n *BlockCacheNode)
- func (bc *BlockCacheImpl) UpdateLib(node *BlockCacheNode)
- type BlockCacheNode
- type BlockCacheRaw
- func (*BlockCacheRaw) Descriptor() ([]byte, []int)
- func (m *BlockCacheRaw) GetBlockBytes() []byte
- func (m *BlockCacheRaw) GetSerialNum() int64
- func (m *BlockCacheRaw) GetWitnessList() *WitnessList
- func (*BlockCacheRaw) ProtoMessage()
- func (m *BlockCacheRaw) Reset()
- func (m *BlockCacheRaw) String() string
- func (m *BlockCacheRaw) XXX_DiscardUnknown()
- func (m *BlockCacheRaw) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *BlockCacheRaw) XXX_Merge(src proto.Message)
- func (m *BlockCacheRaw) XXX_Size() int
- func (m *BlockCacheRaw) XXX_Unmarshal(b []byte) error
- type CacheStatus
- type ConAlgo
- type UpdateActiveRaw
- func (*UpdateActiveRaw) Descriptor() ([]byte, []int)
- func (m *UpdateActiveRaw) GetBlockHashBytes() []byte
- func (m *UpdateActiveRaw) GetWitnessList() *WitnessList
- func (*UpdateActiveRaw) ProtoMessage()
- func (m *UpdateActiveRaw) Reset()
- func (m *UpdateActiveRaw) String() string
- func (m *UpdateActiveRaw) XXX_DiscardUnknown()
- func (m *UpdateActiveRaw) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *UpdateActiveRaw) XXX_Merge(src proto.Message)
- func (m *UpdateActiveRaw) XXX_Size() int
- func (m *UpdateActiveRaw) XXX_Unmarshal(b []byte) error
- type UpdateLinkedRootWitnessRaw
- func (*UpdateLinkedRootWitnessRaw) Descriptor() ([]byte, []int)
- func (m *UpdateLinkedRootWitnessRaw) GetBlockHashBytes() []byte
- func (m *UpdateLinkedRootWitnessRaw) GetLinkedRootWitness() []string
- func (*UpdateLinkedRootWitnessRaw) ProtoMessage()
- func (m *UpdateLinkedRootWitnessRaw) Reset()
- func (m *UpdateLinkedRootWitnessRaw) String() string
- func (m *UpdateLinkedRootWitnessRaw) XXX_DiscardUnknown()
- func (m *UpdateLinkedRootWitnessRaw) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *UpdateLinkedRootWitnessRaw) XXX_Merge(src proto.Message)
- func (m *UpdateLinkedRootWitnessRaw) XXX_Size() int
- func (m *UpdateLinkedRootWitnessRaw) XXX_Unmarshal(b []byte) error
- type WitnessInfo
- func (*WitnessInfo) Descriptor() ([]byte, []int)
- func (m *WitnessInfo) GetNetID() string
- func (*WitnessInfo) ProtoMessage()
- func (m *WitnessInfo) Reset()
- func (m *WitnessInfo) String() string
- func (m *WitnessInfo) XXX_DiscardUnknown()
- func (m *WitnessInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *WitnessInfo) XXX_Merge(src proto.Message)
- func (m *WitnessInfo) XXX_Size() int
- func (m *WitnessInfo) XXX_Unmarshal(b []byte) error
- type WitnessList
- func (wl *WitnessList) Active() []string
- func (wl *WitnessList) CopyWitness(n *BlockCacheNode)
- func (*WitnessList) Descriptor() ([]byte, []int)
- func (m *WitnessList) GetActiveWitnessList() []string
- func (m *WitnessList) GetPendingWitnessList() []string
- func (m *WitnessList) GetPendingWitnessNumber() int64
- func (m *WitnessList) GetWitnessInfo() []string
- func (wl *WitnessList) NetID() []string
- func (wl *WitnessList) Pending() []string
- func (*WitnessList) ProtoMessage()
- func (m *WitnessList) Reset()
- func (wl *WitnessList) SetActive(al []string)
- func (wl *WitnessList) SetPending(pl []string)
- func (m *WitnessList) String() string
- func (wl *WitnessList) UpdateInfo(mv db.MVCCDB, rules *version.Rules) error
- func (wl *WitnessList) UpdatePending(mv db.MVCCDB, rules *version.Rules) error
- func (m *WitnessList) XXX_DiscardUnknown()
- func (m *WitnessList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *WitnessList) XXX_Merge(src proto.Message)
- func (m *WitnessList) XXX_Size() int
- func (m *WitnessList) XXX_Unmarshal(b []byte) error
Constants ¶
const ( // DelSingleBlockTime ... DelSingleBlockTime int64 = 10 )
Variables ¶
var BcMessageType_name = map[int32]string{
0: "LinkType",
1: "UpdateActiveType",
2: "UpdateLinkedRootWitnessType",
}
var BcMessageType_value = map[string]int32{
"LinkType": 0,
"UpdateActiveType": 1,
"UpdateLinkedRootWitnessType": 2,
}
var (
BlockCacheWALDir = "./BlockCacheWAL"
)
The directory of block cache wal.
Functions ¶
This section is empty.
Types ¶
type BcMessage ¶
type BcMessage struct { Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` Type BcMessageType `protobuf:"varint,2,opt,name=type,proto3,enum=blockcache.BcMessageType" json:"type,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*BcMessage) Descriptor ¶
func (*BcMessage) GetType ¶
func (m *BcMessage) GetType() BcMessageType
func (*BcMessage) ProtoMessage ¶
func (*BcMessage) ProtoMessage()
func (*BcMessage) XXX_DiscardUnknown ¶
func (m *BcMessage) XXX_DiscardUnknown()
func (*BcMessage) XXX_Marshal ¶
func (*BcMessage) XXX_Unmarshal ¶
type BcMessageType ¶
type BcMessageType int32
const ( BcMessageType_LinkType BcMessageType = 0 BcMessageType_UpdateActiveType BcMessageType = 1 BcMessageType_UpdateLinkedRootWitnessType BcMessageType = 2 )
func (BcMessageType) EnumDescriptor ¶
func (BcMessageType) EnumDescriptor() ([]byte, []int)
func (BcMessageType) String ¶
func (x BcMessageType) String() string
type BlockCache ¶
type BlockCache interface { Add(*block.Block) *BlockCacheNode AddGenesis(*block.Block) Link(*BlockCacheNode) UpdateLib(*BlockCacheNode) Del(*BlockCacheNode) GetBlockByNumber(int64) (*block.Block, error) GetBlockByHash([]byte) (*block.Block, error) LinkedRoot() *BlockCacheNode Head() *BlockCacheNode Draw() string Recover(p ConAlgo) (err error) AddNodeToWAL(bcn *BlockCacheNode) }
BlockCache defines BlockCache's API
type BlockCacheImpl ¶
type BlockCacheImpl struct {
// contains filtered or unexported fields
}
BlockCacheImpl is the implementation of BlockCache
func NewBlockCache ¶
func NewBlockCache(conf *common.Config, bChain block.Chain, stateDB db.MVCCDB) (*BlockCacheImpl, error)
NewBlockCache return a new BlockCache instance
func (*BlockCacheImpl) Add ¶
func (bc *BlockCacheImpl) Add(blk *block.Block) *BlockCacheNode
Add is add a block
func (*BlockCacheImpl) AddGenesis ¶
func (bc *BlockCacheImpl) AddGenesis(blk *block.Block)
AddGenesis is add genesis block
func (*BlockCacheImpl) AddNodeToWAL ¶
func (bc *BlockCacheImpl) AddNodeToWAL(bcn *BlockCacheNode)
AddNodeToWAL add write node message to WAL
func (*BlockCacheImpl) Del ¶
func (bc *BlockCacheImpl) Del(bcn *BlockCacheNode)
Del is delete a block
func (*BlockCacheImpl) Draw ¶
func (bc *BlockCacheImpl) Draw() string
Draw returns the linkedroot's and singleroot's tree graph.
func (*BlockCacheImpl) GetBlockByHash ¶
func (bc *BlockCacheImpl) GetBlockByHash(hash []byte) (*block.Block, error)
GetBlockByHash get a block by hash
func (*BlockCacheImpl) GetBlockByNumber ¶
func (bc *BlockCacheImpl) GetBlockByNumber(num int64) (*block.Block, error)
GetBlockByNumber get a block by number
func (*BlockCacheImpl) Head ¶
func (bc *BlockCacheImpl) Head() *BlockCacheNode
Head return head of block cache
func (*BlockCacheImpl) Link ¶
func (bc *BlockCacheImpl) Link(bcn *BlockCacheNode)
Link call this when you run the block verify after Add() to ensure add single bcn to linkedRoot
func (*BlockCacheImpl) LinkedRoot ¶
func (bc *BlockCacheImpl) LinkedRoot() *BlockCacheNode
LinkedRoot return the root node
func (*BlockCacheImpl) Recover ¶
func (bc *BlockCacheImpl) Recover(p ConAlgo) (err error)
Recover recover previews block cache
func (*BlockCacheImpl) SetHead ¶
func (bc *BlockCacheImpl) SetHead(n *BlockCacheNode)
SetHead sets head blockcache node.
func (*BlockCacheImpl) SetLinkedRoot ¶
func (bc *BlockCacheImpl) SetLinkedRoot(n *BlockCacheNode)
SetLinkedRoot sets linked blockcache node.
func (*BlockCacheImpl) UpdateLib ¶
func (bc *BlockCacheImpl) UpdateLib(node *BlockCacheNode)
UpdateLib will update last inreversible block
type BlockCacheNode ¶
type BlockCacheNode struct { *block.Block WitnessList Children map[*BlockCacheNode]bool Type BCNType ValidWitness []string SerialNum int64 // contains filtered or unexported fields }
BlockCacheNode is the implementation of BlockCacheNode
func NewBCN ¶
func NewBCN(parent *BlockCacheNode, blk *block.Block) *BlockCacheNode
NewBCN return a new block cache node instance
func (*BlockCacheNode) GetParent ¶
func (bcn *BlockCacheNode) GetParent() *BlockCacheNode
GetParent returns the node's parent node.
func (*BlockCacheNode) SetParent ¶
func (bcn *BlockCacheNode) SetParent(p *BlockCacheNode)
SetParent sets the node's parent.
type BlockCacheRaw ¶
type BlockCacheRaw struct { BlockBytes []byte `protobuf:"bytes,1,opt,name=blockBytes,proto3" json:"blockBytes,omitempty"` WitnessList *WitnessList `protobuf:"bytes,2,opt,name=witnessList,proto3" json:"witnessList,omitempty"` SerialNum int64 `protobuf:"varint,3,opt,name=serialNum,proto3" json:"serialNum,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*BlockCacheRaw) Descriptor ¶
func (*BlockCacheRaw) Descriptor() ([]byte, []int)
func (*BlockCacheRaw) GetBlockBytes ¶
func (m *BlockCacheRaw) GetBlockBytes() []byte
func (*BlockCacheRaw) GetSerialNum ¶
func (m *BlockCacheRaw) GetSerialNum() int64
func (*BlockCacheRaw) GetWitnessList ¶
func (m *BlockCacheRaw) GetWitnessList() *WitnessList
func (*BlockCacheRaw) ProtoMessage ¶
func (*BlockCacheRaw) ProtoMessage()
func (*BlockCacheRaw) Reset ¶
func (m *BlockCacheRaw) Reset()
func (*BlockCacheRaw) String ¶
func (m *BlockCacheRaw) String() string
func (*BlockCacheRaw) XXX_DiscardUnknown ¶
func (m *BlockCacheRaw) XXX_DiscardUnknown()
func (*BlockCacheRaw) XXX_Marshal ¶
func (m *BlockCacheRaw) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*BlockCacheRaw) XXX_Merge ¶
func (m *BlockCacheRaw) XXX_Merge(src proto.Message)
func (*BlockCacheRaw) XXX_Size ¶
func (m *BlockCacheRaw) XXX_Size() int
func (*BlockCacheRaw) XXX_Unmarshal ¶
func (m *BlockCacheRaw) XXX_Unmarshal(b []byte) error
type UpdateActiveRaw ¶
type UpdateActiveRaw struct { BlockHashBytes []byte `protobuf:"bytes,1,opt,name=blockHashBytes,proto3" json:"blockHashBytes,omitempty"` WitnessList *WitnessList `protobuf:"bytes,2,opt,name=witnessList,proto3" json:"witnessList,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*UpdateActiveRaw) Descriptor ¶
func (*UpdateActiveRaw) Descriptor() ([]byte, []int)
func (*UpdateActiveRaw) GetBlockHashBytes ¶
func (m *UpdateActiveRaw) GetBlockHashBytes() []byte
func (*UpdateActiveRaw) GetWitnessList ¶
func (m *UpdateActiveRaw) GetWitnessList() *WitnessList
func (*UpdateActiveRaw) ProtoMessage ¶
func (*UpdateActiveRaw) ProtoMessage()
func (*UpdateActiveRaw) Reset ¶
func (m *UpdateActiveRaw) Reset()
func (*UpdateActiveRaw) String ¶
func (m *UpdateActiveRaw) String() string
func (*UpdateActiveRaw) XXX_DiscardUnknown ¶
func (m *UpdateActiveRaw) XXX_DiscardUnknown()
func (*UpdateActiveRaw) XXX_Marshal ¶
func (m *UpdateActiveRaw) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*UpdateActiveRaw) XXX_Merge ¶
func (m *UpdateActiveRaw) XXX_Merge(src proto.Message)
func (*UpdateActiveRaw) XXX_Size ¶
func (m *UpdateActiveRaw) XXX_Size() int
func (*UpdateActiveRaw) XXX_Unmarshal ¶
func (m *UpdateActiveRaw) XXX_Unmarshal(b []byte) error
type UpdateLinkedRootWitnessRaw ¶
type UpdateLinkedRootWitnessRaw struct { LinkedRootWitness []string `protobuf:"bytes,1,rep,name=linkedRootWitness,proto3" json:"linkedRootWitness,omitempty"` BlockHashBytes []byte `protobuf:"bytes,2,opt,name=blockHashBytes,proto3" json:"blockHashBytes,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*UpdateLinkedRootWitnessRaw) Descriptor ¶
func (*UpdateLinkedRootWitnessRaw) Descriptor() ([]byte, []int)
func (*UpdateLinkedRootWitnessRaw) GetBlockHashBytes ¶
func (m *UpdateLinkedRootWitnessRaw) GetBlockHashBytes() []byte
func (*UpdateLinkedRootWitnessRaw) GetLinkedRootWitness ¶
func (m *UpdateLinkedRootWitnessRaw) GetLinkedRootWitness() []string
func (*UpdateLinkedRootWitnessRaw) ProtoMessage ¶
func (*UpdateLinkedRootWitnessRaw) ProtoMessage()
func (*UpdateLinkedRootWitnessRaw) Reset ¶
func (m *UpdateLinkedRootWitnessRaw) Reset()
func (*UpdateLinkedRootWitnessRaw) String ¶
func (m *UpdateLinkedRootWitnessRaw) String() string
func (*UpdateLinkedRootWitnessRaw) XXX_DiscardUnknown ¶
func (m *UpdateLinkedRootWitnessRaw) XXX_DiscardUnknown()
func (*UpdateLinkedRootWitnessRaw) XXX_Marshal ¶
func (m *UpdateLinkedRootWitnessRaw) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*UpdateLinkedRootWitnessRaw) XXX_Merge ¶
func (m *UpdateLinkedRootWitnessRaw) XXX_Merge(src proto.Message)
func (*UpdateLinkedRootWitnessRaw) XXX_Size ¶
func (m *UpdateLinkedRootWitnessRaw) XXX_Size() int
func (*UpdateLinkedRootWitnessRaw) XXX_Unmarshal ¶
func (m *UpdateLinkedRootWitnessRaw) XXX_Unmarshal(b []byte) error
type WitnessInfo ¶
type WitnessInfo struct { NetID string `protobuf:"bytes,1,opt,name=NetID,proto3" json:"NetID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*WitnessInfo) Descriptor ¶
func (*WitnessInfo) Descriptor() ([]byte, []int)
func (*WitnessInfo) GetNetID ¶
func (m *WitnessInfo) GetNetID() string
func (*WitnessInfo) ProtoMessage ¶
func (*WitnessInfo) ProtoMessage()
func (*WitnessInfo) Reset ¶
func (m *WitnessInfo) Reset()
func (*WitnessInfo) String ¶
func (m *WitnessInfo) String() string
func (*WitnessInfo) XXX_DiscardUnknown ¶
func (m *WitnessInfo) XXX_DiscardUnknown()
func (*WitnessInfo) XXX_Marshal ¶
func (m *WitnessInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*WitnessInfo) XXX_Merge ¶
func (m *WitnessInfo) XXX_Merge(src proto.Message)
func (*WitnessInfo) XXX_Size ¶
func (m *WitnessInfo) XXX_Size() int
func (*WitnessInfo) XXX_Unmarshal ¶
func (m *WitnessInfo) XXX_Unmarshal(b []byte) error
type WitnessList ¶
type WitnessList struct { ActiveWitnessList []string `protobuf:"bytes,1,rep,name=activeWitnessList,proto3" json:"activeWitnessList,omitempty"` PendingWitnessList []string `protobuf:"bytes,2,rep,name=pendingWitnessList,proto3" json:"pendingWitnessList,omitempty"` PendingWitnessNumber int64 `protobuf:"varint,3,opt,name=pendingWitnessNumber,proto3" json:"pendingWitnessNumber,omitempty"` WitnessInfo []string `protobuf:"bytes,4,rep,name=witnessInfo,proto3" json:"witnessInfo,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*WitnessList) Active ¶
func (wl *WitnessList) Active() []string
Active get active witness list
func (*WitnessList) CopyWitness ¶
func (wl *WitnessList) CopyWitness(n *BlockCacheNode)
CopyWitness is copy witness
func (*WitnessList) Descriptor ¶
func (*WitnessList) Descriptor() ([]byte, []int)
func (*WitnessList) GetActiveWitnessList ¶
func (m *WitnessList) GetActiveWitnessList() []string
func (*WitnessList) GetPendingWitnessList ¶
func (m *WitnessList) GetPendingWitnessList() []string
func (*WitnessList) GetPendingWitnessNumber ¶
func (m *WitnessList) GetPendingWitnessNumber() int64
func (*WitnessList) GetWitnessInfo ¶
func (m *WitnessList) GetWitnessInfo() []string
func (*WitnessList) Pending ¶
func (wl *WitnessList) Pending() []string
Pending get pending witness list
func (*WitnessList) ProtoMessage ¶
func (*WitnessList) ProtoMessage()
func (*WitnessList) Reset ¶
func (m *WitnessList) Reset()
func (*WitnessList) SetActive ¶
func (wl *WitnessList) SetActive(al []string)
SetActive set active witness list
func (*WitnessList) SetPending ¶
func (wl *WitnessList) SetPending(pl []string)
SetPending set pending witness list
func (*WitnessList) String ¶
func (m *WitnessList) String() string
func (*WitnessList) UpdateInfo ¶
UpdateInfo update pending witness list
func (*WitnessList) UpdatePending ¶
UpdatePending update pending witness list
func (*WitnessList) XXX_DiscardUnknown ¶
func (m *WitnessList) XXX_DiscardUnknown()
func (*WitnessList) XXX_Marshal ¶
func (m *WitnessList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*WitnessList) XXX_Merge ¶
func (m *WitnessList) XXX_Merge(src proto.Message)
func (*WitnessList) XXX_Size ¶
func (m *WitnessList) XXX_Size() int
func (*WitnessList) XXX_Unmarshal ¶
func (m *WitnessList) XXX_Unmarshal(b []byte) error