Wireframe main executable.

This commit is contained in:
Christian Schwarz
2017-04-26 20:21:18 +02:00
parent 00231ecb73
commit 9750bf3123
3 changed files with 106 additions and 55 deletions

34
cmd/handler.go Normal file
View File

@ -0,0 +1,34 @@
package main
import (
"io"
"github.com/zrepl/zrepl/zfs"
"github.com/zrepl/zrepl/model"
"github.com/zrepl/zrepl/rpc"
)
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)
}
return
}
func (h Handler) HandleInitialTransferRequest(r rpc.InitialTransferRequest) (io.Reader, error) {
// TODO ACL
return zfs.InitialSend(r.Snapshot)
}
func (h Handler) HandleIncrementalTransferRequest(r rpc.IncrementalTransferRequest) (io.Reader, error) {
// TODO ACL
return zfs.IncrementalSend(r.FromSnapshot, r.ToSnapshot)
}