github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/tm-db/remotedb/proto/defs.proto (about)

     1  syntax = "proto3";
     2  
     3  package protodb;
     4  
     5  import "github.com/gogo/protobuf/gogoproto/gogo.proto";
     6  
     7  // Generate tests
     8  option (gogoproto.populate_all) = true;
     9  option (gogoproto.equal_all) = true;
    10  option (gogoproto.testgen_all) = true;
    11  
    12  message Batch {
    13    repeated Operation ops = 1;
    14  }
    15  
    16  message Operation {
    17    Entity entity = 1;
    18    enum Type {
    19      SET = 0;
    20      DELETE = 1;
    21    }
    22    Type type = 2;
    23  }
    24  
    25  message Entity {
    26    int32 id	= 1;
    27    bytes key	= 2;
    28    bytes value	= 3;
    29    bool exists	= 4;
    30    bytes start	= 5;
    31    bytes end	= 6;
    32    string err	= 7;
    33    int64 created_at = 8;
    34  }
    35  
    36  message Nothing {
    37  }
    38  
    39  message Domain {
    40    bytes start = 1;
    41    bytes end   = 2;
    42  }
    43  
    44  message Iterator {
    45    Domain domain = 1;
    46    bool valid	 = 2;
    47    bytes key	 = 3;
    48    bytes value	 = 4;
    49  }
    50  
    51  message Stats {
    52    map<string, string> data = 1;
    53    int64 time_at		   = 2;
    54  }
    55  
    56  message Init {
    57    string Type = 1;
    58    string Name = 2;
    59    string Dir  = 3;
    60  }
    61  
    62  service DB {
    63    rpc init(Init) returns (Entity) {}
    64    rpc get(Entity) returns (Entity) {}
    65    rpc getStream(stream Entity) returns (stream Entity) {}
    66  
    67    rpc has(Entity) returns (Entity) {}
    68    rpc set(Entity) returns (Nothing) {}
    69    rpc setSync(Entity) returns (Nothing) {}
    70    rpc delete(Entity) returns (Nothing) {}
    71    rpc deleteSync(Entity) returns (Nothing) {}
    72    rpc iterator(Entity) returns (stream Iterator) {}
    73    rpc reverseIterator(Entity) returns (stream Iterator) {}
    74    // rpc print(Nothing) returns (Entity) {}
    75    rpc stats(Nothing) returns (Stats) {}
    76    rpc batchWrite(Batch) returns (Nothing) {}
    77    rpc batchWriteSync(Batch) returns (Nothing) {}
    78  }