Files
seaweedfs/weed/storage/blockvol/testrunner/naming.go
T
pingqiuandClaude Opus 4.6 785a7d7efd feat: wire real pinner into flusher retention + real WAL scan executor (Phase 07 P1)
Pinner wired to real retention:
- NewPinner calls vol.SetV2RetentionFloor(p.MinWALRetentionFloor)
- Flusher.RetentionFloorFn() / SetRetentionFloorFn() exposed
- SetV2RetentionFloor chains with existing shipper retention floor
- Holds actually prevent WAL reclaim (not just tracked state)

Executor uses real WAL scan:
- BlockVol.ScanWALEntries(fromLSN, callback) wraps wal.ScanFrom
  with real fd, walOffset, checkpointLSN
- Executor.StreamWALEntries uses ScanWALEntries (not stub)
- Reads real WAL entries, tracks highest LSN scanned

CommittedLSN mapping:
- Explicitly documented as interim V1 model (committed = checkpointed)
- Will diverge when V2 distributed commit separates from local flush

Carry-forward:
- TransferSnapshot/TransferFullBase/TruncateWAL: stubs (need extent I/O)
- Control intent from confirmed failover: deferred

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 20:01:46 -07:00

34 lines
944 B
Go

package testrunner
import (
"crypto/sha256"
"encoding/hex"
"regexp"
"strings"
)
// Naming helpers for IQN/NQN construction.
// Copied from blockvol/naming.go to decouple the testrunner from the engine package.
// The engine remains the source of truth for production code; these copies are
// used only by the test runner to avoid importing the engine.
var reInvalidIQN = regexp.MustCompile(`[^a-z0-9.\-]`)
// SanitizeIQN normalizes a name for use in an IQN.
// Lowercases, replaces invalid chars with '-', truncates to 64 chars.
func SanitizeIQN(name string) string {
s := strings.ToLower(name)
s = reInvalidIQN.ReplaceAllString(s, "-")
if len(s) > 64 {
h := sha256.Sum256([]byte(name))
suffix := hex.EncodeToString(h[:4])
s = s[:64-1-len(suffix)] + "-" + suffix
}
return s
}
// BuildNQN constructs an NVMe NQN from a prefix and volume name.
func BuildNQN(prefix, name string) string {
return prefix + SanitizeIQN(name)
}