/* * SPDX-FileCopyrightText: © Istari Digital, Inc. * SPDX-License-Identifier: Apache-2.0 */ // Style guide for Protocol Buffer 3. // Use CamelCase (with an initial capital) for message names – for example, // SongServerRequest. Use underscore_separated_names for field names – for // example, song_name. syntax = "proto3"; package api; option go_package = "github.com/dgraph-io/dgo/v250/protos/api"; option java_package = "io.dgraph"; option java_outer_classname = "DgraphProto"; // Graph response. service Dgraph { rpc Login (LoginRequest) returns (Response) {} rpc Query (Request) returns (Response) {} rpc Alter (Operation) returns (Payload) {} rpc CommitOrAbort (TxnContext) returns (TxnContext) {} rpc CheckVersion(Check) returns (Version) {} rpc RunDQL(RunDQLRequest) returns (Response) {} rpc AllocateIDs(AllocateIDsRequest) returns (AllocateIDsResponse) {} rpc UpdateExtSnapshotStreamingState(UpdateExtSnapshotStreamingStateRequest) returns (UpdateExtSnapshotStreamingStateResponse) {} rpc StreamExtSnapshot(stream StreamExtSnapshotRequest) returns (StreamExtSnapshotResponse) {} rpc CreateNamespace(CreateNamespaceRequest) returns (CreateNamespaceResponse) {} rpc DropNamespace(DropNamespaceRequest) returns (DropNamespaceResponse) {} rpc ListNamespaces(ListNamespacesRequest) returns (ListNamespacesResponse) {} } message Request { uint64 start_ts = 1; string query = 4; map vars = 5; // Support for GraphQL like variables. bool read_only = 6; bool best_effort = 7; repeated Mutation mutations = 12; bool commit_now = 13; enum RespFormat { JSON = 0; RDF = 1; } RespFormat resp_format = 14; string hash = 15; } message Uids { repeated string uids = 1; } message ListOfString { repeated string value = 1; } message Response { bytes json = 1; TxnContext txn = 2; Latency latency = 3; // Metrics contains all metrics related to the query. Metrics metrics = 4; // uids contains a mapping of blank_node => uid for the node. It only returns uids // that were created as part of a mutation. map uids = 12; bytes rdf = 13; map hdrs = 14; } message Mutation { bytes set_json = 1; bytes delete_json = 2; bytes set_nquads = 3; bytes del_nquads = 4; repeated NQuad set = 5; repeated NQuad del = 6; // This is being used for upserts. string cond = 9; // This field is a duplicate of the one in Request and placed here for convenience. bool commit_now = 14; } message Operation { string schema = 1; string drop_attr = 2; bool drop_all = 3; enum DropOp { NONE = 0; ALL = 1; DATA = 2; ATTR = 3; TYPE = 4; } DropOp drop_op = 4; // If drop_op is ATTR or TYPE, drop_value holds the name of the predicate or // type to delete. string drop_value = 5; // run indexes in background. bool run_in_background = 6; } // Worker services. message Payload { bytes Data = 1; } message TxnContext { uint64 start_ts = 1; uint64 commit_ts = 2; bool aborted = 3; repeated string keys = 4; // List of keys to be used for conflict detection. repeated string preds = 5; // List of predicates involved in this transaction. string hash = 6; } message Check {} message Version { string tag = 1; } message Latency { uint64 parsing_ns = 1; uint64 processing_ns = 2; uint64 encoding_ns = 3; uint64 assign_timestamp_ns = 4; uint64 total_ns = 5; } message Metrics { // num_uids is the map of number of uids processed by each attribute. map num_uids = 1; } message NQuad { reserved 5; // This was used for label. string subject = 1; string predicate = 2; string object_id = 3; Value object_value = 4; string lang = 6; repeated Facet facets = 7; uint64 namespace = 8; } message Value { oneof val { string default_val = 1; bytes bytes_val = 2; int64 int_val = 3; bool bool_val = 4; string str_val = 5; double double_val = 6; bytes geo_val = 7; // Geo data in WKB format bytes date_val = 8; bytes datetime_val = 9; string password_val = 10; uint64 uid_val=11; bytes bigfloat_val=12; bytes vfloat32_val=13; } } message Facet { enum ValType { STRING = 0; INT = 1; FLOAT = 2; BOOL = 3; DATETIME = 4; } string key = 1; bytes value = 2; ValType val_type = 3; repeated string tokens = 4; // tokens of value. string alias = 5; // not stored, only used for query. } message LoginRequest { string userid = 1; string password = 2; string refresh_token = 3; uint64 namespace = 4; } message Jwt { string access_jwt = 1; string refresh_jwt = 2; } message RunDQLRequest { string dql_query = 1; map vars = 2; bool read_only = 3; bool best_effort = 4; Request.RespFormat resp_format = 5; } enum LeaseType { NS = 0; UID = 1; TS = 2; } message AllocateIDsRequest { uint64 how_many = 1; LeaseType lease_type = 2; } message AllocateIDsResponse { uint64 start = 1; uint64 end = 2; // inclusive } message CreateNamespaceRequest {} message CreateNamespaceResponse { uint64 namespace = 1; } message DropNamespaceRequest { uint64 namespace = 1; } message DropNamespaceResponse {} message ListNamespacesRequest {} message ListNamespacesResponse { map namespaces = 1; } message Namespace { uint64 id = 1; } message UpdateExtSnapshotStreamingStateRequest { bool start = 1; bool finish = 2; bool drop_data = 3; } message UpdateExtSnapshotStreamingStateResponse { repeated uint32 groups = 1; } message StreamExtSnapshotRequest { uint32 group_id = 1; bool forward = 2; StreamPacket pkt = 3; } message StreamExtSnapshotResponse {} message StreamPacket { bytes data = 1; bool done = 2; } // vim: noexpandtab sw=2 ts=2