mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-03 05:53:07 +00:00
refactor: remove makeRandomDataset helper function
Remove makeRandomDataset in favor of direct composition with makeRandomBlocks and makeDataset. Part of https://github.com/codex-storage/nim-codex/issues/974 Signed-off-by: Chrysostomos Nanakos <chris@include.gr>
This commit is contained in:
parent
8812d98271
commit
f7a3e90414
@ -198,7 +198,7 @@ asyncchecksuite "NetworkStore - dissemination":
|
||||
await nodes.stop()
|
||||
|
||||
test "Should disseminate blocks across large diameter swarm":
|
||||
let dataset = (await makeRandomDataset(nBlocks = 60, blockSize = 256'nb)).tryGet()
|
||||
let dataset = makeDataset(await makeRandomBlocks(60 * 256, 256'nb)).tryGet()
|
||||
|
||||
nodes = generateNodes(
|
||||
6,
|
||||
|
||||
@ -14,10 +14,6 @@ proc makeRandomBlock*(size: NBytes): Block =
|
||||
let bytes = newSeqWith(size.int, rand(uint8))
|
||||
Block.new(bytes).tryGet()
|
||||
|
||||
#proc makeRandomBlocks*(nBlocks: int, blockSize: NBytes): seq[Block] =
|
||||
#for i in 0 ..< nBlocks:
|
||||
#result.add(makeRandomBlock(blockSize))
|
||||
|
||||
proc makeRandomBlocks*(
|
||||
datasetSize: int, blockSize: NBytes
|
||||
): Future[seq[Block]] {.async.} =
|
||||
@ -47,9 +43,3 @@ proc makeDataset*(blocks: seq[Block]): ?!TestDataset =
|
||||
)
|
||||
|
||||
return success((blocks, tree, manifest))
|
||||
|
||||
proc makeRandomDataset*(
|
||||
nBlocks: int, blockSize: NBytes
|
||||
): Future[?!TestDataset] {.async.} =
|
||||
let blocks = await makeRandomBlocks(nBlocks * blockSize.int, blockSize)
|
||||
makeDataset(blocks)
|
||||
|
||||
@ -364,8 +364,10 @@ asyncchecksuite "RepoStore":
|
||||
let
|
||||
repo = RepoStore.new(repoDs, metaDs, clock = mockClock, quotaMaxBytes =
|
||||
1000'nb)
|
||||
(blocks, tree, manifest) =
|
||||
(await makeRandomDataset(nBlocks = 2, blockSize = 256'nb)).tryGet()
|
||||
(blocks, tree, manifest) = makeDataset(
|
||||
await makeRandomBlocks(datasetSize = 2 * 256, blockSize = 256'nb)
|
||||
)
|
||||
.tryGet()
|
||||
blk = blocks[0]
|
||||
treeCid = tree.rootCid.tryGet()
|
||||
proof = tree.getProof(0).tryGet()
|
||||
@ -381,8 +383,10 @@ asyncchecksuite "RepoStore":
|
||||
let
|
||||
repo = RepoStore.new(repoDs, metaDs, clock = mockClock, quotaMaxBytes =
|
||||
1000'nb)
|
||||
(blocks, tree, manifest) =
|
||||
(await makeRandomDataset(nBlocks = 2, blockSize = 256'nb)).tryGet()
|
||||
(blocks, tree, manifest) = makeDataset(
|
||||
await makeRandomBlocks(datasetSize = 2 * 256, blockSize = 256'nb)
|
||||
)
|
||||
.tryGet()
|
||||
blk = blocks[0]
|
||||
treeCid = tree.rootCid.tryGet()
|
||||
proof = tree.getProof(0).tryGet()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user