Eric Bower
·
2026-05-31
1package rsyncreceiver
2
3import (
4 "io"
5 "log/slog"
6
7 "github.com/picosh/pico/pkg/rsync-receiver/rsyncwire"
8 "github.com/picosh/pico/pkg/rsync-receiver/utils"
9)
10
11type Osenv struct {
12 Stdin io.Reader
13 Stdout io.Writer
14 Stderr io.Writer
15}
16
17// TransferOpts is a subset of Opts which is required for implementing a receiver.
18type TransferOpts struct {
19 Verbose bool
20 DryRun bool
21
22 DeleteMode bool
23 PreserveGid bool
24 PreserveUid bool
25 PreserveLinks bool
26 PreservePerms bool
27 PreserveDevices bool
28 PreserveSpecials bool
29 PreserveTimes bool
30 PreserveHardlinks bool
31 IgnoreTimes bool
32 SizeOnly bool
33 AlwaysChecksum bool
34}
35
36type Transfer struct {
37 // config
38 // Opts *Opts
39 Opts *TransferOpts
40 Dest string
41 Env Osenv
42
43 // state
44 Conn *rsyncwire.Conn
45 Seed int32
46 IOErrors int32
47
48 Files utils.FS
49
50 Logger *slog.Logger
51}
52
53func (rt *Transfer) listOnly() bool { return rt.Dest == "" }