Skip to content

Commit

Permalink
Use internal/replication/driver.Do directly
Browse files Browse the repository at this point in the history
  • Loading branch information
dsh2dsh committed Dec 16, 2024
1 parent 4a0973b commit 8601f63
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 79 deletions.
3 changes: 1 addition & 2 deletions internal/daemon/job/active.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/dsh2dsh/zrepl/internal/daemon/snapper"
"github.com/dsh2dsh/zrepl/internal/endpoint"
"github.com/dsh2dsh/zrepl/internal/logger"
"github.com/dsh2dsh/zrepl/internal/replication"
"github.com/dsh2dsh/zrepl/internal/replication/driver"
"github.com/dsh2dsh/zrepl/internal/replication/logic"
"github.com/dsh2dsh/zrepl/internal/replication/report"
Expand Down Expand Up @@ -739,7 +738,7 @@ func (j *ActiveSide) replicate(ctx context.Context) error {
sender, receiver := j.mode.SenderReceiver()
j.updateTasks(func(tasks *activeSideTasks) {
tasks.state = ActiveSideReplicating
tasks.replicationReport, repWait = replication.Do(
tasks.replicationReport, repWait = driver.Do(
ctx, j.replicationDriverConfig, logic.NewPlanner(
j.promRepStateSecs, j.promBytesReplicated, sender, receiver,
j.mode.PlannerPolicy()))
Expand Down
50 changes: 0 additions & 50 deletions internal/replication/driver/errorclass_enumer.go

This file was deleted.

16 changes: 15 additions & 1 deletion internal/replication/driver/replication_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

"github.com/dsh2dsh/zrepl/internal/config"
"github.com/dsh2dsh/zrepl/internal/daemon/job/signal"
"github.com/dsh2dsh/zrepl/internal/daemon/logging"
"github.com/dsh2dsh/zrepl/internal/logger"
"github.com/dsh2dsh/zrepl/internal/replication/report"
"github.com/dsh2dsh/zrepl/internal/util/chainlock"
Expand Down Expand Up @@ -327,6 +328,10 @@ func Do(ctx context.Context, config Config, planner Planner) (ReportFunc,
return report, wait
}

func getLog(ctx context.Context) *slog.Logger {
return logging.GetLogger(ctx, logging.SubsysReplication)
}

func (a *attempt) do(ctx context.Context, prev *attempt) {
prevs := a.doGlobalPlanning(ctx, prev)
if prevs == nil {
Expand Down Expand Up @@ -828,14 +833,23 @@ func (s *step) report() *report.StepReport {
return r
}

//go:generate enumer -type=errorClass
type errorClass int

const (
errorClassPermanent errorClass = iota
errorClassTemporaryConnectivityRelated
)

func (self errorClass) String() string {
switch self {
case errorClassPermanent:
return "errorClassPermanent"
case errorClassTemporaryConnectivityRelated:
return "errorClassTemporaryConnectivityRelated"
}
return fmt.Sprintf("errorClass(%d)", self)
}

type errorReport struct {
flattened []*timedError
// sorted DESCending by err time
Expand Down
12 changes: 0 additions & 12 deletions internal/replication/driver/replication_driver_logging.go

This file was deleted.

14 changes: 0 additions & 14 deletions internal/replication/replication.go

This file was deleted.

0 comments on commit 8601f63

Please sign in to comment.