Take the SDK whose process can delete a key (issue 1840/S1)

This commit is contained in:
2026-10-22 14:37:18 +02:00
parent b3786cc67e
commit 771cc24fcb
5 changed files with 19 additions and 5 deletions
+14
View File
@@ -263,3 +263,17 @@ func (s State) Watch(key string, handle func(stdio.StateChange) error) error {
}()
return nil
}
// Delete removes a key. A key that was not there is not an error.
func (s State) Delete(key string) error {
ctx, cancel := context.WithTimeout(context.Background(), stateTimeout)
defer cancel()
kv, err := s.store(ctx)
if err != nil {
return err
}
if err := kv.Delete(ctx, key); err != nil && !errors.Is(err, jetstream.ErrKeyNotFound) {
return fmt.Errorf("%s's state %s, key %s: %w", s.Module, s.Name, key, err)
}
return nil
}
+1 -1
View File
@@ -1,4 +1,4 @@
# git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261022122443-2b8ada5eb9dd
# git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261022123624-5ea6c215a48b
## explicit; go 1.26.0
git.novox.be/novox/mesh-sdk/go
git.novox.be/novox/mesh-sdk/go/asks