|
| 1 | +/* |
| 2 | +Copyright IBM Corp. 2017 All Rights Reserved. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package mgmt |
| 18 | + |
| 19 | +import ( |
| 20 | + "github.com/hyperledger/fabric/msp" |
| 21 | +) |
| 22 | + |
| 23 | +// DeserializersManager is a support interface to |
| 24 | +// access the local and channel deserializers |
| 25 | +type DeserializersManager interface { |
| 26 | + |
| 27 | + // GetLocalMSPIdentifier returns the local MSP identifier |
| 28 | + GetLocalMSPIdentifier() string |
| 29 | + |
| 30 | + // GetLocalDeserializer returns the local identity deserializer |
| 31 | + GetLocalDeserializer() msp.IdentityDeserializer |
| 32 | + |
| 33 | + // GetChannelDeserializers returns a map of the channel deserializers |
| 34 | + GetChannelDeserializers() map[string]msp.IdentityDeserializer |
| 35 | +} |
| 36 | + |
| 37 | +// DeserializersManager returns a new instance of DeserializersManager |
| 38 | +func NewDeserializersManager() DeserializersManager { |
| 39 | + return &mspDeserializersManager{} |
| 40 | +} |
| 41 | + |
| 42 | +type mspDeserializersManager struct{} |
| 43 | + |
| 44 | +func (m *mspDeserializersManager) GetLocalMSPIdentifier() string { |
| 45 | + id, _ := GetLocalMSP().GetIdentifier() |
| 46 | + return id |
| 47 | +} |
| 48 | + |
| 49 | +func (m *mspDeserializersManager) GetLocalDeserializer() msp.IdentityDeserializer { |
| 50 | + return GetLocalMSP() |
| 51 | +} |
| 52 | + |
| 53 | +func (m *mspDeserializersManager) GetChannelDeserializers() map[string]msp.IdentityDeserializer { |
| 54 | + return GetDeserializers() |
| 55 | +} |
0 commit comments