Files
seaweedfs/sw-block/runtime/volumev2/bootstrap_runtime.go
T
pingqiuandClaude Opus 4.6 044a6d770b feat: Phase 19 — bounded working RF2 block path
Live HTTP evidence transport, continuous Loop2 service, bounded auto
failover trigger, runtime-managed frontend export, bounded replica
repair, end-to-end RF2 handoff with continued I/O on new primary,
bounded operator HTTP surface, and CSI V2 runtime backend adapter.

11 new proof tests covering the full M6-M10 chain plus CSI create/
lookup/publish through the V2 runtime path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 15:12:00 -07:00

40 lines
1.1 KiB
Go

package volumev2
import (
"fmt"
"time"
"github.com/seaweedfs/seaweedfs/sw-block/runtime/masterv2"
"github.com/seaweedfs/seaweedfs/weed/storage/blockvol"
)
// BootstrapPrimaryVolume creates or opens one named volume on one selected node
// and applies a bounded primary assignment through the runtime-owned path.
func (m *InProcessRuntimeManager) BootstrapPrimaryVolume(volumeName, nodeID, path string, epoch uint64, opts blockvol.CreateOptions) error {
if m == nil {
return fmt.Errorf("volumev2: runtime manager is nil")
}
if volumeName == "" {
return fmt.Errorf("volumev2: bootstrap volume name is required")
}
if nodeID == "" {
return fmt.Errorf("volumev2: bootstrap node id is required")
}
if path == "" {
return fmt.Errorf("volumev2: bootstrap path is required")
}
node, err := m.localNode(nodeID)
if err != nil {
return err
}
return node.ApplyAssignments([]masterv2.Assignment{{
Name: volumeName,
Path: path,
NodeID: nodeID,
Epoch: epoch,
LeaseTTL: 30 * time.Second,
CreateOptions: opts,
Role: "primary",
}})
}