github.com/lalkh/containerd@v1.4.3/pkg/process/deleted_state.go (about) 1 // +build !windows 2 3 /* 4 Copyright The containerd Authors. 5 6 Licensed under the Apache License, Version 2.0 (the "License"); 7 you may not use this file except in compliance with the License. 8 You may obtain a copy of the License at 9 10 http://www.apache.org/licenses/LICENSE-2.0 11 12 Unless required by applicable law or agreed to in writing, software 13 distributed under the License is distributed on an "AS IS" BASIS, 14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 See the License for the specific language governing permissions and 16 limitations under the License. 17 */ 18 19 package process 20 21 import ( 22 "context" 23 24 "github.com/containerd/console" 25 "github.com/containerd/containerd/errdefs" 26 google_protobuf "github.com/gogo/protobuf/types" 27 "github.com/pkg/errors" 28 ) 29 30 type deletedState struct { 31 } 32 33 func (s *deletedState) Pause(ctx context.Context) error { 34 return errors.Errorf("cannot pause a deleted process") 35 } 36 37 func (s *deletedState) Resume(ctx context.Context) error { 38 return errors.Errorf("cannot resume a deleted process") 39 } 40 41 func (s *deletedState) Update(context context.Context, r *google_protobuf.Any) error { 42 return errors.Errorf("cannot update a deleted process") 43 } 44 45 func (s *deletedState) Checkpoint(ctx context.Context, r *CheckpointConfig) error { 46 return errors.Errorf("cannot checkpoint a deleted process") 47 } 48 49 func (s *deletedState) Resize(ws console.WinSize) error { 50 return errors.Errorf("cannot resize a deleted process") 51 } 52 53 func (s *deletedState) Start(ctx context.Context) error { 54 return errors.Errorf("cannot start a deleted process") 55 } 56 57 func (s *deletedState) Delete(ctx context.Context) error { 58 return errors.Wrap(errdefs.ErrNotFound, "cannot delete a deleted process") 59 } 60 61 func (s *deletedState) Kill(ctx context.Context, sig uint32, all bool) error { 62 return errors.Wrap(errdefs.ErrNotFound, "cannot kill a deleted process") 63 } 64 65 func (s *deletedState) SetExited(status int) { 66 // no op 67 } 68 69 func (s *deletedState) Exec(ctx context.Context, path string, r *ExecConfig) (Process, error) { 70 return nil, errors.Errorf("cannot exec in a deleted state") 71 } 72 73 func (s *deletedState) Status(ctx context.Context) (string, error) { 74 return "stopped", nil 75 }