Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

org.apache.seatunnel.api.sink.SupportSaveMode
SupportSaveMode is an interface that Sink needs to implement if the SaveMode function is to be implemented. The interface defines an interface to obtain the saveMode actuator


Code Block
languagejava
package org.apache.seatunnel.api.sink;

...



/** The Sink Connectors which support schema and data SaveMode should implement this interface */

...


public interface SupportSaveMode {

...



    String DATA_SAVE_MODE_KEY = "data_save_mode";

...



    String SCHEMA_SAVE_MODE_KEY = "schema_save_mode";

...




    // This method defines the return of a specific save_mode handler

...


    SaveModeHandler getSaveModeHandler();

...


}

saveMode includes table structure saveMode and existing data saveMode. The different processing methods of respectively by two enumeration said org.apache.seatunnel.api.sink.SchemaSaveMode and org.apache.seatunnel.api.sink.DataSaveMode

Code Block
languagejava
package org.apache.seatunnel.api.sink;

...



public enum SchemaSaveMode {

...



    // Will create when the table does not exist, delete and rebuild when the table is saved

...


    RECREATE_SCHEMA,

...



    // Will Created when the table does not exist, skipped when the table is saved

...


    CREATE_SCHEMA_WHEN_NOT_EXIST,

...



    // Error will be reported when the table does not exist

...


    ERROR_WHEN_SCHEMA_NOT_EXIST,

...


}


Code Block
languagejava
package org.apache.seatunnel.api.sink;

...



/**

...


 * The SaveMode for the Sink connectors that use table or other table structures to organize data

...


 */

...


public enum DataSaveMode {

...



    // Preserve database structure and delete data

...


    KEEP_SCHEMA_DROP_DATA,

...



    // Preserve database structure, preserve data

...


    KEEP_SCHEMA_AND_DATA,

...



    // User defined processing

...


    CUSTOM_PROCESSING,

...



    // When there is data, an error is reported

...


    ERROR_WHEN_DATA_EXISTS

...


}

org.apache.seatunnel.api.sink.SaveModeHandler
SaveModeHandler is an executor that executes saveMode functions. This interface is used to implement the specific logic of saveMode functions.

...