chore: remove bloom filter usage
This commit is contained in:
parent
18f9c29ef0
commit
810a6bb5f5
|
@ -202,8 +202,7 @@ proc newAppController*(statusFoundation: StatusFoundation): AppController =
|
|||
result.devicesService = devices_service.newService(statusFoundation.events, result.settingsService)
|
||||
result.mailserversService = mailservers_service.newService(statusFoundation.events, statusFoundation.threadpool,
|
||||
result.settingsService, result.nodeConfigurationService, statusFoundation.fleetConfiguration)
|
||||
result.nodeService = node_service.newService(statusFoundation.events, statusFoundation.threadpool,
|
||||
result.settingsService, result.nodeConfigurationService)
|
||||
result.nodeService = node_service.newService(statusFoundation.events, result.settingsService, result.nodeConfigurationService)
|
||||
result.gifService = gif_service.newService(result.settingsService)
|
||||
result.ensService = ens_service.newService(statusFoundation.events, statusFoundation.threadpool,
|
||||
result.settingsService, result.walletAccountService, result.transactionService,
|
||||
|
|
|
@ -54,14 +54,10 @@ proc init*(self: Controller) =
|
|||
|
||||
self.events.on(SignalType.Stats.event) do (e:Args):
|
||||
self.delegate.setStats(StatsSignal(e).stats)
|
||||
if not self.isWakuV2: self.delegate.fetchBitsSet()
|
||||
|
||||
self.events.on(SignalType.ChroniclesLogs.event) do(e:Args):
|
||||
self.delegate.log(ChroniclesLogsSignal(e).content)
|
||||
|
||||
self.events.on(SIGNAL_BITS_SET_FETCHED) do (e:Args):
|
||||
self.delegate.setBitsSet(self.nodeService.getBloomBitsSet())
|
||||
|
||||
self.setPeers(self.nodeService.fetchPeers())
|
||||
|
||||
proc sendRPCMessageRaw*(self: Controller, inputJSON: string): string =
|
||||
|
@ -85,9 +81,6 @@ proc setV2LightMode*(self: Controller, enabled: bool): bool =
|
|||
proc getWakuBloomFilterMode*(self: Controller): bool =
|
||||
return self.settingsService.getWakuBloomFilterMode()
|
||||
|
||||
proc fetchBitsSet*(self: Controller) =
|
||||
self.nodeService.fetchBitsSet()
|
||||
|
||||
proc getWakuVersion*(self: Controller): int =
|
||||
var fleet = self.nodeConfigurationService.getFleet()
|
||||
let isWakuV2 = if fleet == WakuV2Prod or fleet == WakuV2Test or fleet == StatusTest or fleet == StatusProd:
|
||||
|
|
|
@ -25,9 +25,6 @@ method setStats*(self: AccessInterface, stats: Stats) {.base.} =
|
|||
method log*(self: AccessInterface, logContent: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method setBitsSet*(self: AccessInterface, bitsSet: int) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method viewDidLoad*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
@ -46,9 +43,6 @@ method setV2LightMode*(self: AccessInterface, enabled: bool) {.base.} =
|
|||
method getWakuBloomFilterMode*(self: AccessInterface): bool {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method fetchBitsSet*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method isV2LightMode*(self: AccessInterface): bool {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -69,9 +69,6 @@ method setV2LightMode*(self: Module, enabled: bool) =
|
|||
method getWakuBloomFilterMode*(self: Module): bool =
|
||||
return self.controller.getWakuBloomFilterMode()
|
||||
|
||||
method fetchBitsSet*(self: Module) =
|
||||
self.controller.fetchBitsSet();
|
||||
|
||||
method isV2LightMode*(self: Module): bool =
|
||||
return self.controller.isV2LightMode()
|
||||
|
||||
|
@ -97,6 +94,3 @@ method log*(self: Module, logContent: string) =
|
|||
|
||||
method setPeerSize*(self: Module, peerSize: int) =
|
||||
self.view.setPeerSize(peerSize)
|
||||
|
||||
method setBitsSet*(self: Module, bitsSet: int) =
|
||||
self.view.setBitsSet(bitsSet)
|
||||
|
|
|
@ -11,7 +11,6 @@ QtObject:
|
|||
lastMessage*: string
|
||||
stats*: Stats
|
||||
peerSize: int
|
||||
bloomBitsSet: int
|
||||
|
||||
proc delete*(self: View) =
|
||||
self.QObject.delete
|
||||
|
@ -89,22 +88,6 @@ QtObject:
|
|||
self.stats = stats
|
||||
self.statsChanged()
|
||||
|
||||
proc fetchBitsSet*(self: View) =
|
||||
self.delegate.fetchBitsSet()
|
||||
|
||||
proc getBloomBitsSet(self: View): int {.slot.} =
|
||||
self.bloomBitsSet
|
||||
|
||||
proc bloomBitsSetChanged(self: View) {.signal.}
|
||||
|
||||
proc setBitsSet*(self: View, bitsSet: int) =
|
||||
self.bloomBitsSet = bitsSet
|
||||
self.bloomBitsSetChanged();
|
||||
|
||||
QtProperty[int] bloomBits:
|
||||
read = getBloomBitsSet
|
||||
notify = bloomBitsSetChanged
|
||||
|
||||
proc uploadRate*(self: View): string {.slot.} = $self.stats.uploadRate
|
||||
|
||||
QtProperty[string] uploadRate:
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
import ../../../backend/node as status_node
|
||||
import bitops, stew/byteutils, chronicles
|
||||
include ../../../app/core/tasks/common
|
||||
|
||||
type
|
||||
BloomBitsSetTaskArg = ref object of QObjectTaskArg
|
||||
bitsSet: int
|
||||
|
||||
proc getBloomFilterBitsSet*(): int =
|
||||
try:
|
||||
let bloomFilter = status_node.getBloomFilter().result.getStr
|
||||
var bitCount = 0;
|
||||
for b in hexToSeqByte(bloomFilter):
|
||||
bitCount += countSetBits(b)
|
||||
return bitCount
|
||||
except Exception as e:
|
||||
error "error while getting BloomFilterBitSet: ", msg = e.msg
|
||||
return 0;
|
||||
|
||||
const bloomBitsSetTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
||||
let
|
||||
arg = decode[BloomBitsSetTaskArg](argEncoded)
|
||||
output = getBloomFilterBitsSet()
|
||||
arg.finish(output)
|
|
@ -4,41 +4,31 @@ import ../settings/service as settings_service
|
|||
import ../node_configuration/service as node_configuration_service
|
||||
|
||||
import ../../../app/core/eventemitter
|
||||
import ../../../app/core/tasks/[qt, threadpool]
|
||||
import ../../../app/core/fleets/fleet_configuration
|
||||
|
||||
include async_tasks
|
||||
import ../../../backend/node as status_node
|
||||
|
||||
logScope:
|
||||
topics = "node-service"
|
||||
|
||||
# Signals which may be emitted by this service:
|
||||
const SIGNAL_BITS_SET_FETCHED* = "bitsSetFetched"
|
||||
const SIGNAL_NETWORK_DISCONNECTED* = "networkDisconnected"
|
||||
const SIGNAL_NETWORK_CONNECTED* = "networkConnected"
|
||||
|
||||
type
|
||||
BitsSet* = ref object of Args
|
||||
bitsSet*: int
|
||||
|
||||
QtObject:
|
||||
type Service* = ref object of QObject
|
||||
events*: EventEmitter
|
||||
threadpool: ThreadPool
|
||||
settingsService: settings_service.Service
|
||||
nodeConfigurationService: node_configuration_service.Service
|
||||
bloomBitsSet: int
|
||||
peers*: seq[string]
|
||||
connected: bool
|
||||
|
||||
proc delete*(self: Service) =
|
||||
self.QObject.delete
|
||||
|
||||
proc newService*(events: EventEmitter, threadpool: ThreadPool, settingsService: settings_service.Service, nodeConfigurationService: node_configuration_service.Service): Service =
|
||||
proc newService*(events: EventEmitter, settingsService: settings_service.Service, nodeConfigurationService: node_configuration_service.Service): Service =
|
||||
new(result, delete)
|
||||
result.QObject.setup
|
||||
result.events = events
|
||||
result.threadpool = threadpool
|
||||
result.settingsService = settingsService
|
||||
result.nodeConfigurationService = nodeConfigurationService
|
||||
result.peers = @[]
|
||||
|
@ -47,24 +37,6 @@ QtObject:
|
|||
proc init*(self: Service) =
|
||||
discard
|
||||
|
||||
proc bloomFiltersBitsSet*(self: Service, slot: string) =
|
||||
let arg = BloomBitsSetTaskArg(
|
||||
tptr: cast[ByteAddress](bloomBitsSetTask),
|
||||
vptr: cast[ByteAddress](self.vptr),
|
||||
slot: slot
|
||||
)
|
||||
self.threadpool.start(arg)
|
||||
|
||||
proc fetchBitsSet*(self: Service) =
|
||||
self.bloomFiltersBitsSet("bitsSet")
|
||||
|
||||
proc getBloomBitsSet*(self: Service): int =
|
||||
return self.bloomBitsSet;
|
||||
|
||||
proc bitsSet*(self: Service, bitsSet: string) {.slot.} =
|
||||
self.bloomBitsSet = parseInt(bitsSet)
|
||||
self.events.emit(SIGNAL_BITS_SET_FETCHED, BitsSet(bitsSet: self.bloomBitsSet))
|
||||
|
||||
proc sendRPCMessageRaw*(self: Service, inputJSON: string): string =
|
||||
return status_node.sendRPCMessageRaw(inputJSON)
|
||||
|
||||
|
|
|
@ -57,30 +57,6 @@ StatusSectionLayout {
|
|||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: bloomF
|
||||
Layout.fillWidth: true
|
||||
StatusBaseText {
|
||||
color: Theme.palette.primaryColor1
|
||||
text: qsTr("Bloom Filter Usage")
|
||||
Layout.rightMargin: Style.current.padding
|
||||
Layout.leftMargin: Style.current.padding
|
||||
Layout.fillWidth: true
|
||||
font.weight: Font.Medium
|
||||
font.pixelSize: 20
|
||||
}
|
||||
StatusBaseText {
|
||||
id: bloomPerc
|
||||
color: Theme.palette.primaryColor1
|
||||
text: ((root.store.nodeModelInst.bloomBits / 512) * 100).toFixed(2) + "%"
|
||||
Layout.rightMargin: Style.current.padding
|
||||
Layout.leftMargin: Style.current.padding
|
||||
Layout.fillWidth: true
|
||||
font.weight: Font.Medium
|
||||
font.pixelSize: 20
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: mailserverLogsContainer
|
||||
height: 300
|
||||
|
|
Loading…
Reference in New Issue