github.phpd.cn/thought-machine/please@v12.2.0+incompatible/src/cache/proto/rpc_cache.proto (about)

     1  // Defines interface to our RPC cache.
     2  
     3  syntax = "proto3";
     4  
     5  option java_package = "net.thoughtmachine.please.cache";
     6  
     7  package proto.rpc_cache;
     8  
     9  service RpcCache {
    10      // Stores an artifact or set of artifacts in the cache.
    11      rpc Store(StoreRequest) returns (StoreResponse);
    12      // Retrieves an artifact or set of artifacts from the cache.
    13      rpc Retrieve(RetrieveRequest) returns (RetrieveResponse);
    14      // Deletes an artifact from the cache.
    15      rpc Delete(DeleteRequest) returns (DeleteResponse);
    16      // Returns the set of currently known cache nodes & their hash topology.
    17      rpc ListNodes(ListRequest) returns (ListResponse);
    18  }
    19  
    20  message Artifact {
    21      // Package of the artifact
    22      string package = 1;
    23      // Target name of the artifact
    24      string target = 2;
    25      // Output file from the target
    26      string file = 3;
    27      // Contents of it
    28      bytes body = 4;
    29      // If the artifact is a symlink, this is non-empty and contains its destination.
    30      string symlink = 5;
    31  }
    32  
    33  message StoreRequest {
    34      // Sequence of artifacts to store.
    35      repeated Artifact artifacts = 1;
    36      // OS of requestor
    37      string os = 2;
    38      // Architecture of requestor
    39      string arch = 3;
    40      // Hash of rule that generated these artifacts
    41      bytes hash = 4;
    42      // Hostname of submitter (optional, used to identify the artifact later)
    43      string hostname = 5;
    44  }
    45  
    46  message StoreResponse {
    47      // True if store was successful.
    48      bool success = 1;
    49  }
    50  
    51  message RetrieveRequest {
    52      // Artifacts to retrieve. The 'body' field should obviously not be set.
    53      // If the 'file' field is not set then all artifacts are retrieved.
    54      repeated Artifact artifacts = 1;
    55      // OS of requestor
    56      string os = 2;
    57      // Architecture of requestor
    58      string arch = 3;
    59      // Hash of rule that generated these artifacts
    60      bytes hash = 4;
    61  }
    62  
    63  message RetrieveResponse {
    64      // True if retrieve was successful.
    65      bool success = 1;
    66      // Contents of artifacts retrieved
    67      repeated Artifact artifacts = 2;
    68  }
    69  
    70  message DeleteRequest {
    71      // Artifacts to delete. The 'body' field should obviously not be set.
    72      repeated Artifact artifacts = 1;
    73      // OS of requestor
    74      string os = 2;
    75      // Architecture of requestor
    76      string arch = 3;
    77      // True to delete entire cache. 'paths' should be empty if this is set.
    78      bool everything = 4;
    79  }
    80  
    81  message DeleteResponse {
    82      // True if delete was successful.
    83      bool success = 1;
    84  }
    85  
    86  message ListRequest {
    87  }
    88  
    89  message ListResponse {
    90      // List of known server nodes.
    91      // If this is empty it indicates that the server is not clustered.
    92      repeated Node nodes = 1;
    93  }
    94  
    95  message Node {
    96      // A name of this node
    97      string name = 1;
    98      // Network address / port of this node
    99      string address = 2;
   100      // Beginning of the hash space for this node
   101      uint32 hash_begin = 3;
   102      // End of the hash space for this node (exclusive).
   103      uint32 hash_end = 4;
   104  }