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

+16
View File
@@ -6,6 +6,7 @@ import (
"time"
)
// Node holds the inode attributes the copier needs.
type Node struct {
Mode uint32
Inode, Version, Nlink, Size, Rdev uint64
@@ -13,6 +14,7 @@ type Node struct {
Mtime time.Time
}
// File type bits of Node.Mode, as in stat(2).
const (
TypeMask uint32 = 0170000
Regular uint32 = 0100000
@@ -24,16 +26,22 @@ const (
CharDevice uint32 = 0020000
)
// Kind returns the file type bits of n.Mode.
func (n Node) Kind() uint32 { return n.Mode & TypeMask }
// Entry is a single directory entry.
type Entry struct {
Name string
Node Node
}
// DirectoryStream iterates over a directory. Next returns io.EOF at the end.
type DirectoryStream interface {
Next() (*Entry, error)
Close() error
}
// File is an open regular file.
type File interface {
io.ReaderAt
io.WriterAt
@@ -43,16 +51,23 @@ type File interface {
Lock(uint64) error
PunchHole(int64, int64) error
}
// DiffStream yields the paths that differ between two snapshots.
type DiffStream interface {
Next() (string, error)
Close() error
}
// Extent is a changed byte range of a file.
type Extent struct{ Offset, Length uint64 }
// BlockStream yields batches of changed extents between two snapshots.
type BlockStream interface {
Next() ([]Extent, error)
Close() error
}
// FS is the filesystem interface implemented by the native libcephfs client.
type FS interface {
Stat(string) (Node, error) // Never follows the final symlink.
Open(string, int, uint32) (File, error)
@@ -76,4 +91,5 @@ type FS interface {
Close() error
}
// Options identifies the cluster, credentials and filesystem to connect to.
type Options struct{ Config, Keyring, User, Filesystem string }