docs: add package and doc comments for exported identifiers

Document every exported type, function and method in the migration,
storage and cephfsnative packages and add package comments for
migration and the cephmig command, following the commentary rules of
Effective Go. Comments on unexported helpers now start with the name
they describe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-12-03 18:07:48 +01:00
1 parent 7413b9a43a
commit c2ef7a6c3b
12 files changed
+150 -7

No files matched your search

+6
View File
@@ -10,11 +10,14 @@ import (
"strings"
)
// Transport copies a snapshot tree to the target and verifies the result.
type Transport interface {
Copy(context.Context, string, string) error
Verify(context.Context, string, string) error
}
// Rsync is the Transport that copies between mounted CephFS trees with
// rsync. BandwidthKiB limits the transfer rate when positive.
type Rsync struct {
Exec Executor
Log io.Writer
@@ -30,6 +33,8 @@ func (r Rsync) args(src, dst string) []string {
}
return append(a, "--", src+"/", dst+"/")
}
// Copy mirrors src into dst, including hard links, ACLs and xattrs.
func (r Rsync) Copy(ctx context.Context, src, dst string) error {
for attempt := 0; attempt < 2; attempt++ {
err := r.Exec.Exec(ctx, r.Log, "rsync", r.args(src, dst)...)
@@ -53,6 +58,7 @@ type differences struct{ n int64 }
func (d *differences) Write(p []byte) (int, error) { d.n += int64(len(p)); return len(p), nil }
// Verify runs rsync as a dry run and fails if any difference remains.
func (r Rsync) Verify(ctx context.Context, src, dst string) error {
args := append([]string{"--dry-run", "--itemize-changes", "--out-format=%i"}, r.args(src, dst)...)
var d differences