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
@@ -13,6 +13,8 @@ import (
|
||||
|
||||
const stateVersion = 1
|
||||
|
||||
// Snapshot is the journal record of one source snapshot and its transfer
|
||||
// to the target.
|
||||
type Snapshot struct {
|
||||
Name string `json:"name"`
|
||||
CreatedAt string `json:"source_created_at"`
|
||||
@@ -24,6 +26,8 @@ type Snapshot struct {
|
||||
Stats *TransferStats `json:"transfer,omitempty"`
|
||||
}
|
||||
|
||||
// State is the persistent migration journal. It is written atomically
|
||||
// after every step so that an interrupted run can be resumed.
|
||||
type State struct {
|
||||
Version int `json:"version"`
|
||||
ID string `json:"id"`
|
||||
@@ -38,6 +42,8 @@ type State struct {
|
||||
LiveSnapshot string `json:"live_snapshot,omitempty"`
|
||||
}
|
||||
|
||||
// LoadState reads and validates the migration journal at path. Symbolic
|
||||
// links are not followed.
|
||||
func LoadState(path string) (*State, error) {
|
||||
f, err := os.OpenFile(path, os.O_RDONLY|syscall.O_NOFOLLOW, 0)
|
||||
if err != nil {
|
||||
@@ -98,6 +104,8 @@ func LoadState(path string) (*State, error) {
|
||||
return &s, nil
|
||||
}
|
||||
|
||||
// SaveState atomically replaces the journal at path with s and syncs the
|
||||
// containing directory.
|
||||
func SaveState(path string, s *State) error {
|
||||
return atomicJSON(path, s)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user