github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/cdc/sink/ddlsink/blackhole/black_hole_ddl_sink.go (about)

     1  // Copyright 2022 PingCAP, Inc.
     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  // See the License for the specific language governing permissions and
    12  // limitations under the License
    13  
    14  package blackhole
    15  
    16  import (
    17  	"context"
    18  
    19  	"github.com/pingcap/log"
    20  	"github.com/pingcap/tiflow/cdc/model"
    21  	"github.com/pingcap/tiflow/cdc/sink/ddlsink"
    22  	"go.uber.org/zap"
    23  )
    24  
    25  // Assert Sink implementation
    26  var _ ddlsink.Sink = (*DDLSink)(nil)
    27  
    28  // DDLSink is a black hole DDL sink.
    29  type DDLSink struct{}
    30  
    31  // NewDDLSink create a black hole DDL sink.
    32  func NewDDLSink() *DDLSink {
    33  	return &DDLSink{}
    34  }
    35  
    36  // WriteDDLEvent do nothing.
    37  func (d *DDLSink) WriteDDLEvent(ctx context.Context,
    38  	ddl *model.DDLEvent,
    39  ) error {
    40  	log.Debug("BlackHoleSink: DDL Event", zap.Any("ddl", ddl))
    41  	return nil
    42  }
    43  
    44  // WriteCheckpointTs do nothing.
    45  func (d *DDLSink) WriteCheckpointTs(ctx context.Context,
    46  	ts uint64, tables []*model.TableInfo,
    47  ) error {
    48  	log.Debug("BlackHoleSink: Checkpoint Ts Event", zap.Uint64("ts", ts), zap.Any("tables", tables))
    49  	return nil
    50  }
    51  
    52  // Close do nothing.
    53  func (d *DDLSink) Close() {}