mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-25 18:04:58 +01:00
gofmt
This commit is contained in:
parent
e082816de5
commit
e30ae972f4
@ -9,8 +9,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/problame/go-streamrpc"
|
"github.com/problame/go-streamrpc"
|
||||||
"github.com/zrepl/zrepl/util"
|
|
||||||
"github.com/zrepl/zrepl/logger"
|
"github.com/zrepl/zrepl/logger"
|
||||||
|
"github.com/zrepl/zrepl/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
type logNetConnConnecter struct {
|
type logNetConnConnecter struct {
|
||||||
@ -58,7 +58,6 @@ func (l logListener) Accept() (net.Conn, error) {
|
|||||||
return util.NewNetConnLogger(conn, l.ReadDump, l.WriteDump)
|
return util.NewNetConnLogger(conn, l.ReadDump, l.WriteDump)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type netsshAddr struct{}
|
type netsshAddr struct{}
|
||||||
|
|
||||||
func (netsshAddr) Network() string { return "netssh" }
|
func (netsshAddr) Network() string { return "netssh" }
|
||||||
@ -102,4 +101,3 @@ func (a twoClassLogAdaptor) Errorf(fmtStr string, args... interface{}) {
|
|||||||
func (a twoClassLogAdaptor) Infof(fmtStr string, args ...interface{}) {
|
func (a twoClassLogAdaptor) Infof(fmtStr string, args ...interface{}) {
|
||||||
a.Logger.Info(fmt.Sprintf(fmtStr, args...))
|
a.Logger.Info(fmt.Sprintf(fmtStr, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/problame/go-netssh"
|
"github.com/problame/go-netssh"
|
||||||
"github.com/problame/go-streamrpc"
|
"github.com/problame/go-streamrpc"
|
||||||
"time"
|
|
||||||
"github.com/zrepl/zrepl/cmd/tlsconf"
|
"github.com/zrepl/zrepl/cmd/tlsconf"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SSHStdinserverConnecter struct {
|
type SSHStdinserverConnecter struct {
|
||||||
|
@ -5,10 +5,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"github.com/zrepl/zrepl/logger"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"github.com/zrepl/zrepl/logger"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ControlJob struct {
|
type ControlJob struct {
|
||||||
|
@ -6,10 +6,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"github.com/zrepl/zrepl/cmd/endpoint"
|
||||||
|
"github.com/zrepl/zrepl/replication"
|
||||||
"github.com/zrepl/zrepl/zfs"
|
"github.com/zrepl/zrepl/zfs"
|
||||||
"sync"
|
"sync"
|
||||||
"github.com/zrepl/zrepl/replication"
|
|
||||||
"github.com/zrepl/zrepl/cmd/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type LocalJob struct {
|
type LocalJob struct {
|
||||||
|
@ -11,8 +11,8 @@ import (
|
|||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/problame/go-streamrpc"
|
"github.com/problame/go-streamrpc"
|
||||||
"github.com/zrepl/zrepl/replication"
|
|
||||||
"github.com/zrepl/zrepl/cmd/endpoint"
|
"github.com/zrepl/zrepl/cmd/endpoint"
|
||||||
|
"github.com/zrepl/zrepl/replication"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PullJob struct {
|
type PullJob struct {
|
||||||
@ -155,7 +155,6 @@ var STREAMRPC_CONFIG = &streamrpc.ConnConfig{ // FIXME oversight and configurabi
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (j *PullJob) doRun(ctx context.Context) {
|
func (j *PullJob) doRun(ctx context.Context) {
|
||||||
|
|
||||||
j.task.Enter("run")
|
j.task.Enter("run")
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/problame/go-streamrpc"
|
"github.com/problame/go-streamrpc"
|
||||||
"net"
|
|
||||||
"github.com/zrepl/zrepl/cmd/endpoint"
|
"github.com/zrepl/zrepl/cmd/endpoint"
|
||||||
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SourceJob struct {
|
type SourceJob struct {
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/tls"
|
||||||
|
"crypto/x509"
|
||||||
"github.com/mattn/go-isatty"
|
"github.com/mattn/go-isatty"
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"github.com/zrepl/zrepl/cmd/tlsconf"
|
||||||
"github.com/zrepl/zrepl/logger"
|
"github.com/zrepl/zrepl/logger"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
"crypto/tls"
|
|
||||||
"crypto/x509"
|
|
||||||
"github.com/zrepl/zrepl/cmd/tlsconf"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type LoggingConfig struct {
|
type LoggingConfig struct {
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/zrepl/zrepl/zfs"
|
|
||||||
"github.com/zrepl/zrepl/cmd/endpoint"
|
"github.com/zrepl/zrepl/cmd/endpoint"
|
||||||
|
"github.com/zrepl/zrepl/zfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DatasetMapFilter struct {
|
type DatasetMapFilter struct {
|
||||||
|
@ -7,12 +7,12 @@ import (
|
|||||||
yaml "github.com/go-yaml/yaml"
|
yaml "github.com/go-yaml/yaml"
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"github.com/problame/go-streamrpc"
|
||||||
|
"github.com/zrepl/zrepl/replication"
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
"github.com/zrepl/zrepl/replication"
|
|
||||||
"github.com/problame/go-streamrpc"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var ConfigFileDefaultLocations []string = []string{
|
var ConfigFileDefaultLocations []string = []string{
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
package endpoint
|
package endpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/zrepl/zrepl/replication/pdu"
|
|
||||||
"github.com/problame/go-streamrpc"
|
|
||||||
"github.com/zrepl/zrepl/zfs"
|
|
||||||
"io"
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/problame/go-streamrpc"
|
||||||
"github.com/zrepl/zrepl/replication"
|
"github.com/zrepl/zrepl/replication"
|
||||||
|
"github.com/zrepl/zrepl/replication/pdu"
|
||||||
|
"github.com/zrepl/zrepl/zfs"
|
||||||
|
"io"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Sender implements replication.ReplicationEndpoint for a sending side
|
// Sender implements replication.ReplicationEndpoint for a sending side
|
||||||
@ -89,7 +89,7 @@ type FSMap interface {
|
|||||||
FSFilter
|
FSFilter
|
||||||
Map(path *zfs.DatasetPath) (*zfs.DatasetPath, error)
|
Map(path *zfs.DatasetPath) (*zfs.DatasetPath, error)
|
||||||
Invert() (FSMap, error)
|
Invert() (FSMap, error)
|
||||||
AsFilter() (FSFilter)
|
AsFilter() FSFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
// Receiver implements replication.ReplicationEndpoint for a receiving side
|
// Receiver implements replication.ReplicationEndpoint for a receiving side
|
||||||
@ -219,7 +219,6 @@ func (e *Receiver) Receive(ctx context.Context, req *pdu.ReceiveReq, sendStream
|
|||||||
// RPC STUBS
|
// RPC STUBS
|
||||||
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
RPCListFilesystems = "ListFilesystems"
|
RPCListFilesystems = "ListFilesystems"
|
||||||
RPCListFilesystemVersions = "ListFilesystemVersions"
|
RPCListFilesystemVersions = "ListFilesystemVersions"
|
||||||
@ -301,7 +300,7 @@ func (s Remote) Send(ctx context.Context, r *pdu.SendReq) (*pdu.SendRes, io.Read
|
|||||||
return &res, rs, nil
|
return &res, rs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Remote) Receive(ctx context.Context, r *pdu.ReceiveReq, sendStream io.ReadCloser) (error) {
|
func (s Remote) Receive(ctx context.Context, r *pdu.ReceiveReq, sendStream io.ReadCloser) error {
|
||||||
defer sendStream.Close()
|
defer sendStream.Close()
|
||||||
b, err := proto.Marshal(r)
|
b, err := proto.Marshal(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package logger
|
package logger
|
||||||
|
|
||||||
|
|
||||||
type nullLogger struct{}
|
type nullLogger struct{}
|
||||||
|
|
||||||
var _ Logger = nullLogger{}
|
var _ Logger = nullLogger{}
|
||||||
@ -19,4 +18,3 @@ func (nullLogger) Info(msg string) {}
|
|||||||
func (nullLogger) Warn(msg string) {}
|
func (nullLogger) Warn(msg string) {}
|
||||||
func (nullLogger) Error(msg string) {}
|
func (nullLogger) Error(msg string) {}
|
||||||
func (nullLogger) Printf(format string, args ...interface{}) {}
|
func (nullLogger) Printf(format string, args ...interface{}) {}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package replication
|
package replication
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/zrepl/zrepl/logger"
|
|
||||||
"context"
|
"context"
|
||||||
|
"github.com/zrepl/zrepl/logger"
|
||||||
"github.com/zrepl/zrepl/replication/fsrep"
|
"github.com/zrepl/zrepl/replication/fsrep"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -27,4 +27,3 @@ func getLogger(ctx context.Context) Logger {
|
|||||||
}
|
}
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zrepl/zrepl/replication/pdu"
|
|
||||||
"github.com/zrepl/zrepl/logger"
|
"github.com/zrepl/zrepl/logger"
|
||||||
|
"github.com/zrepl/zrepl/replication/pdu"
|
||||||
)
|
)
|
||||||
|
|
||||||
type contextKey int
|
type contextKey int
|
||||||
@ -57,7 +57,6 @@ type Report struct {
|
|||||||
Completed, Pending []*StepReport
|
Completed, Pending []*StepReport
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//go:generate stringer -type=State
|
//go:generate stringer -type=State
|
||||||
type State uint
|
type State uint
|
||||||
|
|
||||||
@ -136,7 +135,6 @@ func NewReplicationWithPermanentError(fs string, err error) *Replication {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//go:generate stringer -type=StepState
|
//go:generate stringer -type=StepState
|
||||||
type StepState uint
|
type StepState uint
|
||||||
|
|
||||||
@ -387,4 +385,3 @@ func (step *ReplicationStep) Report() *StepReport {
|
|||||||
}
|
}
|
||||||
return &rep
|
return &rep
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package queue
|
package queue
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
|
||||||
"sort"
|
"sort"
|
||||||
|
"time"
|
||||||
|
|
||||||
. "github.com/zrepl/zrepl/replication/fsrep"
|
. "github.com/zrepl/zrepl/replication/fsrep"
|
||||||
)
|
)
|
||||||
|
@ -10,10 +10,10 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zrepl/zrepl/replication/pdu"
|
|
||||||
"github.com/zrepl/zrepl/replication/fsrep"
|
"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/diff"
|
||||||
|
. "github.com/zrepl/zrepl/replication/internal/queue"
|
||||||
|
"github.com/zrepl/zrepl/replication/pdu"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate stringer -type=State
|
//go:generate stringer -type=State
|
||||||
@ -77,7 +77,6 @@ type Report struct {
|
|||||||
Active *fsrep.Report
|
Active *fsrep.Report
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func NewReplication() *Replication {
|
func NewReplication() *Replication {
|
||||||
r := Replication{
|
r := Replication{
|
||||||
state: Planning,
|
state: Planning,
|
||||||
@ -101,7 +100,6 @@ type Receiver interface {
|
|||||||
fsrep.Receiver
|
fsrep.Receiver
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type FilteredError struct{ fs string }
|
type FilteredError struct{ fs string }
|
||||||
|
|
||||||
func NewFilteredError(fs string) *FilteredError {
|
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 }
|
func (f FilteredError) Error() string { return "endpoint does not allow access to filesystem " + f.fs }
|
||||||
|
|
||||||
|
|
||||||
type updater func(func(*Replication)) (newState State)
|
type updater func(func(*Replication)) (newState State)
|
||||||
type state func(ctx context.Context, sender Sender, receiver Receiver, u updater) 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
|
return &rep
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package pdu
|
package pdu
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFilesystemVersion_RelName(t *testing.T) {
|
func TestFilesystemVersion_RelName(t *testing.T) {
|
||||||
|
@ -9,4 +9,3 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const DEFAULT_INITIAL_REPL_POLICY = InitialReplPolicyMostRecent
|
const DEFAULT_INITIAL_REPL_POLICY = InitialReplPolicyMostRecent
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@ package util
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"time"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type contextWithOptionalDeadline struct {
|
type contextWithOptionalDeadline struct {
|
||||||
@ -28,7 +28,7 @@ func (c *contextWithOptionalDeadline) Err() error {
|
|||||||
return c.err
|
return c.err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *contextWithOptionalDeadline) Done() (<-chan struct{}) {
|
func (c *contextWithOptionalDeadline) Done() <-chan struct{} {
|
||||||
return c.done
|
return c.done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package util
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"context"
|
"context"
|
||||||
"time"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestContextWithOptionalDeadline(t *testing.T) {
|
func TestContextWithOptionalDeadline(t *testing.T) {
|
||||||
|
@ -5,9 +5,9 @@ import (
|
|||||||
"crypto/sha512"
|
"crypto/sha512"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"sort"
|
"sort"
|
||||||
"io"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type fsbyCreateTXG []FilesystemVersion
|
type fsbyCreateTXG []FilesystemVersion
|
||||||
|
@ -78,5 +78,3 @@ func ZFSListMappingProperties(filter DatasetFilter, properties []string) (datase
|
|||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"io"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"io"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type VersionType string
|
type VersionType string
|
||||||
|
Loading…
Reference in New Issue
Block a user