Skip to content

Commit

Permalink
[FAB-2255] Create ImplicitMetaPolicy policy type
Browse files Browse the repository at this point in the history
https://jira.hyperledger.org/browse/FAB-2255

This CR introduces the proto structure for the implicit meta policy
type.  It does not add a provider for this policy type, but simply
defines the structure.

Change-Id: I4256f3faf9cede3f34ddecc266c98dcbcd1148e6
Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
  • Loading branch information
Jason Yellick committed Feb 17, 2017
1 parent 22d2d5c commit 1ffb87e
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 30 deletions.
1 change: 1 addition & 0 deletions protos/common/common.pb.go

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

113 changes: 83 additions & 30 deletions protos/common/policies.pb.go

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

19 changes: 19 additions & 0 deletions protos/common/policies.proto
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ message Policy {
UNKNOWN = 0; // Reserved to check for proper initialization
SIGNATURE = 1;
MSP = 2;
IMPLICIT_META = 3;
}
int32 type = 1; // For outside implementors, consider the first 1000 types reserved, otherwise one of PolicyType
bytes policy = 2;
Expand Down Expand Up @@ -57,3 +58,21 @@ message SignaturePolicy {
NOutOf from = 2;
}
}

// ImplicitMetaPolicy is a policy type which depends on the hierarchical nature of the configuration
// It is implicit because the rule is generate implicitly based on the number of sub policies
// It is meta because it depends only on the result of other policies
// When evaluated, this policy iterates over all immediate child sub-groups, retrieves the policy
// of name sub_policy, evaluates the collection and applies the rule.
// For example, with 4 sub-groups, and a policy name of "foo", ImplicitMetaPolicy retrieves
// each sub-group, retrieves policy "foo" for each subgroup, evaluates it, and, in the case of ANY
// 1 satisfied is sufficient, ALL would require 4 signatures, and MAJORITY would require 3 signatures.
message ImplicitMetaPolicy {
enum Rule {
ANY = 0; // Requires any of the sub-policies be satisfied, if no sub-policies exist, always returns true
ALL = 1; // Requires all of the sub-policies be satisfied
MAJORITY = 2; // Requires a strict majority (greater than half) of the sub-policies be satisfied
}
string sub_policy = 1;
Rule rule = 2;
}

0 comments on commit 1ffb87e

Please sign in to comment.