github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/blobs/blobspb/blobs.proto (about)

     1  // Copyright 2019 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  syntax = "proto3";
    12  package cockroach.blobs;
    13  option go_package = "blobspb";
    14  
    15  import "gogoproto/gogo.proto";
    16  
    17  // GetRequest is used to read a file from a remote node.
    18  // It's path is specified by `filename`, which can either
    19  // be a relative path from the base of external IO dir, or
    20  // an absolute path, which must be contained in external IO dir.
    21  message GetRequest {
    22    string filename = 1;
    23  }
    24  
    25  // GetResponse returns contents of the file requested by GetRequest.
    26  message GetResponse {
    27    bytes payload = 1;
    28  }
    29  
    30  // PutRequest is used to write a payload to a remote node.
    31  // It's path is specified by `filename`, as described in GetRequest.
    32  message PutRequest {
    33    string filename = 1;
    34    bytes payload = 2;
    35  }
    36  
    37  // PutResponse is returned once a file has successfully been written by a PutRequest.
    38  message PutResponse {
    39  }
    40  
    41  // GlobRequest is used to list all files that match the glob pattern on a given node.
    42  message GlobRequest {
    43    string pattern = 1;
    44  }
    45  
    46  // GlobResponse responds with the list of files that matched the given pattern.
    47  message GlobResponse {
    48    repeated string files = 1;
    49  }
    50  
    51  // DeleteRequest is used to delete a file or empty directory on a remote node.
    52  // It's path is specified by `filename`, as described in GetRequest.
    53  message DeleteRequest {
    54    string filename = 1;
    55  }
    56  
    57  // DeleteResponse is returned once a file has been successfully deleted by DeleteRequest.
    58  message DeleteResponse {
    59  }
    60  
    61  // StatRequest is used to get the file size of a file.
    62  // It's path is specified by `filename`, as described in GetRequest.
    63  message StatRequest {
    64    string filename = 1;
    65  }
    66  
    67  // BlobStat returns the file size of the file requested in StatRequest.
    68  message BlobStat {
    69    int64 filesize = 1;
    70  }
    71  
    72  // StreamChunk contains a chunk of the payload we are streaming
    73  message StreamChunk {
    74    bytes payload = 1;
    75  }
    76  
    77  // StreamResponse is used to acknowledge a stream ending.
    78  message StreamResponse {
    79  }
    80  
    81  // Blob service allows for inter node file sharing.
    82  // It is used by ExternalStorage when interacting with
    83  // files that are stored on a node's local file system.
    84  service Blob {
    85    rpc List(GlobRequest) returns (GlobResponse) {}
    86    rpc Delete(DeleteRequest) returns (DeleteResponse) {}
    87    rpc Stat(StatRequest) returns (BlobStat) {}
    88    rpc GetStream(GetRequest) returns (stream StreamChunk) {}
    89    rpc PutStream(stream StreamChunk) returns (StreamResponse) {}
    90  }