Skip to content

Commit 8a388d6

Browse files
committed
leases: support resource management
Add three methods for lease service so that the client can use it to manage the resource by lease, not just gc.root label. With the following methods, it is easy for client to maintain their own cache system. ``` - AddResource(context.Context, Lease, Resource) error - RemoveResource(context.Context, Lease, Resource) error - ListResources(context.Context, Lease) ([]Resource, error) ``` And the resource is to be ```golang type Resource { ID string Type string } ``` For the snapshots, the Type field will be formatted by snapshots/%{type}, like snapshots/overlayfs. fix: #3295 Signed-off-by: Wei Fu <[email protected]>
1 parent 0e7a3c9 commit 8a388d6

10 files changed

Lines changed: 2125 additions & 229 deletions

File tree

api/next.pb.txt

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2627,6 +2627,89 @@ file {
26272627
json_name: "leases"
26282628
}
26292629
}
2630+
message_type {
2631+
name: "Resource"
2632+
field {
2633+
name: "id"
2634+
number: 1
2635+
label: LABEL_OPTIONAL
2636+
type: TYPE_STRING
2637+
json_name: "id"
2638+
}
2639+
field {
2640+
name: "type"
2641+
number: 2
2642+
label: LABEL_OPTIONAL
2643+
type: TYPE_STRING
2644+
json_name: "type"
2645+
}
2646+
}
2647+
message_type {
2648+
name: "AddResourceRequest"
2649+
field {
2650+
name: "id"
2651+
number: 1
2652+
label: LABEL_OPTIONAL
2653+
type: TYPE_STRING
2654+
json_name: "id"
2655+
}
2656+
field {
2657+
name: "resource"
2658+
number: 2
2659+
label: LABEL_OPTIONAL
2660+
type: TYPE_MESSAGE
2661+
type_name: ".containerd.services.leases.v1.Resource"
2662+
options {
2663+
65001: 0
2664+
}
2665+
json_name: "resource"
2666+
}
2667+
}
2668+
message_type {
2669+
name: "DeleteResourceRequest"
2670+
field {
2671+
name: "id"
2672+
number: 1
2673+
label: LABEL_OPTIONAL
2674+
type: TYPE_STRING
2675+
json_name: "id"
2676+
}
2677+
field {
2678+
name: "resource"
2679+
number: 2
2680+
label: LABEL_OPTIONAL
2681+
type: TYPE_MESSAGE
2682+
type_name: ".containerd.services.leases.v1.Resource"
2683+
options {
2684+
65001: 0
2685+
}
2686+
json_name: "resource"
2687+
}
2688+
}
2689+
message_type {
2690+
name: "ListResourcesRequest"
2691+
field {
2692+
name: "id"
2693+
number: 1
2694+
label: LABEL_OPTIONAL
2695+
type: TYPE_STRING
2696+
json_name: "id"
2697+
}
2698+
}
2699+
message_type {
2700+
name: "ListResourcesResponse"
2701+
field {
2702+
name: "resources"
2703+
number: 1
2704+
label: LABEL_REPEATED
2705+
type: TYPE_MESSAGE
2706+
type_name: ".containerd.services.leases.v1.Resource"
2707+
options {
2708+
65001: 0
2709+
}
2710+
json_name: "resources"
2711+
}
2712+
}
26302713
service {
26312714
name: "Leases"
26322715
method {
@@ -2644,6 +2727,21 @@ file {
26442727
input_type: ".containerd.services.leases.v1.ListRequest"
26452728
output_type: ".containerd.services.leases.v1.ListResponse"
26462729
}
2730+
method {
2731+
name: "AddResource"
2732+
input_type: ".containerd.services.leases.v1.AddResourceRequest"
2733+
output_type: ".google.protobuf.Empty"
2734+
}
2735+
method {
2736+
name: "DeleteResource"
2737+
input_type: ".containerd.services.leases.v1.DeleteResourceRequest"
2738+
output_type: ".google.protobuf.Empty"
2739+
}
2740+
method {
2741+
name: "ListResources"
2742+
input_type: ".containerd.services.leases.v1.ListResourcesRequest"
2743+
output_type: ".containerd.services.leases.v1.ListResourcesResponse"
2744+
}
26472745
}
26482746
options {
26492747
go_package: "github.com/containerd/containerd/api/services/leases/v1;leases"

0 commit comments

Comments
 (0)