From fcbbfd81315a911e5223565e39d7c3884a880fff Mon Sep 17 00:00:00 2001 From: Wondertan Date: Sat, 22 Jan 2022 14:00:57 +0200 Subject: [PATCH] feat: detach WithMsgIdFunction --- pubsub.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pubsub.go b/pubsub.go index 0a72f13..e5f8c04 100644 --- a/pubsub.go +++ b/pubsub.go @@ -20,7 +20,7 @@ import ( "github.com/libp2p/go-libp2p-core/protocol" logging "github.com/ipfs/go-log" - timecache "github.com/whyrusleeping/timecache" + "github.com/whyrusleeping/timecache" ) // DefaultMaximumMessageSize is 1mb. @@ -1161,7 +1161,7 @@ type TopicOptions struct{} type TopicOpt func(t *Topic) error // WithMsgIdFunction sets custom MsgIdFunction for a Topic, enabling topics to have own msg id generation rules. -func (p *PubSub) WithMsgIdFunction(msgId MsgIdFunction) TopicOpt { +func WithMsgIdFunction(msgId MsgIdFunction) TopicOpt { return func(t *Topic) error { t.p.idGen.Set(t.topic, msgId) return nil