|
| 1 | +// Copyright (c) 2023-2026, Nubificus LTD |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +package containerdshim |
| 16 | + |
| 17 | +import ( |
| 18 | + "context" |
| 19 | + |
| 20 | + taskAPI "github.com/containerd/containerd/api/runtime/task/v2" |
| 21 | + "github.com/containerd/ttrpc" |
| 22 | +) |
| 23 | + |
| 24 | +// taskService is urunc's shim-side wrapper around containerd's runc task |
| 25 | +// service. It is intentionally behavior-preserving for now; feature-specific |
| 26 | +// helpers can hook into Create/Delete here without replacing the plugin again. |
| 27 | +type taskService struct { |
| 28 | + taskAPI.TaskService |
| 29 | + |
| 30 | + containerdAddress string |
| 31 | +} |
| 32 | + |
| 33 | +func (s *taskService) Create(ctx context.Context, r *taskAPI.CreateTaskRequest) (*taskAPI.CreateTaskResponse, error) { |
| 34 | + return s.TaskService.Create(ctx, r) |
| 35 | +} |
| 36 | + |
| 37 | +func (s *taskService) Delete(ctx context.Context, r *taskAPI.DeleteRequest) (*taskAPI.DeleteResponse, error) { |
| 38 | + return s.TaskService.Delete(ctx, r) |
| 39 | +} |
| 40 | + |
| 41 | +func (s *taskService) RegisterTTRPC(server *ttrpc.Server) error { |
| 42 | + taskAPI.RegisterTaskService(server, s) |
| 43 | + return nil |
| 44 | +} |
0 commit comments