-
Notifications
You must be signed in to change notification settings - Fork 0
/
querytype.go
40 lines (34 loc) · 920 Bytes
/
querytype.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
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
/*
Notice: This file has been modified for Hyperledger Fabric SDK Go usage.
Please review third_party pinning scripts and patches for more details.
*/
package protoext
import "github.com/hyperledger/fabric-protos-go/discovery"
// QueryType defines the types of service discovery requests
type QueryType uint8
const (
InvalidQueryType QueryType = iota
ConfigQueryType
PeerMembershipQueryType
ChaincodeQueryType
LocalMembershipQueryType
)
// GetType returns the type of the request
func GetQueryType(q *discovery.Query) QueryType {
switch {
case q.GetCcQuery() != nil:
return ChaincodeQueryType
case q.GetConfigQuery() != nil:
return ConfigQueryType
case q.GetPeerQuery() != nil:
return PeerMembershipQueryType
case q.GetLocalPeers() != nil:
return LocalMembershipQueryType
default:
return InvalidQueryType
}
}