github.com/adnan-c/fabric_e2e_couchdb@v0.6.1-preview.0.20170228180935-21ce6b23cf91/protos/common/configtx.proto (about)

     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  // XXX This is the older mechanism for specifying channel configuration
    18  // it is intended to be removed once there is no more dependency on it.
    19  
    20  syntax = "proto3";
    21  
    22  import "common/common.proto";
    23  import "common/policies.proto";
    24  
    25  option go_package = "github.com/hyperledger/fabric/protos/common";
    26  
    27  package common;
    28  
    29  // ConfigEnvelope is designed to contain _all_ configuration for a chain with no dependency
    30  // on previous configuration transactions.
    31  //
    32  // It is generated with the following scheme:
    33  //   1. Retrieve the existing configuration
    34  //   2. Note the config properties (ConfigValue, ConfigPolicy, ConfigGroup) to be modified
    35  //   3. Add any intermediate ConfigGroups to the ConfigUpdate.read_set (sparsely)
    36  //   4. Add any additional desired dependencies to ConfigUpdate.read_set (sparsely)
    37  //   5. Modify the config properties, incrementing each version by 1, set them in the ConfigUpdate.write_set
    38  //      Note: any element not modified but specified should already be in the read_set, so may be specified sparsely
    39  //   6. Create ConfigUpdate message and marshal it into ConfigUpdateEnvelope.update and encode the required signatures
    40  //     a) Each signature is of type ConfigSignature
    41  //     b) The ConfigSignature signature is over the concatenation of signature_header and the ConfigUpdate bytes (which includes a ChainHeader)
    42  //   5. Submit new Config for ordering in Envelope signed by submitter
    43  //     a) The Envelope Payload has data set to the marshaled ConfigEnvelope
    44  //     b) The Envelope Payload has a header of type Header.Type.CONFIG_UPDATE
    45  //
    46  // The configuration manager will verify:
    47  //   1. All items in the read_set exist at the read versions
    48  //   2. All items in the write_set at a different version than, or not in, the read_set have been appropriately signed according to their mod_policy
    49  //   3. The new configuration satisfies the ConfigSchema
    50  message ConfigEnvelope {
    51      Config config = 1;        // A marshaled Config structure
    52      Envelope last_update = 2; // The last CONFIG_UPDATE message which generated this current configuration
    53                                // Note that CONFIG_UPDATE has a Payload.Data of a Marshaled ConfigUpdate
    54  }
    55  
    56  message ConfigGroupSchema {
    57      map<string, ConfigGroupSchema> groups = 1;
    58      map<string, ConfigValueSchema> values = 2;
    59      map<string, ConfigPolicySchema> policies = 3;
    60  }
    61  
    62  message ConfigValueSchema {}
    63  
    64  message ConfigPolicySchema {}
    65  
    66  // Config represents the config for a particular channel
    67  message Config {
    68      ChannelHeader header = 1;
    69      ConfigGroup channel = 2;
    70  }
    71  
    72  message ConfigUpdateEnvelope {
    73      bytes config_update = 1;                 // A marshaled ConfigUpdate structure
    74      repeated ConfigSignature signatures = 2; // Signatures over the config_update
    75  }
    76  
    77  // ConfigUpdate is used to submit a subset of config and to have the orderer apply to Config
    78  // it is always submitted inside a ConfigUpdateEnvelope which allows the addition of signatures
    79  // resulting in a new total configuration.  The update is applied as follows:
    80  // 1. The versions from all of the elements in the read_set is verified against the versions in the existing config.
    81  //    If there is a mismatch in the read versions, then the config update fails and is rejected.
    82  // 2. Any elements in the write_set with the same version as the read_set are ignored.
    83  // 3. The corresponding mod_policy for every remaining element in the write_set is collected.
    84  // 4. Each policy is checked against the signatures from the ConfigUpdateEnvelope, any failing to verify are rejected
    85  // 5. The write_set is applied to the Config and the ConfigGroupSchema verifies that the updates were legal
    86  message ConfigUpdate {
    87      ChannelHeader header = 1;    // Header scopes the update to a particular Channel
    88      ConfigGroup read_set = 2;  // ReadSet explicitly lists the portion of the config which was read, this should be sparse with only Version set
    89      ConfigGroup write_set = 3; // WriteSet lists the portion of the config which was written, this should included updated Versions
    90  }
    91  
    92  // ConfigGroup is the hierarchical data structure for holding config
    93  message ConfigGroup {
    94      uint64 version = 1;
    95      map<string,ConfigGroup> groups = 2;
    96      map<string,ConfigValue> values = 3;
    97      map<string,ConfigPolicy> policies = 4;
    98      string mod_policy = 5;
    99  }
   100  
   101  // ConfigValue represents an individual piece of config data
   102  message ConfigValue {
   103      uint64 version = 1;
   104      bytes value = 2;
   105      string mod_policy = 3;
   106  }
   107  
   108  message ConfigPolicy {
   109      uint64 version = 1;
   110      Policy policy = 2;
   111      string mod_policy = 3;
   112  }
   113  
   114  message ConfigSignature {
   115      bytes signature_header = 1; // A marshaled SignatureHeader
   116      bytes signature = 2;        // Signature over the concatenation signatureHeader bytes and config bytes
   117  }