forked from hyperledger/fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
orderer.go
103 lines (83 loc) · 2.89 KB
/
orderer.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
Copyright IBM Corp. 2016 All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package config
import (
"time"
"github.com/hyperledger/fabric/common/channelconfig"
ab "github.com/hyperledger/fabric/protos/orderer"
)
// Orderer is a mock implementation of channelconfig.Orderer
type Orderer struct {
// ConsensusTypeVal is returned as the result of ConsensusType()
ConsensusTypeVal string
// BatchSizeVal is returned as the result of BatchSize()
BatchSizeVal *ab.BatchSize
// BatchTimeoutVal is returned as the result of BatchTimeout()
BatchTimeoutVal time.Duration
// KafkaBrokersVal is returned as the result of KafkaBrokers()
KafkaBrokersVal []string
// MaxChannelsCountVal is returns as the result of MaxChannelsCount()
MaxChannelsCountVal uint64
// OrganizationsVal is returned as the result of Organizations()
OrganizationsVal map[string]channelconfig.Org
// CapabilitiesVal is returned as the result of Capabilities()
CapabilitiesVal channelconfig.OrdererCapabilities
}
// ConsensusType returns the ConsensusTypeVal
func (scm *Orderer) ConsensusType() string {
return scm.ConsensusTypeVal
}
// BatchSize returns the BatchSizeVal
func (scm *Orderer) BatchSize() *ab.BatchSize {
return scm.BatchSizeVal
}
// BatchTimeout returns the BatchTimeoutVal
func (scm *Orderer) BatchTimeout() time.Duration {
return scm.BatchTimeoutVal
}
// KafkaBrokers returns the KafkaBrokersVal
func (scm *Orderer) KafkaBrokers() []string {
return scm.KafkaBrokersVal
}
// MaxChannelsCount returns the MaxChannelsCountVal
func (scm *Orderer) MaxChannelsCount() uint64 {
return scm.MaxChannelsCountVal
}
// Organizations returns OrganizationsVal
func (scm *Orderer) Organizations() map[string]channelconfig.Org {
return scm.OrganizationsVal
}
// Capabilities returns CapabilitiesVal
func (scm *Orderer) Capabilities() channelconfig.OrdererCapabilities {
return scm.CapabilitiesVal
}
// OrdererCapabilities mocks the channelconfig.OrdererCapabilities interface
type OrdererCapabilities struct {
// SupportedErr is returned by Supported()
SupportedErr error
// PredictableChannelTemplateVal is returned by PredictableChannelTemplate()
PredictableChannelTemplateVal bool
// ResubmissionVal is returned by Resubmission()
ResubmissionVal bool
// ExpirationVal is returned by ExpirationCheck()
ExpirationVal bool
}
// Supported returns SupportedErr
func (oc *OrdererCapabilities) Supported() error {
return oc.SupportedErr
}
// PredictableChannelTemplate returns PredictableChannelTemplateVal
func (oc *OrdererCapabilities) PredictableChannelTemplate() bool {
return oc.PredictableChannelTemplateVal
}
// Resubmission returns ResubmissionVal
func (oc *OrdererCapabilities) Resubmission() bool {
return oc.ResubmissionVal
}
// ExpirationCheck specifies whether the orderer checks for identity expiration checks
// when validating messages
func (oc *OrdererCapabilities) ExpirationCheck() bool {
return oc.ExpirationVal
}