Documentation
¶
Index ¶
- Variables
- func GetRegisteredContractInfo() map[string]*ContractInfo
- func RegisterContractConstructor(name string, addr *types.Address, f ContractConstructor)
- func RegisterExecutorConstructor(typ string, f TxsExecutorConstructor)
- func RegisterLicenseConstructor(typ string, f LicenseConstructor)
- func RegisterOffchainTransmissionConstructor(typ string, f OffchainTransmissionConstructor)
- func RegisterOrderConstructor(typ string, f OrderConstructor)
- func RegisterPierHAConstructor(typ string, f PierHAConstructor)
- func RegisterRegistryConstructor(typ string, f RegistryConstructor)
- type ApplyTxFunc
- type Client
- type ConfigOption
- type Contract
- type ContractConstructor
- type ContractInfo
- type DHTManager
- type HAClient
- type InvalidReason
- type License
- type LicenseConstructor
- type OffChainTransmission
- type OffchainTransmissionConstructor
- type OrderConstructor
- type PeerManager
- type PierHA
- type PierHAConstructor
- type RegisterContractFunc
- type Registry
- type RegistryConstructor
- type TxOpt
- type TxsExecutor
- type TxsExecutorConstructor
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TxsExecutorConstructorM = make(map[string]TxsExecutorConstructor) ContractConstructorM = make(map[string]*ContractInfo) RegisterConstructorM = make(map[string]RegistryConstructor) LicenseConstructorM = make(map[string]LicenseConstructor) PierHAConstructorM = make(map[string]PierHAConstructor) OrderConstructorM = make(map[string]OrderConstructor) OffchainTransmissionContructorM = make(map[string]OffchainTransmissionConstructor) )
Functions ¶
func GetRegisteredContractInfo ¶
func GetRegisteredContractInfo() map[string]*ContractInfo
func RegisterContractConstructor ¶
func RegisterContractConstructor(name string, addr *types.Address, f ContractConstructor)
func RegisterExecutorConstructor ¶
func RegisterExecutorConstructor(typ string, f TxsExecutorConstructor)
func RegisterLicenseConstructor ¶
func RegisterLicenseConstructor(typ string, f LicenseConstructor)
func RegisterOffchainTransmissionConstructor ¶
func RegisterOffchainTransmissionConstructor(typ string, f OffchainTransmissionConstructor)
func RegisterOrderConstructor ¶
func RegisterOrderConstructor(typ string, f OrderConstructor)
func RegisterPierHAConstructor ¶
func RegisterPierHAConstructor(typ string, f PierHAConstructor)
func RegisterRegistryConstructor ¶
func RegisterRegistryConstructor(typ string, f RegistryConstructor)
Types ¶
type ApplyTxFunc ¶
type ApplyTxFunc func(int, pb.Transaction, InvalidReason, *TxOpt) *pb.Receipt
type Client ¶
type Client interface {
// Initialize initialize plugin client
Initialize(configPath string, extra []byte, mode string) error
// Start starts to listen appchain event
Start() error
// Stop stops client
Stop() error
// GetIBTPCh gets an interchain ibtp channel generated by client
GetIBTPCh() chan *pb.IBTP
// GetUpdateMeta gets an updated trust meta channel by client
GetUpdateMeta() chan *pb.UpdateMeta
// SubmitIBTP submits the interchain ibtp to appchain
SubmitIBTP(from string, index uint64, serviceID string, ibtpType pb.IBTP_Type, content *pb.Content, proof *pb.BxhProof, isEncrypted bool) (*pb.SubmitIBTPResponse, error)
// SubmitIBTPBatch submit the multi interchain ibtps to appchain
SubmitIBTPBatch(from []string, index []uint64, serviceID []string, ibtpType []pb.IBTP_Type, content []*pb.Content, proof []*pb.BxhProof, isEncrypted []bool) (*pb.SubmitIBTPResponse, error)
// SubmitReceipt submit the multi receipt ibtp to appchain
SubmitReceipt(to string, index uint64, serviceID string, ibtpType pb.IBTP_Type, result *pb.Result, proof *pb.BxhProof) (*pb.SubmitIBTPResponse, error)
// SubmitReceiptBatch submit the receipt ibtp to appchain
SubmitReceiptBatch(to []string, index []uint64, serviceID []string, ibtpType []pb.IBTP_Type, result []*pb.Result, proof []*pb.BxhProof) (*pb.SubmitIBTPResponse, error)
// GetOutMessage gets interchain ibtp by service pair and index from broker contract
GetOutMessage(servicePair string, idx uint64) (*pb.IBTP, error)
// GetReceiptMessage gets receipt ibtp by service pair and index from broker contract
GetReceiptMessage(servicePair string, idx uint64) (*pb.IBTP, error)
// GetInMeta gets an index map, which implicates the greatest index of
// ingoing interchain txs for each service pair
GetInMeta() (map[string]uint64, error)
// GetOutMeta gets an index map, which implicates the greatest index of
// outgoing interchain txs for each service pair
GetOutMeta() (map[string]uint64, error)
// GetReceiptMeta gets an index map, which implicates the greatest index of
// executed callback txs for each service pair
GetCallbackMeta() (map[string]uint64, error)
// GetDstRollbackMeta gets an index map, which implicates the greatest index of
// executed rollback txs from each service pair
GetDstRollbackMeta() (map[string]uint64, error)
// GetDirectTransactionMeta gets transaction start timestamp, timeout period and transaction status in direct mode
GetDirectTransactionMeta(string) (uint64, uint64, uint64, error)
// GetServices gets all service IDs the pier cares
GetServices() ([]string, error)
// GetChainID gets BitXHub and appchain ID
GetChainID() (string, string, error)
// GetAppchainInfo gets appchain information by appchain ID
GetAppchainInfo(chainID string) (string, []byte, string, error)
// Name gets name of blockchain from plugin
Name() string
// Type gets type of blockchain from plugin
Type() string
// GetOffChainData get offchain data and send back
GetOffChainData(request *pb.GetDataRequest) (*pb.GetDataResponse, error)
// GetOffChainDataReq get offchain data request
GetOffChainDataReq() chan *pb.GetDataRequest
// SubmitOffChainData submit offchain data to plugin
SubmitOffChainData(response *pb.GetDataResponse) error
}
Client defines the interface that interacts with appchain
type ConfigOption ¶
type ConfigOption interface{}
type ContractConstructor ¶
type ContractConstructor func() Contract
type ContractInfo ¶
type ContractInfo struct {
Name string
Constructor ContractConstructor
}
func GetContractInfo ¶
func GetContractInfo(addr *types.Address) (*ContractInfo, error)
type DHTManager ¶
type DHTManager interface {
// FindProviders Search for peers who are able to provide a given key
FindProviders(id string) (string, error)
// Provider adds the given cid to the content routing system. If 'true' is
// passed, it also announces it, otherwise it is just kept in the local
// accounting of which objects are being provided.
Provider(string, bool) error
}
type HAClient ¶
type HAClient interface {
//Check whethe there is a master pier connect to the BitXHub.
CheckMasterPier(address string) (*pb.Response, error)
//Set the master pier connect to the BitXHub.
SetMasterPier(address string, index string, timeout int64) (*pb.Response, error)
//Update the master pier status
HeartBeat(address string, index string) (*pb.Response, error)
}
type InvalidReason ¶
type InvalidReason string
type LicenseConstructor ¶
func GetLicenseConstructor ¶
func GetLicenseConstructor(typ string) (LicenseConstructor, error)
type OffChainTransmission ¶
type OffchainTransmissionConstructor ¶
type OffchainTransmissionConstructor func(appchainID string, peerMgr PeerManager, client Client) OffChainTransmission
func GetOffchainTransmissionConstructor ¶
func GetOffchainTransmissionConstructor(typ string) (OffchainTransmissionConstructor, error)
type OrderConstructor ¶
func GetOrderConstructor ¶
func GetOrderConstructor(typ string) (OrderConstructor, error)
type PeerManager ¶
type PeerManager interface {
basicMgr.BasicPeerManager
DHTManager
Connect(info *peer.AddrInfo) (string, error)
// AsyncSendWithStream sends message using existed stream
AsyncSendWithStream(network.Stream, *pb.Message) error
// ConnectedPeerIDs find connectedPeers
ConnectedPeerIDs() []string
// RegisterMsgHandler
RegisterMsgHandler(pb.Message_Type, func(network.Stream, *pb.Message)) error
// RegisterMultiMsgHandler
RegisterMultiMsgHandler([]pb.Message_Type, func(network.Stream, *pb.Message)) error
// RegisterConnectHandler
RegisterConnectHandler(func(string)) error
}
type PierHAConstructor ¶
func GetPierHAConstructor ¶
func GetPierHAConstructor(typ string) (PierHAConstructor, error)
type RegisterContractFunc ¶
type RegistryConstructor ¶
type RegistryConstructor func(storage.Storage, logrus.FieldLogger) Registry
func GetRegistryConstructor ¶
func GetRegistryConstructor(typ string) (RegistryConstructor, error)
type TxsExecutor ¶
type TxsExecutor interface {
ApplyTransactions(txs []pb.Transaction, invalidTxs map[int]InvalidReason) []*pb.Receipt
GetBoltContracts() map[string]Contract
AddNormalTx(hash *types.Hash)
GetNormalTxs() []*types.Hash
AddInterchainCounter(to string, index *pb.VerifiedIndex)
GetInterchainCounter() map[string][]*pb.VerifiedIndex
GetDescription() string
}
type TxsExecutorConstructor ¶
type TxsExecutorConstructor func(ApplyTxFunc, RegisterContractFunc, logrus.FieldLogger) TxsExecutor
func GetExecutorConstructor ¶
func GetExecutorConstructor(typ string) (TxsExecutorConstructor, error)
Click to show internal directories.
Click to hide internal directories.