Skip to content

Commit b203ef7

Browse files
committed
feat(sharding)_: add shards config
1 parent 06e149f commit b203ef7

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

wakuv2/shard.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,42 @@ func DefaultNonProtectedShard() *Shard {
5454
}
5555
}
5656

57+
// TODO this is used only for community control messages, we need to stop using it once migration is done
5758
func DefaultNonProtectedPubsubTopic() string {
5859
return DefaultNonProtectedShard().PubsubTopic()
5960
}
61+
62+
func DefaultShard() *Shard {
63+
return &Shard{
64+
Cluster: MainStatusShardCluster,
65+
Index: DefaultShardIndex,
66+
}
67+
}
68+
69+
// GlobalCommunityControlShard returns the shard for the global community control messages
70+
//
71+
// Specs: https://github.com/vacp2p/rfc-index/blob/8ee2a6d6b232838d83374c35e2413f84436ecf64/status/56/communities.md?plain=1#L329
72+
func GlobalCommunityControlShard() *Shard {
73+
return &Shard{
74+
Cluster: MainStatusShardCluster,
75+
Index: 128,
76+
}
77+
}
78+
79+
// GlobalCommunityContentShard returns the shard for the global community content messages
80+
//
81+
// Specs: https://github.com/vacp2p/rfc-index/blob/8ee2a6d6b232838d83374c35e2413f84436ecf64/status/56/communities.md?plain=1#L330
82+
func GlobalCommunityContentShard() *Shard {
83+
return &Shard{
84+
Cluster: MainStatusShardCluster,
85+
Index: 256,
86+
}
87+
}
88+
89+
func GlobalCommunityControlPubsubTopic() string {
90+
return GlobalCommunityControlShard().PubsubTopic()
91+
}
92+
93+
func GlobalCommunityContentPubsubTopic() string {
94+
return GlobalCommunityContentShard().PubsubTopic()
95+
}

0 commit comments

Comments
 (0)