github.com/google/cadvisor@v0.49.1/third_party/containerd/api/services/content/v1/content.proto (about)

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