forked from hyperledger/fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
support.go
39 lines (30 loc) · 916 Bytes
/
support.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
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package peer
import (
"github.com/hyperledger/fabric/common/channelconfig"
)
var supportFactory SupportFactory
// SupportFactory is a factory of Support interfaces
type SupportFactory interface {
// NewSupport returns a Support interface
NewSupport() Support
}
// Support gives access to peer resources and avoids calls to static methods
type Support interface {
// GetApplicationConfig returns the configtxapplication.SharedConfig for the channel
// and whether the Application config exists
GetApplicationConfig(cid string) (channelconfig.Application, bool)
}
type supportImpl struct {
operations Operations
}
func (s *supportImpl) GetApplicationConfig(cid string) (channelconfig.Application, bool) {
cc := s.operations.GetChannelConfig(cid)
if cc == nil {
return nil, false
}
return cc.ApplicationConfig()
}