Add leases api

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan
2017-10-26 16:16:14 -07:00
parent 01cdf330bb
commit e13894bb7a
19 changed files with 2671 additions and 13 deletions

View File

@@ -2405,6 +2405,182 @@ file {
}
syntax: "proto3"
}
file {
name: "github.com/containerd/containerd/api/services/leases/v1/leases.proto"
package: "containerd.services.leases.v1"
dependency: "gogoproto/gogo.proto"
dependency: "google/protobuf/empty.proto"
dependency: "google/protobuf/timestamp.proto"
message_type {
name: "Snapshot"
field {
name: "snapshotter"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "snapshotter"
}
field {
name: "key"
number: 2
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "key"
}
}
message_type {
name: "Lease"
field {
name: "id"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "id"
}
field {
name: "created_at"
number: 2
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".google.protobuf.Timestamp"
options {
65010: 1
65001: 0
}
json_name: "createdAt"
}
field {
name: "labels"
number: 3
label: LABEL_REPEATED
type: TYPE_MESSAGE
type_name: ".containerd.services.leases.v1.Lease.LabelsEntry"
json_name: "labels"
}
nested_type {
name: "LabelsEntry"
field {
name: "key"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "key"
}
field {
name: "value"
number: 2
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "value"
}
options {
map_entry: true
}
}
}
message_type {
name: "CreateRequest"
field {
name: "id"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "id"
}
field {
name: "labels"
number: 3
label: LABEL_REPEATED
type: TYPE_MESSAGE
type_name: ".containerd.services.leases.v1.CreateRequest.LabelsEntry"
json_name: "labels"
}
nested_type {
name: "LabelsEntry"
field {
name: "key"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "key"
}
field {
name: "value"
number: 2
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "value"
}
options {
map_entry: true
}
}
}
message_type {
name: "CreateResponse"
field {
name: "lease"
number: 1
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".containerd.services.leases.v1.Lease"
json_name: "lease"
}
}
message_type {
name: "DeleteRequest"
field {
name: "id"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "id"
}
}
message_type {
name: "ListRequest"
field {
name: "filters"
number: 1
label: LABEL_REPEATED
type: TYPE_STRING
json_name: "filters"
}
}
message_type {
name: "ListResponse"
field {
name: "leases"
number: 1
label: LABEL_REPEATED
type: TYPE_MESSAGE
type_name: ".containerd.services.leases.v1.Lease"
json_name: "leases"
}
}
service {
name: "Leases"
method {
name: "Create"
input_type: ".containerd.services.leases.v1.CreateRequest"
output_type: ".containerd.services.leases.v1.CreateResponse"
}
method {
name: "Delete"
input_type: ".containerd.services.leases.v1.DeleteRequest"
output_type: ".google.protobuf.Empty"
}
method {
name: "List"
input_type: ".containerd.services.leases.v1.ListRequest"
output_type: ".containerd.services.leases.v1.ListResponse"
}
}
options {
go_package: "github.com/containerd/containerd/api/services/leases/v1;leases"
}
syntax: "proto3"
}
file {
name: "github.com/containerd/containerd/api/services/namespaces/v1/namespace.proto"
package: "containerd.services.namespaces.v1"

View File

@@ -0,0 +1 @@
package leases

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,64 @@
syntax = "proto3";
package containerd.services.leases.v1;
import "gogoproto/gogo.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
option go_package = "github.com/containerd/containerd/api/services/leases/v1;leases";
// Leases service manages resources leases within the metadata store.
service Leases {
// Create creates a new lease for managing changes to metadata. A lease
// can be used to protect objects from being removed.
rpc Create(CreateRequest) returns (CreateResponse);
// Delete deletes the lease and makes any unreferenced objects created
// during the lease eligible for garbage collection if not referenced
// or retained by other resources during the lease.
rpc Delete(DeleteRequest) returns (google.protobuf.Empty);
// ListTransactions lists all active leases, returning the full list of
// leases and optionally including the referenced resources.
rpc List(ListRequest) returns (ListResponse);
}
// Snapshot is a snapshot resource reference.
message Snapshot {
string snapshotter = 1;
string key = 2;
}
// Lease is an object which retains resources while it exists.
message Lease {
string id = 1;
google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
map<string, string> labels = 3;
}
message CreateRequest {
// ID is used to identity the lease, when the id is not set the service
// generates a random identifier for the lease.
string id = 1;
map<string, string> labels = 3;
}
message CreateResponse {
Lease lease = 1;
}
message DeleteRequest {
string id = 1;
}
message ListRequest {
repeated string filters = 1;
}
message ListResponse {
repeated Lease leases = 1;
}