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:
1 parent
7413b9a43a
commit
c2ef7a6c3b
12 files changed
+150
-7
No files matched your search
@@ -55,21 +55,32 @@ func (e Engine) access() Access {
|
||||
}
|
||||
return mountedAccess{}
|
||||
}
|
||||
|
||||
// Inspect checks both endpoints without changing them and reports what a
|
||||
// migration would transfer.
|
||||
func (e Engine) Inspect(ctx context.Context, c Config) (*Inspection, error) {
|
||||
return e.access().Inspect(ctx, c, e.Exec)
|
||||
}
|
||||
|
||||
// Round describes one snapshot transfer handed to a RoundTransport.
|
||||
// BaseName and BaseSourcePath name the last completed snapshot, if any,
|
||||
// which allows an incremental transfer.
|
||||
type Round struct {
|
||||
SourcePath, TargetPath string
|
||||
BaseName, BaseSourcePath string
|
||||
Name, StatePath string
|
||||
}
|
||||
|
||||
// RoundTransport is a Transport that keeps state across a snapshot round,
|
||||
// such as the native backend's on-disk index.
|
||||
type RoundTransport interface {
|
||||
BeginRound(context.Context, Round) error
|
||||
Published(string)
|
||||
Commit(context.Context, string) error
|
||||
Statistics() TransferStats
|
||||
}
|
||||
|
||||
// TransferStats summarizes the work done for one snapshot round.
|
||||
type TransferStats struct {
|
||||
Mode string `json:"mode"`
|
||||
BaseSnapshot string `json:"base_snapshot,omitempty"`
|
||||
@@ -81,7 +92,8 @@ type TransferStats struct {
|
||||
SnapDiffEntries int64 `json:"snapdiff_entries"`
|
||||
}
|
||||
|
||||
// NewEngine never silently falls back from native I/O to mounted/rsync I/O.
|
||||
// NewEngine returns an Engine for c.Backend and a Closer that releases its
|
||||
// connections. It never silently falls back from native I/O to mounted/rsync I/O.
|
||||
func NewEngine(ctx context.Context, c Config, x Executor, log io.Writer) (Engine, io.Closer, error) {
|
||||
if c.Backend == "native" {
|
||||
return openNativeEngine(ctx, c, x, log)
|
||||
|
||||
Reference in new issue
Block a user