Read this node's placement from its node and module keys, or its placement.<node> before the holder converts it, so a write of the holder's is composed only once its node key lands (issue 774, research 072 row 37)
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/nats-io/nats.go"
|
||||
@@ -23,7 +24,9 @@ type KVUpdate struct {
|
||||
// never polls.
|
||||
type KVBus interface {
|
||||
// KVWatch yields the keys of the bucket matching the pattern now, a Caught update, then every change, until ctx ends
|
||||
// or the link does (the channel is then closed). A bucket the node's account may not read is an error.
|
||||
// or the link does (the channel is then closed). A bucket the node's account may not read is an error. The pattern
|
||||
// may be several, separated by spaces (WatchPatterns), watched as one: a node's placement in either form of its
|
||||
// keys (research 072 row 37).
|
||||
KVWatch(ctx context.Context, bucket, pattern string) (<-chan KVUpdate, error)
|
||||
}
|
||||
|
||||
@@ -41,7 +44,7 @@ func (b OverNATS) KVWatch(ctx context.Context, bucket, pattern string) (<-chan K
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("the bucket %s: %w", bucket, err)
|
||||
}
|
||||
w, err := kv.Watch(pattern, nats.Context(ctx))
|
||||
w, err := kv.WatchFiltered(strings.Fields(pattern), nats.Context(ctx))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("watching %s in %s: %w", pattern, bucket, err)
|
||||
}
|
||||
@@ -296,3 +299,6 @@ func (q *Session) KVWatchAwait(ctx context.Context, bucket, pattern string, wait
|
||||
}()
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// WatchPatterns is several key patterns as one pattern KVWatch takes.
|
||||
func WatchPatterns(patterns ...string) string { return strings.Join(patterns, " ") }
|
||||
|
||||
Reference in New Issue
Block a user