waku2: static shards
- use protected topics for communities - associate chats to pubsub topics and populate these depending if the chat belongs to a community or not - mailserver functions should be aware of pubsub topics - generate private key for pubsub topic protection when creating a community - add shard cluster and index to communities - setup shards for existing communities - distribute pubsubtopic password
This commit is contained in:
parent
de34ea37f2
commit
350a952116
|
@ -518,6 +518,11 @@ type CommunityShard struct {
|
|||
Shard *common.Shard `json:"shard"`
|
||||
}
|
||||
|
||||
type CommunityShard struct {
|
||||
CommunityID string `json:"communityID"`
|
||||
Shard *common.Shard `json:"shard"`
|
||||
}
|
||||
|
||||
type KnownCommunitiesResponse struct {
|
||||
ContractCommunities []string `json:"contractCommunities"` // TODO: use CommunityShard
|
||||
ContractFeaturedCommunities []string `json:"contractFeaturedCommunities"` // TODO: use CommunityShard
|
||||
|
|
|
@ -138,6 +138,13 @@ func (m *Messenger) prepareEncodedCommunityData(community *communities.Community
|
|||
return "", "", err
|
||||
}
|
||||
|
||||
shardCluster := int32(common.UndefinedShardValue)
|
||||
shardIndex := int32(common.UndefinedShardValue)
|
||||
if community.Shard() != nil {
|
||||
shardCluster = int32(community.Shard().Cluster)
|
||||
shardIndex = int32(community.Shard().Index)
|
||||
}
|
||||
|
||||
urlDataProto := &protobuf.URLData{
|
||||
Content: communityData,
|
||||
Shard: community.Shard().Protobuffer(),
|
||||
|
@ -202,6 +209,14 @@ func (m *Messenger) parseCommunityURLWithData(data string, chatKey string) (*URL
|
|||
return nil, err
|
||||
}
|
||||
|
||||
var shard *common.Shard
|
||||
if urlDataProto.ShardCluster != common.UndefinedShardValue && urlDataProto.ShardIndex != common.UndefinedShardValue {
|
||||
shard = &common.Shard{
|
||||
Cluster: uint16(urlDataProto.ShardCluster),
|
||||
Index: uint16(urlDataProto.ShardIndex),
|
||||
}
|
||||
}
|
||||
|
||||
return &URLDataResponse{
|
||||
Community: CommunityURLData{
|
||||
DisplayName: communityProto.DisplayName,
|
||||
|
@ -305,6 +320,14 @@ func (m *Messenger) prepareEncodedCommunityChannelData(community *communities.Co
|
|||
return "", "", err
|
||||
}
|
||||
|
||||
shardCluster := int32(common.UndefinedShardValue)
|
||||
shardIndex := int32(common.UndefinedShardValue)
|
||||
if community.Shard() != nil {
|
||||
shardCluster = int32(community.Shard().Cluster)
|
||||
shardIndex = int32(community.Shard().Index)
|
||||
|
||||
}
|
||||
|
||||
urlDataProto := &protobuf.URLData{
|
||||
Content: channelData,
|
||||
Shard: community.Shard().Protobuffer(),
|
||||
|
@ -382,6 +405,14 @@ func (m *Messenger) parseCommunityChannelURLWithData(data string, chatKey string
|
|||
return nil, err
|
||||
}
|
||||
|
||||
var shard *common.Shard
|
||||
if urlDataProto.ShardCluster != common.UndefinedShardValue && urlDataProto.ShardIndex != common.UndefinedShardValue {
|
||||
shard = &common.Shard{
|
||||
Cluster: uint16(urlDataProto.ShardCluster),
|
||||
Index: uint16(urlDataProto.ShardIndex),
|
||||
}
|
||||
}
|
||||
|
||||
return &URLDataResponse{
|
||||
Community: CommunityURLData{
|
||||
DisplayName: channelProto.Community.DisplayName,
|
||||
|
|
Loading…
Reference in New Issue