All Downloads are FREE. Search and download functionalities are using the official Maven repository.

.proxima-server-rpc-proto.0.9.0-jdk11.source-code.rpc.proto Maven / Gradle / Ivy

There is a newer version: 0.14.0
Show newest version
/*
 * Copyright 2017-2022 O2 Czech Republic, a.s.
 *
 * 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.
 */
/* service definition */

syntax = "proto3";
option java_package = "cz.o2.proxima.proto.service";
option go_package = "ingest";

/** Ingest of a attribute update (or delete) */
message Ingest {

  /**
   * UUID of the ingest. This UUID is returned in status to match
   * the request with the response
   **/
  string uuid = 1;
  /** Name of the entity */
  string entity = 2;

  /** Name of the attribute.
    * Might be a wildcard specified (e.g. "prefix.*" if `delete` is true, meaning to delete the whole prefix.
    */
  string attribute = 3;
  /** Key of the entity. */
  string key = 4;
  /** Value to update. */
  bytes value = 5;
  /** Timestamp of the ingest. If not provided, it will be replaced with actual ingest timestamp. */
  uint64 stamp = 7;

  /**
   * Whether to delete the attribute. You must explicitly set this
   * if you want to delete an attribute.
   **/
  bool delete = 6;

  /**
   * Optional transaction ID associated with the ingest.
   **/
  string transactionId = 8;

}

/** Response to a message ingest */
message Status {

  /** The UUID of the original ingest request */
  string uuid = 1;

  /** Status code:
   *   200 - OK - the request was processed and is ingested
   *   400 - Bad request - the request was missing some key parts
   *   404 - Not found - the entity or attribute not found in the settings
   *   412 - Not acceptable - the message has unknown format (unable to validate the scheme)
   *   502 - Bad gateway - cannot connect to the target storage
   *   504 - Gateway timeout - the request timeouted
   **/
  uint32 status = 2;

  /**
   * Textual information for the event. Might be missing for 200 OK.
   * Contains error message if any error occurs
   **/
  string statusMessage = 3;

}

/** Bulk  of ingest requests. */
message IngestBulk {

  repeated Ingest ingest = 1;

}

/**
 * Bulk of status responses for the client.
 * The server is free to buffer the responses and send them by single
 * ack message to lower the network pressure.
 */
message StatusBulk {

  repeated Status status = 1;

}

message TransactionCommitRequest {

  string transactionId = 1;

}

message TransactionCommitResponse {

  enum Status {
    UNKNOWN = 0;
    COMMITTED = 1;
    REJECTED = 2;
    FAILED = 3;
  }

  Status status = 1;

}

/**
 * Ingest service serves as data entry point. All data
 * is sent to the system via this endpoint.
 */
service IngestService {

  /**
   * The main ingest method. Use this for high performance ingest requests.
   * Note that the returned StatusBulk will not be necesarilly corresponding
   * the the input bulk. So each IngestBulk can result in any number of
   * StatusBulk messages. It is up to the application to handle the
   * StatusBulk as a stream of individual Statuses.
   */
  rpc ingestBulk (stream IngestBulk) returns (stream StatusBulk);

  /**
   * Stream ingestion with single ingest requests. Use this method when
   * sending small isolated and infrequent ingest requests.
   */
  rpc ingestSingle (stream Ingest) returns (stream Status);


  /**
   * Synchronous ingest request.
   */
  rpc ingest (Ingest) returns (Status);

  /**
   * A synchronous request to commit a transaction.
   */
  rpc commit (TransactionCommitRequest) returns (TransactionCommitResponse);

}

/**
 * Request to read data from the system.
 */
message GetRequest {

  /** Name of the entity. */
  string entity = 1;

  /** Key of the entity. */
  string key = 2;

  /** Name of the attribute. */
  string attribute = 3;

  /**
   * ID of transaction that is part of this request (if any).
   * If empty, the request is not part of any ongoing transaction.
   */
  string transactionId = 4;

}

/**
 * Response to the GetRequest.
 */
message GetResponse {

  /**
   * Status code. Can be
   *  200 - OK
   *  400 - Bad request - if missing some required field(s) in request
   *  404 - Entity or attribute not found
   *  500 - Internal server error
   **/
  uint32 status = 1;

  /**
   * The status message. Might be omitted if status is 200.
   **/
  string statusMessage = 2;

  /**
   * Value of the requested attribute.
   **/
  bytes value = 3;

}

/**
 * Request to list attributes of given entity by known wildcard prefix.
 */
message ListRequest {

  /** Name of the entity. */
  string entity = 1;

  /** Key of the entity. */
  string key = 2;

  /** Prefix of the wildcard attribute (i.e. the name without tha last `.*') */
  string wildcardPrefix = 3;

  /** Offset. If present, return attribute that follows the given one. */
  string offset = 4;

  /** Maximal number of items to return. If less or equal to zero than unlimited.*/
  uint32 limit = 5;

  /**
   * ID of transaction that is part of this request (if any).
   * If empty, the request is not part of any ongoing transaction.
   */
  string transactionId = 6;

}

/**
 * Response to the ListRequest.
 **/
message ListResponse {

  /** The attribute-value returned from the storage. */
  message AttrValue {

    /** The fully qualified attribute. */
    string attribute = 1;

    /** The value of the attribute. */
    bytes value = 2;

  }

  /**
   * Status code. Can be
   *  200 - OK
   *  400 - Bad request - if missing some required field(s) in the request
   *  404 - The entity or the attribute prefix is not found
   *  500 - Internal server error
   **/
  uint32 status = 1;

  /**
   * The status message. Might be omitted if status is 200.
   **/
  string statusMessage = 2;

  /**
   * All scanned values.
   **/
  repeated AttrValue value = 3;

}

/**
 * A message describing entity-key-attribute without actual data.
 * Transactions use this information to properly route requests to transaction managers
 * that are able to ensure the required isolation level.
 **/
message KeyAttribute {

  /** Name of entity. */
  string entity = 1;
  /** Key of entity. */
  string key = 2;
  /** The attribute. */
  string attribute = 3;

}

message BeginTransactionRequest {

  /**
   * A list of entity-key-attributes that will be involved during the transaction.
   * The list will be automatically updated as new requests with the same transaction ID
   * arrive, but at least the outputs need to be known in advance.
   * 
   * An empty list will create a GLOBAL transaction, with resulting scalability concerns.
   */
  repeated KeyAttribute attributesInvolved = 1;

  /** An optional transaction ID. When omitted a new transaction ID will be generated. */
  string transcationId = 2;

}

message BeginTransactionResponse {

  /** ID associated to the transcation. */
  string transactionId = 1;

}

/**
 * Service that serves for retrieving data from the system
 * (via stream or random access calls).
 */
service RetrieveService {

  /** Synchronous request to fetch a value of a specified attribute. */
  rpc get (GetRequest) returns (GetResponse);

  /** Synchronous request to list attributes of a specified entity by prefix. */
  rpc listAttributes (ListRequest) returns (ListResponse);

  /**
   * Synchronous request to begin a transaction.
   * Returns most importantly the ID of the transaction that should be the used in subsequent read operations.
   */
  rpc begin (BeginTransactionRequest) returns (BeginTransactionResponse);

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy