feat: support task cancellation

This commit is contained in:
Gareth George
2023-12-20 08:54:45 +00:00
parent 95ca96a31f
commit fc9c06df00
15 changed files with 366 additions and 74 deletions

View File

@@ -314,6 +314,14 @@ func (s *Server) Unlock(ctx context.Context, req *types.StringValue) (*emptypb.E
return &emptypb.Empty{}, nil
}
func (s *Server) Cancel(ctx context.Context, req *types.Int64Value) (*emptypb.Empty, error) {
if err := s.orchestrator.CancelOperation(req.Value, v1.OperationStatus_STATUS_USER_CANCELLED); err != nil {
return nil, fmt.Errorf("failed to cancel operation %d: %w", req.Value, err)
}
return &emptypb.Empty{}, nil
}
func (s *Server) PathAutocomplete(ctx context.Context, path *types.StringValue) (*types.StringList, error) {
ents, err := os.ReadDir(path.Value)
if errors.Is(err, os.ErrNotExist) {