gofmt
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package replication
|
||||
|
||||
import (
|
||||
"github.com/zrepl/zrepl/logger"
|
||||
"context"
|
||||
"github.com/zrepl/zrepl/logger"
|
||||
"github.com/zrepl/zrepl/replication/fsrep"
|
||||
)
|
||||
|
||||
@@ -27,4 +27,3 @@ func getLogger(ctx context.Context) Logger {
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/zrepl/zrepl/replication/pdu"
|
||||
"github.com/zrepl/zrepl/logger"
|
||||
"github.com/zrepl/zrepl/replication/pdu"
|
||||
)
|
||||
|
||||
type contextKey int
|
||||
@@ -51,18 +51,17 @@ type StepReport struct {
|
||||
}
|
||||
|
||||
type Report struct {
|
||||
Filesystem string
|
||||
Status string
|
||||
Problem string
|
||||
Completed,Pending []*StepReport
|
||||
Filesystem string
|
||||
Status string
|
||||
Problem string
|
||||
Completed, Pending []*StepReport
|
||||
}
|
||||
|
||||
|
||||
//go:generate stringer -type=State
|
||||
type State uint
|
||||
|
||||
const (
|
||||
Ready State = 1 << iota
|
||||
Ready State = 1 << iota
|
||||
RetryWait
|
||||
PermanentError
|
||||
Completed
|
||||
@@ -123,7 +122,7 @@ func (b *ReplicationBuilder) Done() (r *Replication) {
|
||||
} else {
|
||||
b.r.state = Completed
|
||||
}
|
||||
r = b.r
|
||||
r = b.r
|
||||
b.r = nil
|
||||
return r
|
||||
}
|
||||
@@ -136,12 +135,11 @@ func NewReplicationWithPermanentError(fs string, err error) *Replication {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//go:generate stringer -type=StepState
|
||||
type StepState uint
|
||||
|
||||
const (
|
||||
StepReady StepState = 1 << iota
|
||||
StepReady StepState = 1 << iota
|
||||
StepRetry
|
||||
StepPermanentError
|
||||
StepCompleted
|
||||
@@ -387,4 +385,3 @@ func (step *ReplicationStep) Report() *StepReport {
|
||||
}
|
||||
return &rep
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package queue
|
||||
|
||||
import (
|
||||
"time"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
. "github.com/zrepl/zrepl/replication/fsrep"
|
||||
)
|
||||
@@ -27,12 +27,12 @@ func NewReplicationQueue() *ReplicationQueue {
|
||||
func (q ReplicationQueue) Len() int { return len(q) }
|
||||
func (q ReplicationQueue) Swap(i, j int) { q[i], q[j] = q[j], q[i] }
|
||||
|
||||
type lessmapEntry struct{
|
||||
type lessmapEntry struct {
|
||||
prio int
|
||||
less func(a,b *replicationQueueItem) bool
|
||||
less func(a, b *replicationQueueItem) bool
|
||||
}
|
||||
|
||||
var lessmap = map[State]lessmapEntry {
|
||||
var lessmap = map[State]lessmapEntry{
|
||||
Ready: {
|
||||
prio: 0,
|
||||
less: func(a, b *replicationQueueItem) bool {
|
||||
@@ -94,7 +94,7 @@ func (q *ReplicationQueue) GetNext() (done []*Replication, next *ReplicationQueu
|
||||
|
||||
func (q *ReplicationQueue) Add(fsr *Replication) {
|
||||
*q = append(*q, &replicationQueueItem{
|
||||
fsr: fsr,
|
||||
fsr: fsr,
|
||||
state: fsr.State(),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -10,17 +10,17 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/zrepl/zrepl/replication/pdu"
|
||||
"github.com/zrepl/zrepl/replication/fsrep"
|
||||
. "github.com/zrepl/zrepl/replication/internal/queue"
|
||||
. "github.com/zrepl/zrepl/replication/internal/diff"
|
||||
. "github.com/zrepl/zrepl/replication/internal/queue"
|
||||
"github.com/zrepl/zrepl/replication/pdu"
|
||||
)
|
||||
|
||||
//go:generate stringer -type=State
|
||||
type State uint
|
||||
|
||||
const (
|
||||
Planning State = 1 << iota
|
||||
Planning State = 1 << iota
|
||||
PlanningError
|
||||
Working
|
||||
WorkingWait
|
||||
@@ -77,7 +77,6 @@ type Report struct {
|
||||
Active *fsrep.Report
|
||||
}
|
||||
|
||||
|
||||
func NewReplication() *Replication {
|
||||
r := Replication{
|
||||
state: Planning,
|
||||
@@ -101,7 +100,6 @@ type Receiver interface {
|
||||
fsrep.Receiver
|
||||
}
|
||||
|
||||
|
||||
type FilteredError struct{ fs string }
|
||||
|
||||
func NewFilteredError(fs string) *FilteredError {
|
||||
@@ -110,7 +108,6 @@ func NewFilteredError(fs string) *FilteredError {
|
||||
|
||||
func (f FilteredError) Error() string { return "endpoint does not allow access to filesystem " + f.fs }
|
||||
|
||||
|
||||
type updater func(func(*Replication)) (newState State)
|
||||
type state func(ctx context.Context, sender Sender, receiver Receiver, u updater) state
|
||||
|
||||
@@ -381,4 +378,3 @@ func (r *Replication) Report() *Report {
|
||||
|
||||
return &rep
|
||||
}
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ func FilesystemVersionFromZFS(fsv zfs.FilesystemVersion) *FilesystemVersion {
|
||||
panic("unknown fsv.Type: " + fsv.Type)
|
||||
}
|
||||
return &FilesystemVersion{
|
||||
Type: t,
|
||||
Name: fsv.Name,
|
||||
Guid: fsv.Guid,
|
||||
Type: t,
|
||||
Name: fsv.Name,
|
||||
Guid: fsv.Guid,
|
||||
CreateTXG: fsv.CreateTXG,
|
||||
Creation: fsv.Creation.Format(time.RFC3339),
|
||||
Creation: fsv.Creation.Format(time.RFC3339),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,10 +64,10 @@ func (v *FilesystemVersion) ZFSFilesystemVersion() *zfs.FilesystemVersion {
|
||||
}
|
||||
}
|
||||
return &zfs.FilesystemVersion{
|
||||
Type: v.Type.ZFSVersionType(),
|
||||
Name: v.Name,
|
||||
Guid: v.Guid,
|
||||
Type: v.Type.ZFSVersionType(),
|
||||
Name: v.Name,
|
||||
Guid: v.Guid,
|
||||
CreateTXG: v.CreateTXG,
|
||||
Creation: ct,
|
||||
Creation: ct,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package pdu
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFilesystemVersion_RelName(t *testing.T) {
|
||||
|
||||
type TestCase struct {
|
||||
In FilesystemVersion
|
||||
Out string
|
||||
In FilesystemVersion
|
||||
Out string
|
||||
Panic bool
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ func TestFilesystemVersion_ZFSFilesystemVersion(t *testing.T) {
|
||||
emptyZFS := empty.ZFSFilesystemVersion()
|
||||
assert.Zero(t, emptyZFS.Creation)
|
||||
|
||||
dateInvalid := &FilesystemVersion{Creation:"foobar"}
|
||||
dateInvalid := &FilesystemVersion{Creation: "foobar"}
|
||||
assert.Panics(t, func() {
|
||||
dateInvalid.ZFSFilesystemVersion()
|
||||
})
|
||||
|
||||
@@ -9,4 +9,3 @@ const (
|
||||
)
|
||||
|
||||
const DEFAULT_INITIAL_REPL_POLICY = InitialReplPolicyMostRecent
|
||||
|
||||
|
||||
Reference in New Issue
Block a user