diff --git a/cmd/handler.go b/cmd/handler.go index 93a08d3..3a784e1 100644 --- a/cmd/handler.go +++ b/cmd/handler.go @@ -1,7 +1,6 @@ package main import ( - "github.com/zrepl/zrepl/model" "github.com/zrepl/zrepl/rpc" "github.com/zrepl/zrepl/zfs" "io" @@ -9,22 +8,12 @@ import ( type Handler struct{} -func (h Handler) HandleFilesystemRequest(r rpc.FilesystemRequest) (roots []model.Filesystem, err error) { - - roots = make([]model.Filesystem, 0, 10) - - for _, root := range r.Roots { - var zfsRoot model.Filesystem - if zfsRoot, err = zfs.FilesystemsAtRoot(root); err != nil { - return - } - roots = append(roots, zfsRoot) - } - +func (h Handler) HandleFilesystemRequest(r rpc.FilesystemRequest) (roots []zfs.DatasetPath, err error) { return } func (h Handler) HandleFilesystemVersionsRequest(r rpc.FilesystemVersionsRequest) (versions []zfs.FilesystemVersion, err error) { + return } func (h Handler) HandleInitialTransferRequest(r rpc.InitialTransferRequest) (io.Reader, error) { diff --git a/model/model.go b/model/model.go deleted file mode 100644 index 7844bae..0000000 --- a/model/model.go +++ /dev/null @@ -1,21 +0,0 @@ -package model - -type Filesystem struct { - Name string - Parent *Filesystem - Children []Filesystem - Snapshots []Snapshot -} - -type FilesytemMapping struct { - From Filesystem - To Filesystem -} - -type Snapshot struct { - Name string -} - -type Pool struct { - Root Filesystem -} diff --git a/rpc/rpc.go b/rpc/rpc.go index 4214670..59328e2 100644 --- a/rpc/rpc.go +++ b/rpc/rpc.go @@ -4,7 +4,6 @@ import ( "encoding/json" "errors" "fmt" - . "github.com/zrepl/zrepl/model" . "github.com/zrepl/zrepl/util" "github.com/zrepl/zrepl/zfs" "io" @@ -12,14 +11,14 @@ import ( ) type RPCRequester interface { - FilesystemRequest(r FilesystemRequest) (roots []Filesystem, err error) + FilesystemRequest(r FilesystemRequest) (roots []zfs.DatasetPath, err error) FilesystemVersionsRequest(r FilesystemVersionsRequest) (versions []zfs.FilesystemVersion, err error) InitialTransferRequest(r InitialTransferRequest) (io.Reader, error) IncrementalTransferRequest(r IncrementalTransferRequest) (io.Reader, error) } type RPCHandler interface { - HandleFilesystemRequest(r FilesystemRequest) (roots []Filesystem, err error) + HandleFilesystemRequest(r FilesystemRequest) (roots []zfs.DatasetPath, err error) // returned versions ordered by birthtime, oldest first HandleFilesystemVersionsRequest(r FilesystemVersionsRequest) (versions []zfs.FilesystemVersion, err error) @@ -284,13 +283,13 @@ func (c ByteStreamRPC) ProtocolVersionRequest() (err error) { return c.sendRequestReceiveHeader(b, ROK) } -func (c ByteStreamRPC) FilesystemRequest(r FilesystemRequest) (roots []Filesystem, err error) { +func (c ByteStreamRPC) FilesystemRequest(r FilesystemRequest) (roots []zfs.DatasetPath, err error) { if err = c.sendRequestReceiveHeader(r, RFilesystems); err != nil { return } - roots = make([]Filesystem, 0) + roots = make([]zfs.DatasetPath, 0) if err = c.decoder.Decode(&roots); err != nil { return @@ -334,7 +333,7 @@ func ConnectLocalRPC(handler RPCHandler) RPCRequester { return LocalRPC{handler} } -func (c LocalRPC) FilesystemRequest(r FilesystemRequest) (roots []Filesystem, err error) { +func (c LocalRPC) FilesystemRequest(r FilesystemRequest) (roots []zfs.DatasetPath, err error) { return c.handler.HandleFilesystemRequest(r) }