Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- type FetchTxnRequest
- func (*FetchTxnRequest) Descriptor() ([]byte, []int)
- func (m *FetchTxnRequest) GetHeight() uint64
- func (m *FetchTxnRequest) GetMissingTxHashes() map[uint64]string
- func (m *FetchTxnRequest) GetReplicaId() uint64
- func (m *FetchTxnRequest) Marshal() (dAtA []byte, err error)
- func (m *FetchTxnRequest) MarshalTo(dAtA []byte) (int, error)
- func (*FetchTxnRequest) ProtoMessage()
- func (m *FetchTxnRequest) Reset()
- func (m *FetchTxnRequest) Size() (n int)
- func (m *FetchTxnRequest) String() string
- func (m *FetchTxnRequest) Unmarshal(dAtA []byte) error
- func (m *FetchTxnRequest) XXX_DiscardUnknown()
- func (m *FetchTxnRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FetchTxnRequest) XXX_Merge(src proto.Message)
- func (m *FetchTxnRequest) XXX_Size() int
- func (m *FetchTxnRequest) XXX_Unmarshal(b []byte) error
- type FetchTxnResponse
- func (*FetchTxnResponse) Descriptor() ([]byte, []int)
- func (m *FetchTxnResponse) GetHeight() uint64
- func (m *FetchTxnResponse) GetMissingTxnList() map[uint64]*pb.Transaction
- func (m *FetchTxnResponse) GetReplicaId() uint64
- func (m *FetchTxnResponse) Marshal() (dAtA []byte, err error)
- func (m *FetchTxnResponse) MarshalTo(dAtA []byte) (int, error)
- func (*FetchTxnResponse) ProtoMessage()
- func (m *FetchTxnResponse) Reset()
- func (m *FetchTxnResponse) Size() (n int)
- func (m *FetchTxnResponse) String() string
- func (m *FetchTxnResponse) Unmarshal(dAtA []byte) error
- func (m *FetchTxnResponse) XXX_DiscardUnknown()
- func (m *FetchTxnResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FetchTxnResponse) XXX_Merge(src proto.Message)
- func (m *FetchTxnResponse) XXX_Size() int
- func (m *FetchTxnResponse) XXX_Unmarshal(b []byte) error
- type LocalMissingTxnEvent
- type MemPool
- type TxCache
- type TxSlice
- func (*TxSlice) Descriptor() ([]byte, []int)
- func (m *TxSlice) GetTxList() []*pb.Transaction
- func (m *TxSlice) Marshal() (dAtA []byte, err error)
- func (m *TxSlice) MarshalTo(dAtA []byte) (int, error)
- func (*TxSlice) ProtoMessage()
- func (m *TxSlice) Reset()
- func (m *TxSlice) Size() (n int)
- func (m *TxSlice) String() string
- func (m *TxSlice) Unmarshal(dAtA []byte) error
- func (m *TxSlice) XXX_DiscardUnknown()
- func (m *TxSlice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TxSlice) XXX_Merge(src proto.Message)
- func (m *TxSlice) XXX_Size() int
- func (m *TxSlice) XXX_Unmarshal(b []byte) error
Constants ¶
View Source
const ( DefaultTestChainHeight = uint64(1) DefaultTestBatchSize = uint64(4) DefaultTestTxSetSize = uint64(1) LevelDBDir = "test-db" )
View Source
const ( DefaultPoolSize = 50000 DefaultTxCacheSize = 10000 DefaultBatchSize = 500 DefaultTxSetSize = 10 DefaultBatchTick = 500 * time.Millisecond DefaultTxSetTick = 100 * time.Millisecond DefaultFetchTxnTimeout = 3 * time.Second )
View Source
const ( StartReason1 = "first transaction set" StartReason2 = "finish executing a batch" StopReason1 = "generated a batch by batch timer" StopReason2 = "generated a batch by batch size" StopReason3 = "restart batch timer" )
batch timer reasons
Variables ¶
View Source
var ( ErrInvalidLengthMessage = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowMessage = fmt.Errorf("proto: integer overflow") )
View Source
var (
InterchainContractAddr = types.NewAddressByStr("000000000000000000000000000000000000000a")
)
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ID uint64
BatchSize uint64
PoolSize uint64
TxSliceSize uint64
BatchTick time.Duration
FetchTimeout time.Duration
TxSliceTimeout time.Duration
PeerMgr peermgr.PeerManager
GetTransactionFunc func(hash *types.Hash) (*pb.Transaction, error)
ChainHeight uint64
Logger logrus.FieldLogger
}
type FetchTxnRequest ¶
type FetchTxnRequest struct {
ReplicaId uint64 `protobuf:"varint,1,opt,name=replicaId,proto3" json:"replicaId,omitempty"`
Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
MissingTxHashes map[uint64]string `` /* 197-byte string literal not displayed */
}
func (*FetchTxnRequest) Descriptor ¶
func (*FetchTxnRequest) Descriptor() ([]byte, []int)
func (*FetchTxnRequest) GetHeight ¶
func (m *FetchTxnRequest) GetHeight() uint64
func (*FetchTxnRequest) GetMissingTxHashes ¶
func (m *FetchTxnRequest) GetMissingTxHashes() map[uint64]string
func (*FetchTxnRequest) GetReplicaId ¶
func (m *FetchTxnRequest) GetReplicaId() uint64
func (*FetchTxnRequest) Marshal ¶
func (m *FetchTxnRequest) Marshal() (dAtA []byte, err error)
func (*FetchTxnRequest) ProtoMessage ¶
func (*FetchTxnRequest) ProtoMessage()
func (*FetchTxnRequest) Reset ¶
func (m *FetchTxnRequest) Reset()
func (*FetchTxnRequest) Size ¶
func (m *FetchTxnRequest) Size() (n int)
func (*FetchTxnRequest) String ¶
func (m *FetchTxnRequest) String() string
func (*FetchTxnRequest) Unmarshal ¶
func (m *FetchTxnRequest) Unmarshal(dAtA []byte) error
func (*FetchTxnRequest) XXX_DiscardUnknown ¶
func (m *FetchTxnRequest) XXX_DiscardUnknown()
func (*FetchTxnRequest) XXX_Marshal ¶
func (m *FetchTxnRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*FetchTxnRequest) XXX_Merge ¶
func (m *FetchTxnRequest) XXX_Merge(src proto.Message)
func (*FetchTxnRequest) XXX_Size ¶
func (m *FetchTxnRequest) XXX_Size() int
func (*FetchTxnRequest) XXX_Unmarshal ¶
func (m *FetchTxnRequest) XXX_Unmarshal(b []byte) error
type FetchTxnResponse ¶
type FetchTxnResponse struct {
ReplicaId uint64 `protobuf:"varint,1,opt,name=replicaId,proto3" json:"replicaId,omitempty"`
Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
MissingTxnList map[uint64]*pb.Transaction `` /* 194-byte string literal not displayed */
}
func (*FetchTxnResponse) Descriptor ¶
func (*FetchTxnResponse) Descriptor() ([]byte, []int)
func (*FetchTxnResponse) GetHeight ¶
func (m *FetchTxnResponse) GetHeight() uint64
func (*FetchTxnResponse) GetMissingTxnList ¶
func (m *FetchTxnResponse) GetMissingTxnList() map[uint64]*pb.Transaction
func (*FetchTxnResponse) GetReplicaId ¶
func (m *FetchTxnResponse) GetReplicaId() uint64
func (*FetchTxnResponse) Marshal ¶
func (m *FetchTxnResponse) Marshal() (dAtA []byte, err error)
func (*FetchTxnResponse) ProtoMessage ¶
func (*FetchTxnResponse) ProtoMessage()
func (*FetchTxnResponse) Reset ¶
func (m *FetchTxnResponse) Reset()
func (*FetchTxnResponse) Size ¶
func (m *FetchTxnResponse) Size() (n int)
func (*FetchTxnResponse) String ¶
func (m *FetchTxnResponse) String() string
func (*FetchTxnResponse) Unmarshal ¶
func (m *FetchTxnResponse) Unmarshal(dAtA []byte) error
func (*FetchTxnResponse) XXX_DiscardUnknown ¶
func (m *FetchTxnResponse) XXX_DiscardUnknown()
func (*FetchTxnResponse) XXX_Marshal ¶
func (m *FetchTxnResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*FetchTxnResponse) XXX_Merge ¶
func (m *FetchTxnResponse) XXX_Merge(src proto.Message)
func (*FetchTxnResponse) XXX_Size ¶
func (m *FetchTxnResponse) XXX_Size() int
func (*FetchTxnResponse) XXX_Unmarshal ¶
func (m *FetchTxnResponse) XXX_Unmarshal(b []byte) error
type LocalMissingTxnEvent ¶
type MemPool ¶
type MemPool interface {
// Start starts mempool service.
Start() error
// Stop stops mempool service.
Stop()
// RecvTransaction receives transaction from API.
RecvTransaction(tx *pb.Transaction) error
// RecvForwardTxs receives transactions from other vp nodes.
RecvForwardTxs(txSlice *TxSlice)
// UpdateLeader updates the leader node info when the consensus module updates the leader status.
UpdateLeader(uint64)
// FetchTxn sends the fetching missing transactions request.
FetchTxn(lostTxnEvent *LocalMissingTxnEvent)
// RecvFetchTxnRequest receives the fetching missing transactions request,
// and load the related transactions from its mempool or storage.
RecvFetchTxnRequest(fetchTxnRequest *FetchTxnRequest)
// RecvFetchTxnResponse receives the fetching missing transactions response,
// and posts to consensus module.
RecvFetchTxnResponse(fetchTxnResponse *FetchTxnResponse)
// GetChainHeight gets the sequence number of block.
GetChainHeight() uint64
// IncreaseChainHeight increases the sequence number of block.
IncreaseChainHeight()
// GetBlock return the transactions list by given ready.
// If the corresponding transaction cannot be found, a list of missing transactions will be returned.
GetBlockByHashList(ready *raftproto.Ready) (map[uint64]string, []*pb.Transaction)
// Remove removes the committed transactions from mempool
CommitTransactions(ready *raftproto.Ready)
// GetPendingNonceByAccount will return the latest pending nonce of a given account
GetPendingNonceByAccount(account string) uint64
}
type TxSlice ¶
type TxSlice struct {
TxList []*pb.Transaction `protobuf:"bytes,1,rep,name=TxList,proto3" json:"TxList,omitempty"`
}
func (*TxSlice) Descriptor ¶
func (*TxSlice) GetTxList ¶
func (m *TxSlice) GetTxList() []*pb.Transaction
func (*TxSlice) ProtoMessage ¶
func (*TxSlice) ProtoMessage()
func (*TxSlice) XXX_DiscardUnknown ¶
func (m *TxSlice) XXX_DiscardUnknown()
func (*TxSlice) XXX_Marshal ¶
func (*TxSlice) XXX_Unmarshal ¶
Click to show internal directories.
Click to hide internal directories.