storage: the upgrade uses the record's state codes from the runtime file

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 5.5 committed 2026-11-30 13:44:14 -08:00
1 parent d6d4e48229
commit ab3a2feb30
1 file changed
-26
@@ -14,32 +14,6 @@ import (
"github.com/seaweedfs/seaweed-block/core/chunkkernel"
)
// Kernel states as page bytes. Zero is never a state: a zeroed page fails.
var chunkRecordStateCodes = map[chunkkernel.Kind]uint8{
chunkkernel.Absent: 1,
chunkkernel.Partial: 2,
chunkkernel.Unknown: 3,
chunkkernel.HashUnpublished: 4,
chunkkernel.HashPublished: 5,
}
func chunkRecordStateCode(k chunkkernel.Kind) (uint8, error) {
c, ok := chunkRecordStateCodes[k]
if !ok {
return 0, fmt.Errorf("storage: chunk record: no code for kernel state %q", k)
}
return c, nil
}
func chunkRecordKind(code uint8) (chunkkernel.Kind, error) {
for k, c := range chunkRecordStateCodes {
if c == code {
return k, nil
}
}
return "", fmt.Errorf("%w: state code %d", errChunkRecordCheck, code)
}
// coverageArg is the kernel's argument for a coverage.
func coverageArg(c LocalCoverage) chunkkernel.Arg {
switch c {