grid-sdk 0.3.5

Hyperledger Grid is a platform for building supply chain solutions that include distributed ledger components. It provides a growing set of tools that accelerate development for supply chain smart contractsand client interfaces.
Documentation
// Copyright 2017 Intel Corporation
//
// 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.
// -----------------------------------------------------------------------------

syntax = "proto3";

import "schema_state.proto";

message Property {
  message Reporter {
    // The public key of the Agent authorized to report updates.
    string public_key = 1;

    // A flag indicating whether the reporter is authorized to send updates.
    // When a reporter is added, this is set to true, and a `RevokeReporter`
    // transaction sets it to false.
    bool authorized = 2;

    // An update must be stored with some way of identifying which
    // Agent sent it. Storing a full public key for each update would
    // be wasteful, so instead Reporters are identified by their index
    // in the `reporters` field.
    uint32 index = 3;
  }

  // The name of the Property, e.g. "temperature". This must be unique among
  // Properties.
  string name = 1;

  // The natural key of the Property's associated Record.
  string record_id = 2;

  // The name of the PropertyDefinition that defines this record.
  PropertyDefinition property_definition = 3;

  // The Reporters authorized to send updates, sorted by index. New
  // Reporters should be given an index equal to the number of
  // Reporters already authorized.
  repeated Reporter reporters = 4;

  // The page to which new updates are added. This number represents
  // the last 4 hex characters of the page's address. Consequently,
  // it should not exceed 16^4 = 65536.
  uint32 current_page = 5;

  // A flag indicating whether the first 16^4 pages have been filled.
  // This is used to calculate the last four hex characters of the
  // address of the page containing the earliest updates. When it is
  // false, the earliest page's address will end in "0001". When it is
  // true, the earliest page's address will be one more than the
  // current_page, or "0001" if the current_page is "ffff".
  bool wrapped = 6;
}

message PropertyList {
  repeated Property entries = 1;
}

message PropertyPage {
  message ReportedValue {
    // The index of the reporter id in reporters field.
    uint32 reporter_index = 1;

    // The approximate time this value was reported, as a Unix UTC timestamp.
    uint64 timestamp = 2;

    PropertyValue value = 3;
  }

  // The name of the page's associated Property and the record_id of
  // its associated Record. These are required to distinguish pages
  // with colliding addresses.
  string name = 1;
  string record_id = 2;

  // ReportedValues are sorted first by timestamp, then by reporter_index.
  repeated ReportedValue reported_values = 3;
}


message PropertyPageList {
  repeated PropertyPage entries = 1;
}

message Proposal {
  enum Role {
    OWNER = 0;
    CUSTODIAN = 1;
    REPORTER = 2;
  }

  enum Status {
    OPEN = 0;
    ACCEPTED = 1;
    REJECTED = 2;
    CANCELED = 3;
  }

  // The Record that this proposal applies to.
  string record_id = 1;

  // The approximate time this proposal was created, as a Unix UTC timestamp.
  uint64 timestamp = 2;

  // The public key of the Agent sending the Proposal. This Agent must
  // be the owner of the Record (or the custodian, if the Proposal is
  // to transfer custodianship).
  string issuing_agent = 3;

  // The public key of the Agent to whom the Proposal is sent.
  string receiving_agent = 4;

  // What the Proposal is for -- transferring ownership, transferring
  // custodianship, or authorizing a reporter.
  Role role = 5;

  // The names of properties for which the reporter is being authorized
  // (empty for owner or custodian transfers).
  repeated string properties = 6;

  // The status of the Proposal. For a given Record and receiving
  // Agent, there can be only one open Proposal at a time for each
  // role.
  Status status = 7;

  // The human-readable terms of transfer.
  string terms = 8;
}


message ProposalList {
  repeated Proposal entries = 1;
}

message Record {
  message AssociatedAgent {
    // Agent's public key.
    string agent_id = 1;

    // The approximate time this agent was associated, as a Unix UTC timestamp.
    uint64 timestamp = 2;
  }

  // User-defined natural key which identifies the object in the real world
  // (for example a serial number).
  string record_id = 1;

  // Name of the schema used by the record.
  string schema = 2;

  // Ordered oldest to newest by timestamp.
  repeated AssociatedAgent owners = 3;
  repeated AssociatedAgent custodians = 4;

  // Flag indicating whether the Record can be updated. If it is set
  // to true, then the record has been finalized and no further
  // changes can be made to it or its Properties.
  bool final = 5;
}

message RecordList {
  repeated Record entries = 1;
}