Skip to content

Commit fdc3ba8

Browse files
committed
Rename struct DataTransport to DataSource
1 parent 34142f5 commit fdc3ba8

3 files changed

Lines changed: 19 additions & 19 deletions

File tree

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const (
1313
defaultRetryDelay = 30 * time.Second
1414
)
1515

16-
type DataTransport struct {
16+
type DataSource struct {
1717
// data sources
1818
DbConn *gorm.DB
1919
RosettaClient *client.APIClient
@@ -24,10 +24,10 @@ type DataTransport struct {
2424
RetryDelay time.Duration
2525
}
2626

27-
type TransportOption func(*DataTransport)
27+
type SourceOption func(*DataSource)
2828

29-
func NewDataTransport(opts ...TransportOption) DataTransport {
30-
d := DataTransport{
29+
func NewDataSource(opts ...SourceOption) DataSource {
30+
d := DataSource{
3131
Ctx: context.Background(),
3232
RetryDelay: defaultRetryDelay,
3333
}
@@ -38,38 +38,38 @@ func NewDataTransport(opts ...TransportOption) DataTransport {
3838
return d
3939
}
4040

41-
func WithContext(ctx context.Context) TransportOption {
42-
return func(w *DataTransport) {
41+
func WithContext(ctx context.Context) SourceOption {
42+
return func(w *DataSource) {
4343
w.Ctx = ctx
4444
}
4545
}
4646

47-
func WithRetryDelay(delay time.Duration) TransportOption {
48-
return func(w *DataTransport) {
47+
func WithRetryDelay(delay time.Duration) SourceOption {
48+
return func(w *DataSource) {
4949
w.RetryDelay = delay
5050
}
5151
}
5252

53-
func WithDBConnection(dbConn *gorm.DB) TransportOption {
54-
return func(w *DataTransport) {
53+
func WithDBConnection(dbConn *gorm.DB) SourceOption {
54+
return func(w *DataSource) {
5555
w.DbConn = dbConn
5656
}
5757
}
5858

59-
func WithRosettaClient(client *client.APIClient) TransportOption {
60-
return func(w *DataTransport) {
59+
func WithRosettaClient(client *client.APIClient) SourceOption {
60+
return func(w *DataSource) {
6161
w.RosettaClient = client
6262
}
6363
}
6464

65-
func WithNodeClient(node interface{}) TransportOption {
66-
return func(w *DataTransport) {
65+
func WithNodeClient(node interface{}) SourceOption {
66+
return func(w *DataSource) {
6767
w.NodeClient = node
6868
}
6969
}
7070

71-
func WithDataStore(cfg ds.DataStoreConfig) TransportOption {
72-
return func(w *DataTransport) {
71+
func WithDataStore(cfg ds.DataStoreConfig) SourceOption {
72+
return func(w *DataSource) {
7373
switch cfg.Service {
7474
case ds.MinIOStorage:
7575
c, _ := ds.NewMinioClient(cfg)

workers/workQueue/dispatcher.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ func NewJobDispatcher(cfg DispatcherConfig) JobDispatcher {
3434
return d
3535
}
3636

37-
func (j JobDispatcher) BuildWorkers(count int, dataTransport connections.DataTransport, constructor WorkerConstructor) {
37+
func (j JobDispatcher) BuildWorkers(count int, dataSource connections.DataSource, constructor WorkerConstructor) {
3838
for i := 0; i < count; i++ {
3939
workerId := fmt.Sprintf("worker.%d", i)
40-
worker := constructor(workerId, dataTransport, j.workerChannel)
40+
worker := constructor(workerId, dataSource, j.workerChannel)
4141
worker.Worker.Start()
4242
}
4343
}

workers/workQueue/worker_queued.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type QueuedWorker struct {
1111
Worker IQueuedWorker
1212
}
1313

14-
type WorkerConstructor func(string, cn.DataTransport, chan chan Work) QueuedWorker
14+
type WorkerConstructor func(string, cn.DataSource, chan chan Work) QueuedWorker
1515

1616
type Work struct {
1717
JobId int64

0 commit comments

Comments
 (0)