services -> domains
This commit is contained in:
@@ -17,7 +17,7 @@ import (
|
||||
|
||||
const (
|
||||
// KV bucket names
|
||||
BucketServices = "wild-services" // service registrations
|
||||
BucketDomains = "wild-domains" // domain registrations
|
||||
BucketPresence = "wild-presence" // node liveness (TTL keys)
|
||||
|
||||
// Stream names
|
||||
@@ -126,13 +126,13 @@ func (s *Server) ensureBuckets() error {
|
||||
|
||||
// Services bucket — no TTL, entries persist until explicitly deleted
|
||||
_, err := s.js.CreateOrUpdateKeyValue(ctx, jetstream.KeyValueConfig{
|
||||
Bucket: BucketServices,
|
||||
Bucket: BucketDomains,
|
||||
Description: "Service registrations from Wild Cloud, Wild Works, and manual entries",
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("services bucket: %w", err)
|
||||
}
|
||||
slog.Info("NATS KV bucket ready", "bucket", BucketServices)
|
||||
slog.Info("NATS KV bucket ready", "bucket", BucketDomains)
|
||||
|
||||
// Presence bucket — TTL-based, keys expire when nodes stop renewing
|
||||
_, err = s.js.CreateOrUpdateKeyValue(ctx, jetstream.KeyValueConfig{
|
||||
|
||||
@@ -36,10 +36,10 @@ func TestBucketsCreated(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
// Verify services bucket exists
|
||||
kv, err := s.js.KeyValue(ctx, BucketServices)
|
||||
// Verify domains bucket exists
|
||||
kv, err := s.js.KeyValue(ctx, BucketDomains)
|
||||
if err != nil {
|
||||
t.Fatalf("services bucket not found: %v", err)
|
||||
t.Fatalf("domains bucket not found: %v", err)
|
||||
}
|
||||
|
||||
// Write and read a value
|
||||
|
||||
Reference in New Issue
Block a user