@@ -24,11 +24,10 @@ import (
24
24
25
25
var log = logging .Logger ("pubsub-valuestore" )
26
26
27
- // MinimalPubsub allows us to provide the bare minimum pubsub functionality
28
- // to the router, while still using the same pubsub instance in other goroutines.
29
- // This is primarily done to allow callers to not have to worry about topic management
30
- // due to topics only allowing a single "joiner".
31
- type MinimalPubsub interface {
27
+ // Pubsub is the minimal subset of the pubsub interface required by the pubsub
28
+ // value store. This way, users can wrap the underlying pubsub implementation
29
+ // without re-exporting/implementing the entire interface.
30
+ type Pubsub interface {
32
31
RegisterTopicValidator (topic string , val pubsub.Validator , opts ... pubsub.ValidatorOpt ) error
33
32
Join (topic string , opts ... pubsub.TopicOpt ) (* pubsub.Topic , error )
34
33
}
@@ -41,7 +40,7 @@ type watchGroup struct {
41
40
type PubsubValueStore struct {
42
41
ctx context.Context
43
42
ds ds.Datastore
44
- ps MinimalPubsub
43
+ ps Pubsub
45
44
46
45
host host.Host
47
46
fetch * fetchProtocol
@@ -81,7 +80,7 @@ func KeyToTopic(key string) string {
81
80
type Option func (* PubsubValueStore ) error
82
81
83
82
// NewPubsubValueStore constructs a new ValueStore that gets and receives records through pubsub.
84
- func NewPubsubValueStore (ctx context.Context , host host.Host , ps MinimalPubsub , validator record.Validator , opts ... Option ) (* PubsubValueStore , error ) {
83
+ func NewPubsubValueStore (ctx context.Context , host host.Host , ps Pubsub , validator record.Validator , opts ... Option ) (* PubsubValueStore , error ) {
85
84
psValueStore := & PubsubValueStore {
86
85
ctx : ctx ,
87
86
0 commit comments