fixing redundant funcion types

This commit is contained in:
Gabriel mermelstein 2024-05-30 13:07:19 +02:00
parent b161f0a3cb
commit d5132edfe1
No known key found for this signature in database
GPG Key ID: 82B8134785FEAE0D
2 changed files with 4 additions and 6 deletions

View File

@ -41,7 +41,7 @@ const
StaticShardingPubsubTopicPrefix = Waku2PubsubTopicPrefix & "/rs"
proc parseStaticSharding*(
T: type NsPubsubTopic, topic: PubsubTopic | string
T: type NsPubsubTopic, topic: PubsubTopic
): ParsingResult[NsPubsubTopic] =
if not topic.startsWith(StaticShardingPubsubTopicPrefix):
return err(
@ -72,9 +72,7 @@ proc parseStaticSharding*(
ok(NsPubsubTopic.staticSharding(clusterId, shardId))
proc parse*(
T: type NsPubsubTopic, topic: PubsubTopic | string
): ParsingResult[NsPubsubTopic] =
proc parse*(T: type NsPubsubTopic, topic: PubsubTopic): ParsingResult[NsPubsubTopic] =
## Splits a namespaced topic string into its constituent parts.
## The topic string has to be in the format `/<application>/<version>/<topic-name>/<encoding>`
NsPubsubTopic.parseStaticSharding(topic)

View File

@ -85,7 +85,7 @@ func contains*(rs: RelayShards, clusterId, shardId: uint16): bool =
func contains*(rs: RelayShards, topic: NsPubsubTopic): bool =
return rs.contains(topic.clusterId, topic.shardId)
func contains*(rs: RelayShards, topic: PubsubTopic | string): bool =
func contains*(rs: RelayShards, topic: PubsubTopic): bool =
let parseRes = NsPubsubTopic.parse(topic)
if parseRes.isErr():
return false
@ -240,7 +240,7 @@ proc containsShard*(r: Record, clusterId, shardId: uint16): bool =
proc containsShard*(r: Record, topic: NsPubsubTopic): bool =
return containsShard(r, topic.clusterId, topic.shardId)
proc containsShard*(r: Record, topic: PubsubTopic | string): bool =
proc containsShard*(r: Record, topic: PubsubTopic): bool =
let parseRes = NsPubsubTopic.parse(topic)
if parseRes.isErr():
debug "invalid static sharding topic", topic = topic, error = parseRes.error