mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-22 00:13:52 +01:00
handler: remove PushMapping, rename PullMapping to PullACL
This commit is contained in:
parent
3c7f782dac
commit
c7161cf8e6
@ -7,16 +7,15 @@ import (
|
||||
)
|
||||
|
||||
type Handler struct {
|
||||
Logger Logger
|
||||
PushMapping zfs.DatasetMapping
|
||||
PullMapping zfs.DatasetMapping
|
||||
Logger Logger
|
||||
PullACL zfs.DatasetMapping
|
||||
}
|
||||
|
||||
func (h Handler) HandleFilesystemRequest(r rpc.FilesystemRequest) (roots []zfs.DatasetPath, err error) {
|
||||
|
||||
h.Logger.Printf("handling fsr: %#v", r)
|
||||
|
||||
if roots, err = zfs.ZFSListMapping(h.PullMapping); err != nil {
|
||||
if roots, err = zfs.ZFSListMapping(h.PullACL); err != nil {
|
||||
h.Logger.Printf("handle fsr err: %v\n", err)
|
||||
return
|
||||
}
|
||||
@ -29,9 +28,9 @@ func (h Handler) HandleFilesystemRequest(r rpc.FilesystemRequest) (roots []zfs.D
|
||||
func (h Handler) HandleFilesystemVersionsRequest(r rpc.FilesystemVersionsRequest) (versions []zfs.FilesystemVersion, err error) {
|
||||
|
||||
// allowed to request that?
|
||||
if _, err = h.PullMapping.Map(r.Filesystem); err != nil {
|
||||
if _, err = h.PullACL.Map(r.Filesystem); err != nil {
|
||||
h.Logger.Printf("filesystem: %#v\n", r.Filesystem)
|
||||
h.Logger.Printf("pull mapping: %#v\n", h.PullMapping)
|
||||
h.Logger.Printf("pull mapping: %#v\n", h.PullACL)
|
||||
h.Logger.Printf("allowed error: %#v\n", err)
|
||||
return
|
||||
}
|
||||
@ -52,7 +51,7 @@ func (h Handler) HandleInitialTransferRequest(r rpc.InitialTransferRequest) (str
|
||||
|
||||
h.Logger.Printf("handling initial transfer request: %#v", r)
|
||||
// allowed to request that?
|
||||
if _, err = h.PullMapping.Map(r.Filesystem); err != nil {
|
||||
if _, err = h.PullACL.Map(r.Filesystem); err != nil {
|
||||
h.Logger.Printf("initial transfer request acl errror: %#v", err)
|
||||
return
|
||||
}
|
||||
@ -73,7 +72,7 @@ func (h Handler) HandleIncrementalTransferRequest(r rpc.IncrementalTransferReque
|
||||
|
||||
h.Logger.Printf("handling incremental transfer request: %#v", r)
|
||||
// allowed to request that?
|
||||
if _, err = h.PullMapping.Map(r.Filesystem); err != nil {
|
||||
if _, err = h.PullACL.Map(r.Filesystem); err != nil {
|
||||
h.Logger.Printf("incremental transfer request acl errror: %#v", err)
|
||||
return
|
||||
}
|
||||
|
@ -122,9 +122,8 @@ func cmdStdinServer(c *cli.Context) (err error) {
|
||||
|
||||
sinkLogger := log.New(logOut, fmt.Sprintf("sink[%s] ", identity), logFlags)
|
||||
handler := Handler{
|
||||
Logger: sinkLogger,
|
||||
PushMapping: findMapping(conf.Sinks),
|
||||
PullMapping: findMapping(conf.PullACLs),
|
||||
Logger: sinkLogger,
|
||||
PullACL: findMapping(conf.PullACLs),
|
||||
}
|
||||
|
||||
if err = rpc.ListenByteStreamRPC(sshByteStream, handler, sinkLogger); err != nil {
|
||||
@ -197,8 +196,8 @@ func jobPull(pull Pull, c *cli.Context, log jobrun.Logger) (err error) {
|
||||
|
||||
if lt, ok := pull.From.Transport.(LocalTransport); ok {
|
||||
lt.SetHandler(Handler{
|
||||
Logger: log,
|
||||
PullMapping: pull.Mapping,
|
||||
Logger: log,
|
||||
PullACL: pull.Mapping,
|
||||
})
|
||||
pull.From.Transport = lt
|
||||
log.Printf("fixing up local transport: %#v", pull.From.Transport)
|
||||
|
Loading…
Reference in New Issue
Block a user