Passed
Pull Request — master (#3)
by Timothy
06:14
created

ConfigEnvelope   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 1
Metric Value
c 1
b 1
f 1
dl 0
loc 70
rs 10
wmc 5
1
<?php
2
# Generated by the protocol buffer compiler.  DO NOT EDIT!
3
# source: common/configtx.proto
4
5
namespace Hyperledger\Fabric\Protos\Common;
6
7
use Google\Protobuf\Internal\GPBType;
8
use Google\Protobuf\Internal\RepeatedField;
9
use Google\Protobuf\Internal\GPBUtil;
10
11
/**
12
 * ConfigEnvelope is designed to contain _all_ configuration for a chain with no dependency
13
 * on previous configuration transactions.
14
 * It is generated with the following scheme:
15
 *   1. Retrieve the existing configuration
16
 *   2. Note the config properties (ConfigValue, ConfigPolicy, ConfigGroup) to be modified
17
 *   3. Add any intermediate ConfigGroups to the ConfigUpdate.read_set (sparsely)
18
 *   4. Add any additional desired dependencies to ConfigUpdate.read_set (sparsely)
19
 *   5. Modify the config properties, incrementing each version by 1, set them in the ConfigUpdate.write_set
20
 *      Note: any element not modified but specified should already be in the read_set, so may be specified sparsely
21
 *   6. Create ConfigUpdate message and marshal it into ConfigUpdateEnvelope.update and encode the required signatures
22
 *     a) Each signature is of type ConfigSignature
23
 *     b) The ConfigSignature signature is over the concatenation of signature_header and the ConfigUpdate bytes (which includes a ChainHeader)
24
 *   5. Submit new Config for ordering in Envelope signed by submitter
25
 *     a) The Envelope Payload has data set to the marshaled ConfigEnvelope
26
 *     b) The Envelope Payload has a header of type Header.Type.CONFIG_UPDATE
27
 * The configuration manager will verify:
28
 *   1. All items in the read_set exist at the read versions
29
 *   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
30
 *   3. The new configuration satisfies the ConfigSchema
31
 *
32
 * Generated from protobuf message <code>common.ConfigEnvelope</code>
33
 */
34
class ConfigEnvelope extends \Google\Protobuf\Internal\Message
35
{
36
    /**
37
     * A marshaled Config structure
38
     *
39
     * Generated from protobuf field <code>.common.Config config = 1;</code>
40
     */
41
    private $config = null;
42
    /**
43
     * The last CONFIG_UPDATE message which generated this current configuration
44
     *
45
     * Generated from protobuf field <code>.common.Envelope last_update = 2;</code>
46
     */
47
    private $last_update = null;
48
49
    public function __construct() {
50
        \GPBMetadata\Common\Configtx::initOnce();
51
        parent::__construct();
52
    }
53
54
    /**
55
     * A marshaled Config structure
56
     *
57
     * Generated from protobuf field <code>.common.Config config = 1;</code>
58
     * @return \Hyperledger\Fabric\Protos\Common\Config
59
     */
60
    public function getConfig()
61
    {
62
        return $this->config;
63
    }
64
65
    /**
66
     * A marshaled Config structure
67
     *
68
     * Generated from protobuf field <code>.common.Config config = 1;</code>
69
     * @param \Hyperledger\Fabric\Protos\Common\Config $var
70
     * @return $this
71
     */
72
    public function setConfig($var)
73
    {
74
        GPBUtil::checkMessage($var, \Hyperledger\Fabric\Protos\Common\Config::class);
75
        $this->config = $var;
76
77
        return $this;
78
    }
79
80
    /**
81
     * The last CONFIG_UPDATE message which generated this current configuration
82
     *
83
     * Generated from protobuf field <code>.common.Envelope last_update = 2;</code>
84
     * @return \Hyperledger\Fabric\Protos\Common\Envelope
85
     */
86
    public function getLastUpdate()
87
    {
88
        return $this->last_update;
89
    }
90
91
    /**
92
     * The last CONFIG_UPDATE message which generated this current configuration
93
     *
94
     * Generated from protobuf field <code>.common.Envelope last_update = 2;</code>
95
     * @param \Hyperledger\Fabric\Protos\Common\Envelope $var
96
     * @return $this
97
     */
98
    public function setLastUpdate($var)
99
    {
100
        GPBUtil::checkMessage($var, \Hyperledger\Fabric\Protos\Common\Envelope::class);
101
        $this->last_update = $var;
102
103
        return $this;
104
    }
105
106
}
107
108