Skip to content

Commit

Permalink
Merge pull request apache#36 from KomachiSion/master
Browse files Browse the repository at this point in the history
Move package and rename package for apache#33
  • Loading branch information
avalon566 authored Nov 18, 2019
2 parents aafd0ba + 6359575 commit 1467fbb
Show file tree
Hide file tree
Showing 56 changed files with 208 additions and 186 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import info.avalon566.shardingscaling.core.config.ScalingContext;
import info.avalon566.shardingscaling.core.config.SyncConfiguration;
import info.avalon566.shardingscaling.core.config.SyncType;
import info.avalon566.shardingscaling.core.job.SyncTaskProgress;
import info.avalon566.shardingscaling.core.job.ScalingJobController;
import info.avalon566.shardingscaling.core.controller.SyncTaskProgress;
import info.avalon566.shardingscaling.core.controller.ScalingJobController;
import info.avalon566.shardingscaling.utils.RuntimeUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.log4j.PropertyConfigurator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

/**
* Rule configuration.
*
* @author avalon566
*/
@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package info.avalon566.shardingscaling.core.config;

import info.avalon566.shardingscaling.core.sync.reader.LogPosition;
import info.avalon566.shardingscaling.core.execute.executor.reader.LogPosition;
import lombok.Data;
import lombok.RequiredArgsConstructor;

Expand All @@ -37,7 +37,7 @@ public class SyncConfiguration {
private final SyncType syncType;

/**
* 单表写入并发度.
* The concurrency of writers.
*/
private final int concurrency;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

/**
* Sync type.
*
* @author avalon566
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.job;
package info.avalon566.shardingscaling.core.controller;

import info.avalon566.shardingscaling.core.job.sync.executor.Event;
import info.avalon566.shardingscaling.core.execute.Event;

/**
* Report callback.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.job;
package info.avalon566.shardingscaling.core.controller;

import info.avalon566.shardingscaling.core.config.SyncConfiguration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.job;
package info.avalon566.shardingscaling.core.controller;

import info.avalon566.shardingscaling.core.config.RdbmsConfiguration;
import info.avalon566.shardingscaling.core.config.SyncConfiguration;
import info.avalon566.shardingscaling.core.config.SyncType;
import info.avalon566.shardingscaling.core.job.sync.RealtimeDataSyncTask;
import info.avalon566.shardingscaling.core.job.sync.executor.Event;
import info.avalon566.shardingscaling.core.job.sync.executor.EventType;
import info.avalon566.shardingscaling.core.job.sync.executor.SyncJobExecutor;
import info.avalon566.shardingscaling.core.job.sync.executor.local.LocalSyncJobExecutor;
import info.avalon566.shardingscaling.core.sync.reader.LogPosition;
import info.avalon566.shardingscaling.core.sync.reader.ReaderFactory;
import info.avalon566.shardingscaling.core.sync.util.DataSourceFactory;
import info.avalon566.shardingscaling.core.sync.util.DbMetaDataUtil;
import info.avalon566.shardingscaling.core.synctask.RealtimeDataSyncTask;
import info.avalon566.shardingscaling.core.execute.Event;
import info.avalon566.shardingscaling.core.execute.EventType;
import info.avalon566.shardingscaling.core.execute.engine.SyncJobExecutor;
import info.avalon566.shardingscaling.core.execute.engine.local.LocalSyncJobExecutor;
import info.avalon566.shardingscaling.core.execute.executor.reader.LogPosition;
import info.avalon566.shardingscaling.core.execute.executor.reader.ReaderFactory;
import info.avalon566.shardingscaling.core.util.DataSourceFactory;
import info.avalon566.shardingscaling.core.util.DbMetaDataUtil;
import lombok.extern.slf4j.Slf4j;

import javax.sql.DataSource;
Expand Down Expand Up @@ -86,8 +86,8 @@ public void stop() {
*/
public SyncTaskProgress getProgress() {
List<SyncTaskProgress> result = syncJobExecutor.getProgresses();
// if history data sync job, only return first migrate progress.
// if realtime data sync job, there only one migrate progress.
// if history data execute job, only return first migrate progress.
// if realtime data execute job, there only one migrate progress.
return result.get(0);
}

Expand All @@ -108,7 +108,7 @@ public void onProcess(final Event event) {
}
}
if (finished) {
log.info("data sync finish");
log.info("data execute finish");
if (STAGE_SYNC_HISTORY_DATA.equals(stage)) {
stage = STAGE_SYNC_REALTIME_DATA;
syncRealtimeData(startLogPosition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.job;
package info.avalon566.shardingscaling.core.controller;

import info.avalon566.shardingscaling.core.sync.reader.LogPosition;
import info.avalon566.shardingscaling.core.execute.executor.reader.LogPosition;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.job.sync.executor;
package info.avalon566.shardingscaling.core.execute;

import lombok.Data;
import lombok.RequiredArgsConstructor;

/**
* Event.
*
* @author avalon566
*/
@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.job.sync.executor;
package info.avalon566.shardingscaling.core.execute;

/**
* Event type.
*
* @author avalon566
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.job.sync.executor;
package info.avalon566.shardingscaling.core.execute;

/**
* Job Running reporter.
*
* @author avalon566
*/
public interface Reporter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.sync;
package info.avalon566.shardingscaling.core.execute.engine;

import info.avalon566.shardingscaling.core.exception.SyncExecuteException;
import info.avalon566.shardingscaling.core.sync.channel.Channel;
import info.avalon566.shardingscaling.core.sync.reader.Reader;
import info.avalon566.shardingscaling.core.sync.writer.Writer;
import info.avalon566.shardingscaling.core.execute.executor.SyncRunner;
import info.avalon566.shardingscaling.core.execute.executor.channel.Channel;
import info.avalon566.shardingscaling.core.execute.executor.reader.Reader;
import info.avalon566.shardingscaling.core.execute.executor.writer.Writer;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
Expand Down Expand Up @@ -63,7 +64,7 @@ public SyncExecutor(final Channel channel, final Reader reader, final List<Write
/**
* Execute.
*
* @throws SyncExecuteException sync execute exception
* @throws SyncExecuteException execute execute exception
*/
public void execute() throws SyncExecuteException {
List<Future<?>> futures = new ArrayList<>(syncRunners.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,24 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.job.sync.executor;
package info.avalon566.shardingscaling.core.execute.engine;

import info.avalon566.shardingscaling.core.config.SyncConfiguration;
import info.avalon566.shardingscaling.core.job.ReportCallback;
import info.avalon566.shardingscaling.core.job.SyncTaskProgress;
import info.avalon566.shardingscaling.core.controller.ReportCallback;
import info.avalon566.shardingscaling.core.controller.SyncTaskProgress;
import info.avalon566.shardingscaling.core.execute.Reporter;

import java.util.List;

/**
* Sync job executor, run in in process, k8s etc.
*
* @author avalon566
*/
public interface SyncJobExecutor {

/**
* start sync jobs.
* start execute jobs.
*
* @param configs job configs
* @param reportCallback report callback
Expand All @@ -39,12 +41,12 @@ public interface SyncJobExecutor {
Reporter start(List<SyncConfiguration> configs, ReportCallback reportCallback);

/**
* stop all sync jobs.
* stop all execute jobs.
*/
void stop();

/**
* get all sync job migrate progresses.
* get all execute job migrate progresses.
*
* @return list of migrate progresses
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.job.sync.executor.local;
package info.avalon566.shardingscaling.core.execute.engine.local;

import info.avalon566.shardingscaling.core.job.sync.executor.Event;
import info.avalon566.shardingscaling.core.job.sync.executor.Reporter;
import info.avalon566.shardingscaling.core.execute.Event;
import info.avalon566.shardingscaling.core.execute.Reporter;

import java.util.concurrent.ConcurrentLinkedQueue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.job.sync.executor.local;
package info.avalon566.shardingscaling.core.execute.engine.local;

import info.avalon566.shardingscaling.core.config.SyncConfiguration;
import info.avalon566.shardingscaling.core.job.ReportCallback;
import info.avalon566.shardingscaling.core.job.SyncTaskProgress;
import info.avalon566.shardingscaling.core.job.sync.SyncTask;
import info.avalon566.shardingscaling.core.job.sync.executor.Event;
import info.avalon566.shardingscaling.core.job.sync.executor.Reporter;
import info.avalon566.shardingscaling.core.job.sync.executor.SyncJobExecutor;
import info.avalon566.shardingscaling.core.job.sync.SyncTaskFactory;
import info.avalon566.shardingscaling.core.controller.ReportCallback;
import info.avalon566.shardingscaling.core.controller.SyncTaskProgress;
import info.avalon566.shardingscaling.core.synctask.SyncTask;
import info.avalon566.shardingscaling.core.execute.Event;
import info.avalon566.shardingscaling.core.execute.Reporter;
import info.avalon566.shardingscaling.core.execute.engine.SyncJobExecutor;
import info.avalon566.shardingscaling.core.synctask.SyncTaskFactory;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
* Local sync job executor.
* Local execute job executor.
*
* @author avalon566
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.sync;
package info.avalon566.shardingscaling.core.execute.executor;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;

/**
* Abstract runner.
*
* @author avalon566
*/
public abstract class AbstractSyncRunner implements SyncRunner {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.sync;
package info.avalon566.shardingscaling.core.execute.executor;

/**
* sync runner.
* execute runner.
*
* @author avalon566
*/
public interface SyncRunner extends Runnable {

/**
* Start run sync.
* Start run execute.
*/
void start();

/**
* Stop running sync.
* Stop running execute.
*/
void stop();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.sync.channel;
package info.avalon566.shardingscaling.core.execute.executor.channel;

import info.avalon566.shardingscaling.core.sync.record.Record;
import info.avalon566.shardingscaling.core.execute.executor.record.Record;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.sync.channel;
package info.avalon566.shardingscaling.core.execute.executor.channel;

import info.avalon566.shardingscaling.core.sync.record.Record;
import info.avalon566.shardingscaling.core.execute.executor.record.Record;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.sync.channel;
package info.avalon566.shardingscaling.core.execute.executor.channel;

import info.avalon566.shardingscaling.core.config.ScalingContext;
import info.avalon566.shardingscaling.core.sync.record.Record;
import info.avalon566.shardingscaling.core.execute.executor.record.Record;

import java.util.ArrayList;
import java.util.LinkedList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
* limitations under the License.
*/

package info.avalon566.shardingscaling.core.sync.channel;
package info.avalon566.shardingscaling.core.execute.executor.channel;

import info.avalon566.shardingscaling.core.sync.reader.LogPosition;
import info.avalon566.shardingscaling.core.sync.record.DataRecord;
import info.avalon566.shardingscaling.core.sync.record.FinishedRecord;
import info.avalon566.shardingscaling.core.sync.record.PlaceholderRecord;
import info.avalon566.shardingscaling.core.sync.record.Record;
import info.avalon566.shardingscaling.core.execute.executor.reader.LogPosition;
import info.avalon566.shardingscaling.core.execute.executor.record.DataRecord;
import info.avalon566.shardingscaling.core.execute.executor.record.FinishedRecord;
import info.avalon566.shardingscaling.core.execute.executor.record.PlaceholderRecord;
import info.avalon566.shardingscaling.core.execute.executor.record.Record;

import java.util.Collections;
import java.util.HashMap;
Expand All @@ -34,7 +34,7 @@
import java.util.concurrent.ConcurrentHashMap;

/**
* Realtime data sync channel.
* Realtime data execute channel.
*
* @author avalon566
*/
Expand Down
Loading

0 comments on commit 1467fbb

Please sign in to comment.