Skip to content

Commit eebeec4

Browse files
authored
Merge pull request #52 from libp2p/minimalsub
fix: rename MinimalPubsub -> Pubsub interface and improve docs
2 parents 93f8ec9 + aa0520d commit eebeec4

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atq
123123
github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8=
124124
github.com/libp2p/go-flow-metrics v0.0.2 h1:U5TvqfoyR6GVRM+bC15Ux1ltar1kbj6Zw6xOVR02CZs=
125125
github.com/libp2p/go-flow-metrics v0.0.2/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs=
126+
github.com/libp2p/go-flow-metrics v0.0.3 h1:8tAs/hSdNvUiLgtlSy3mxwxWP4I9y/jlkPFT7epKdeM=
126127
github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs=
127128
github.com/libp2p/go-libp2p-blankhost v0.1.1 h1:X919sCh+KLqJcNRApj43xCSiQRYqOSI88Fdf55ngf78=
128129
github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro=
@@ -326,6 +327,7 @@ github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:
326327
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
327328
go.opencensus.io v0.22.1 h1:8dP3SGL7MPB94crU3bEPplMPe83FI4EouesJUeFHv50=
328329
go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA=
330+
go.opencensus.io v0.22.2 h1:75k/FF0Q2YM8QYo07VPddOLBslDt1MZOdEslOHvmzAs=
329331
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
330332
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
331333
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=

pubsub.go

+6-7
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ import (
2424

2525
var log = logging.Logger("pubsub-valuestore")
2626

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 {
3231
RegisterTopicValidator(topic string, val pubsub.Validator, opts ...pubsub.ValidatorOpt) error
3332
Join(topic string, opts ...pubsub.TopicOpt) (*pubsub.Topic, error)
3433
}
@@ -41,7 +40,7 @@ type watchGroup struct {
4140
type PubsubValueStore struct {
4241
ctx context.Context
4342
ds ds.Datastore
44-
ps MinimalPubsub
43+
ps Pubsub
4544

4645
host host.Host
4746
fetch *fetchProtocol
@@ -81,7 +80,7 @@ func KeyToTopic(key string) string {
8180
type Option func(*PubsubValueStore) error
8281

8382
// 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) {
8584
psValueStore := &PubsubValueStore{
8685
ctx: ctx,
8786

0 commit comments

Comments
 (0)