diff --git a/disttask/framework/operator/example.go b/disttask/framework/operator/example.go deleted file mode 100644 index 01249be88c5b0..0000000000000 --- a/disttask/framework/operator/example.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2023 PingCAP, Inc. -// -// 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 operator - -type SimpleOperator struct { - source DataSource - sink DataSink -} diff --git a/disttask/framework/operator/operator.go b/disttask/framework/operator/operator.go deleted file mode 100644 index c6b5abde9444b..0000000000000 --- a/disttask/framework/operator/operator.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 PingCAP, Inc. -// -// 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 operator - -import "github.com/pingcap/tidb/util/logutil" - -type OperatorImpl interface { - PreExecute(data any) error - Execute(data any) error - PostExecute(data any) error -} - -type DataSource interface { - HasNext() (bool, error) - Read() (any, error) -} - -type DataSink interface { - IsFull() (bool, error) - Write(data any) error -} - -type Operator struct { - source DataSource - sink DataSink - impl OperatorImpl -} - -func (o *Operator) PreExecute(data any) error { - logutil.BgLogger().Info("pre execute") - return o.impl.PreExecute(data) -} - -func (o *Operator) Execute(data any) error { - logutil.BgLogger().Info("execute") - return o.impl.Execute(data) -} - -func (o *Operator) PostExecute(data any) error { - logutil.BgLogger().Info("post execute") - return o.impl.PostExecute(data) -} - -func (o *Operator) ReadFromSource() (any, error) { - return o.source.Read() -} - -func (o *Operator) WriteToSink(data any) error { - return o.sink.Write(data) -} - -func (o *Operator) HasNext() (bool, error) { - return o.source.HasNext() -}