mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-02-17 15:27:28 +00:00
* feat: introduce LRU cache Replace `MemoryStore` with LRU caching mechanism. `lrucache` library was forked to https://github.com/status-im/lrucache.nim. Co-authored-by: Eric Mastro <eric.mastro@gmail.com> # Conflicts: # dagger/dagger.nim # dagger/stores.nim # dagger/stores/manager.nim # tests/dagger/blockexc/testengine.nim # tests/dagger/helpers/nodeutils.nim # tests/dagger/testnode.nim # tests/dagger/teststores.nim * feat: introduce --cache-size CLI option Allow for a value of `0` to disable the cache. # Conflicts: # dagger/dagger.nim * allow dynamic block size in cache allow block size to be variable/dynamic update lrucache to use updated lrucache dep Using removeLru proc, added tests * Refactor CacheStore init block Co-authored-by: Michael Bradley, Jr <michaelsbradleyjr@gmail.com>
59 lines
1.9 KiB
Nim
59 lines
1.9 KiB
Nim
mode = ScriptMode.Verbose
|
|
|
|
version = "0.1.0"
|
|
author = "Dagger Team"
|
|
description = "p2p data durability engine"
|
|
license = "MIT"
|
|
|
|
requires "libp2p#unstable",
|
|
"nimcrypto >= 0.4.1",
|
|
"bearssl >= 0.1.4",
|
|
"chronicles >= 0.7.2",
|
|
"chronos >= 2.5.2",
|
|
"metrics",
|
|
"secp256k1",
|
|
"stew#head",
|
|
"protobufserialization >= 0.2.0 & < 0.3.0",
|
|
"https://github.com/status-im/nim-nitro >= 0.4.0 & < 0.5.0",
|
|
"questionable >= 0.9.1 & < 0.10.0",
|
|
"upraises >= 0.1.0 & < 0.2.0",
|
|
"asynctest >= 0.3.0 & < 0.4.0"
|
|
|
|
### Helper functions
|
|
proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
|
|
if not dirExists "build":
|
|
mkDir "build"
|
|
# allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims"
|
|
var extra_params = params
|
|
for i in 2..<paramCount():
|
|
extra_params &= " " & paramStr(i)
|
|
exec "nim " & lang & " --out:build/" & name & " " & extra_params & " " & srcDir & name & ".nim"
|
|
|
|
proc test(name: string, srcDir = "tests/", params = "-d:chronicles_log_level=DEBUG", lang = "c") =
|
|
buildBinary name, srcDir, params
|
|
exec "build/" & name
|
|
|
|
task testContracts, "Build, deploy and test contracts":
|
|
exec "cd vendor/dagger-contracts && npm install"
|
|
|
|
# start node
|
|
# Note: combining this command with the previous does not work
|
|
exec "cd vendor/dagger-contracts && npx hardhat node --no-deploy &"
|
|
|
|
# deploy contracts
|
|
exec "sleep 3 && " &
|
|
"cd vendor/dagger-contracts && npx hardhat deploy --network localhost --export '../../deployment-localhost.json'"
|
|
|
|
# run contract tests using deployed contracts
|
|
try:
|
|
test "testContracts", "tests/", "-d:chronicles_log_level=WARN"
|
|
finally:
|
|
# kill simulator processes
|
|
exec "ps -ef | grep hardhat | grep -v grep | awk '{ print $2 }' | xargs kill"
|
|
|
|
task testAll, "Build & run Dagger tests":
|
|
test "testAll", params = "-d:chronicles_log_level=WARN"
|
|
|
|
task dagger, "build dagger binary":
|
|
buildBinary "dagger"
|