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"`
|
Shard *common.Shard `json:"shard"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CommunityShard struct {
|
||||||
|
CommunityID string `json:"communityID"`
|
||||||
|
Shard *common.Shard `json:"shard"`
|
||||||
|
}
|
||||||
|
|
||||||
type KnownCommunitiesResponse struct {
|
type KnownCommunitiesResponse struct {
|
||||||
ContractCommunities []string `json:"contractCommunities"` // TODO: use CommunityShard
|
ContractCommunities []string `json:"contractCommunities"` // TODO: use CommunityShard
|
||||||
ContractFeaturedCommunities []string `json:"contractFeaturedCommunities"` // TODO: use CommunityShard
|
ContractFeaturedCommunities []string `json:"contractFeaturedCommunities"` // TODO: use CommunityShard
|
||||||
|
|
|
@ -138,6 +138,13 @@ func (m *Messenger) prepareEncodedCommunityData(community *communities.Community
|
||||||
return "", "", err
|
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{
|
urlDataProto := &protobuf.URLData{
|
||||||
Content: communityData,
|
Content: communityData,
|
||||||
Shard: community.Shard().Protobuffer(),
|
Shard: community.Shard().Protobuffer(),
|
||||||
|
@ -202,6 +209,14 @@ func (m *Messenger) parseCommunityURLWithData(data string, chatKey string) (*URL
|
||||||
return nil, err
|
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{
|
return &URLDataResponse{
|
||||||
Community: CommunityURLData{
|
Community: CommunityURLData{
|
||||||
DisplayName: communityProto.DisplayName,
|
DisplayName: communityProto.DisplayName,
|
||||||
|
@ -305,6 +320,14 @@ func (m *Messenger) prepareEncodedCommunityChannelData(community *communities.Co
|
||||||
return "", "", err
|
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{
|
urlDataProto := &protobuf.URLData{
|
||||||
Content: channelData,
|
Content: channelData,
|
||||||
Shard: community.Shard().Protobuffer(),
|
Shard: community.Shard().Protobuffer(),
|
||||||
|
@ -382,6 +405,14 @@ func (m *Messenger) parseCommunityChannelURLWithData(data string, chatKey string
|
||||||
return nil, err
|
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{
|
return &URLDataResponse{
|
||||||
Community: CommunityURLData{
|
Community: CommunityURLData{
|
||||||
DisplayName: channelProto.Community.DisplayName,
|
DisplayName: channelProto.Community.DisplayName,
|
||||||
|
|
Loading…
Reference in New Issue