github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/sawtooth-supply-chain-master/protos/property.proto (about) 1 // Copyright 2017 Intel Corporation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // ----------------------------------------------------------------------------- 15 16 syntax = "proto3"; 17 18 19 message Property { 20 message Reporter { 21 // The public key of the Agent authorized to report updates. 22 string public_key = 1; 23 bool authorized = 2; 24 // An update must be stored with some way of identifying which 25 // Agent sent it. Storing a full public key for each update would 26 // be wasteful, so instead Reporters are identified by their index 27 // in the `reporters` field. 28 uint32 index = 3; 29 } 30 31 // The name of the Property, e.g. "temperature". This must be unique 32 // among Properties. 33 string name = 1; 34 35 // The natural key of the Property's associated Record. 36 string record_id = 2; 37 38 // The Property's type (int, string, etc.) 39 PropertySchema.DataType data_type = 3; 40 41 // The Reporters authorized to send updates, sorted by index. New 42 // Reporters should be given an index equal to the number of 43 // Reporters already authorized. 44 repeated Reporter reporters = 4; 45 46 // The page to which new updates are added. This number represents 47 // the last 4 hex characters of the page's address. Consequently, 48 // it should not exceed 16^4 = 65536. 49 uint32 current_page = 5; 50 51 // A flag indicating whether the first 16^4 pages have been filled. 52 // This is used to calculate the last four hex characters of the 53 // address of the page containing the earliest updates. When it is 54 // false, the earliest page's address will end in "0001". When it is 55 // true, the earliest page's address will be one more than the 56 // current_page, or "0001" if the current_page is "ffff". 57 bool wrapped = 6; 58 59 // If set to true, values may only be set for this Property 60 // during Record creation, not later with updates. 61 bool fixed = 9; 62 63 // Used with numbers to communicate how the integer value should be converted 64 // to a fractional number. Uses the same principle as scientific notation. 65 // A number value of 1, with an exponent of 3, would be 1,000 (1 * 10^3). 66 // A number value of 1, with an exponent of -3, would be 0.001 (1 * 10^-3). 67 sint32 number_exponent = 10; 68 69 // Used with ENUM data types, the string names of available options 70 repeated string enum_options = 11; 71 72 // Used with STRUCT data types, defines the properties a struct must contain 73 repeated PropertySchema struct_properties = 12; 74 75 // This optional metadata describes the unit a Property is measured in 76 string unit = 20; 77 } 78 79 80 message PropertyContainer { 81 repeated Property entries = 1; 82 } 83 84 85 message PropertySchema { 86 enum DataType { 87 TYPE_UNSET = 0; 88 BYTES = 1; 89 BOOLEAN = 2; 90 NUMBER = 3; 91 STRING = 4; 92 ENUM = 5; 93 STRUCT = 6; 94 LOCATION = 7; 95 } 96 97 // The name of the property, e.g. "temperature" 98 string name = 1; 99 100 // The Property's type (int, string, etc.) 101 DataType data_type = 2; 102 103 // A flag indicating whether initial values must be provided for the 104 // Property when a Record is created. 105 bool required = 3; 106 107 // Another flag. If set to true, values may only be set for this Property 108 // during Record creation, not later with updates. 109 bool fixed = 4; 110 111 // A flag that indicates a property may not be set at record creation, 112 // only later during subsequent property updates. 113 bool delayed = 5; 114 115 // Used with numbers to communicate how the integer value should be converted 116 // to a fractional number. Uses the same principle as scientific notation. 117 // A number value of 1, with an exponent of 3, would be 1,000 (1 * 10^3). 118 // A number value of 1, with an exponent of -3, would be 0.001 (1 * 10^-3). 119 sint32 number_exponent = 10; 120 121 // Used with ENUM data types, the string names of available options 122 repeated string enum_options = 11; 123 124 // Used with STRUCT data types, defines the properties a struct must contain 125 repeated PropertySchema struct_properties = 12; 126 127 // This optional metadata describes the unit a Property is measured in 128 string unit = 20; 129 } 130 131 132 message PropertyValue { 133 // The name of the property being set 134 string name = 1; 135 136 // The PropertyValue's type (int, string, etc.) 137 PropertySchema.DataType data_type = 2; 138 139 // The type-specific value to initialize or update a Property. Only 140 // one of these fields should be used, and it should match the type 141 // specified for this Property in the RecordType. 142 bytes bytes_value = 11; 143 bool boolean_value = 12; 144 sint64 number_value = 13; 145 string string_value = 14; 146 string enum_value = 15; 147 repeated PropertyValue struct_values = 16; 148 Location location_value = 17; 149 } 150 151 152 message PropertyPage { 153 message ReportedValue { 154 // The index of the reporter id in reporters field 155 uint32 reporter_index = 1; 156 // Approximately when this value was reported, as a Unix UTC 157 // timestamp 158 uint64 timestamp = 2; 159 160 // The type-specific value of the update. Only one of these 161 // fields should be used, and it should match the type 162 // specified for this Property in the RecordType. 163 bytes bytes_value = 11; 164 bool boolean_value = 12; 165 sint64 number_value = 13; 166 string string_value = 14; 167 uint32 enum_value = 15; 168 repeated PropertyValue struct_values = 16; 169 Location location_value = 17; 170 } 171 172 // The name of the page's associated Property and the record_id of 173 // its associated Record. These are required to distinguish pages 174 // with colliding addresses. 175 string name = 1; 176 string record_id = 2; 177 178 // ReportedValues are sorted first by timestamp, then by 179 // reporter_index 180 repeated ReportedValue reported_values = 3; 181 } 182 183 184 message PropertyPageContainer { 185 repeated PropertyPage entries = 1; 186 } 187 188 189 message Location { 190 // Coordinates are expected to be in millionths of a degree 191 sint64 latitude = 1; 192 sint64 longitude = 2; 193 }