syntax = "proto3";

package gitaly;

import "shared.proto";

service BlobService {
  // GetBlob returns the contents of a blob object referenced by its object
  // ID. We use a stream to return a chunked arbitrarily large binary
  // response
  rpc GetBlob(GetBlobRequest) returns (stream GetBlobResponse) {}
}

message GetBlobRequest {
  Repository repository = 1;
  // Object ID (SHA1) of the blob we want to get
  string oid = 2;
  // Maximum number of bytes we want to receive. Use '-1' to get the full blob no matter how big.
  int64 limit = 3;
}

message GetBlobResponse {
  // Blob size; present only in first response message
  int64 size = 1; 
  // Chunk of blob data
  bytes data = 2; 
  // Object ID of the actual blob returned. Empty if no blob was found.
  string oid = 3;
}
