github.com/lalkh/containerd@v1.4.3/api/services/content/v1/content.proto (about)

     1  syntax = "proto3";
     2  
     3  package containerd.services.content.v1;
     4  
     5  import weak "gogoproto/gogo.proto";
     6  import "google/protobuf/field_mask.proto";
     7  import "google/protobuf/timestamp.proto";
     8  import "google/protobuf/empty.proto";
     9  
    10  option go_package = "github.com/containerd/containerd/api/services/content/v1;content";
    11  
    12  // Content provides access to a content addressable storage system.
    13  service Content {
    14  	// Info returns information about a committed object.
    15  	//
    16  	// This call can be used for getting the size of content and checking for
    17  	// existence.
    18  	rpc Info(InfoRequest) returns (InfoResponse);
    19  
    20  	// Update updates content metadata.
    21  	//
    22  	// This call can be used to manage the mutable content labels. The
    23  	// immutable metadata such as digest, size, and committed at cannot
    24  	// be updated.
    25  	rpc Update(UpdateRequest) returns (UpdateResponse);
    26  
    27  	// List streams the entire set of content as Info objects and closes the
    28  	// stream.
    29  	//
    30  	// Typically, this will yield a large response, chunked into messages.
    31  	// Clients should make provisions to ensure they can handle the entire data
    32  	// set.
    33  	rpc List(ListContentRequest) returns (stream ListContentResponse);
    34  
    35  	// Delete will delete the referenced object.
    36  	rpc Delete(DeleteContentRequest) returns (google.protobuf.Empty);
    37  
    38  	// Read allows one to read an object based on the offset into the content.
    39  	//
    40  	// The requested data may be returned in one or more messages.
    41  	rpc Read(ReadContentRequest) returns (stream ReadContentResponse);
    42  
    43  	// Status returns the status for a single reference.
    44  	rpc Status(StatusRequest) returns (StatusResponse);
    45  
    46  	// ListStatuses returns the status of ongoing object ingestions, started via
    47  	// Write.
    48  	//
    49  	// Only those matching the regular expression will be provided in the
    50  	// response. If the provided regular expression is empty, all ingestions
    51  	// will be provided.
    52  	rpc ListStatuses(ListStatusesRequest) returns (ListStatusesResponse);
    53  
    54  	// Write begins or resumes writes to a resource identified by a unique ref.
    55  	// Only one active stream may exist at a time for each ref.
    56  	//
    57  	// Once a write stream has started, it may only write to a single ref, thus
    58  	// once a stream is started, the ref may be omitted on subsequent writes.
    59  	//
    60  	// For any write transaction represented by a ref, only a single write may
    61  	// be made to a given offset. If overlapping writes occur, it is an error.
    62  	// Writes should be sequential and implementations may throw an error if
    63  	// this is required.
    64  	//
    65  	// If expected_digest is set and already part of the content store, the
    66  	// write will fail.
    67  	//
    68  	// When completed, the commit flag should be set to true. If expected size
    69  	// or digest is set, the content will be validated against those values.
    70  	rpc Write(stream WriteContentRequest) returns (stream WriteContentResponse);
    71  
    72  	// Abort cancels the ongoing write named in the request. Any resources
    73  	// associated with the write will be collected.
    74  	rpc Abort(AbortRequest) returns (google.protobuf.Empty);
    75  }
    76  
    77  message Info {
    78  	// Digest is the hash identity of the blob.
    79  	string digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
    80  
    81  	// Size is the total number of bytes in the blob.
    82  	int64 size = 2;
    83  
    84  	// CreatedAt provides the time at which the blob was committed.
    85  	google.protobuf.Timestamp created_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
    86  
    87  	// UpdatedAt provides the time the info was last updated.
    88  	google.protobuf.Timestamp updated_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
    89  
    90  	// Labels are arbitrary data on snapshots.
    91  	//
    92  	// The combined size of a key/value pair cannot exceed 4096 bytes.
    93  	map<string, string> labels  = 5;
    94  }
    95  
    96  message InfoRequest {
    97  	string digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
    98  }
    99  
   100  message InfoResponse {
   101  	Info info = 1 [(gogoproto.nullable) = false];
   102  }
   103  
   104  message UpdateRequest {
   105  	Info info = 1 [(gogoproto.nullable) = false];
   106  
   107  	// UpdateMask specifies which fields to perform the update on. If empty,
   108  	// the operation applies to all fields.
   109  	//
   110  	// In info, Digest, Size, and CreatedAt are immutable,
   111  	// other field may be updated using this mask.
   112  	// If no mask is provided, all mutable field are updated.
   113  	google.protobuf.FieldMask update_mask = 2;
   114  }
   115  
   116  message UpdateResponse {
   117  	Info info = 1 [(gogoproto.nullable) = false];
   118  }
   119  
   120  message ListContentRequest {
   121  	// Filters contains one or more filters using the syntax defined in the
   122  	// containerd filter package.
   123  	//
   124  	// The returned result will be those that match any of the provided
   125  	// filters. Expanded, containers that match the following will be
   126  	// returned:
   127  	//
   128  	//   filters[0] or filters[1] or ... or filters[n-1] or filters[n]
   129  	//
   130  	// If filters is zero-length or nil, all items will be returned.
   131  	repeated string filters = 1;
   132  }
   133  
   134  message ListContentResponse {
   135  	repeated Info info = 1 [(gogoproto.nullable) = false];
   136  }
   137  
   138  message DeleteContentRequest {
   139  	// Digest specifies which content to delete.
   140  	string digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
   141  }
   142  
   143  // ReadContentRequest defines the fields that make up a request to read a portion of
   144  // data from a stored object.
   145  message ReadContentRequest {
   146  	// Digest is the hash identity to read.
   147  	string digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
   148  
   149  	// Offset specifies the number of bytes from the start at which to begin
   150  	// the read. If zero or less, the read will be from the start. This uses
   151  	// standard zero-indexed semantics.
   152  	int64 offset = 2;
   153  
   154  	// size is the total size of the read. If zero, the entire blob will be
   155  	// returned by the service.
   156  	int64 size = 3;
   157  }
   158  
   159  // ReadContentResponse carries byte data for a read request.
   160  message ReadContentResponse {
   161  	int64 offset = 1; // offset of the returned data
   162  	bytes data = 2; // actual data
   163  }
   164  
   165  message Status {
   166  	google.protobuf.Timestamp started_at = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
   167  	google.protobuf.Timestamp updated_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
   168  	string ref = 3;
   169  	int64 offset = 4;
   170  	int64 total = 5;
   171  	string expected = 6 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
   172  }
   173  
   174  
   175  message StatusRequest {
   176  	string ref = 1;
   177  }
   178  
   179  message StatusResponse {
   180  	Status status = 1;
   181  }
   182  
   183  message ListStatusesRequest {
   184  	repeated string filters = 1;
   185  }
   186  
   187  message ListStatusesResponse {
   188  	repeated Status statuses = 1 [(gogoproto.nullable) = false];
   189  }
   190  
   191  // WriteAction defines the behavior of a WriteRequest.
   192  enum WriteAction {
   193  	option (gogoproto.goproto_enum_prefix) = false;
   194  	option (gogoproto.enum_customname) = "WriteAction";
   195  
   196  	// WriteActionStat instructs the writer to return the current status while
   197  	// holding the lock on the write.
   198  	STAT = 0 [(gogoproto.enumvalue_customname) = "WriteActionStat"];
   199  
   200  	// WriteActionWrite sets the action for the write request to write data.
   201  	//
   202  	// Any data included will be written at the provided offset. The
   203  	// transaction will be left open for further writes.
   204  	//
   205  	// This is the default.
   206  	WRITE = 1 [(gogoproto.enumvalue_customname) = "WriteActionWrite"];
   207  
   208  	// WriteActionCommit will write any outstanding data in the message and
   209  	// commit the write, storing it under the digest.
   210  	//
   211  	// This can be used in a single message to send the data, verify it and
   212  	// commit it.
   213  	//
   214  	// This action will always terminate the write.
   215  	COMMIT = 2 [(gogoproto.enumvalue_customname) = "WriteActionCommit"];
   216  }
   217  
   218  // WriteContentRequest writes data to the request ref at offset.
   219  message WriteContentRequest {
   220  	// Action sets the behavior of the write.
   221  	//
   222  	// When this is a write and the ref is not yet allocated, the ref will be
   223  	// allocated and the data will be written at offset.
   224  	//
   225  	// If the action is write and the ref is allocated, it will accept data to
   226  	// an offset that has not yet been written.
   227  	//
   228  	// If the action is write and there is no data, the current write status
   229  	// will be returned. This works differently from status because the stream
   230  	// holds a lock.
   231  	WriteAction action = 1;
   232  
   233  	// Ref identifies the pre-commit object to write to.
   234  	string ref = 2;
   235  
   236  	// Total can be set to have the service validate the total size of the
   237  	// committed content.
   238  	//
   239  	// The latest value before or with the commit action message will be use to
   240  	// validate the content. If the offset overflows total, the service may
   241  	// report an error. It is only required on one message for the write.
   242  	//
   243  	// If the value is zero or less, no validation of the final content will be
   244  	// performed.
   245  	int64 total = 3;
   246  
   247  	// Expected can be set to have the service validate the final content against
   248  	// the provided digest.
   249  	//
   250  	// If the digest is already present in the object store, an AlreadyExists
   251  	// error will be returned.
   252  	//
   253  	// Only the latest version will be used to check the content against the
   254  	// digest. It is only required to include it on a single message, before or
   255  	// with the commit action message.
   256  	string expected = 4 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
   257  
   258  	// Offset specifies the number of bytes from the start at which to begin
   259  	// the write. For most implementations, this means from the start of the
   260  	// file. This uses standard, zero-indexed semantics.
   261  	//
   262  	// If the action is write, the remote may remove all previously written
   263  	// data after the offset. Implementations may support arbitrary offsets but
   264  	// MUST support reseting this value to zero with a write. If an
   265  	// implementation does not support a write at a particular offset, an
   266  	// OutOfRange error must be returned.
   267  	int64 offset = 5;
   268  
   269  	// Data is the actual bytes to be written.
   270  	//
   271  	// If this is empty and the message is not a commit, a response will be
   272  	// returned with the current write state.
   273  	bytes data = 6;
   274  
   275  	// Labels are arbitrary data on snapshots.
   276  	//
   277  	// The combined size of a key/value pair cannot exceed 4096 bytes.
   278  	map<string, string> labels  = 7;
   279  }
   280  
   281  // WriteContentResponse is returned on the culmination of a write call.
   282  message WriteContentResponse {
   283  	// Action contains the action for the final message of the stream. A writer
   284  	// should confirm that they match the intended result.
   285  	WriteAction action = 1;
   286  
   287  	// StartedAt provides the time at which the write began.
   288  	//
   289  	// This must be set for stat and commit write actions. All other write
   290  	// actions may omit this.
   291  	google.protobuf.Timestamp started_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
   292  
   293  	// UpdatedAt provides the last time of a successful write.
   294  	//
   295  	// This must be set for stat and commit write actions. All other write
   296  	// actions may omit this.
   297  	google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
   298  
   299  	// Offset is the current committed size for the write.
   300  	int64 offset = 4;
   301  
   302  	// Total provides the current, expected total size of the write.
   303  	//
   304  	// We include this to provide consistency with the Status structure on the
   305  	// client writer.
   306  	//
   307  	// This is only valid on the Stat and Commit response.
   308  	int64 total = 5;
   309  
   310  	// Digest, if present, includes the digest up to the currently committed
   311  	// bytes. If action is commit, this field will be set. It is implementation
   312  	// defined if this is set for other actions.
   313  	string digest = 6 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
   314  }
   315  
   316  message AbortRequest {
   317  	string ref = 1;
   318  }