mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-02-04 13:43:12 +00:00
style: nph formatting
Signed-off-by: Chrysostomos Nanakos <chris@include.gr>
This commit is contained in:
parent
41efa3fc68
commit
0720763165
@ -760,13 +760,12 @@ proc wantListHandler*(
|
||||
wantType = $e.wantType
|
||||
|
||||
if e.address notin peerCtx.wantedBlocks: # Adding new entry to peer wants
|
||||
let
|
||||
have =
|
||||
try:
|
||||
await e.address in self.localStore
|
||||
except CatchableError as exc:
|
||||
# TODO: should not be necessary once we have proper exception tracking on the BlockStore interface
|
||||
false
|
||||
let have =
|
||||
try:
|
||||
await e.address in self.localStore
|
||||
except CatchableError as exc:
|
||||
# TODO: should not be necessary once we have proper exception tracking on the BlockStore interface
|
||||
false
|
||||
|
||||
if e.cancel:
|
||||
# This is sort of expected if we sent the block to the peer, as we have removed
|
||||
@ -781,17 +780,13 @@ proc wantListHandler*(
|
||||
if have:
|
||||
trace "We HAVE the block", address = e.address
|
||||
presence.add(
|
||||
BlockPresence(
|
||||
address: e.address, `type`: BlockPresenceType.Have
|
||||
)
|
||||
BlockPresence(address: e.address, `type`: BlockPresenceType.Have)
|
||||
)
|
||||
else:
|
||||
trace "We DON'T HAVE the block", address = e.address
|
||||
if e.sendDontHave:
|
||||
presence.add(
|
||||
BlockPresence(
|
||||
address: e.address, `type`: BlockPresenceType.DontHave
|
||||
)
|
||||
BlockPresence(address: e.address, `type`: BlockPresenceType.DontHave)
|
||||
)
|
||||
|
||||
codex_block_exchange_want_have_lists_received.inc()
|
||||
|
||||
@ -24,10 +24,8 @@ func parse(_: type UInt256, bytes: seq[byte]): ?UInt256 =
|
||||
UInt256.fromBytesBE(bytes).some
|
||||
|
||||
func init*(_: type Presence, message: PresenceMessage): ?Presence =
|
||||
|
||||
some Presence(
|
||||
address: message.address,
|
||||
have: message.`type` == BlockPresenceType.Have,
|
||||
address: message.address, have: message.`type` == BlockPresenceType.Have
|
||||
)
|
||||
|
||||
func init*(_: type PresenceMessage, presence: Presence): PresenceMessage =
|
||||
|
||||
@ -303,7 +303,8 @@ const
|
||||
nimBanner* = getNimBanner()
|
||||
|
||||
codexFullVersion* =
|
||||
"Storage version: " & codexVersion & "\p" & "Storage revision: " & codexRevision & "\p"
|
||||
"Storage version: " & codexVersion & "\p" & "Storage revision: " & codexRevision &
|
||||
"\p"
|
||||
|
||||
proc parseCmdArg*(
|
||||
T: typedesc[MultiAddress], input: string
|
||||
|
||||
@ -84,8 +84,7 @@ func isManifest*(mc: MultiCodec): ?!bool =
|
||||
func `==`*(a, b: Manifest): bool =
|
||||
(a.treeCid == b.treeCid) and (a.datasetSize == b.datasetSize) and
|
||||
(a.blockSize == b.blockSize) and (a.version == b.version) and (a.hcodec == b.hcodec) and
|
||||
(a.codec == b.codec) and (a.filename == b.filename) and
|
||||
(a.mimetype == b.mimetype)
|
||||
(a.codec == b.codec) and (a.filename == b.filename) and (a.mimetype == b.mimetype)
|
||||
|
||||
func `$`*(self: Manifest): string =
|
||||
result =
|
||||
|
||||
@ -489,10 +489,7 @@ proc initDebugApi(node: CodexNodeRef, conf: CodexConf, router: var RestRouter) =
|
||||
"",
|
||||
"announceAddresses": node.discovery.announceAddrs,
|
||||
"table": table,
|
||||
"storage": {
|
||||
"version": $codexVersion,
|
||||
"revision": $codexRevision,
|
||||
},
|
||||
"storage": {"version": $codexVersion, "revision": $codexRevision},
|
||||
}
|
||||
|
||||
# return pretty json for human readability
|
||||
|
||||
@ -10,7 +10,6 @@ import ../units
|
||||
export json
|
||||
|
||||
type
|
||||
|
||||
RestContent* = object
|
||||
cid* {.serialize.}: Cid
|
||||
manifest* {.serialize.}: Manifest
|
||||
|
||||
@ -253,9 +253,7 @@ asyncchecksuite "NetworkStore engine handlers":
|
||||
|
||||
await engine.blockPresenceHandler(
|
||||
peerId,
|
||||
blocks.mapIt(
|
||||
PresenceMessage.init(Presence(address: it.address, have: true))
|
||||
),
|
||||
blocks.mapIt(PresenceMessage.init(Presence(address: it.address, have: true))),
|
||||
)
|
||||
|
||||
for a in blocks.mapIt(it.address):
|
||||
|
||||
@ -230,10 +230,7 @@ asyncchecksuite "Network - Test Limits":
|
||||
): Future[void] {.async: (raises: []).} =
|
||||
check false
|
||||
|
||||
let fut = network1.send(
|
||||
switch2.peerInfo.peerId,
|
||||
Message()
|
||||
)
|
||||
let fut = network1.send(switch2.peerInfo.peerId, Message())
|
||||
|
||||
await sleepAsync(100.millis)
|
||||
check not fut.finished
|
||||
|
||||
@ -13,9 +13,8 @@ import ./helpers
|
||||
import ./examples
|
||||
|
||||
suite "Manifest":
|
||||
let
|
||||
manifest =
|
||||
Manifest.new(treeCid = Cid.example, blockSize = 1.MiBs, datasetSize = 100.MiBs)
|
||||
let manifest =
|
||||
Manifest.new(treeCid = Cid.example, blockSize = 1.MiBs, datasetSize = 100.MiBs)
|
||||
|
||||
proc encodeDecode(manifest: Manifest): Manifest =
|
||||
let e = manifest.encode().tryGet()
|
||||
|
||||
@ -20,7 +20,7 @@ multinodesuite "Rest API validation":
|
||||
test "should return 204 when attempting delete of non-existing dataset", config:
|
||||
let data = await RandomChunker.example(blocks = 2)
|
||||
let cid = (await client.upload(data)).get
|
||||
|
||||
|
||||
let responseBefore = await client.deleteRaw($Cid.example)
|
||||
check responseBefore.status == 204
|
||||
check (await responseBefore.body) == "" # No content
|
||||
|
||||
@ -20,7 +20,6 @@ template twonodessuite*(name: string, body: untyped) =
|
||||
var client2 {.inject, used.}: CodexClient
|
||||
|
||||
setup:
|
||||
|
||||
node1 = clients()[0]
|
||||
node2 = clients()[1]
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user