github.com/pachyderm/pachyderm@v1.13.4/src/client/pfs/pfs.proto (about)

     1  syntax = "proto3";
     2  
     3  package pfs;
     4  option go_package = "github.com/pachyderm/pachyderm/src/client/pfs";
     5  
     6  import "google/protobuf/empty.proto";
     7  import "google/protobuf/timestamp.proto";
     8  import "google/protobuf/wrappers.proto";
     9  
    10  import "gogoproto/gogo.proto";
    11  
    12  import "client/auth/auth.proto";
    13  
    14  ////  PFS Data structures (stored in etcd)
    15  
    16  message Repo {
    17    string name = 1;
    18  }
    19  
    20  message Branch {
    21    Repo repo = 1;
    22    string name = 2;
    23  }
    24  
    25  message File {
    26    Commit commit = 1;
    27    string path = 2;
    28  }
    29  
    30  message Block {
    31    string hash = 1;
    32  }
    33  
    34  message Object {
    35    string hash = 1;
    36  }
    37  
    38  message Tag {
    39    string name = 1;
    40  }
    41  
    42  // RepoInfo is the main data structure representing a Repo in etcd
    43  message RepoInfo {
    44    reserved 4;
    45    Repo repo = 1;
    46    google.protobuf.Timestamp created = 2;
    47    uint64 size_bytes = 3;
    48    string description = 5;
    49    repeated Branch branches = 7;
    50  
    51    // Set by ListRepo and InspectRepo if Pachyderm's auth system is active, but
    52    // not stored in etcd. To set a user's auth scope for a repo, use the
    53    // Pachyderm Auth API (in src/client/auth/auth.proto)
    54    RepoAuthInfo auth_info = 6;
    55    // tombstone indicates that this repo has been deleted. It's set by DeleteRepo()
    56    // when called with `--split-txn` (which breaks up a DeleteRepo() call into multiple
    57    // etcd transactions to avoid a 'transaction too large' error), and it indicates
    58    // that DeleteRepo has started deleting branches and commits in the repo, but
    59    // not all of its commits have been deleted and not all upstream commits'
    60    // subvenance have been updated.
    61    bool tombstone = 8;
    62  }
    63  
    64  // RepoAuthInfo includes the caller's access scope for a repo, and is returned
    65  // by ListRepo and InspectRepo but not persisted in etcd. It's used by the
    66  // Pachyderm dashboard to render repo access appropriately. To set a user's auth
    67  // scope for a repo, use the Pachyderm Auth API (in src/client/auth/auth.proto)
    68  message RepoAuthInfo {
    69    // The callers access level to the relevant repo (e.g. may be OWNER even if
    70    // the user isn't an OWNER of the repo, if they're an admin for the cluster)
    71    auth.Scope access_level = 1;
    72  }
    73  
    74  message BranchInfo {
    75    Branch branch = 4;
    76    Commit head = 2;
    77    repeated Branch provenance = 3;
    78    repeated Branch subvenance = 5;
    79    repeated Branch direct_provenance = 6;
    80    Trigger trigger = 7;
    81  
    82    // Deprecated field left for backward compatibility.
    83    string name = 1;
    84  }
    85  
    86  message BranchInfos {
    87    repeated BranchInfo branch_info = 1;
    88  }
    89  
    90  // Trigger defines the conditions under which a head is moved, and to which
    91  // branch it is moved.
    92  message Trigger {
    93    // Which branch this trigger refers to
    94    string branch = 1;
    95    // All indicates that all conditions must be satisfied before the trigger
    96    // happens, otherwise any conditions being satisfied will trigger it.
    97    bool all = 2;
    98    // Triggers if the cron spec has been satisfied since the last trigger and
    99    // there's been a new commit.
   100    string cron_spec = 3;
   101    // Triggers if there's been `size` new data added since the last trigger.
   102    string size = 4;
   103    // Triggers if there's been `commits` new commits added since the last trigger.
   104    int64 commits = 5;
   105  }
   106  
   107  // These are the different places where a commit may be originated from
   108  enum OriginKind {
   109    USER = 0;
   110    AUTO = 1;
   111    FSCK = 2;
   112  }
   113  
   114  message CommitOrigin {
   115    OriginKind kind = 1;
   116  }
   117  // Commit is a reference to a commit (e.g. the collection of branches and the
   118  // collection of currently-open commits in etcd are collections of Commit
   119  // protos)
   120  message Commit {
   121    Repo repo = 1;
   122    string id = 2 [(gogoproto.customname) = "ID"];
   123  }
   124  
   125  // CommitRange represents chain of commits with Lower being an ancestor of
   126  // Upper or, in the case of a range of size 1, the same commit.
   127  message CommitRange {
   128    Commit lower = 1;
   129    Commit upper = 2;
   130  }
   131  
   132  // CommitProvenance keeps track of where (i.e. which branch) a certain commit
   133  // originated from. A commit's provenance consists of the commits of
   134  // the commits which are in its causal history.
   135  message CommitProvenance {
   136    Commit commit = 1;
   137    Branch branch = 2;
   138  }
   139  
   140  // CommitInfo is the main data structure representing a commit in etcd
   141  message CommitInfo {
   142    reserved 6, 10;
   143    Commit commit = 1;
   144    Branch branch = 15;
   145    CommitOrigin origin = 17;
   146    // description is a user-provided script describing this commit
   147    string description = 8;
   148    Commit parent_commit = 2;
   149    repeated Commit child_commits = 11;
   150    google.protobuf.Timestamp started = 3;
   151    google.protobuf.Timestamp finished = 4;
   152    uint64 size_bytes = 5;
   153  
   154    // the commits and their original branches on which this commit is provenant
   155    repeated CommitProvenance provenance = 16;
   156  
   157    // ReadyProvenance is the number of provenant commits which have been
   158    // finished, if ReadyProvenance == len(Provenance) then the commit is ready
   159    // to be processed by pps.
   160    int64 ready_provenance = 12;
   161  
   162    repeated CommitRange subvenance = 9;
   163    // this is the block that stores the serialized form of a tree that
   164    // represents the entire file system hierarchy of the repo at this commit
   165    // If this is nil, then the commit is either open (in which case 'finished'
   166    // will also be nil) or is the output commit of a failed job (in which case
   167    // 'finished' will have a value -- the end time of the job)
   168    Object tree = 7;
   169    repeated Object trees = 13;
   170    Object datums = 14;
   171  
   172    int64 subvenant_commits_success = 18;
   173    int64 subvenant_commits_failure = 19;
   174    int64 subvenant_commits_total = 20;
   175  }
   176  
   177  enum FileType {
   178    RESERVED = 0;
   179    FILE = 1;
   180    DIR = 2;
   181  }
   182  
   183  message FileInfo {
   184    File file = 1;
   185    FileType file_type = 2;
   186    uint64 size_bytes = 3;
   187    google.protobuf.Timestamp committed = 10;
   188    // the base names (i.e. just the filenames, not the full paths) of
   189    // the children
   190    repeated string children = 6;
   191    repeated Object objects = 8;
   192    repeated BlockRef blockRefs = 9;
   193    bytes hash = 7;
   194  }
   195  
   196  message ByteRange {
   197    uint64 lower = 1;
   198    uint64 upper = 2;
   199  }
   200  
   201  message BlockRef {
   202    Block block = 1;
   203    ByteRange range = 2;
   204  }
   205  
   206  message ObjectInfo {
   207    Object object = 1;
   208    BlockRef block_ref = 2;
   209  }
   210  
   211  message Compaction {
   212    repeated string input_prefixes = 2;
   213  }
   214  
   215  message Shard {
   216    Compaction compaction = 1;
   217    PathRange range = 2;
   218    string output_path = 3;
   219  }
   220  
   221  message PathRange {
   222    string lower = 1;
   223    string upper = 2;
   224  }
   225  
   226  // PFS API
   227  
   228  message CreateRepoRequest {
   229    reserved 2;
   230    Repo repo = 1;
   231    string description = 3;
   232    bool update = 4;
   233  }
   234  
   235  message InspectRepoRequest {
   236    Repo repo = 1;
   237  }
   238  
   239  message ListRepoRequest {
   240    reserved 1;
   241  }
   242  
   243  message ListRepoResponse {
   244    repeated RepoInfo repo_info = 1;
   245  }
   246  
   247  message DeleteRepoRequest {
   248    Repo repo = 1;
   249    bool force = 2;
   250    bool all = 3;
   251    bool split_transaction = 4;
   252  }
   253  
   254  // CommitState describes the states a commit can be in.
   255  // The states are increasingly specific, i.e. a commit that is FINISHED also counts as STARTED.
   256  enum CommitState {
   257    STARTED = 0; // The commit has been started, all commits satisfy this state.
   258    READY = 1; // The commit has been started, and all of its provenant commits have been finished.
   259    FINISHED = 2; // The commit has been finished.
   260  }
   261  
   262  message StartCommitRequest {
   263    reserved 2;
   264    // Parent.ID may be empty in which case the commit that Branch points to will be used as the parent.
   265    // If branch is empty, or if branch does not exist, the commit will have no parent.
   266    Commit parent = 1;
   267    // description is a user-provided string describing this commit
   268    string description = 4;
   269    string branch = 3;
   270    repeated CommitProvenance provenance = 5;
   271  }
   272  
   273  message BuildCommitRequest {
   274    reserved 2;
   275    Commit parent = 1;
   276    string branch = 4;
   277    CommitOrigin origin = 12;
   278    repeated CommitProvenance provenance = 6;
   279    Object tree = 3;
   280    repeated Object trees = 7;
   281    Object datums = 8;
   282    // ID sets the ID of the created commit.
   283    string ID = 5;
   284    uint64 size_bytes = 9;
   285    // 'started' and 'finished' are set by Restore() when repopulating old
   286    // commits. If 'finished' is set, the commit being built is always marked
   287    // finished.
   288    google.protobuf.Timestamp started = 10;
   289    google.protobuf.Timestamp finished = 11;
   290  }
   291  
   292  message FinishCommitRequest {
   293    Commit commit = 1;
   294    // description is a user-provided string describing this commit. Setting this
   295    // will overwrite the description set in StartCommit
   296    string description = 2;
   297  
   298    Object tree = 3;
   299    repeated Object trees = 5;
   300    Object datums = 7;
   301    uint64 size_bytes = 6;
   302    // If set, 'commit' will be closed (its 'finished' field will be set to the
   303    // current time) but its 'tree' will be left nil.
   304    bool empty = 4;
   305  }
   306  
   307  message InspectCommitRequest {
   308    Commit commit = 1;
   309    // BlockState causes inspect commit to block until the commit is in the desired state.
   310    CommitState block_state = 2;
   311  }
   312  
   313  message ListCommitRequest {
   314    Repo repo = 1;
   315    Commit from = 2;
   316    Commit to = 3;
   317    uint64 number = 4;
   318    bool reverse = 5;  // Return commits oldest to newest
   319  }
   320  
   321  message CommitInfos {
   322    repeated CommitInfo commit_info = 1;
   323  }
   324  
   325  message CreateBranchRequest {
   326    Commit head = 1;
   327    // s_branch matches the field number and type of SetBranchRequest.Branch in
   328    // Pachyderm 1.6--so that operations (generated by pachyderm 1.6's
   329    // Admin.Export) can be deserialized by pachyderm 1.7 correctly
   330    string s_branch = 2;
   331    Branch branch = 3;
   332    repeated Branch provenance = 4;
   333    Trigger trigger = 5;
   334  }
   335  
   336  message InspectBranchRequest {
   337    Branch branch = 1;
   338  }
   339  
   340  message ListBranchRequest {
   341    Repo repo = 1;
   342    bool reverse = 2; // Returns branches oldest to newest
   343  }
   344  
   345  message DeleteBranchRequest {
   346    Branch branch = 1;
   347    bool force = 2;
   348  }
   349  
   350  message DeleteCommitRequest {
   351    Commit commit = 1;
   352  }
   353  
   354  message FlushCommitRequest {
   355    repeated Commit commits = 1;
   356    repeated Repo to_repos = 2;
   357  }
   358  
   359  message SubscribeCommitRequest {
   360    Repo repo = 1;
   361    string branch = 2;
   362    CommitProvenance prov = 5;
   363    // only commits created since this commit are returned
   364    Commit from = 3;
   365    // Don't return commits until they're in (at least) the desired state.
   366    CommitState state = 4;
   367  }
   368  
   369  message GetFileRequest {
   370    File file = 1;
   371    int64 offset_bytes = 2;
   372    int64 size_bytes = 3;
   373  }
   374  
   375  enum Delimiter {
   376    NONE = 0;
   377    JSON = 1;
   378    LINE = 2;
   379    SQL = 3;
   380    CSV = 4;
   381  }
   382  
   383  // An OverwriteIndex specifies the index of objects from which new writes
   384  // are applied to.  Existing objects starting from the index are deleted.
   385  // We want a separate message for ObjectIndex because we want to be able to
   386  // distinguish between a zero index and a non-existent index.
   387  message OverwriteIndex {
   388    int64 index = 1;
   389  }
   390  
   391  message PutFileRequest {
   392    reserved 2, 4;
   393    File file = 1;
   394    bytes value = 3;
   395    string url = 5;
   396    // applies only to URLs that can be recursively walked, for example s3:// URLs
   397    bool recursive = 6;
   398    // Delimiter causes data to be broken up into separate files with File.Path
   399    // as a prefix.
   400    Delimiter delimiter = 7;
   401    // TargetFileDatums specifies the target number of datums in each written
   402    // file it may be lower if data does not split evenly, but will never be
   403    // higher, unless the value is 0.
   404    int64 target_file_datums = 8;
   405    // TargetFileBytes specifies the target number of bytes in each written
   406    // file, files may have more or fewer bytes than the target.
   407    int64 target_file_bytes = 9;
   408    // header_records is an option for splitting data when 'delimiter' is not NONE
   409    // (or SQL). It specifies the number of records that are converted to a
   410    // header and applied to all file shards.
   411    //
   412    // This is particularly useful for CSV files, where the first row often
   413    // contains column titles; if 'header_records' is set to one in that case,
   414    // the first row will be associated with the directory that contains the rest
   415    // of the split-up csv rows as files, and if any data is retrieved from that
   416    // directory by GetFile, it will appear to begin with that first row of
   417    // column labels (including in pipeline workers).
   418    //
   419    // Note that SQL files have their own logic for determining headers (their
   420    // header is not a number of records, but a collection of SQL commands that
   421    // create the relevant tables and such). This way, SQL files retrieved by
   422    // GetFile can be passed to psql, and they will set up the appropriate tables
   423    // before inserting the records in the files that were retrieved.
   424    int64 header_records = 11;
   425    // overwrite_index is the object index where the write starts from.  All
   426    // existing objects starting from the index are deleted.
   427    OverwriteIndex overwrite_index = 10;
   428    // delete indicates that the file should be deleted, this is redundant with
   429    // DeleteFile, but is necessary because it allows you to send file deletes
   430    // atomically with other PutFile operations.
   431    bool delete = 12;
   432  }
   433  
   434  // PutFileRecord is used to record PutFile requests in etcd temporarily.
   435  message PutFileRecord {
   436    int64 size_bytes = 1;
   437    string object_hash = 2;
   438    OverwriteIndex overwrite_index = 3;
   439    BlockRef block_ref = 4;
   440  }
   441  
   442  message PutFileRecords {
   443    bool split = 1;
   444    repeated PutFileRecord records = 2;
   445    bool tombstone = 3;
   446    PutFileRecord header = 4;
   447    PutFileRecord footer = 5;
   448  }
   449  
   450  message CopyFileRequest {
   451    File src = 1;
   452    File dst = 2;
   453    bool overwrite = 3;
   454  }
   455  
   456  message InspectFileRequest {
   457    File file = 1;
   458  }
   459  
   460  message ListFileRequest {
   461    // File is the parent directory of the files we want to list. This sets the
   462    // repo, the commit/branch, and path prefix of files we're interested in
   463    // If the "path" field is omitted, a list of files at the top level of the repo
   464    // is returned
   465    File file = 1;
   466  
   467    // Full indicates whether the result should include file contents, which may
   468    // be large (i.e. the list of children for directories, and the list of object
   469    // references for regular files)
   470    bool full = 2;
   471  
   472    // History indicates how many historical versions you want returned. Its
   473    // semantics are:
   474    // 0: Return the files as they are at the commit in `file`. FileInfo.File
   475    //    will equal File in this request.
   476    // 1: Return the files as they are in the last commit they were modified in.
   477    //    (This will have the same hash as if you'd passed 0, but
   478    //    FileInfo.File.Commit will be different.
   479    // 2: Return the above and the files as they are in the next-last commit they
   480    //    were modified in.
   481    // 3: etc.
   482    //-1: Return all historical versions.
   483    int64 history = 3;
   484  }
   485  
   486  message WalkFileRequest {
   487      File file = 1;
   488  }
   489  
   490  message GlobFileRequest {
   491    Commit commit = 1;
   492    string pattern = 2;
   493  }
   494  
   495  // FileInfos is the result of both ListFile and GlobFile
   496  message FileInfos {
   497    repeated FileInfo file_info = 1;
   498  }
   499  
   500  message DiffFileRequest {
   501    File new_file = 1;
   502    // OldFile may be left nil in which case the same path in the parent of
   503    // NewFile's commit will be used.
   504    File old_file = 2;
   505    bool shallow = 3;
   506  }
   507  
   508  message DiffFileResponse {
   509    repeated FileInfo new_files = 1;
   510    repeated FileInfo old_files = 2;
   511  }
   512  
   513  message DeleteFileRequest {
   514    File file = 1;
   515  }
   516  
   517  message FsckRequest {
   518    bool fix = 1;
   519  }
   520  
   521  message FsckResponse {
   522    string fix = 1;
   523    string error = 2;
   524  }
   525  
   526  // Messages specific to Pachyderm 2.
   527  
   528  message FileOperationRequestV2 {
   529    Commit commit = 1;
   530    oneof operation {
   531      PutTarRequestV2 put_tar = 2;
   532      DeleteFilesRequestV2 delete_files = 3;
   533    }
   534  }
   535  
   536  message PutTarRequestV2 {
   537    bool overwrite = 1;
   538    string tag = 2;
   539    bytes data = 3;
   540  }
   541  
   542  message DeleteFilesRequestV2 {
   543    repeated string files = 1; 
   544    string tag = 2;
   545  }
   546  
   547  message GetTarRequestV2 {
   548    File file = 1;
   549  }
   550  
   551  message DiffFileResponseV2 {
   552    FileInfo old_file = 1;
   553    FileInfo new_file = 2;
   554  }
   555  
   556  message CreateTmpFileSetResponse {
   557    string fileset_id = 1;
   558  }
   559  
   560  message RenewTmpFileSetRequest {
   561    string fileset_id = 1;
   562    int64 ttl_seconds = 2;
   563  }
   564  
   565  message ClearCommitRequestV2 {
   566    Commit commit = 1;
   567  }
   568  
   569  service API {
   570    // Repo rpcs
   571    // CreateRepo creates a new repo.
   572    // An error is returned if the repo already exists.
   573    rpc CreateRepo(CreateRepoRequest) returns (google.protobuf.Empty) {}
   574    // InspectRepo returns info about a repo.
   575    rpc InspectRepo(InspectRepoRequest) returns (RepoInfo) {}
   576    // ListRepo returns info about all repos.
   577    rpc ListRepo(ListRepoRequest) returns (ListRepoResponse) {}
   578    // DeleteRepo deletes a repo.
   579    rpc DeleteRepo(DeleteRepoRequest) returns (google.protobuf.Empty) {}
   580  
   581    // Commit rpcs
   582    // StartCommit creates a new write commit from a parent commit.
   583    rpc StartCommit(StartCommitRequest) returns (Commit) {}
   584    // FinishCommit turns a write commit into a read commit.
   585    rpc FinishCommit(FinishCommitRequest) returns (google.protobuf.Empty) {}
   586    // InspectCommit returns the info about a commit.
   587    rpc InspectCommit(InspectCommitRequest) returns (CommitInfo) {}
   588    // ListCommit returns info about all commits. This is deprecated in favor of
   589    // ListCommitStream.
   590    rpc ListCommit(ListCommitRequest) returns (CommitInfos) {}
   591    // ListCommitStream is like ListCommit, but returns its results in a GRPC stream
   592    rpc ListCommitStream(ListCommitRequest) returns (stream CommitInfo) {}
   593    // DeleteCommit deletes a commit.
   594    rpc DeleteCommit(DeleteCommitRequest) returns (google.protobuf.Empty) {}
   595    // FlushCommit waits for downstream commits to finish
   596    rpc FlushCommit(FlushCommitRequest) returns (stream CommitInfo) {}
   597    // SubscribeCommit subscribes for new commits on a given branch
   598    rpc SubscribeCommit(SubscribeCommitRequest) returns (stream CommitInfo) {}
   599    // BuildCommit builds a commit that's backed by the given tree
   600    rpc BuildCommit(BuildCommitRequest) returns (Commit) {}
   601  
   602    // CreateBranch creates a new branch
   603    rpc CreateBranch(CreateBranchRequest) returns (google.protobuf.Empty) {}
   604    // InspectBranch returns info about a branch.
   605    rpc InspectBranch(InspectBranchRequest) returns (BranchInfo) {}
   606    // ListBranch returns info about the heads of branches.
   607    rpc ListBranch(ListBranchRequest) returns (BranchInfos) {}
   608    // DeleteBranch deletes a branch; note that the commits still exist.
   609    rpc DeleteBranch(DeleteBranchRequest) returns (google.protobuf.Empty) {}
   610  
   611    // File rpcs
   612    // PutFile writes the specified file to pfs.
   613    rpc PutFile(stream PutFileRequest) returns (google.protobuf.Empty) {}
   614    // CopyFile copies the contents of one file to another.
   615    rpc CopyFile(CopyFileRequest) returns (google.protobuf.Empty) {}
   616    // GetFile returns a byte stream of the contents of the file.
   617    rpc GetFile(GetFileRequest) returns (stream google.protobuf.BytesValue) {}
   618    // InspectFile returns info about a file.
   619    rpc InspectFile(InspectFileRequest) returns (FileInfo) {}
   620    // ListFile returns info about all files. This is deprecated in favor of
   621    // ListFileStream
   622    rpc ListFile(ListFileRequest) returns (FileInfos) {}
   623    // ListFileStream is a streaming version of ListFile
   624    // TODO(msteffen): When the dash has been updated to use ListFileStream,
   625    // replace ListFile with this RPC (https://github.com/pachyderm/dash/issues/201)
   626    rpc ListFileStream(ListFileRequest) returns (stream FileInfo) {}
   627    // WalkFile walks over all the files under a directory, including children of children.
   628    rpc WalkFile(WalkFileRequest) returns (stream FileInfo) {}
   629    // GlobFile returns info about all files. This is deprecated in favor of
   630    // GlobFileStream
   631    rpc GlobFile(GlobFileRequest) returns (FileInfos) {}
   632    // GlobFileStream is a streaming version of GlobFile
   633    // TODO(msteffen): When the dash has been updated to use GlobFileStream,
   634    // replace GlobFile with this RPC (https://github.com/pachyderm/dash/issues/201)
   635    rpc GlobFileStream(GlobFileRequest) returns (stream FileInfo) {}
   636    // DiffFile returns the differences between 2 paths at 2 commits.
   637    rpc DiffFile(DiffFileRequest) returns (DiffFileResponse) {}
   638    // DeleteFile deletes a file.
   639    rpc DeleteFile(DeleteFileRequest) returns (google.protobuf.Empty) {}
   640  
   641    // DeleteAll deletes everything
   642    rpc DeleteAll(google.protobuf.Empty) returns (google.protobuf.Empty) {}
   643    // Fsck does a file system consistency check for pfs
   644    rpc Fsck(FsckRequest) returns (stream FsckResponse) {}
   645  
   646    // RPCs specific to Pachyderm 2.
   647    rpc FileOperationV2(stream FileOperationRequestV2) returns (google.protobuf.Empty) {}
   648    rpc GetTarV2(GetTarRequestV2) returns (stream google.protobuf.BytesValue) {}
   649    // DiffFileV2 returns the differences between 2 paths at 2 commits.
   650    // it streams back one file at a time which is either from the new path, or the old path
   651    rpc DiffFileV2(DiffFileRequest) returns (stream DiffFileResponseV2) {}
   652    // CreateTmpFileSet creates a new temp fileset
   653    rpc CreateTmpFileSet(stream FileOperationRequestV2) returns (CreateTmpFileSetResponse) {}
   654    // RenewTmpFileSet prevents the temporary fileset from being deleted for a set amount of time
   655    rpc RenewTmpFileSet(RenewTmpFileSetRequest) returns (google.protobuf.Empty) {}
   656    // ClearCommitV2 removes all data from the commit.
   657    rpc ClearCommitV2(ClearCommitRequestV2) returns (google.protobuf.Empty) {}
   658  }
   659  
   660  message PutObjectRequest {
   661    bytes value = 1;
   662    repeated Tag tags = 2;
   663    Block block = 3;
   664  }
   665  
   666  message CreateObjectRequest {
   667    Object object = 1;
   668    BlockRef block_ref = 2;
   669  }
   670  
   671  message GetObjectsRequest {
   672    repeated Object objects = 1;
   673    uint64 offset_bytes = 2;
   674    // The number of bytes requested.
   675    uint64 size_bytes = 3;
   676    // The total amount of bytes in these objects.  It's OK if it's not
   677    // entirely accurate or if it's unknown (in which case it'd be set to 0).
   678    // It's used primarily as a hint for cache eviction.
   679    uint64 total_size = 4;
   680  }
   681  
   682  message PutBlockRequest {
   683    Block block = 1;
   684    bytes value = 2;
   685  }
   686  
   687  message GetBlockRequest {
   688    Block block = 1;
   689  }
   690  
   691  message GetBlocksRequest {
   692    repeated BlockRef blockRefs = 1;
   693    uint64 offset_bytes = 2;
   694    // The number of bytes requested.
   695    uint64 size_bytes = 3;
   696    // The total amount of bytes in these blocks.  It's OK if it's not
   697    // entirely accurate or if it's unknown (in which case it'd be set to 0).
   698    // It's used primarily as a hint for cache eviction.
   699    uint64 total_size = 4;
   700  }
   701  
   702  message ListBlockRequest {}
   703  
   704  message TagObjectRequest {
   705    Object object = 1;
   706    repeated Tag tags = 2;
   707  }
   708  
   709  message ListObjectsRequest {}
   710  
   711  message ListTagsRequest {
   712    string prefix = 1;
   713    bool include_object = 2;
   714  }
   715  
   716  message ListTagsResponse {
   717    Tag tag = 1;
   718    Object object = 2;
   719  }
   720  
   721  message DeleteObjectsRequest {
   722    repeated Object objects = 1;
   723  }
   724  
   725  message DeleteObjectsResponse {}
   726  
   727  message DeleteTagsRequest {
   728    repeated Tag tags = 1;
   729  }
   730  
   731  message DeleteTagsResponse {}
   732  
   733  message CheckObjectRequest {
   734    Object object = 1;
   735  }
   736  
   737  message CheckObjectResponse {
   738    bool exists = 1;
   739  }
   740  
   741  message Objects {
   742    repeated Object objects = 1;
   743  }
   744  
   745  message PutObjDirectRequest {
   746    string obj = 1;
   747    bytes value = 2;
   748  }
   749  
   750  message GetObjDirectRequest {
   751    string obj = 1;
   752  }
   753  
   754  message DeleteObjDirectRequest {
   755    // The 'object' and 'prefix' fields are mutually exclusive.
   756  
   757    // Delete a single object by its path.
   758    string object = 1;
   759  
   760    // Delete all objects with paths matching this prefix, cannot be applied to
   761    // the core storage layer paths, as those are generally not safe to delete
   762    // (use garbage collection for that). This is for deleting objects generated
   763    // vi `PutObjDirect`.
   764    string prefix = 2;
   765  }
   766  
   767  service ObjectAPI {
   768    rpc PutObject(stream PutObjectRequest) returns (Object) {}
   769    rpc PutObjectSplit(stream PutObjectRequest) returns (Objects) {}
   770    rpc PutObjects(stream PutObjectRequest) returns (google.protobuf.Empty) {}
   771    rpc CreateObject(CreateObjectRequest) returns (google.protobuf.Empty) {}
   772    rpc GetObject(Object) returns (stream google.protobuf.BytesValue) {}
   773    rpc GetObjects(GetObjectsRequest) returns (stream google.protobuf.BytesValue) {}
   774    rpc PutBlock(stream PutBlockRequest) returns (google.protobuf.Empty) {}
   775    rpc GetBlock(GetBlockRequest) returns (stream google.protobuf.BytesValue) {}
   776    rpc GetBlocks(GetBlocksRequest) returns (stream google.protobuf.BytesValue) {}
   777    rpc ListBlock(ListBlockRequest) returns (stream Block) {}
   778    rpc TagObject(TagObjectRequest) returns (google.protobuf.Empty) {}
   779    rpc InspectObject(Object) returns (ObjectInfo) {}
   780    // CheckObject checks if an object exists in the blob store without
   781    // actually reading the object.
   782    rpc CheckObject(CheckObjectRequest) returns (CheckObjectResponse) {}
   783    rpc ListObjects(ListObjectsRequest) returns (stream ObjectInfo) {}
   784    rpc DeleteObjects(DeleteObjectsRequest) returns (DeleteObjectsResponse) {}
   785    rpc GetTag(Tag) returns (stream google.protobuf.BytesValue) {}
   786    rpc InspectTag(Tag) returns (ObjectInfo) {}
   787    rpc ListTags(ListTagsRequest) returns (stream ListTagsResponse) {}
   788    rpc DeleteTags(DeleteTagsRequest) returns (DeleteTagsResponse) {}
   789    rpc Compact(google.protobuf.Empty) returns (google.protobuf.Empty) {}
   790    // PutObjDirect puts an obj directly into object store, bypassing the content
   791    // addressing layer.
   792    rpc PutObjDirect(stream PutObjDirectRequest) returns (google.protobuf.Empty) {}
   793    // GetObjDirect gets an obj directly out of object store, bypassing the
   794    // content addressing layer.
   795    rpc GetObjDirect(GetObjDirectRequest) returns (stream google.protobuf.BytesValue) {}
   796    rpc DeleteObjDirect(DeleteObjDirectRequest) returns (google.protobuf.Empty) {}
   797  }
   798  
   799  message ObjectIndex {
   800    map<string, BlockRef> objects = 1;
   801    map<string, Object> tags = 2;
   802  }
   803