Purge model package, not really used anyways.

This commit is contained in:
Christian Schwarz 2017-05-03 17:26:45 +02:00
parent 514f9aa123
commit f005ce318d
3 changed files with 7 additions and 40 deletions

View File

@ -1,7 +1,6 @@
package main package main
import ( import (
"github.com/zrepl/zrepl/model"
"github.com/zrepl/zrepl/rpc" "github.com/zrepl/zrepl/rpc"
"github.com/zrepl/zrepl/zfs" "github.com/zrepl/zrepl/zfs"
"io" "io"
@ -9,22 +8,12 @@ import (
type Handler struct{} type Handler struct{}
func (h Handler) HandleFilesystemRequest(r rpc.FilesystemRequest) (roots []model.Filesystem, err error) { func (h Handler) HandleFilesystemRequest(r rpc.FilesystemRequest) (roots []zfs.DatasetPath, 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)
}
return return
} }
func (h Handler) HandleFilesystemVersionsRequest(r rpc.FilesystemVersionsRequest) (versions []zfs.FilesystemVersion, err error) { func (h Handler) HandleFilesystemVersionsRequest(r rpc.FilesystemVersionsRequest) (versions []zfs.FilesystemVersion, err error) {
return
} }
func (h Handler) HandleInitialTransferRequest(r rpc.InitialTransferRequest) (io.Reader, error) { func (h Handler) HandleInitialTransferRequest(r rpc.InitialTransferRequest) (io.Reader, error) {

View File

@ -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
}

View File

@ -4,7 +4,6 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
. "github.com/zrepl/zrepl/model"
. "github.com/zrepl/zrepl/util" . "github.com/zrepl/zrepl/util"
"github.com/zrepl/zrepl/zfs" "github.com/zrepl/zrepl/zfs"
"io" "io"
@ -12,14 +11,14 @@ import (
) )
type RPCRequester interface { 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) FilesystemVersionsRequest(r FilesystemVersionsRequest) (versions []zfs.FilesystemVersion, err error)
InitialTransferRequest(r InitialTransferRequest) (io.Reader, error) InitialTransferRequest(r InitialTransferRequest) (io.Reader, error)
IncrementalTransferRequest(r IncrementalTransferRequest) (io.Reader, error) IncrementalTransferRequest(r IncrementalTransferRequest) (io.Reader, error)
} }
type RPCHandler interface { 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 // returned versions ordered by birthtime, oldest first
HandleFilesystemVersionsRequest(r FilesystemVersionsRequest) (versions []zfs.FilesystemVersion, err error) HandleFilesystemVersionsRequest(r FilesystemVersionsRequest) (versions []zfs.FilesystemVersion, err error)
@ -284,13 +283,13 @@ func (c ByteStreamRPC) ProtocolVersionRequest() (err error) {
return c.sendRequestReceiveHeader(b, ROK) 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 { if err = c.sendRequestReceiveHeader(r, RFilesystems); err != nil {
return return
} }
roots = make([]Filesystem, 0) roots = make([]zfs.DatasetPath, 0)
if err = c.decoder.Decode(&roots); err != nil { if err = c.decoder.Decode(&roots); err != nil {
return return
@ -334,7 +333,7 @@ func ConnectLocalRPC(handler RPCHandler) RPCRequester {
return LocalRPC{handler} 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) return c.handler.HandleFilesystemRequest(r)
} }