forked from containerd/nri
-
Notifications
You must be signed in to change notification settings - Fork 0
/
task.go
118 lines (91 loc) · 3.02 KB
/
task.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"context"
"fmt"
"syscall"
"github.com/containerd/containerd"
ctrdapitypes "github.com/containerd/containerd/api/types"
"github.com/containerd/containerd/cio"
oci "github.com/opencontainers/runtime-spec/specs-go"
)
type fakeTask struct {
id string
pid uint32
spec *oci.Spec
}
func newFakeTask(id string, pid uint32, spec *oci.Spec) containerd.Task {
return &fakeTask{
id: id,
pid: pid,
spec: spec,
}
}
func (t *fakeTask) ID() string {
return t.id
}
func (t *fakeTask) Pid() uint32 {
return t.pid
}
func (t *fakeTask) Spec(context.Context) (*oci.Spec, error) {
return t.spec, nil
}
func (t *fakeTask) Start(context.Context) error {
return nil
}
func (t *fakeTask) Delete(context.Context, ...containerd.ProcessDeleteOpts) (*containerd.ExitStatus, error) {
return nil, fmt.Errorf("unimplemented")
}
func (t *fakeTask) Kill(context.Context, syscall.Signal, ...containerd.KillOpts) error {
return fmt.Errorf("unimplemented")
}
func (t *fakeTask) Wait(context.Context) (<-chan containerd.ExitStatus, error) {
return nil, fmt.Errorf("unimplemented")
}
func (t *fakeTask) CloseIO(context.Context, ...containerd.IOCloserOpts) error {
return fmt.Errorf("unimplemented")
}
func (t *fakeTask) Resize(context.Context, uint32, uint32) error {
return fmt.Errorf("unimplemented")
}
func (t *fakeTask) IO() cio.IO {
return nil
}
func (t *fakeTask) Status(context.Context) (containerd.Status, error) {
return containerd.Status{}, fmt.Errorf("unimplemented")
}
func (t *fakeTask) Pause(context.Context) error {
return fmt.Errorf("unimplemented")
}
func (t *fakeTask) Resume(context.Context) error {
return fmt.Errorf("unimplemented")
}
func (t *fakeTask) Exec(context.Context, string, *oci.Process, cio.Creator) (containerd.Process, error) {
return nil, fmt.Errorf("unimplemented")
}
func (t *fakeTask) Pids(context.Context) ([]containerd.ProcessInfo, error) {
return nil, fmt.Errorf("unimplemented")
}
func (t *fakeTask) Checkpoint(context.Context, ...containerd.CheckpointTaskOpts) (containerd.Image, error) {
return nil, fmt.Errorf("unimplemented")
}
func (t *fakeTask) Update(context.Context, ...containerd.UpdateTaskOpts) error {
return fmt.Errorf("unimplemented")
}
func (t *fakeTask) LoadProcess(context.Context, string, cio.Attach) (containerd.Process, error) {
return nil, fmt.Errorf("unimplemented")
}
func (t *fakeTask) Metrics(context.Context) (*ctrdapitypes.Metric, error) {
return nil, fmt.Errorf("unimplemented")
}