Skip to content

Commit

Permalink
[FAB-5590] Add proto fields for isolated_data
Browse files Browse the repository at this point in the history
The channel creation transaction needs a way to specify additional data
that is not otherwise reflected in the standard config.  Still, it's
desirable to specify this information in a consistent way, so it should
be expressed using the same structures as the configuration.

This CR introduces the notion of the 'isolated_data' field to the
ConfigUpdate message.  For now, the only consumer will be the RSCC seed
data information, which will be set to the key rscc_seed_data and will
be the bytes of a common.Config message.

Because we need to be able to be able to inspect this new config message
type, we need a way to differentiate channel config from resource
config.  Thus, this CR also introduces a 'type' field to both the Config
message and the ConfigUpdate message.

Change-Id: Ida6283dbeeca466aafd9bc6d027ce46e1baee0c6
Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
  • Loading branch information
Jason Yellick committed Aug 12, 2017
1 parent d0c97c0 commit 7e5e955
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 74 deletions.
148 changes: 101 additions & 47 deletions protos/common/configtx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions protos/common/configtx.proto
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
/*
Copyright IBM Corp. 2017 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
SPDX-License-Identifier: Apache-2.0
*/

syntax = "proto3";
Expand All @@ -24,6 +14,13 @@ option java_package = "org.hyperledger.fabric.protos.common";

package common;

// ConfigType is an enumeration of possible types for the config. The type field in the config is
// an int32 for extensibility, but this enum type should generally be used to populate it
enum ConfigType {
CHANNEL = 0; // The original and default configuration type, defines parameters for the operation of a channel
RESOURCE = 1; // Defines a set of resource names, and their mapping to policies which restrict access to those resources
}

// ConfigEnvelope is designed to contain _all_ configuration for a chain with no dependency
// on previous configuration transactions.
//
Expand Down Expand Up @@ -64,7 +61,8 @@ message ConfigPolicySchema {}
// Config represents the config for a particular channel
message Config {
uint64 sequence = 1;
ConfigGroup channel_group = 2;
ConfigGroup channel_group = 2; // channel_group is a bad name for this, it should be changed to root when API breakage is allowed
int32 type = 3;
}

message ConfigUpdateEnvelope {
Expand All @@ -82,9 +80,11 @@ message ConfigUpdateEnvelope {
// 4. Each policy is checked against the signatures from the ConfigUpdateEnvelope, any failing to verify are rejected
// 5. The write_set is applied to the Config and the ConfigGroupSchema verifies that the updates were legal
message ConfigUpdate {
string channel_id = 1; // Which channel this config update is for
ConfigGroup read_set = 2; // ReadSet explicitly lists the portion of the config which was read, this should be sparse with only Version set
ConfigGroup write_set = 3; // WriteSet lists the portion of the config which was written, this should included updated Versions
string channel_id = 1; // Which channel this config update is for
ConfigGroup read_set = 2; // ReadSet explicitly lists the portion of the config which was read, this should be sparse with only Version set
ConfigGroup write_set = 3; // WriteSet lists the portion of the config which was written, this should included updated Versions
int32 type = 4; // The type of config this update is intended for (usually a value from ConfigType enum) , must match the type in the Config message
map<string, bytes> isolated_data = 5; // Data which is not to be reflected in the resulting Config, but is still needed for some other purpose. For instance, rscc_seed_data
}

// ConfigGroup is the hierarchical data structure for holding config
Expand Down
2 changes: 2 additions & 0 deletions protos/peer/admin.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions protos/peer/resources.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions protos/peer/resources.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/

syntax = "proto3";

option java_package = "org.hyperledger.fabric.protos.peer";
option go_package = "github.com/hyperledger/fabric/protos/peer";

package protos;

// Resource represents a resource in the peer whose ACL is determined by the policy_ref field
message Resource {
string policy_ref = 1; // The policy name to use for this resource
}
Loading

0 comments on commit 7e5e955

Please sign in to comment.