github.com/containerd/containerd@v22.0.0-20200918172823-438c87b8e050+incompatible/api/services/leases/v1/leases.proto (about)

     1  syntax = "proto3";
     2  
     3  package containerd.services.leases.v1;
     4  
     5  import weak "gogoproto/gogo.proto";
     6  import "google/protobuf/empty.proto";
     7  import "google/protobuf/timestamp.proto";
     8  
     9  option go_package = "github.com/containerd/containerd/api/services/leases/v1;leases";
    10  
    11  // Leases service manages resources leases within the metadata store.
    12  service Leases {
    13  	// Create creates a new lease for managing changes to metadata. A lease
    14  	// can be used to protect objects from being removed.
    15  	rpc Create(CreateRequest) returns (CreateResponse);
    16  
    17  	// Delete deletes the lease and makes any unreferenced objects created
    18  	// during the lease eligible for garbage collection if not referenced
    19  	// or retained by other resources during the lease.
    20  	rpc Delete(DeleteRequest) returns (google.protobuf.Empty);
    21  
    22  	// List lists all active leases, returning the full list of
    23  	// leases and optionally including the referenced resources.
    24  	rpc List(ListRequest) returns (ListResponse);
    25  
    26  	// AddResource references the resource by the provided lease.
    27  	rpc AddResource(AddResourceRequest) returns (google.protobuf.Empty);
    28  
    29  	// DeleteResource dereferences the resource by the provided lease.
    30  	rpc DeleteResource(DeleteResourceRequest) returns (google.protobuf.Empty);
    31  
    32  	// ListResources lists all the resources referenced by the lease.
    33  	rpc ListResources(ListResourcesRequest) returns (ListResourcesResponse);
    34  }
    35  
    36  // Lease is an object which retains resources while it exists.
    37  message Lease {
    38  	string id = 1;
    39  
    40  	google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
    41  
    42  	map<string, string> labels = 3;
    43  }
    44  
    45  message CreateRequest {
    46  	// ID is used to identity the lease, when the id is not set the service
    47  	// generates a random identifier for the lease.
    48  	string id = 1;
    49  
    50  	map<string, string> labels = 3;
    51  }
    52  
    53  message CreateResponse {
    54  	Lease lease = 1;
    55  }
    56  
    57  message DeleteRequest {
    58  	string id = 1;
    59  
    60  	// Sync indicates that the delete and cleanup should be done
    61  	// synchronously before returning to the caller
    62  	//
    63  	// Default is false
    64  	bool sync = 2;
    65  }
    66  
    67  message ListRequest {
    68  	repeated string filters = 1;
    69  }
    70  
    71  message ListResponse {
    72  	repeated Lease leases = 1;
    73  }
    74  
    75  message Resource {
    76  	string id = 1;
    77  
    78  	// For snapshotter resource, there are many snapshotter types here, like
    79  	// overlayfs, devmapper etc. The type will be formatted with type,
    80  	// like "snapshotter/overlayfs".
    81  	string type = 2;
    82  }
    83  
    84  message AddResourceRequest {
    85  	string id = 1;
    86  
    87  	Resource resource = 2 [(gogoproto.nullable) = false];
    88  }
    89  
    90  message DeleteResourceRequest {
    91  	string id = 1;
    92  
    93  	Resource resource = 2 [(gogoproto.nullable) = false];
    94  }
    95  
    96  message ListResourcesRequest {
    97  	string id = 1;
    98  }
    99  
   100  message ListResourcesResponse {
   101  	repeated Resource resources = 1	[(gogoproto.nullable) = false];
   102  }