feat(store): drift state, move candidates and service merge (#10)

Adds services.awaiting_inventory, Service.Drifted/RunsRef/RunningRef, AcceptRunning, MoveCandidates, MergeSources and MergeService, and maps a job for a deleted service to ErrNotFound.
This commit is contained in:
2026-10-13 10:28:34 +02:00
parent 307e46e4c7
commit 061243f5da
11 changed files with 1036 additions and 14 deletions
+9 -1
View File
@@ -2,7 +2,10 @@
// and digest.
package imageref
import "strings"
import (
"regexp"
"strings"
)
// Ref is an image reference split into its parts. Tag and Digest are empty
// when the reference has none.
@@ -41,3 +44,8 @@ func (r Ref) String() string {
}
return s
}
var digestPattern = regexp.MustCompile(`^sha256:[0-9a-f]{64}$`)
// IsDigest reports whether d is a well-formed sha256 digest.
func IsDigest(d string) bool { return digestPattern.MatchString(d) }
+17
View File
@@ -1,6 +1,7 @@
package imageref
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
@@ -27,3 +28,19 @@ func TestParse(t *testing.T) {
})
}
}
func TestIsDigest(t *testing.T) {
cases := []struct {
in string
want bool
}{
{"sha256:" + strings.Repeat("a", 64), true},
{"sha256:" + strings.Repeat("a", 63), false},
{"sha256:" + strings.Repeat("A", 64), false},
{"sha512:" + strings.Repeat("a", 64), false},
{"", false},
}
for _, c := range cases {
assert.Equal(t, c.want, IsDigest(c.in), c.in)
}
}