github.com/leonlxy/hyperledger@v1.0.0-alpha.0.20170427033203-34922035d248/protos/common/policies.pb.go (about) 1 // Code generated by protoc-gen-go. 2 // source: common/policies.proto 3 // DO NOT EDIT! 4 5 package common 6 7 import proto "github.com/golang/protobuf/proto" 8 import fmt "fmt" 9 import math "math" 10 import common1 "github.com/hyperledger/fabric/protos/msp" 11 12 // Reference imports to suppress errors if they are not otherwise used. 13 var _ = proto.Marshal 14 var _ = fmt.Errorf 15 var _ = math.Inf 16 17 type Policy_PolicyType int32 18 19 const ( 20 Policy_UNKNOWN Policy_PolicyType = 0 21 Policy_SIGNATURE Policy_PolicyType = 1 22 Policy_MSP Policy_PolicyType = 2 23 Policy_IMPLICIT_META Policy_PolicyType = 3 24 ) 25 26 var Policy_PolicyType_name = map[int32]string{ 27 0: "UNKNOWN", 28 1: "SIGNATURE", 29 2: "MSP", 30 3: "IMPLICIT_META", 31 } 32 var Policy_PolicyType_value = map[string]int32{ 33 "UNKNOWN": 0, 34 "SIGNATURE": 1, 35 "MSP": 2, 36 "IMPLICIT_META": 3, 37 } 38 39 func (x Policy_PolicyType) String() string { 40 return proto.EnumName(Policy_PolicyType_name, int32(x)) 41 } 42 func (Policy_PolicyType) EnumDescriptor() ([]byte, []int) { return fileDescriptor4, []int{0, 0} } 43 44 type ImplicitMetaPolicy_Rule int32 45 46 const ( 47 ImplicitMetaPolicy_ANY ImplicitMetaPolicy_Rule = 0 48 ImplicitMetaPolicy_ALL ImplicitMetaPolicy_Rule = 1 49 ImplicitMetaPolicy_MAJORITY ImplicitMetaPolicy_Rule = 2 50 ) 51 52 var ImplicitMetaPolicy_Rule_name = map[int32]string{ 53 0: "ANY", 54 1: "ALL", 55 2: "MAJORITY", 56 } 57 var ImplicitMetaPolicy_Rule_value = map[string]int32{ 58 "ANY": 0, 59 "ALL": 1, 60 "MAJORITY": 2, 61 } 62 63 func (x ImplicitMetaPolicy_Rule) String() string { 64 return proto.EnumName(ImplicitMetaPolicy_Rule_name, int32(x)) 65 } 66 func (ImplicitMetaPolicy_Rule) EnumDescriptor() ([]byte, []int) { return fileDescriptor4, []int{3, 0} } 67 68 // Policy expresses a policy which the orderer can evaluate, because there has been some desire expressed to support 69 // multiple policy engines, this is typed as a oneof for now 70 type Policy struct { 71 Type int32 `protobuf:"varint,1,opt,name=type" json:"type,omitempty"` 72 Policy []byte `protobuf:"bytes,2,opt,name=policy,proto3" json:"policy,omitempty"` 73 } 74 75 func (m *Policy) Reset() { *m = Policy{} } 76 func (m *Policy) String() string { return proto.CompactTextString(m) } 77 func (*Policy) ProtoMessage() {} 78 func (*Policy) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{0} } 79 80 // SignaturePolicyEnvelope wraps a SignaturePolicy and includes a version for future enhancements 81 type SignaturePolicyEnvelope struct { 82 Version int32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"` 83 Policy *SignaturePolicy `protobuf:"bytes,2,opt,name=policy" json:"policy,omitempty"` 84 Identities []*common1.MSPPrincipal `protobuf:"bytes,3,rep,name=identities" json:"identities,omitempty"` 85 } 86 87 func (m *SignaturePolicyEnvelope) Reset() { *m = SignaturePolicyEnvelope{} } 88 func (m *SignaturePolicyEnvelope) String() string { return proto.CompactTextString(m) } 89 func (*SignaturePolicyEnvelope) ProtoMessage() {} 90 func (*SignaturePolicyEnvelope) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{1} } 91 92 func (m *SignaturePolicyEnvelope) GetPolicy() *SignaturePolicy { 93 if m != nil { 94 return m.Policy 95 } 96 return nil 97 } 98 99 func (m *SignaturePolicyEnvelope) GetIdentities() []*common1.MSPPrincipal { 100 if m != nil { 101 return m.Identities 102 } 103 return nil 104 } 105 106 // SignaturePolicy is a recursive message structure which defines a featherweight DSL for describing 107 // policies which are more complicated than 'exactly this signature'. The NOutOf operator is sufficent 108 // to express AND as well as OR, as well as of course N out of the following M policies 109 // SignedBy implies that the signature is from a valid certificate which is signed by the trusted 110 // authority specified in the bytes. This will be the certificate itself for a self-signed certificate 111 // and will be the CA for more traditional certificates 112 type SignaturePolicy struct { 113 // Types that are valid to be assigned to Type: 114 // *SignaturePolicy_SignedBy 115 // *SignaturePolicy_NOutOf_ 116 Type isSignaturePolicy_Type `protobuf_oneof:"Type"` 117 } 118 119 func (m *SignaturePolicy) Reset() { *m = SignaturePolicy{} } 120 func (m *SignaturePolicy) String() string { return proto.CompactTextString(m) } 121 func (*SignaturePolicy) ProtoMessage() {} 122 func (*SignaturePolicy) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{2} } 123 124 type isSignaturePolicy_Type interface { 125 isSignaturePolicy_Type() 126 } 127 128 type SignaturePolicy_SignedBy struct { 129 SignedBy int32 `protobuf:"varint,1,opt,name=signed_by,json=signedBy,oneof"` 130 } 131 type SignaturePolicy_NOutOf_ struct { 132 NOutOf *SignaturePolicy_NOutOf `protobuf:"bytes,2,opt,name=n_out_of,json=nOutOf,oneof"` 133 } 134 135 func (*SignaturePolicy_SignedBy) isSignaturePolicy_Type() {} 136 func (*SignaturePolicy_NOutOf_) isSignaturePolicy_Type() {} 137 138 func (m *SignaturePolicy) GetType() isSignaturePolicy_Type { 139 if m != nil { 140 return m.Type 141 } 142 return nil 143 } 144 145 func (m *SignaturePolicy) GetSignedBy() int32 { 146 if x, ok := m.GetType().(*SignaturePolicy_SignedBy); ok { 147 return x.SignedBy 148 } 149 return 0 150 } 151 152 func (m *SignaturePolicy) GetNOutOf() *SignaturePolicy_NOutOf { 153 if x, ok := m.GetType().(*SignaturePolicy_NOutOf_); ok { 154 return x.NOutOf 155 } 156 return nil 157 } 158 159 // XXX_OneofFuncs is for the internal use of the proto package. 160 func (*SignaturePolicy) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { 161 return _SignaturePolicy_OneofMarshaler, _SignaturePolicy_OneofUnmarshaler, _SignaturePolicy_OneofSizer, []interface{}{ 162 (*SignaturePolicy_SignedBy)(nil), 163 (*SignaturePolicy_NOutOf_)(nil), 164 } 165 } 166 167 func _SignaturePolicy_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { 168 m := msg.(*SignaturePolicy) 169 // Type 170 switch x := m.Type.(type) { 171 case *SignaturePolicy_SignedBy: 172 b.EncodeVarint(1<<3 | proto.WireVarint) 173 b.EncodeVarint(uint64(x.SignedBy)) 174 case *SignaturePolicy_NOutOf_: 175 b.EncodeVarint(2<<3 | proto.WireBytes) 176 if err := b.EncodeMessage(x.NOutOf); err != nil { 177 return err 178 } 179 case nil: 180 default: 181 return fmt.Errorf("SignaturePolicy.Type has unexpected type %T", x) 182 } 183 return nil 184 } 185 186 func _SignaturePolicy_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { 187 m := msg.(*SignaturePolicy) 188 switch tag { 189 case 1: // Type.signed_by 190 if wire != proto.WireVarint { 191 return true, proto.ErrInternalBadWireType 192 } 193 x, err := b.DecodeVarint() 194 m.Type = &SignaturePolicy_SignedBy{int32(x)} 195 return true, err 196 case 2: // Type.n_out_of 197 if wire != proto.WireBytes { 198 return true, proto.ErrInternalBadWireType 199 } 200 msg := new(SignaturePolicy_NOutOf) 201 err := b.DecodeMessage(msg) 202 m.Type = &SignaturePolicy_NOutOf_{msg} 203 return true, err 204 default: 205 return false, nil 206 } 207 } 208 209 func _SignaturePolicy_OneofSizer(msg proto.Message) (n int) { 210 m := msg.(*SignaturePolicy) 211 // Type 212 switch x := m.Type.(type) { 213 case *SignaturePolicy_SignedBy: 214 n += proto.SizeVarint(1<<3 | proto.WireVarint) 215 n += proto.SizeVarint(uint64(x.SignedBy)) 216 case *SignaturePolicy_NOutOf_: 217 s := proto.Size(x.NOutOf) 218 n += proto.SizeVarint(2<<3 | proto.WireBytes) 219 n += proto.SizeVarint(uint64(s)) 220 n += s 221 case nil: 222 default: 223 panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) 224 } 225 return n 226 } 227 228 type SignaturePolicy_NOutOf struct { 229 N int32 `protobuf:"varint,1,opt,name=n" json:"n,omitempty"` 230 Policies []*SignaturePolicy `protobuf:"bytes,2,rep,name=policies" json:"policies,omitempty"` 231 } 232 233 func (m *SignaturePolicy_NOutOf) Reset() { *m = SignaturePolicy_NOutOf{} } 234 func (m *SignaturePolicy_NOutOf) String() string { return proto.CompactTextString(m) } 235 func (*SignaturePolicy_NOutOf) ProtoMessage() {} 236 func (*SignaturePolicy_NOutOf) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{2, 0} } 237 238 func (m *SignaturePolicy_NOutOf) GetPolicies() []*SignaturePolicy { 239 if m != nil { 240 return m.Policies 241 } 242 return nil 243 } 244 245 // ImplicitMetaPolicy is a policy type which depends on the hierarchical nature of the configuration 246 // It is implicit because the rule is generate implicitly based on the number of sub policies 247 // It is meta because it depends only on the result of other policies 248 // When evaluated, this policy iterates over all immediate child sub-groups, retrieves the policy 249 // of name sub_policy, evaluates the collection and applies the rule. 250 // For example, with 4 sub-groups, and a policy name of "foo", ImplicitMetaPolicy retrieves 251 // each sub-group, retrieves policy "foo" for each subgroup, evaluates it, and, in the case of ANY 252 // 1 satisfied is sufficient, ALL would require 4 signatures, and MAJORITY would require 3 signatures. 253 type ImplicitMetaPolicy struct { 254 SubPolicy string `protobuf:"bytes,1,opt,name=sub_policy,json=subPolicy" json:"sub_policy,omitempty"` 255 Rule ImplicitMetaPolicy_Rule `protobuf:"varint,2,opt,name=rule,enum=common.ImplicitMetaPolicy_Rule" json:"rule,omitempty"` 256 } 257 258 func (m *ImplicitMetaPolicy) Reset() { *m = ImplicitMetaPolicy{} } 259 func (m *ImplicitMetaPolicy) String() string { return proto.CompactTextString(m) } 260 func (*ImplicitMetaPolicy) ProtoMessage() {} 261 func (*ImplicitMetaPolicy) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{3} } 262 263 func init() { 264 proto.RegisterType((*Policy)(nil), "common.Policy") 265 proto.RegisterType((*SignaturePolicyEnvelope)(nil), "common.SignaturePolicyEnvelope") 266 proto.RegisterType((*SignaturePolicy)(nil), "common.SignaturePolicy") 267 proto.RegisterType((*SignaturePolicy_NOutOf)(nil), "common.SignaturePolicy.NOutOf") 268 proto.RegisterType((*ImplicitMetaPolicy)(nil), "common.ImplicitMetaPolicy") 269 proto.RegisterEnum("common.Policy_PolicyType", Policy_PolicyType_name, Policy_PolicyType_value) 270 proto.RegisterEnum("common.ImplicitMetaPolicy_Rule", ImplicitMetaPolicy_Rule_name, ImplicitMetaPolicy_Rule_value) 271 } 272 273 func init() { proto.RegisterFile("common/policies.proto", fileDescriptor4) } 274 275 var fileDescriptor4 = []byte{ 276 // 478 bytes of a gzipped FileDescriptorProto 277 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x52, 0xd1, 0x8e, 0xd2, 0x40, 278 0x14, 0x65, 0x00, 0x0b, 0x5c, 0x58, 0xad, 0x13, 0x15, 0xb2, 0x89, 0x4a, 0x1a, 0x63, 0x48, 0x4c, 279 0xda, 0x04, 0x7c, 0xf2, 0x0d, 0x94, 0xb8, 0x75, 0x69, 0x21, 0x03, 0x1b, 0xb3, 0xbe, 0x34, 0x14, 280 0x06, 0x76, 0x92, 0x32, 0x33, 0x69, 0xa7, 0x9b, 0xd4, 0xaf, 0xf0, 0xd9, 0xbf, 0xf1, 0xcf, 0x4c, 281 0x3b, 0xed, 0x66, 0x5d, 0xb3, 0x6f, 0xf7, 0xdc, 0x9e, 0x7b, 0xee, 0x39, 0x73, 0x0b, 0x2f, 0x77, 282 0xe2, 0x74, 0x12, 0xdc, 0x91, 0x22, 0x62, 0x3b, 0x46, 0x13, 0x5b, 0xc6, 0x42, 0x09, 0x6c, 0xe8, 283 0xf6, 0x79, 0xff, 0x94, 0x48, 0xe7, 0x94, 0xc8, 0x40, 0xc6, 0x8c, 0xef, 0x98, 0xdc, 0x46, 0x9a, 284 0x60, 0xfd, 0x04, 0x63, 0x95, 0x8f, 0x64, 0x18, 0x43, 0x53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6f, 0x1e, 0xf1, 0x66, 296 0xfb, 0xcb, 0x54, 0x2d, 0x0f, 0x17, 0x35, 0x62, 0xf0, 0xa2, 0x3a, 0xbf, 0x04, 0x43, 0xf7, 0x70, 297 0x0f, 0x50, 0x95, 0x19, 0x71, 0x3c, 0x81, 0x76, 0x75, 0xd2, 0x41, 0xbd, 0xb0, 0xfe, 0x68, 0xde, 298 0x3b, 0xe2, 0xcc, 0x80, 0x66, 0x7e, 0x18, 0xeb, 0x17, 0x02, 0xec, 0x9e, 0x64, 0xde, 0x55, 0x1e, 299 0x55, 0xdb, 0xbb, 0x18, 0x90, 0xa4, 0x61, 0x50, 0xbe, 0x62, 0xbe, 0xaa, 0x43, 0x3a, 0x49, 0x1a, 300 0x96, 0x9f, 0x27, 0xd0, 0x8c, 0xd3, 0x88, 0x16, 0x11, 0x9e, 0x8e, 0xdf, 0x56, 0xeb, 0xfe, 0x17, 301 0xb2, 0x49, 0x1a, 0x51, 0x52, 0x90, 0xad, 0xf7, 0xd0, 0xcc, 0x51, 0x7e, 0xef, 0xa9, 0x7f, 0x6d, 302 0xd6, 0x8a, 0x62, 0xb1, 0x30, 0x11, 0xee, 0x41, 0xdb, 0x9b, 0x7e, 0x5b, 0x12, 0x77, 0x73, 0x6d, 303 0xd6, 0x67, 0x6b, 0x78, 0x27, 0xe2, 0xa3, 0x7d, 0x93, 0x49, 0x1a, 0x47, 0x74, 0x7f, 0xa4, 0xb1, 304 0x7d, 0xd8, 0x86, 0x31, 0xdb, 0xe9, 0xff, 0x31, 0x29, 0xb7, 0xfd, 0xf8, 0x70, 0x64, 0xea, 0x26, 305 0x0d, 0x73, 0xe8, 0xdc, 0x23, 0x3b, 0x9a, 0xec, 0x68, 0xb2, 0xa3, 0xc9, 0xa1, 0x51, 0xc0, 0xc9, 306 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x94, 0x05, 0x25, 0xe5, 0x05, 0x03, 0x00, 0x00, 307 }