Skip to content

Commit 7a6efda

Browse files
committed
gossipsub: initiate topic table extension
1 parent ed53c17 commit 7a6efda

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

extensions.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ import (
66
)
77

88
type PeerExtensions struct {
9-
TestExtension bool
9+
TestExtension bool
10+
TopicTableExtension bool
1011
}
1112

1213
type TestExtensionConfig struct {
1314
OnReceiveTestExtension func(from peer.ID)
1415
}
1516

17+
type TopicTableExtensionConfig struct {
18+
}
19+
1620
func WithTestExtension(c TestExtensionConfig) Option {
1721
return func(ps *PubSub) error {
1822
if rt, ok := ps.rt.(*GossipSubRouter); ok {
@@ -26,6 +30,12 @@ func WithTestExtension(c TestExtensionConfig) Option {
2630
}
2731
}
2832

33+
func WithTopicTableExtension(c TopicTableExtensionConfig) Option {
34+
return func(ps *PubSub) error {
35+
return nil
36+
}
37+
}
38+
2939
func hasPeerExtensions(rpc *RPC) bool {
3040
if rpc != nil && rpc.Control != nil && rpc.Control.Extensions != nil {
3141
return true
@@ -60,7 +70,8 @@ type extensionsState struct {
6070
reportMisbehavior func(peer.ID)
6171
sendRPC func(p peer.ID, r *RPC, urgent bool)
6272

63-
testExtension *testExtension
73+
testExtension *testExtension
74+
topicTableExtension *topicTableExtension
6475
}
6576

6677
func newExtensionsState(myExtensions PeerExtensions, reportMisbehavior func(peer.ID), sendRPC func(peer.ID, *RPC, bool)) *extensionsState {

topictable_extension.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package pubsub
2+
3+
type topicTableExtension struct {
4+
}

0 commit comments

Comments
 (0)