-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnector.go
44 lines (36 loc) · 1.52 KB
/
connector.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package fabric_connector
import (
"context"
pb "github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab"
)
type SdkProvider interface {
ChannelOperator
ChainCodeAdminOperator
ChainCodeUserOperator
EventCallBack
}
type ChannelOperator interface {
CreateChannel(channelID string) (txID string, err error)
JoinChannel(channelID string) error
}
type ChainCodeAdminOperator interface {
InstallChainCode(ccID, ccVersion, ccPath string) error
InstantiateChainCode(channelID, ccID, ccVersion, ccPath, ccPolicy string, args [][]byte) (txID string, err error)
UpgradeChainCode(channelID, ccID, ccVersion, ccPath, ccPolicy string, args [][]byte) (txID string, err error)
}
type ChainCodeUserOperator interface {
InvokeChainCode(channelID, ccID, function string, args [][]byte) (payload []byte, txID string, err error)
QueryChainCode(channelID, ccID, function string, args [][]byte) (payload []byte, err error)
QueryTransaction(channelID string, transactionID fab.TransactionID) (*pb.ProcessedTransaction, error)
}
type EventCallBack interface {
RegisterBlockEvent(ctx context.Context, channelID string, event BlockEventWithTransaction) error
}
type Gateway interface {
EventCallBack
SubmitTransaction(channelID, ccID, function string, args []string) (payload []byte, err error)
EvaluateTransaction(channelID, ccID, function string, args []string) (payload []byte, err error)
RegisterChaincodeEvent(ctx context.Context, channelID, ccID, eventID string, event ChaincodeEvent) error
Close()
}