github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/pingcap/tidb/ddl/callback.go (about)

     1  // Copyright 2015 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 ddl
    15  
    16  import "github.com/insionng/yougam/libraries/pingcap/tidb/model"
    17  
    18  // Callback is the interface supporting callback function when DDL changed.
    19  type Callback interface {
    20  	// OnChanged is called after schema is changed.
    21  	OnChanged(err error) error
    22  	// OnJobRunBefore is called before running job.
    23  	OnJobRunBefore(job *model.Job)
    24  	// OnJobUpdated is called after the running job is updated.
    25  	OnJobUpdated(job *model.Job)
    26  }
    27  
    28  // BaseCallback implements Callback.OnChanged interface.
    29  type BaseCallback struct {
    30  }
    31  
    32  // OnChanged implements Callback interface.
    33  func (c *BaseCallback) OnChanged(err error) error {
    34  	return err
    35  }
    36  
    37  // OnJobRunBefore implements Callback.OnJobRunBefore interface.
    38  func (c *BaseCallback) OnJobRunBefore(job *model.Job) {
    39  	// Nothing to do.
    40  }
    41  
    42  // OnJobUpdated implements Callback.OnJobUpdated interface.
    43  func (c *BaseCallback) OnJobUpdated(job *model.Job) {
    44  	// Nothing to do.
    45  }