Skip to content

Commit

Permalink
[Improvement][new api] refer to apache#2127
Browse files Browse the repository at this point in the history
1. class name of SeaTunnelRuntimeEnvironment changes to SeaTunnelContextAware
2. Serializer doesn't need to extend Serializable
3. unify Enumerator concept
  • Loading branch information
lhyundeadsoul committed Jul 6, 2022
1 parent 6d29e3e commit 939f32f
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
package org.apache.seatunnel.api.serialization;

import java.io.IOException;
import java.io.Serializable;

public interface Serializer<T> extends Serializable {
public interface Serializer<T> {

/**
* Serializes the given object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.apache.seatunnel.api.common.PluginIdentifierInterface;
import org.apache.seatunnel.api.common.SeaTunnelPluginLifeCycle;
import org.apache.seatunnel.api.serialization.Serializer;
import org.apache.seatunnel.api.source.SeaTunnelRuntimeEnvironment;
import org.apache.seatunnel.api.source.SeaTunnelContextAware;
import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
import org.apache.seatunnel.api.table.type.SeaTunnelRowType;

Expand All @@ -43,7 +43,7 @@
* {@link SinkAggregatedCommitter} handle it, this class should implement interface {@link Serializable}.
*/
public interface SeaTunnelSink<IN, StateT, CommitInfoT, AggregatedCommitInfoT>
extends Serializable, PluginIdentifierInterface, SeaTunnelPluginLifeCycle, SeaTunnelRuntimeEnvironment {
extends Serializable, PluginIdentifierInterface, SeaTunnelPluginLifeCycle, SeaTunnelContextAware {

/**
* Set the row type info of sink row data. This method will be automatically called by translation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/**
* This interface defines the runtime environment of the SeaTunnel application.
*/
public interface SeaTunnelRuntimeEnvironment {
public interface SeaTunnelContextAware {

default void setSeaTunnelContext(SeaTunnelContext seaTunnelContext){
// nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @param <StateT> The type of checkpoint states.
*/
public interface SeaTunnelSource<T, SplitT extends SourceSplit, StateT>
extends Serializable, PluginIdentifierInterface, SeaTunnelPluginLifeCycle, SeaTunnelRuntimeEnvironment {
extends Serializable, PluginIdentifierInterface, SeaTunnelPluginLifeCycle, SeaTunnelContextAware {

/**
* Get the boundedness of this source.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ interface Context {
*
* @param sourceEvent the source event to coordinator.
*/
void sendSourceEventToCoordinator(SourceEvent sourceEvent);
void sendSourceEventToEnumerator(SourceEvent sourceEvent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public abstract class AbstractSingleSplitSource<T> implements SeaTunnelSource<T,

@Override
public final AbstractSingleSplitReader<T> createReader(SourceReader.Context readerContext) throws Exception {
checkArgument(readerContext.getIndexOfSubtask() == 0, "Single split source allows only a single reader to be created.");
checkArgument(readerContext.getIndexOfSubtask() == 0, "A single split source allows only one single reader to be created.");
return createReader(new SingleSplitReaderContext(readerContext));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void sendSplitRequest() {
}

@Override
public void sendSourceEventToCoordinator(SourceEvent sourceEvent) {
public void sendSourceEventToEnumerator(SourceEvent sourceEvent) {
coordinatedSource.handleReaderEvent(subtaskId, sourceEvent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void sendSplitRequest() {
}

@Override
public void sendSourceEventToCoordinator(SourceEvent sourceEvent) {
public void sendSourceEventToEnumerator(SourceEvent sourceEvent) {
// TODO: exception
throw new RuntimeException("");
}
Expand Down

0 comments on commit 939f32f

Please sign in to comment.