mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-01-04 05:43:06 +00:00
New -> NewFloodsubWithProtocols
This commit is contained in:
parent
6840b190db
commit
75fcbf0c2c
@ -14,8 +14,8 @@ const (
|
|||||||
FloodSubID = protocol.ID("/floodsub/1.0.0")
|
FloodSubID = protocol.ID("/floodsub/1.0.0")
|
||||||
)
|
)
|
||||||
|
|
||||||
// New returns a new floodsub-enabled PubSub objecting using the protocols specified in ps
|
// NewFloodsubWithProtocols returns a new floodsub-enabled PubSub objecting using the protocols specified in ps
|
||||||
func New(ctx context.Context, h host.Host, ps []protocol.ID, opts ...Option) (*PubSub, error) {
|
func NewFloodsubWithProtocols(ctx context.Context, h host.Host, ps []protocol.ID, opts ...Option) (*PubSub, error) {
|
||||||
rt := &FloodSubRouter{
|
rt := &FloodSubRouter{
|
||||||
protocols: ps,
|
protocols: ps,
|
||||||
}
|
}
|
||||||
@ -24,7 +24,7 @@ func New(ctx context.Context, h host.Host, ps []protocol.ID, opts ...Option) (*P
|
|||||||
|
|
||||||
// NewFloodSub returns a new PubSub object using the FloodSubRouter
|
// NewFloodSub returns a new PubSub object using the FloodSubRouter
|
||||||
func NewFloodSub(ctx context.Context, h host.Host, opts ...Option) (*PubSub, error) {
|
func NewFloodSub(ctx context.Context, h host.Host, opts ...Option) (*PubSub, error) {
|
||||||
return New(ctx, h, []protocol.ID{FloodSubID}, opts...)
|
return NewFloodsubWithProtocols(ctx, h, []protocol.ID{FloodSubID}, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
type FloodSubRouter struct {
|
type FloodSubRouter struct {
|
||||||
|
|||||||
@ -681,7 +681,7 @@ func TestFloodSubPluggableProtocol(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func mustCreatePubSub(ctx context.Context, t *testing.T, h host.Host, ps ...protocol.ID) *PubSub {
|
func mustCreatePubSub(ctx context.Context, t *testing.T, h host.Host, ps ...protocol.ID) *PubSub {
|
||||||
psub, err := New(ctx, h, ps)
|
psub, err := NewFloodsubWithProtocols(ctx, h, ps)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user