diff --git a/.github/actions/nimbus-build-system/action.yml b/.github/actions/nimbus-build-system/action.yml index 4ec8af4b..f70af604 100644 --- a/.github/actions/nimbus-build-system/action.yml +++ b/.github/actions/nimbus-build-system/action.yml @@ -218,7 +218,7 @@ runs: run: | git config --global core.symlinks false - - name: Build Nim and Codex dependencies + - name: Build Nim and Logos Storage dependencies shell: ${{ inputs.shell }} {0} run: | which gcc diff --git a/.github/workflows/Readme.md b/.github/workflows/Readme.md index 1aff4962..f7f00e57 100644 --- a/.github/workflows/Readme.md +++ b/.github/workflows/Readme.md @@ -70,7 +70,7 @@ runners busy for longer on a workflow that you know is going to fail anyway. Consequent runs will therefore take longer to start. Fail fast is most likely better for overall development speed. -[usage]: https://github.com/codex-storage/nim-codex/actions/runs/3462031231/usage +[usage]: https://github.com/logos-storage/logos-storage-nim/actions/runs/3462031231/usage [composite]: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action [reusable]: https://docs.github.com/en/actions/using-workflows/reusing-workflows [cache]: https://github.com/actions/cache/blob/main/workarounds.md#update-a-cache diff --git a/.github/workflows/ci-reusable.yml b/.github/workflows/ci-reusable.yml index bb74b9a2..b6131b18 100644 --- a/.github/workflows/ci-reusable.yml +++ b/.github/workflows/ci-reusable.yml @@ -54,9 +54,9 @@ jobs: with: node-version: 22 - - name: Start Ethereum node with Codex contracts + - name: Start Ethereum node with Logos Storage contracts if: matrix.tests == 'contract' || matrix.tests == 'integration' || matrix.tests == 'tools' || matrix.tests == 'all' - working-directory: vendor/codex-contracts-eth + working-directory: vendor/logos-storage-contracts-eth env: MSYS2_PATH_TYPE: inherit run: | diff --git a/.github/workflows/docker-reusable.yml b/.github/workflows/docker-reusable.yml index eb614216..b8bfeffa 100644 --- a/.github/workflows/docker-reusable.yml +++ b/.github/workflows/docker-reusable.yml @@ -70,7 +70,7 @@ on: type: string outputs: codex_image: - description: Codex Docker image tag + description: Logos Storage Docker image tag value: ${{ jobs.publish.outputs.codex_image }} @@ -87,7 +87,7 @@ env: TAG_SUFFIX: ${{ inputs.tag_suffix }} CONTRACT_IMAGE: ${{ inputs.contract_image }} # Tests - TESTS_SOURCE: codex-storage/cs-codex-dist-tests + TESTS_SOURCE: logos-storage/logos-storage-nim-cs-dist-tests TESTS_BRANCH: master CONTINUOUS_TESTS_LIST: ${{ inputs.continuous_tests_list }} CONTINUOUS_TESTS_DURATION: ${{ inputs.continuous_tests_duration }} @@ -316,7 +316,7 @@ jobs: max-parallel: 1 matrix: tests: ${{ fromJSON(needs.compute-continuous-tests-inputs.outputs.continuous_tests_list) }} - uses: codex-storage/cs-codex-dist-tests/.github/workflows/run-continuous-tests.yaml@master + uses: logos-storage/logos-storage-nim-cs-dist-tests/.github/workflows/run-continuous-tests.yaml@master with: source: ${{ needs.compute-tests-inputs.outputs.source }} branch: ${{ needs.compute-tests-inputs.outputs.branch }} @@ -333,7 +333,7 @@ jobs: name: Run Release Tests needs: [compute-tests-inputs] if: ${{ inputs.run_release_tests == 'true' }} - uses: codex-storage/cs-codex-dist-tests/.github/workflows/run-release-tests.yaml@master + uses: logos-storage/logos-storage-nim-cs-dist-tests/.github/workflows/run-release-tests.yaml@master with: source: ${{ needs.compute-tests-inputs.outputs.source }} branch: ${{ needs.compute-tests-inputs.outputs.branch }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3a633a81..2b62e3b2 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -31,7 +31,7 @@ jobs: - name: Get submodule short hash id: get-hash run: | - hash=$(git rev-parse --short HEAD:vendor/codex-contracts-eth) + hash=$(git rev-parse --short HEAD:vendor/logos-storage-contracts-eth) echo "hash=$hash" >> $GITHUB_OUTPUT build-and-push: name: Build and Push diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4232ff0f..18607c70 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -52,7 +52,7 @@ jobs: node-version: 18 - name: Build OpenAPI - run: npx @redocly/cli build-docs openapi.yaml --output openapi/index.html --title "Codex API" + run: npx @redocly/cli build-docs openapi.yaml --output openapi/index.html --title "Logos Storage API" - name: Build Postman Collection run: npx -y openapi-to-postmanv2 -s openapi.yaml -o openapi/postman.json -p -O folderStrategy=Tags,includeAuthInfoInExample=false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3220cd8c..4c2cbd90 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ env: cache_nonce: 0 # Allows for easily busting actions/cache caches nim_version: pinned rust_version: 1.79.0 - codex_binary_base: codex + storage_binary_base: storage cirdl_binary_base: cirdl build_dir: build nim_flags: '' @@ -73,18 +73,18 @@ jobs: windows*) os_name="windows" ;; esac github_ref_name="${GITHUB_REF_NAME/\//-}" - codex_binary="${{ env.codex_binary_base }}-${github_ref_name}-${os_name}-${{ matrix.cpu }}" + storage_binary="${{ env.storage_binary_base }}-${github_ref_name}-${os_name}-${{ matrix.cpu }}" cirdl_binary="${{ env.cirdl_binary_base }}-${github_ref_name}-${os_name}-${{ matrix.cpu }}" if [[ ${os_name} == "windows" ]]; then - codex_binary="${codex_binary}.exe" + storage_binary="${storage_binary}.exe" cirdl_binary="${cirdl_binary}.exe" fi - echo "codex_binary=${codex_binary}" >>$GITHUB_ENV + echo "storage_binary=${storage_binary}" >>$GITHUB_ENV echo "cirdl_binary=${cirdl_binary}" >>$GITHUB_ENV - name: Release - Build run: | - make NIMFLAGS="--out:${{ env.build_dir }}/${{ env.codex_binary }} ${{ env.nim_flags }}" + make NIMFLAGS="--out:${{ env.build_dir }}/${{ env.storage_binary }} ${{ env.nim_flags }}" make cirdl NIMFLAGS="--out:${{ env.build_dir }}/${{ env.cirdl_binary }} ${{ env.nim_flags }}" - name: Release - Libraries @@ -95,11 +95,11 @@ jobs: done fi - - name: Release - Upload codex build artifacts + - name: Release - Upload Logos Storage build artifacts uses: actions/upload-artifact@v4 with: - name: release-${{ env.codex_binary }} - path: ${{ env.build_dir }}/${{ env.codex_binary_base }}* + name: release-${{ env.storage_binary }} + path: ${{ env.build_dir }}/${{ env.storage_binary_base }}* retention-days: 30 - name: Release - Upload cirdl build artifacts @@ -139,7 +139,7 @@ jobs: } # Compress and prepare - for file in ${{ env.codex_binary_base }}* ${{ env.cirdl_binary_base }}*; do + for file in ${{ env.storage_binary_base }}* ${{ env.cirdl_binary_base }}*; do if [[ "${file}" == *".exe"* ]]; then # Windows - binary only @@ -212,6 +212,6 @@ jobs: if: startsWith(github.ref, 'refs/tags/') with: token: ${{ secrets.DISPATCH_PAT }} - repository: codex-storage/py-codex-api-client + repository: logos-storage/logos-storage-py-api-client event-type: generate - client-payload: '{"openapi_url": "https://raw.githubusercontent.com/codex-storage/nim-codex/${{ github.ref }}/openapi.yaml"}' + client-payload: '{"openapi_url": "https://raw.githubusercontent.com/logos-storage/logos-storage-nim/${{ github.ref }}/openapi.yaml"}' diff --git a/.gitmodules b/.gitmodules index 0260b1c7..e5beeb1e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -159,9 +159,9 @@ [submodule "vendor/nim-leopard"] path = vendor/nim-leopard url = https://github.com/status-im/nim-leopard.git -[submodule "vendor/nim-codex-dht"] - path = vendor/nim-codex-dht - url = https://github.com/codex-storage/nim-codex-dht.git +[submodule "vendor/logos-storage-nim-dht"] + path = vendor/logos-storage-nim-dht + url = https://github.com/logos-storage/logos-storage-nim-dht.git ignore = untracked branch = master [submodule "vendor/nim-datastore"] @@ -173,9 +173,11 @@ [submodule "vendor/nim-eth"] path = vendor/nim-eth url = https://github.com/status-im/nim-eth -[submodule "vendor/codex-contracts-eth"] - path = vendor/codex-contracts-eth - url = https://github.com/status-im/codex-contracts-eth +[submodule "vendor/logos-storage-contracts-eth"] + path = vendor/logos-storage-contracts-eth + url = https://github.com/logos-storage/logos-storage-contracts-eth.git + ignore = untracked + branch = master [submodule "vendor/nim-protobuf-serialization"] path = vendor/nim-protobuf-serialization url = https://github.com/status-im/nim-protobuf-serialization @@ -190,26 +192,28 @@ url = https://github.com/zevv/npeg [submodule "vendor/nim-poseidon2"] path = vendor/nim-poseidon2 - url = https://github.com/codex-storage/nim-poseidon2.git + url = https://github.com/logos-storage/nim-poseidon2.git + ignore = untracked + branch = master [submodule "vendor/constantine"] path = vendor/constantine url = https://github.com/mratsim/constantine.git [submodule "vendor/nim-circom-compat"] path = vendor/nim-circom-compat - url = https://github.com/codex-storage/nim-circom-compat.git + url = https://github.com/logos-storage/nim-circom-compat.git ignore = untracked branch = master -[submodule "vendor/codex-storage-proofs-circuits"] - path = vendor/codex-storage-proofs-circuits - url = https://github.com/codex-storage/codex-storage-proofs-circuits.git +[submodule "vendor/logos-storage-proofs-circuits"] + path = vendor/logos-storage-proofs-circuits + url = https://github.com/logos-storage/logos-storage-proofs-circuits.git ignore = untracked branch = master [submodule "vendor/nim-serde"] path = vendor/nim-serde - url = https://github.com/codex-storage/nim-serde.git + url = https://github.com/logos-storage/nim-serde.git [submodule "vendor/nim-leveldbstatic"] path = vendor/nim-leveldbstatic - url = https://github.com/codex-storage/nim-leveldb.git + url = https://github.com/logos-storage/nim-leveldb.git [submodule "vendor/nim-zippy"] path = vendor/nim-zippy url = https://github.com/status-im/nim-zippy.git @@ -225,4 +229,4 @@ path = vendor/nim-ngtcp2 url = https://github.com/vacp2p/nim-ngtcp2.git ignore = untracked - branch = main + branch = main \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index c7e54c92..c43a9edf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,7 +25,7 @@ pipeline { stage('Check') { steps { script { - sh './result/bin/codex --version' + sh './result/bin/storage --version' } } } diff --git a/Makefile b/Makefile index 4ec12fb5..d9b9d70e 100644 --- a/Makefile +++ b/Makefile @@ -93,10 +93,10 @@ else # "variables.mk" was included. Business as usual until the end of this file # default target, because it's the first one that doesn't start with '.' -# Builds the codex binary +# Builds the Logos Storage binary all: | build deps echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim codex $(NIM_PARAMS) build.nims + $(ENV_SCRIPT) nim storage $(NIM_PARAMS) build.nims # Build tools/cirdl cirdl: | deps @@ -246,29 +246,29 @@ clean: | clean-nph ################ ## C Bindings ## ################ -.PHONY: libcodex +.PHONY: libstorage STATIC ?= 0 -ifneq ($(strip $(CODEX_LIB_PARAMS)),) -NIM_PARAMS := $(NIM_PARAMS) $(CODEX_LIB_PARAMS) +ifneq ($(strip $(STORAGE_LIB_PARAMS)),) +NIM_PARAMS := $(NIM_PARAMS) $(STORAGE_LIB_PARAMS) endif -libcodex: +libstorage: $(MAKE) deps - rm -f build/libcodex* + rm -f build/libstorage* ifeq ($(STATIC), 1) echo -e $(BUILD_MSG) "build/$@.a" && \ - $(ENV_SCRIPT) nim libcodexStatic $(NIM_PARAMS) -d:LeopardCmakeFlags="\"-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release\"" codex.nims + $(ENV_SCRIPT) nim libstorageStatic $(NIM_PARAMS) -d:LeopardCmakeFlags="\"-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release\"" codex.nims else ifeq ($(detected_OS),Windows) echo -e $(BUILD_MSG) "build/$@.dll" && \ - $(ENV_SCRIPT) nim libcodexDynamic $(NIM_PARAMS) -d:LeopardCmakeFlags="\"-G \\\"MSYS Makefiles\\\" -DCMAKE_BUILD_TYPE=Release\"" codex.nims + $(ENV_SCRIPT) nim libstorageDynamic $(NIM_PARAMS) -d:LeopardCmakeFlags="\"-G \\\"MSYS Makefiles\\\" -DCMAKE_BUILD_TYPE=Release\"" codex.nims else ifeq ($(detected_OS),macOS) echo -e $(BUILD_MSG) "build/$@.dylib" && \ - $(ENV_SCRIPT) nim libcodexDynamic $(NIM_PARAMS) -d:LeopardCmakeFlags="\"-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release\"" codex.nims + $(ENV_SCRIPT) nim libstorageDynamic $(NIM_PARAMS) -d:LeopardCmakeFlags="\"-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release\"" codex.nims else echo -e $(BUILD_MSG) "build/$@.so" && \ - $(ENV_SCRIPT) nim libcodexDynamic $(NIM_PARAMS) -d:LeopardCmakeFlags="\"-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release\"" codex.nims + $(ENV_SCRIPT) nim libstorageDynamic $(NIM_PARAMS) -d:LeopardCmakeFlags="\"-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release\"" codex.nims endif endif # "variables.mk" was not included diff --git a/README.md b/README.md index 78b4e6f5..8c19c66f 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,22 @@ -# Codex Decentralized Durability Engine +# Logos Storage Decentralized Engine -> The Codex project aims to create a decentralized durability engine that allows persisting data in p2p networks. In other words, it allows storing files and data with predictable durability guarantees for later retrieval. +> The Logos Storage project aims to create a decentralized engine that allows persisting data in p2p networks. > WARNING: This project is under active development and is considered pre-alpha. [![License: Apache](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Stability: experimental](https://img.shields.io/badge/stability-experimental-orange.svg)](#stability) -[![CI](https://github.com/codex-storage/nim-codex/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/codex-storage/nim-codex/actions/workflows/ci.yml?query=branch%3Amaster) -[![Docker](https://github.com/codex-storage/nim-codex/actions/workflows/docker.yml/badge.svg?branch=master)](https://github.com/codex-storage/nim-codex/actions/workflows/docker.yml?query=branch%3Amaster) -[![Codecov](https://codecov.io/gh/codex-storage/nim-codex/branch/master/graph/badge.svg?token=XFmCyPSNzW)](https://codecov.io/gh/codex-storage/nim-codex) +[![CI](https://github.com/logos-storage/logos-storage-nim/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/logos-storage/logos-storage-nim/actions/workflows/ci.yml?query=branch%3Amaster) +[![Docker](https://github.com/logos-storage/logos-storage-nim/actions/workflows/docker.yml/badge.svg?branch=master)](https://github.com/logos-storage/logos-storage-nim/actions/workflows/docker.yml?query=branch%3Amaster) +[![Codecov](https://codecov.io/gh/logos-storage/logos-storage-nim/branch/master/graph/badge.svg?token=XFmCyPSNzW)](https://codecov.io/gh/logos-storage/logos-storage-nim) [![Discord](https://img.shields.io/discord/895609329053474826)](https://discord.gg/CaJTh24ddQ) ![Docker Pulls](https://img.shields.io/docker/pulls/codexstorage/nim-codex) ## Build and Run -For detailed instructions on preparing to build nim-codex see [*Build Codex*](https://docs.codex.storage/learn/build). +For detailed instructions on preparing to build logos-storagenim see [*Build Logos Storage*](https://docs.codex.storage/learn/build). To build the project, clone it and run: @@ -29,12 +29,12 @@ The executable will be placed under the `build` directory under the project root Run the client with: ```bash -build/codex +build/storage ``` ## Configuration -It is possible to configure a Codex node in several ways: +It is possible to configure a Logos Storage node in several ways: 1. CLI options 2. Environment variables 3. Configuration file @@ -45,9 +45,9 @@ Please check [documentation](https://docs.codex.storage/learn/run#configuration) ## Guides -To get acquainted with Codex, consider: -* running the simple [Codex Two-Client Test](https://docs.codex.storage/learn/local-two-client-test) for a start, and; -* if you are feeling more adventurous, try [Running a Local Codex Network with Marketplace Support](https://docs.codex.storage/learn/local-marketplace) using a local blockchain as well. +To get acquainted with Logos Storage, consider: +* running the simple [Logos Storage Two-Client Test](https://docs.codex.storage/learn/local-two-client-test) for a start, and; +* if you are feeling more adventurous, try [Running a Local Logos Storage Network with Marketplace Support](https://docs.codex.storage/learn/local-marketplace) using a local blockchain as well. ## API @@ -55,13 +55,13 @@ The client exposes a REST API that can be used to interact with the clients. Ove ## Bindings -Codex provides a C API that can be wrapped by other languages. The bindings is located in the `library` folder. +Logos Storage provides a C API that can be wrapped by other languages. The bindings is located in the `library` folder. Currently, only a Go binding is included. ### Build the C library ```bash -make libcodex +make libstorage ``` This produces the shared library under `build/`. @@ -71,7 +71,7 @@ This produces the shared library under `build/`. Build the Go example: ```bash -go build -o codex-go examples/golang/codex.go +go build -o storage-go examples/golang/storage.go ``` Export the library path: @@ -83,20 +83,20 @@ export LD_LIBRARY_PATH=build Run the example: ```bash -./codex-go +./storage-go ``` ### Static vs Dynamic build -By default, Codex builds a dynamic library (`libcodex.so`), which you can load at runtime. -If you prefer a static library (`libcodex.a`), set the `STATIC` flag: +By default, Logos Storage builds a dynamic library (`libstorage.so`), which you can load at runtime. +If you prefer a static library (`libstorage.a`), set the `STATIC` flag: ```bash # Build dynamic (default) -make libcodex +make libstorage # Build static -make STATIC=1 libcodex +make STATIC=1 libstorage ``` ### Limitation @@ -109,7 +109,7 @@ Feel free to dive in, contributions are welcomed! Open an issue or submit PRs. ### Linting and formatting -`nim-codex` uses [nph](https://github.com/arnetheduck/nph) for formatting our code and it is required to adhere to its styling. +`logos-storage-nim` uses [nph](https://github.com/arnetheduck/nph) for formatting our code and it is required to adhere to its styling. If you are setting up fresh setup, in order to get `nph` run `make build-nph`. In order to format files run `make nph/`. If you want you can install Git pre-commit hook using `make install-nph-commit`, which will format modified files prior committing them. diff --git a/benchmarks/README.md b/benchmarks/README.md index 0cff64e9..6f7a0a06 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -10,17 +10,17 @@ nim c -r run_benchmarks ``` By default all circuit files for each combinations of circuit args will be generated in a unique folder named like: - nim-codex/benchmarks/circuit_bench_depth32_maxslots256_cellsize2048_blocksize65536_nsamples9_entropy1234567_seed12345_nslots11_ncells512_index3 + logos-storage-nim/benchmarks/circuit_bench_depth32_maxslots256_cellsize2048_blocksize65536_nsamples9_entropy1234567_seed12345_nslots11_ncells512_index3 Generating the circuit files often takes longer than running benchmarks, so caching the results allows re-running the benchmark as needed. You can modify the `CircuitArgs` and `CircuitEnv` objects in `runAllBenchMarks` to suite your needs. See `create_circuits.nim` for their definition. -The runner executes all commands relative to the `nim-codex` repo. This simplifies finding the correct circuit includes paths, etc. `CircuitEnv` sets all of this. +The runner executes all commands relative to the `logos-storage-nim` repo. This simplifies finding the correct circuit includes paths, etc. `CircuitEnv` sets all of this. -## Codex Ark Circom CLI +## Logos Storage Ark Circom CLI -Runs Codex's prover setup with Ark / Circom. +Runs Logos Storage's prover setup with Ark / Circom. Compile: ```sh diff --git a/benchmarks/create_circuits.nim b/benchmarks/create_circuits.nim index 911dcd51..72089d6e 100644 --- a/benchmarks/create_circuits.nim +++ b/benchmarks/create_circuits.nim @@ -29,10 +29,10 @@ proc findCodexProjectDir(): string = func default*(tp: typedesc[CircuitEnv]): CircuitEnv = let codexDir = findCodexProjectDir() result.nimCircuitCli = - codexDir / "vendor" / "codex-storage-proofs-circuits" / "reference" / "nim" / + codexDir / "vendor" / "logos-storage-proofs-circuits" / "reference" / "nim" / "proof_input" / "cli" result.circuitDirIncludes = - codexDir / "vendor" / "codex-storage-proofs-circuits" / "circuit" + codexDir / "vendor" / "logos-storage-proofs-circuits" / "circuit" result.ptauPath = codexDir / "benchmarks" / "ceremony" / "powersOfTau28_hez_final_23.ptau" result.ptauUrl = "https://storage.googleapis.com/zkevm/ptau".parseUri @@ -118,7 +118,7 @@ proc createCircuit*( ## ## All needed circuit files will be generated as needed. ## They will be located in `circBenchDir` which defaults to a folder like: - ## `nim-codex/benchmarks/circuit_bench_depth32_maxslots256_cellsize2048_blocksize65536_nsamples9_entropy1234567_seed12345_nslots11_ncells512_index3` + ## `logos-storage-nim/benchmarks/circuit_bench_depth32_maxslots256_cellsize2048_blocksize65536_nsamples9_entropy1234567_seed12345_nslots11_ncells512_index3` ## with all the given CircuitArgs. ## let circdir = circBenchDir diff --git a/build.nims b/build.nims index dcfe5c13..47e848b3 100644 --- a/build.nims +++ b/build.nims @@ -3,7 +3,7 @@ mode = ScriptMode.Verbose import std/os except commandLineParams ### Helper functions -proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") = +proc buildBinary(srcName: string, outName = os.lastPathPart(srcName), srcDir = "./", params = "", lang = "c") = if not dirExists "build": mkDir "build" @@ -18,10 +18,9 @@ proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") = let # Place build output in 'build' folder, even if name includes a longer path. - outName = os.lastPathPart(name) cmd = "nim " & lang & " --out:build/" & outName & " " & extra_params & " " & srcDir & - name & ".nim" + srcName & ".nim" exec(cmd) @@ -37,62 +36,64 @@ proc buildLibrary(name: string, srcDir = "./", params = "", `type` = "dynamic") ) exec "nim c" & " --out:build/" & lib_name & " --threads:on --app:lib --opt:size --noMain --mm:refc --header --d:metrics " & - "--nimMainPrefix:libcodex -d:noSignalHandler " & + "--nimMainPrefix:libstorage -d:noSignalHandler " & "-d:LeopardExtraCompilerFlags=-fPIC " & "-d:chronicles_runtime_filtering " & "-d:chronicles_log_level=TRACE " & params & " " & srcDir & name & ".nim" else: exec "nim c" & " --out:build/" & name & ".a --threads:on --app:staticlib --opt:size --noMain --mm:refc --header --d:metrics " & - "--nimMainPrefix:libcodex -d:noSignalHandler " & + "--nimMainPrefix:libstorage -d:noSignalHandler " & "-d:LeopardExtraCompilerFlags=-fPIC " & "-d:chronicles_runtime_filtering " & "-d:chronicles_log_level=TRACE " & params & " " & srcDir & name & ".nim" -proc test(name: string, srcDir = "tests/", params = "", lang = "c") = - buildBinary name, srcDir, params - exec "build/" & name +proc test(name: string, outName = name, srcDir = "tests/", params = "", lang = "c") = + buildBinary name, outName, srcDir, params + exec "build/" & outName -task codex, "build codex binary": +task storage, "build logos storage binary": buildBinary "codex", + outname = "storage", params = "-d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE" task toolsCirdl, "build tools/cirdl binary": buildBinary "tools/cirdl/cirdl" -task testCodex, "Build & run Codex tests": - test "testCodex", params = "-d:codex_enable_proof_failures=true" +task testStorage, "Build & run Logos Storage tests": + test "testCodex", outName = "testStorage", params = "-d:storage_enable_proof_failures=true" -task testContracts, "Build & run Codex Contract tests": +task testContracts, "Build & run Logos Storage Contract tests": test "testContracts" task testIntegration, "Run integration tests": buildBinary "codex", + outName = "storage", params = - "-d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE -d:codex_enable_proof_failures=true" + "-d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE -d:storage_enable_proof_failures=true" test "testIntegration" # use params to enable logging from the integration test executable # test "testIntegration", params = "-d:chronicles_sinks=textlines[notimestamps,stdout],textlines[dynamic] " & # "-d:chronicles_enabled_topics:integration:TRACE" -task build, "build codex binary": - codexTask() +task build, "build Logos Storage binary": + storageTask() task test, "Run tests": - testCodexTask() + testStorageTask() task testTools, "Run Tools tests": toolsCirdlTask() test "testTools" task testAll, "Run all tests (except for Taiko L2 tests)": - testCodexTask() + testStorageTask() testContractsTask() testIntegrationTask() testToolsTask() task testTaiko, "Run Taiko L2 tests": - codexTask() + storageTask() test "testTaiko" import strutils @@ -125,7 +126,7 @@ task coverage, "generates code coverage report": test "coverage", srcDir = "tests/", params = - " --nimcache:nimcache/coverage -d:release -d:codex_enable_proof_failures=true" + " --nimcache:nimcache/coverage -d:release -d:storage_enable_proof_failures=true" exec("rm nimcache/coverage/*.c") rmDir("coverage") mkDir("coverage") @@ -146,22 +147,22 @@ task showCoverage, "open coverage html": if findExe("open") != "": exec("open coverage/report/index.html") -task libcodexDynamic, "Generate bindings": +task libstorageDynamic, "Generate bindings": var params = "" when compiles(commandLineParams): for param in commandLineParams(): if param.len > 0 and param.startsWith("-"): params.add " " & param - let name = "libcodex" + let name = "libstorage" buildLibrary name, "library/", params, "dynamic" -task libcodexStatic, "Generate bindings": +task libstorageStatic, "Generate bindings": var params = "" when compiles(commandLineParams): for param in commandLineParams(): if param.len > 0 and param.startsWith("-"): params.add " " & param - let name = "libcodex" + let name = "libstorage" buildLibrary name, "library/", params, "static" diff --git a/codex.nim b/codex.nim index b3e40608..24d27959 100644 --- a/codex.nim +++ b/codex.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -45,7 +45,7 @@ when isMainModule: let config = CodexConf.load( version = codexFullVersion, - envVarsPrefix = "codex", + envVarsPrefix = "storage", secondarySources = proc( config: CodexConf, sources: auto ) {.gcsafe, raises: [ConfigurationError].} = @@ -99,7 +99,7 @@ when isMainModule: try: CodexServer.new(config, privateKey) except Exception as exc: - error "Failed to start Codex", msg = exc.msg + error "Failed to start Logos Storage", msg = exc.msg quit QuitFailure ## Ctrl+C handling @@ -107,7 +107,7 @@ when isMainModule: shutdown = server.shutdown() state = CodexStatus.Stopping - notice "Stopping Codex" + notice "Stopping Logos Storage" proc controlCHandler() {.noconv.} = when defined(windows): @@ -138,7 +138,7 @@ when isMainModule: try: waitFor server.start() except CatchableError as error: - error "Codex failed to start", error = error.msg + error "Logos Storage failed to start", error = error.msg # XXX ideally we'd like to issue a stop instead of quitting cold turkey, # but this would mean we'd have to fix the implementation of all # services so they won't crash if we attempt to stop them before they @@ -159,7 +159,7 @@ when isMainModule: # be assigned before state switches to Stopping waitFor shutdown except CatchableError as error: - error "Codex didn't shutdown correctly", error = error.msg + error "Logos Storage didn't shutdown correctly", error = error.msg quit QuitFailure - notice "Exited codex" + notice "Exited Storage" diff --git a/codex.nimble b/codex.nimble index f3033861..43c39219 100644 --- a/codex.nimble +++ b/codex.nimble @@ -1,5 +1,5 @@ version = "0.1.0" -author = "Codex Team" +author = "Logos Storage Team" description = "p2p data durability engine" license = "MIT" binDir = "build" diff --git a/codex/blockexchange/engine/advertiser.nim b/codex/blockexchange/engine/advertiser.nim index 9e68ebbb..c038db38 100644 --- a/codex/blockexchange/engine/advertiser.nim +++ b/codex/blockexchange/engine/advertiser.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/blockexchange/engine/discovery.nim b/codex/blockexchange/engine/discovery.nim index 883eea8e..6a1b808d 100644 --- a/codex/blockexchange/engine/discovery.nim +++ b/codex/blockexchange/engine/discovery.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/blockexchange/engine/engine.nim b/codex/blockexchange/engine/engine.nim index 90fd513d..f9245885 100644 --- a/codex/blockexchange/engine/engine.nim +++ b/codex/blockexchange/engine/engine.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/blockexchange/engine/payments.nim b/codex/blockexchange/engine/payments.nim index 260a3005..45259762 100644 --- a/codex/blockexchange/engine/payments.nim +++ b/codex/blockexchange/engine/payments.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/blockexchange/engine/pendingblocks.nim b/codex/blockexchange/engine/pendingblocks.nim index 2ff1062c..f843870f 100644 --- a/codex/blockexchange/engine/pendingblocks.nim +++ b/codex/blockexchange/engine/pendingblocks.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/blockexchange/network/network.nim b/codex/blockexchange/network/network.nim index 904b60d8..4c6ca41a 100644 --- a/codex/blockexchange/network/network.nim +++ b/codex/blockexchange/network/network.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/blockexchange/network/networkpeer.nim b/codex/blockexchange/network/networkpeer.nim index 8363fdc2..927303a6 100644 --- a/codex/blockexchange/network/networkpeer.nim +++ b/codex/blockexchange/network/networkpeer.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/blockexchange/peers/peercontext.nim b/codex/blockexchange/peers/peercontext.nim index f9b3d586..a02e8a89 100644 --- a/codex/blockexchange/peers/peercontext.nim +++ b/codex/blockexchange/peers/peercontext.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/blockexchange/peers/peerctxstore.nim b/codex/blockexchange/peers/peerctxstore.nim index d2762fc8..853bd33f 100644 --- a/codex/blockexchange/peers/peerctxstore.nim +++ b/codex/blockexchange/peers/peerctxstore.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/blockexchange/protobuf/blockexc.nim b/codex/blockexchange/protobuf/blockexc.nim index a0512cd3..9b1144ba 100644 --- a/codex/blockexchange/protobuf/blockexc.nim +++ b/codex/blockexchange/protobuf/blockexc.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/blockexchange/protobuf/message.nim b/codex/blockexchange/protobuf/message.nim index 00dbc57b..03c9dd00 100644 --- a/codex/blockexchange/protobuf/message.nim +++ b/codex/blockexchange/protobuf/message.nim @@ -1,4 +1,4 @@ -# Protocol of data exchange between Codex nodes +# Protocol of data exchange between Logos Storage nodes # and Protobuf encoder/decoder for these messages. # # Eventually all this code should be auto-generated from message.proto. diff --git a/codex/blockexchange/protobuf/message.proto b/codex/blockexchange/protobuf/message.proto index 65d1f9a9..ee24c797 100644 --- a/codex/blockexchange/protobuf/message.proto +++ b/codex/blockexchange/protobuf/message.proto @@ -1,4 +1,4 @@ -// Protocol of data exchange between Codex nodes. +// Protocol of data exchange between Logos Storage nodes. // Extended version of https://github.com/ipfs/specs/blob/main/BITSWAP.md syntax = "proto3"; diff --git a/codex/blocktype.nim b/codex/blocktype.nim index edacb927..b5a1019c 100644 --- a/codex/blocktype.nim +++ b/codex/blocktype.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/chunker.nim b/codex/chunker.nim index f0022859..75758bc4 100644 --- a/codex/chunker.nim +++ b/codex/chunker.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/codex.nim b/codex/codex.nim index 63f56c6b..73575c53 100644 --- a/codex/codex.nim +++ b/codex/codex.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -138,7 +138,7 @@ proc bootstrapInteractions(s: CodexServer): Future[void] {.async.} = # This is used for simulation purposes. Normal nodes won't be compiled with this flag # and hence the proof failure will always be 0. - when codex_enable_proof_failures: + when storage_enable_proof_failures: let proofFailures = config.simulateProofFailures if proofFailures > 0: warn "Enabling proof failure simulation!" @@ -170,10 +170,10 @@ proc bootstrapInteractions(s: CodexServer): Future[void] {.async.} = proc start*(s: CodexServer) {.async.} = if s.isStarted: - warn "Codex server already started, skipping" + warn "Storage server already started, skipping" return - trace "Starting codex node", config = $s.config + trace "Starting Storage node", config = $s.config await s.repoStore.start() s.maintenance.start() @@ -197,10 +197,10 @@ proc start*(s: CodexServer) {.async.} = proc stop*(s: CodexServer) {.async.} = if not s.isStarted: - warn "Codex is not started" + warn "Storage is not started" return - notice "Stopping codex node" + notice "Stopping Storage node" var futures = @[ @@ -216,8 +216,8 @@ proc stop*(s: CodexServer) {.async.} = let res = await noCancel allFinishedFailed[void](futures) if res.failure.len > 0: - error "Failed to stop codex node", failures = res.failure.len - raiseAssert "Failed to stop codex node" + error "Failed to stop Storage node", failures = res.failure.len + raiseAssert "Failed to stop Storage node" proc close*(s: CodexServer) {.async.} = var futures = @[s.codexNode.close(), s.repoStore.close()] @@ -232,8 +232,8 @@ proc close*(s: CodexServer) {.async.} = raiseAssert("Failure in taskpool shutdown:" & exc.msg) if res.failure.len > 0: - error "Failed to close codex node", failures = res.failure.len - raiseAssert "Failed to close codex node" + error "Failed to close Storage node", failures = res.failure.len + raiseAssert "Failed to close Storage node" proc shutdown*(server: CodexServer) {.async.} = await server.stop() diff --git a/codex/codextypes.nim b/codex/codextypes.nim index 274b9be0..67e90242 100644 --- a/codex/codextypes.nim +++ b/codex/codextypes.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/conf.nim b/codex/conf.nim index 0e71b562..bc8b5506 100644 --- a/codex/conf.nim +++ b/codex/conf.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -63,18 +63,18 @@ proc `==`*(a, b: ThreadCount): bool {.borrow.} proc defaultDataDir*(): string = let dataDir = when defined(windows): - "AppData" / "Roaming" / "Codex" + "AppData" / "Roaming" / "Storage" elif defined(macosx): - "Library" / "Application Support" / "Codex" + "Library" / "Application Support" / "Storage" else: - ".cache" / "codex" + ".cache" / "storage" getHomeDir() / dataDir const - codex_enable_api_debug_peers* {.booldefine.} = false - codex_enable_proof_failures* {.booldefine.} = false - codex_enable_log_counter* {.booldefine.} = false + storage_enable_api_debug_peers* {.booldefine.} = false + storage_enable_proof_failures* {.booldefine.} = false + storage_enable_log_counter* {.booldefine.} = false DefaultThreadCount* = ThreadCount(0) @@ -137,7 +137,7 @@ type .}: Port dataDir* {. - desc: "The directory where codex will store configuration and data", + desc: "The directory where Storage will store configuration and data", defaultValue: defaultDataDir(), defaultValueDesc: "", abbr: "d", @@ -198,7 +198,7 @@ type .}: ThreadCount agentString* {. - defaultValue: "Codex", + defaultValue: "Logos Storage", desc: "Node agent string which is used as identifier in network", name: "agent-string" .}: string @@ -391,7 +391,7 @@ type case persistenceCmd* {.defaultValue: noCmd, command.}: PersistenceCmd of PersistenceCmd.prover: circuitDir* {. - desc: "Directory where Codex will store proof circuit data", + desc: "Directory where Storage will store proof circuit data", defaultValue: defaultDataDir() / "circuits", defaultValueDesc: "data/circuits", abbr: "cd", @@ -496,7 +496,8 @@ proc getCodexRevision(): string = return res proc getCodexContractsRevision(): string = - let res = strip(staticExec("git rev-parse --short HEAD:vendor/codex-contracts-eth")) + let res = + strip(staticExec("git rev-parse --short HEAD:vendor/logos-storage-contracts-eth")) return res proc getNimBanner(): string = @@ -509,8 +510,8 @@ const nimBanner* = getNimBanner() codexFullVersion* = - "Codex version: " & codexVersion & "\p" & "Codex revision: " & codexRevision & "\p" & - "Codex contracts revision: " & codexContractsRevision & "\p" & nimBanner + "Storage version: " & codexVersion & "\p" & "Storage revision: " & codexRevision & + "\p" & "Storage contracts revision: " & codexContractsRevision & "\p" & nimBanner proc parseCmdArg*( T: typedesc[MultiAddress], input: string @@ -803,7 +804,7 @@ proc setupLogging*(conf: CodexConf) = of LogKind.None: noOutput - when codex_enable_log_counter: + when storage_enable_log_counter: var counter = 0.uint64 proc numberedWriter(logLevel: LogLevel, msg: LogOutputStr) = inc(counter) diff --git a/codex/contracts/Readme.md b/codex/contracts/Readme.md index cae2a4cc..2a746863 100644 --- a/codex/contracts/Readme.md +++ b/codex/contracts/Readme.md @@ -1,13 +1,13 @@ -Codex Contracts in Nim +Logos Storage Contracts in Nim ======================= -Nim API for the [Codex smart contracts][1]. +Nim API for the [Logos Storage smart contracts][1]. Usage ----- For a global overview of the steps involved in starting and fulfilling a -storage contract, see [Codex Contracts][1]. +storage contract, see [Logos Storage Contracts][1]. Smart contract -------------- @@ -144,5 +144,5 @@ await storage .markProofAsMissing(id, period) ``` -[1]: https://github.com/status-im/codex-contracts-eth/ -[2]: https://github.com/status-im/codex-research/blob/main/design/storage-proof-timing.md +[1]: https://github.com/logos-storage/logos-storage-contracts-eth/ +[2]: https://github.com/logos-storage/logos-storage-research/blob/master/design/storage-proof-timing.md diff --git a/codex/discovery.nim b/codex/discovery.nim index 4b555db1..424ec9c0 100644 --- a/codex/discovery.nim +++ b/codex/discovery.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/erasure.nim b/codex/erasure.nim index 5dfebcd4..f9310a40 100644 --- a/codex/erasure.nim +++ b/codex/erasure.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/erasure/backend.nim b/codex/erasure/backend.nim index 14bb0ddb..9885326f 100644 --- a/codex/erasure/backend.nim +++ b/codex/erasure/backend.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/erasure/backends/leopard.nim b/codex/erasure/backends/leopard.nim index a0016570..66bc059d 100644 --- a/codex/erasure/backends/leopard.nim +++ b/codex/erasure/backends/leopard.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/erasure/erasure.nim b/codex/erasure/erasure.nim index bec2f135..c8afe440 100644 --- a/codex/erasure/erasure.nim +++ b/codex/erasure/erasure.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/errors.nim b/codex/errors.nim index 9ce52df7..655aec87 100644 --- a/codex/errors.nim +++ b/codex/errors.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/logutils.nim b/codex/logutils.nim index e9604aba..ae27df7f 100644 --- a/codex/logutils.nim +++ b/codex/logutils.nim @@ -11,7 +11,7 @@ ## 4. Remove usages of `nim-json-serialization` from the codebase ## 5. Remove need to declare `writeValue` for new types ## 6. Remove need to [avoid importing or exporting `toJson`, `%`, `%*` to prevent -## conflicts](https://github.com/codex-storage/nim-codex/pull/645#issuecomment-1838834467) +## conflicts](https://github.com/logos-storage/logos-storage-nim/pull/645#issuecomment-1838834467) ## ## When declaring a new type, one should consider importing the `codex/logutils` ## module, and specifying `formatIt`. If textlines log output and json log output diff --git a/codex/manifest/coders.nim b/codex/manifest/coders.nim index 207b6c99..b899bb09 100644 --- a/codex/manifest/coders.nim +++ b/codex/manifest/coders.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/manifest/manifest.nim b/codex/manifest/manifest.nim index 101fbb89..fadc8c88 100644 --- a/codex/manifest/manifest.nim +++ b/codex/manifest/manifest.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/merkletree/codex/coders.nim b/codex/merkletree/codex/coders.nim index bfcccbd6..d81979c1 100644 --- a/codex/merkletree/codex/coders.nim +++ b/codex/merkletree/codex/coders.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/merkletree/codex/codex.nim b/codex/merkletree/codex/codex.nim index bf9f39d6..b3e3e18b 100644 --- a/codex/merkletree/codex/codex.nim +++ b/codex/merkletree/codex/codex.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/merkletree/merkletree.nim b/codex/merkletree/merkletree.nim index f1905bec..06859316 100644 --- a/codex/merkletree/merkletree.nim +++ b/codex/merkletree/merkletree.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/merkletree/poseidon2.nim b/codex/merkletree/poseidon2.nim index 56ad1e4d..65b3c4dd 100644 --- a/codex/merkletree/poseidon2.nim +++ b/codex/merkletree/poseidon2.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/multihash_exts.nim b/codex/multihash_exts.nim index e9477177..05a5305d 100644 --- a/codex/multihash_exts.nim +++ b/codex/multihash_exts.nim @@ -4,7 +4,7 @@ import poseidon2 proc sha2_256hash_constantine(data: openArray[byte], output: var openArray[byte]) = # Using Constantine's SHA256 instead of mhash for optimal performance on 32-byte merkle node hashing - # See: https://github.com/codex-storage/nim-codex/issues/1162 + # See: https://github.com/logos-storage/logos-storage-nim/issues/1162 if len(output) > 0: let digest = hashes.sha256.hash(data) copyMem(addr output[0], addr digest[0], 32) diff --git a/codex/namespaces.nim b/codex/namespaces.nim index c159ab1a..169be184 100644 --- a/codex/namespaces.nim +++ b/codex/namespaces.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/node.nim b/codex/node.nim index 4c259bfc..e5c8926e 100644 --- a/codex/node.nim +++ b/codex/node.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -881,7 +881,7 @@ proc start*(self: CodexNodeRef) {.async.} = self.contracts.validator = ValidatorInteractions.none self.networkId = self.switch.peerInfo.peerId - notice "Started codex node", id = self.networkId, addrs = self.switch.peerInfo.addrs + notice "Started Storage node", id = self.networkId, addrs = self.switch.peerInfo.addrs proc stop*(self: CodexNodeRef) {.async.} = trace "Stopping node" diff --git a/codex/rest/api.nim b/codex/rest/api.nim index 938ede12..5650f230 100644 --- a/codex/rest/api.nim +++ b/codex/rest/api.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -180,7 +180,7 @@ proc getFilenameFromContentDisposition(contentDisposition: string): ?string = proc initDataApi(node: CodexNodeRef, repoStore: RepoStore, router: var RestRouter) = let allowedOrigin = router.allowedOrigin # prevents capture inside of api defintion - router.api(MethodOptions, "/api/codex/v1/data") do( + router.api(MethodOptions, "/api/storage/v1/data") do( resp: HttpResponseRef ) -> RestApiResponse: if corsOrigin =? allowedOrigin: @@ -192,7 +192,7 @@ proc initDataApi(node: CodexNodeRef, repoStore: RepoStore, router: var RestRoute resp.status = Http204 await resp.sendBody("") - router.rawApi(MethodPost, "/api/codex/v1/data") do() -> RestApiResponse: + router.rawApi(MethodPost, "/api/storage/v1/data") do() -> RestApiResponse: ## Upload a file in a streaming manner ## @@ -254,11 +254,11 @@ proc initDataApi(node: CodexNodeRef, repoStore: RepoStore, router: var RestRoute finally: await reader.closeWait() - router.api(MethodGet, "/api/codex/v1/data") do() -> RestApiResponse: + router.api(MethodGet, "/api/storage/v1/data") do() -> RestApiResponse: let json = await formatManifestBlocks(node) return RestApiResponse.response($json, contentType = "application/json") - router.api(MethodOptions, "/api/codex/v1/data/{cid}") do( + router.api(MethodOptions, "/api/storage/v1/data/{cid}") do( cid: Cid, resp: HttpResponseRef ) -> RestApiResponse: if corsOrigin =? allowedOrigin: @@ -267,7 +267,7 @@ proc initDataApi(node: CodexNodeRef, repoStore: RepoStore, router: var RestRoute resp.status = Http204 await resp.sendBody("") - router.api(MethodGet, "/api/codex/v1/data/{cid}") do( + router.api(MethodGet, "/api/storage/v1/data/{cid}") do( cid: Cid, resp: HttpResponseRef ) -> RestApiResponse: var headers = buildCorsHeaders("GET", allowedOrigin) @@ -283,7 +283,7 @@ proc initDataApi(node: CodexNodeRef, repoStore: RepoStore, router: var RestRoute await node.retrieveCid(cid.get(), local = true, resp = resp) - router.api(MethodDelete, "/api/codex/v1/data/{cid}") do( + router.api(MethodDelete, "/api/storage/v1/data/{cid}") do( cid: Cid, resp: HttpResponseRef ) -> RestApiResponse: ## Deletes either a single block or an entire dataset @@ -304,7 +304,7 @@ proc initDataApi(node: CodexNodeRef, repoStore: RepoStore, router: var RestRoute resp.status = Http204 await resp.sendBody("") - router.api(MethodPost, "/api/codex/v1/data/{cid}/network") do( + router.api(MethodPost, "/api/storage/v1/data/{cid}/network") do( cid: Cid, resp: HttpResponseRef ) -> RestApiResponse: ## Download a file from the network to the local node @@ -325,7 +325,7 @@ proc initDataApi(node: CodexNodeRef, repoStore: RepoStore, router: var RestRoute let json = %formatManifest(cid.get(), manifest) return RestApiResponse.response($json, contentType = "application/json") - router.api(MethodGet, "/api/codex/v1/data/{cid}/network/stream") do( + router.api(MethodGet, "/api/storage/v1/data/{cid}/network/stream") do( cid: Cid, resp: HttpResponseRef ) -> RestApiResponse: ## Download a file from the network in a streaming @@ -344,7 +344,7 @@ proc initDataApi(node: CodexNodeRef, repoStore: RepoStore, router: var RestRoute resp.setHeader("Access-Control-Expose-Headers", "Content-Disposition") await node.retrieveCid(cid.get(), local = false, resp = resp) - router.api(MethodGet, "/api/codex/v1/data/{cid}/network/manifest") do( + router.api(MethodGet, "/api/storage/v1/data/{cid}/network/manifest") do( cid: Cid, resp: HttpResponseRef ) -> RestApiResponse: ## Download only the manifest. @@ -362,7 +362,7 @@ proc initDataApi(node: CodexNodeRef, repoStore: RepoStore, router: var RestRoute let json = %formatManifest(cid.get(), manifest) return RestApiResponse.response($json, contentType = "application/json") - router.api(MethodGet, "/api/codex/v1/data/{cid}/exists") do( + router.api(MethodGet, "/api/storage/v1/data/{cid}/exists") do( cid: Cid, resp: HttpResponseRef ) -> RestApiResponse: ## Only test if the give CID is available in the local store @@ -378,7 +378,7 @@ proc initDataApi(node: CodexNodeRef, repoStore: RepoStore, router: var RestRoute let json = %*{$cid: hasCid} return RestApiResponse.response($json, contentType = "application/json") - router.api(MethodGet, "/api/codex/v1/space") do() -> RestApiResponse: + router.api(MethodGet, "/api/storage/v1/space") do() -> RestApiResponse: let json = %RestRepoStore( totalBlocks: repoStore.totalBlocks, @@ -391,7 +391,7 @@ proc initDataApi(node: CodexNodeRef, repoStore: RepoStore, router: var RestRoute proc initSalesApi(node: CodexNodeRef, router: var RestRouter) = let allowedOrigin = router.allowedOrigin - router.api(MethodGet, "/api/codex/v1/sales/slots") do() -> RestApiResponse: + router.api(MethodGet, "/api/storage/v1/sales/slots") do() -> RestApiResponse: var headers = buildCorsHeaders("GET", allowedOrigin) ## Returns active slots for the host @@ -409,7 +409,7 @@ proc initSalesApi(node: CodexNodeRef, router: var RestRouter) = trace "Excepting processing request", exc = exc.msg return RestApiResponse.error(Http500, headers = headers) - router.api(MethodGet, "/api/codex/v1/sales/slots/{slotId}") do( + router.api(MethodGet, "/api/storage/v1/sales/slots/{slotId}") do( slotId: SlotId ) -> RestApiResponse: ## Returns active slot with id {slotId} for the host. Returns 404 if the @@ -439,7 +439,7 @@ proc initSalesApi(node: CodexNodeRef, router: var RestRouter) = restAgent.toJson, contentType = "application/json", headers = headers ) - router.api(MethodGet, "/api/codex/v1/sales/availability") do() -> RestApiResponse: + router.api(MethodGet, "/api/storage/v1/sales/availability") do() -> RestApiResponse: ## Returns storage that is for sale var headers = buildCorsHeaders("GET", allowedOrigin) @@ -461,7 +461,7 @@ proc initSalesApi(node: CodexNodeRef, router: var RestRouter) = trace "Excepting processing request", exc = exc.msg return RestApiResponse.error(Http500, headers = headers) - router.rawApi(MethodPost, "/api/codex/v1/sales/availability") do() -> RestApiResponse: + router.rawApi(MethodPost, "/api/storage/v1/sales/availability") do() -> RestApiResponse: ## Add available storage to sell. ## Every time Availability's offer finishes, its capacity is ## returned to the availability. @@ -541,7 +541,7 @@ proc initSalesApi(node: CodexNodeRef, router: var RestRouter) = trace "Excepting processing request", exc = exc.msg return RestApiResponse.error(Http500, headers = headers) - router.api(MethodOptions, "/api/codex/v1/sales/availability/{id}") do( + router.api(MethodOptions, "/api/storage/v1/sales/availability/{id}") do( id: AvailabilityId, resp: HttpResponseRef ) -> RestApiResponse: if corsOrigin =? allowedOrigin: @@ -550,7 +550,7 @@ proc initSalesApi(node: CodexNodeRef, router: var RestRouter) = resp.status = Http204 await resp.sendBody("") - router.rawApi(MethodPatch, "/api/codex/v1/sales/availability/{id}") do( + router.rawApi(MethodPatch, "/api/storage/v1/sales/availability/{id}") do( id: AvailabilityId ) -> RestApiResponse: ## Updates Availability. @@ -638,7 +638,7 @@ proc initSalesApi(node: CodexNodeRef, router: var RestRouter) = trace "Excepting processing request", exc = exc.msg return RestApiResponse.error(Http500) - router.rawApi(MethodGet, "/api/codex/v1/sales/availability/{id}/reservations") do( + router.rawApi(MethodGet, "/api/storage/v1/sales/availability/{id}/reservations") do( id: AvailabilityId ) -> RestApiResponse: ## Gets Availability's reservations. @@ -682,7 +682,7 @@ proc initSalesApi(node: CodexNodeRef, router: var RestRouter) = proc initPurchasingApi(node: CodexNodeRef, router: var RestRouter) = let allowedOrigin = router.allowedOrigin - router.rawApi(MethodPost, "/api/codex/v1/storage/request/{cid}") do( + router.rawApi(MethodPost, "/api/storage/v1/storage/request/{cid}") do( cid: Cid ) -> RestApiResponse: var headers = buildCorsHeaders("POST", allowedOrigin) @@ -792,7 +792,7 @@ proc initPurchasingApi(node: CodexNodeRef, router: var RestRouter) = trace "Excepting processing request", exc = exc.msg return RestApiResponse.error(Http500, headers = headers) - router.api(MethodGet, "/api/codex/v1/storage/purchases/{id}") do( + router.api(MethodGet, "/api/storage/v1/storage/purchases/{id}") do( id: PurchaseId ) -> RestApiResponse: var headers = buildCorsHeaders("GET", allowedOrigin) @@ -824,7 +824,7 @@ proc initPurchasingApi(node: CodexNodeRef, router: var RestRouter) = trace "Excepting processing request", exc = exc.msg return RestApiResponse.error(Http500, headers = headers) - router.api(MethodGet, "/api/codex/v1/storage/purchases") do() -> RestApiResponse: + router.api(MethodGet, "/api/storage/v1/storage/purchases") do() -> RestApiResponse: var headers = buildCorsHeaders("GET", allowedOrigin) try: @@ -846,7 +846,7 @@ proc initNodeApi(node: CodexNodeRef, conf: CodexConf, router: var RestRouter) = ## various node management api's ## - router.api(MethodGet, "/api/codex/v1/spr") do() -> RestApiResponse: + router.api(MethodGet, "/api/storage/v1/spr") do() -> RestApiResponse: ## Returns node SPR in requested format, json or text. ## var headers = buildCorsHeaders("GET", allowedOrigin) @@ -869,7 +869,7 @@ proc initNodeApi(node: CodexNodeRef, conf: CodexConf, router: var RestRouter) = trace "Excepting processing request", exc = exc.msg return RestApiResponse.error(Http500, headers = headers) - router.api(MethodGet, "/api/codex/v1/peerid") do() -> RestApiResponse: + router.api(MethodGet, "/api/storage/v1/peerid") do() -> RestApiResponse: ## Returns node's peerId in requested format, json or text. ## var headers = buildCorsHeaders("GET", allowedOrigin) @@ -888,7 +888,7 @@ proc initNodeApi(node: CodexNodeRef, conf: CodexConf, router: var RestRouter) = trace "Excepting processing request", exc = exc.msg return RestApiResponse.error(Http500, headers = headers) - router.api(MethodGet, "/api/codex/v1/connect/{peerId}") do( + router.api(MethodGet, "/api/storage/v1/connect/{peerId}") do( peerId: PeerId, addrs: seq[MultiAddress] ) -> RestApiResponse: ## Connect to a peer @@ -926,7 +926,7 @@ proc initNodeApi(node: CodexNodeRef, conf: CodexConf, router: var RestRouter) = proc initDebugApi(node: CodexNodeRef, conf: CodexConf, router: var RestRouter) = let allowedOrigin = router.allowedOrigin - router.api(MethodGet, "/api/codex/v1/debug/info") do() -> RestApiResponse: + router.api(MethodGet, "/api/storage/v1/debug/info") do() -> RestApiResponse: ## Print rudimentary node information ## var headers = buildCorsHeaders("GET", allowedOrigin) @@ -946,7 +946,7 @@ proc initDebugApi(node: CodexNodeRef, conf: CodexConf, router: var RestRouter) = "", "announceAddresses": node.discovery.announceAddrs, "table": table, - "codex": { + "storage": { "version": $codexVersion, "revision": $codexRevision, "contracts": $codexContractsRevision, @@ -961,7 +961,7 @@ proc initDebugApi(node: CodexNodeRef, conf: CodexConf, router: var RestRouter) = trace "Excepting processing request", exc = exc.msg return RestApiResponse.error(Http500, headers = headers) - router.api(MethodPost, "/api/codex/v1/debug/chronicles/loglevel") do( + router.api(MethodPost, "/api/storage/v1/debug/chronicles/loglevel") do( level: Option[string] ) -> RestApiResponse: ## Set log level at run time @@ -987,8 +987,8 @@ proc initDebugApi(node: CodexNodeRef, conf: CodexConf, router: var RestRouter) = trace "Excepting processing request", exc = exc.msg return RestApiResponse.error(Http500, headers = headers) - when codex_enable_api_debug_peers: - router.api(MethodGet, "/api/codex/v1/debug/peer/{peerId}") do( + when storage_enable_api_debug_peers: + router.api(MethodGet, "/api/storage/v1/debug/peer/{peerId}") do( peerId: PeerId ) -> RestApiResponse: var headers = buildCorsHeaders("GET", allowedOrigin) diff --git a/codex/rest/coders.nim b/codex/rest/coders.nim index 319ce3d6..3f9388d6 100644 --- a/codex/rest/coders.nim +++ b/codex/rest/coders.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/rng.nim b/codex/rng.nim index 0d789305..d36da9d7 100644 --- a/codex/rng.nim +++ b/codex/rng.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/sales.nim b/codex/sales.nim index 353b70cc..bc4262f1 100644 --- a/codex/sales.nim +++ b/codex/sales.nim @@ -22,7 +22,7 @@ import ./utils/exceptions ## Sales holds a list of available storage that it may sell. ## ## When storage is requested on the market that matches availability, the Sales -## object will instruct the Codex node to persist the requested data. Once the +## object will instruct the Logos Storage node to persist the requested data. Once the ## data has been persisted, it uploads a proof of storage to the market in an ## attempt to win a storage contract. ## diff --git a/codex/sales/reservations.nim b/codex/sales/reservations.nim index 8ab16105..2e62fdf8 100644 --- a/codex/sales/reservations.nim +++ b/codex/sales/reservations.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/sales/states/filled.nim b/codex/sales/states/filled.nim index b0fc65c9..ec54762a 100644 --- a/codex/sales/states/filled.nim +++ b/codex/sales/states/filled.nim @@ -11,7 +11,7 @@ import ./cancelled import ./failed import ./proving -when codex_enable_proof_failures: +when storage_enable_proof_failures: import ./provingsimulated logScope: @@ -59,7 +59,7 @@ method run*( if err =? (await onExpiryUpdate(request.content.cid, requestEnd)).errorOption: return some State(SaleErrored(error: err)) - when codex_enable_proof_failures: + when storage_enable_proof_failures: if context.simulateProofFailures > 0: info "Proving with failure rate", rate = context.simulateProofFailures return some State( diff --git a/codex/sales/states/preparing.nim b/codex/sales/states/preparing.nim index dba249de..ff6eb88c 100644 --- a/codex/sales/states/preparing.nim +++ b/codex/sales/states/preparing.nim @@ -61,7 +61,7 @@ method run*( return some State(SaleIgnored(reprocessSlot: false)) # TODO: Once implemented, check to ensure the host is allowed to fill the slot, - # due to the [sliding window mechanism](https://github.com/codex-storage/codex-research/blob/master/design/marketplace.md#dispersal) + # due to the [sliding window mechanism](https://github.com/logos-storage/logos-storage-research/blob/master/design/marketplace.md#dispersal) logScope: slotIndex = data.slotIndex diff --git a/codex/sales/states/provingsimulated.nim b/codex/sales/states/provingsimulated.nim index edf7eb1e..8ba468e7 100644 --- a/codex/sales/states/provingsimulated.nim +++ b/codex/sales/states/provingsimulated.nim @@ -1,5 +1,5 @@ import ../../conf -when codex_enable_proof_failures: +when storage_enable_proof_failures: import std/strutils import pkg/stint import pkg/ethers diff --git a/codex/slots/builder/builder.nim b/codex/slots/builder/builder.nim index 5fbb0fe1..633e19ea 100644 --- a/codex/slots/builder/builder.nim +++ b/codex/slots/builder/builder.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/slots/converters.nim b/codex/slots/converters.nim index f0dc3990..f22a7d64 100644 --- a/codex/slots/converters.nim +++ b/codex/slots/converters.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2024 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/slots/proofs/backends/circomcompat.nim b/codex/slots/proofs/backends/circomcompat.nim index 1d2e3e19..479866f4 100644 --- a/codex/slots/proofs/backends/circomcompat.nim +++ b/codex/slots/proofs/backends/circomcompat.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2024 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/slots/proofs/backends/converters.nim b/codex/slots/proofs/backends/converters.nim index ee771477..19ea3b35 100644 --- a/codex/slots/proofs/backends/converters.nim +++ b/codex/slots/proofs/backends/converters.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2024 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/slots/proofs/prover.nim b/codex/slots/proofs/prover.nim index 1afcd068..b3e83d7c 100644 --- a/codex/slots/proofs/prover.nim +++ b/codex/slots/proofs/prover.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2024 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/slots/sampler/sampler.nim b/codex/slots/sampler/sampler.nim index d7a36cfd..1afae3fb 100644 --- a/codex/slots/sampler/sampler.nim +++ b/codex/slots/sampler/sampler.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/slots/sampler/utils.nim b/codex/slots/sampler/utils.nim index ce78fadc..0e7c5b93 100644 --- a/codex/slots/sampler/utils.nim +++ b/codex/slots/sampler/utils.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2024 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/slots/types.nim b/codex/slots/types.nim index 0cd24326..5976c9b0 100644 --- a/codex/slots/types.nim +++ b/codex/slots/types.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2024 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/stores/blockstore.nim b/codex/stores/blockstore.nim index 253346a8..732d29e4 100644 --- a/codex/stores/blockstore.nim +++ b/codex/stores/blockstore.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/stores/cachestore.nim b/codex/stores/cachestore.nim index a86e6b10..cb5da7a3 100644 --- a/codex/stores/cachestore.nim +++ b/codex/stores/cachestore.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/stores/keyutils.nim b/codex/stores/keyutils.nim index 0d14c2e0..78efa732 100644 --- a/codex/stores/keyutils.nim +++ b/codex/stores/keyutils.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/stores/maintenance.nim b/codex/stores/maintenance.nim index 1d109031..38486239 100644 --- a/codex/stores/maintenance.nim +++ b/codex/stores/maintenance.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/stores/networkstore.nim b/codex/stores/networkstore.nim index d047dc51..200024f9 100644 --- a/codex/stores/networkstore.nim +++ b/codex/stores/networkstore.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/stores/repostore/coders.nim b/codex/stores/repostore/coders.nim index 47df7219..a840308c 100644 --- a/codex/stores/repostore/coders.nim +++ b/codex/stores/repostore/coders.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2024 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/stores/repostore/operations.nim b/codex/stores/repostore/operations.nim index ddbfdfb0..e27322ea 100644 --- a/codex/stores/repostore/operations.nim +++ b/codex/stores/repostore/operations.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2024 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/stores/repostore/store.nim b/codex/stores/repostore/store.nim index 16813a16..aab1a080 100644 --- a/codex/stores/repostore/store.nim +++ b/codex/stores/repostore/store.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2024 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/stores/repostore/types.nim b/codex/stores/repostore/types.nim index 42f528e9..bd43dded 100644 --- a/codex/stores/repostore/types.nim +++ b/codex/stores/repostore/types.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2024 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/stores/treehelper.nim b/codex/stores/treehelper.nim index 3c214856..9b0eb5d9 100644 --- a/codex/stores/treehelper.nim +++ b/codex/stores/treehelper.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/streams/seekablestream.nim b/codex/streams/seekablestream.nim index c48ec28f..926fa70d 100644 --- a/codex/streams/seekablestream.nim +++ b/codex/streams/seekablestream.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/streams/storestream.nim b/codex/streams/storestream.nim index 42eb5148..af747dd6 100644 --- a/codex/streams/storestream.nim +++ b/codex/streams/storestream.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/units.nim b/codex/units.nim index b600103f..e95f9e81 100644 --- a/codex/units.nim +++ b/codex/units.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/utils.nim b/codex/utils.nim index 9cea427e..618db055 100644 --- a/codex/utils.nim +++ b/codex/utils.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/utils/addrutils.nim b/codex/utils/addrutils.nim index 641ad9d4..1b7a556a 100644 --- a/codex/utils/addrutils.nim +++ b/codex/utils/addrutils.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/utils/asyncheapqueue.nim b/codex/utils/asyncheapqueue.nim index bc37c462..3794e5cc 100644 --- a/codex/utils/asyncheapqueue.nim +++ b/codex/utils/asyncheapqueue.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/utils/fileutils.nim b/codex/utils/fileutils.nim index 28b82b84..52427c87 100644 --- a/codex/utils/fileutils.nim +++ b/codex/utils/fileutils.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/utils/keyutils.nim b/codex/utils/keyutils.nim index e0881df6..dcdc17bb 100644 --- a/codex/utils/keyutils.nim +++ b/codex/utils/keyutils.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/utils/poseidon2digest.nim b/codex/utils/poseidon2digest.nim index 6eaf21e9..31f07b26 100644 --- a/codex/utils/poseidon2digest.nim +++ b/codex/utils/poseidon2digest.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/utils/safeasynciter.nim b/codex/utils/safeasynciter.nim index be46cc0f..56b1d697 100644 --- a/codex/utils/safeasynciter.nim +++ b/codex/utils/safeasynciter.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2025 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/codex/utils/timer.nim b/codex/utils/timer.nim index e5097e21..fc22dfd3 100644 --- a/codex/utils/timer.nim +++ b/codex/utils/timer.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/examples/golang/README.md b/examples/golang/README.md index 30a12932..119648c2 100644 --- a/examples/golang/README.md +++ b/examples/golang/README.md @@ -1,18 +1,18 @@ ## Pre-requisite -libcodex.so is needed to be compiled and present in build folder. +libstorage.so is needed to be compiled and present in build folder. ## Compilation -From the codex root folder: +From the Logos Storage root folder: ```code -go build -o codex-go examples/golang/codex.go +go build -o storage-go examples/golang/storage.go ``` ## Run -From the codex root folder: +From the storage root folder: ```code @@ -20,5 +20,5 @@ export LD_LIBRARY_PATH=build ``` ```code -./codex-go +./storage-go ``` diff --git a/examples/golang/codex.go b/examples/golang/storage.go similarity index 69% rename from examples/golang/codex.go rename to examples/golang/storage.go index cf6f9aa3..5908afc9 100644 --- a/examples/golang/codex.go +++ b/examples/golang/storage.go @@ -1,12 +1,12 @@ package main /* - #cgo LDFLAGS: -L../../build/ -lcodex + #cgo LDFLAGS: -L../../build/ -lstorage #cgo LDFLAGS: -L../../ -Wl,-rpath,../../ #include #include - #include "../../library/libcodex.h" + #include "../../library/libstorage.h" typedef struct { int ret; @@ -35,83 +35,83 @@ package main return m->ret; } - void libcodexNimMain(void); + void libstorageNimMain(void); - static void codex_host_init_once(void){ + static void storage_host_init_once(void){ static int done; - if (!__atomic_exchange_n(&done, 1, __ATOMIC_SEQ_CST)) libcodexNimMain(); + if (!__atomic_exchange_n(&done, 1, __ATOMIC_SEQ_CST)) libstorageNimMain(); } // resp must be set != NULL in case interest on retrieving data from the callback void callback(int ret, char* msg, size_t len, void* resp); - static void* cGoCodexNew(const char* configJson, void* resp) { - void* ret = codex_new(configJson, (CodexCallback) callback, resp); + static void* cGoStorageNew(const char* configJson, void* resp) { + void* ret = storage_new(configJson, (StorageCallback) callback, resp); return ret; } - static int cGoCodexStart(void* codexCtx, void* resp) { - return codex_start(codexCtx, (CodexCallback) callback, resp); + static int cGoStorageStart(void* storageCtx, void* resp) { + return storage_start(storageCtx, (StorageCallback) callback, resp); } - static int cGoCodexStop(void* codexCtx, void* resp) { - return codex_stop(codexCtx, (CodexCallback) callback, resp); + static int cGoStorageStop(void* storageCtx, void* resp) { + return storage_stop(storageCtx, (StorageCallback) callback, resp); } - static int cGoCodexClose(void* codexCtx, void* resp) { - return codex_close(codexCtx, (CodexCallback) callback, resp); + static int cGoStorageClose(void* storageCtx, void* resp) { + return storage_close(storageCtx, (StorageCallback) callback, resp); } - static int cGoCodexDestroy(void* codexCtx, void* resp) { - return codex_destroy(codexCtx, (CodexCallback) callback, resp); + static int cGoStorageDestroy(void* storageCtx, void* resp) { + return storage_destroy(storageCtx, (StorageCallback) callback, resp); } - static int cGoCodexVersion(void* codexCtx, void* resp) { - return codex_version(codexCtx, (CodexCallback) callback, resp); + static int cGoStorageVersion(void* storageCtx, void* resp) { + return storage_version(storageCtx, (StorageCallback) callback, resp); } - static int cGoCodexRevision(void* codexCtx, void* resp) { - return codex_revision(codexCtx, (CodexCallback) callback, resp); + static int cGoStorageRevision(void* storageCtx, void* resp) { + return storage_revision(storageCtx, (StorageCallback) callback, resp); } - static int cGoCodexRepo(void* codexCtx, void* resp) { - return codex_repo(codexCtx, (CodexCallback) callback, resp); + static int cGoStorageRepo(void* storageCtx, void* resp) { + return storage_repo(storageCtx, (StorageCallback) callback, resp); } - static int cGoCodexSpr(void* codexCtx, void* resp) { - return codex_spr(codexCtx, (CodexCallback) callback, resp); + static int cGoStorageSpr(void* storageCtx, void* resp) { + return storage_spr(storageCtx, (StorageCallback) callback, resp); } - static int cGoCodexPeerId(void* codexCtx, void* resp) { - return codex_peer_id(codexCtx, (CodexCallback) callback, resp); + static int cGoStoragePeerId(void* storageCtx, void* resp) { + return storage_peer_id(storageCtx, (StorageCallback) callback, resp); } - static int cGoCodexUploadInit(void* codexCtx, char* filepath, size_t chunkSize, void* resp) { - return codex_upload_init(codexCtx, filepath, chunkSize, (CodexCallback) callback, resp); + static int cGoStorageUploadInit(void* storageCtx, char* filepath, size_t chunkSize, void* resp) { + return storage_upload_init(storageCtx, filepath, chunkSize, (StorageCallback) callback, resp); } - static int cGoCodexUploadChunk(void* codexCtx, char* sessionId, const uint8_t* chunk, size_t len, void* resp) { - return codex_upload_chunk(codexCtx, sessionId, chunk, len, (CodexCallback) callback, resp); + static int cGoStorageUploadChunk(void* storageCtx, char* sessionId, const uint8_t* chunk, size_t len, void* resp) { + return storage_upload_chunk(storageCtx, sessionId, chunk, len, (StorageCallback) callback, resp); } - static int cGoCodexUploadFinalize(void* codexCtx, char* sessionId, void* resp) { - return codex_upload_finalize(codexCtx, sessionId, (CodexCallback) callback, resp); + static int cGoStorageUploadFinalize(void* storageCtx, char* sessionId, void* resp) { + return storage_upload_finalize(storageCtx, sessionId, (StorageCallback) callback, resp); } - static int cGoCodexUploadCancel(void* codexCtx, char* sessionId, void* resp) { - return codex_upload_cancel(codexCtx, sessionId, (CodexCallback) callback, resp); + static int cGoStorageUploadCancel(void* storageCtx, char* sessionId, void* resp) { + return storage_upload_cancel(storageCtx, sessionId, (StorageCallback) callback, resp); } - static int cGoCodexUploadFile(void* codexCtx, char* sessionId, void* resp) { - return codex_upload_file(codexCtx, sessionId, (CodexCallback) callback, resp); + static int cGoStorageUploadFile(void* storageCtx, char* sessionId, void* resp) { + return storage_upload_file(storageCtx, sessionId, (StorageCallback) callback, resp); } - static int cGoCodexLogLevel(void* codexCtx, char* logLevel, void* resp) { - return codex_log_level(codexCtx, logLevel, (CodexCallback) callback, resp); + static int cGoStorageLogLevel(void* storageCtx, char* logLevel, void* resp) { + return storage_log_level(storageCtx, logLevel, (StorageCallback) callback, resp); } - static int cGoCodexExists(void* codexCtx, char* cid, void* resp) { - return codex_storage_exists(codexCtx, cid, (CodexCallback) callback, resp); + static int cGoStorageExists(void* storageCtx, char* cid, void* resp) { + return storage_exists(storageCtx, cid, (StorageCallback) callback, resp); } */ import "C" @@ -169,11 +169,11 @@ type Config struct { // Default: 8008 MetricsPort int `json:"metrics-port,omitempty"` - // The directory where codex will store configuration and data + // The directory where logos storage will store configuration and data // Default: - // $HOME\AppData\Roaming\Codex on Windows - // $HOME/Library/Application Support/Codex on macOS - // $HOME/.cache/codex on Linux + // $HOME\AppData\Roaming\Logos Storage on Windows + // $HOME/Library/Application Support/Logos Storage on macOS + // $HOME/.cache/logos_storage on Linux DataDir string `json:"data-dir,omitempty"` // Multi Addresses to listen on @@ -205,7 +205,7 @@ type Config struct { NumThreads int `json:"num-threads,omitempty"` // Node agent string which is used as identifier in network - // Default: "Codex" + // Default: "Logos Storage" AgentString string `json:"agent-string,omitempty"` // Backend for main repo store (fs, sqlite, leveldb) @@ -242,7 +242,7 @@ type Config struct { LogFile string `json:"log-file,omitempty"` } -type CodexNode struct { +type StorageNode struct { ctx unsafe.Pointer } @@ -383,7 +383,7 @@ type UploadOptions struct { // It is used to detect the mimetype. Filepath string - // ChunkSize is the size of each upload chunk, passed as `blockSize` to the Codex node + // ChunkSize is the size of each upload chunk, passed as `blockSize` to the Logos Storage node // store. Default is to 64 KB. ChunkSize ChunkSize @@ -416,12 +416,12 @@ func getReaderSize(r io.Reader) int64 { } } -// New creates a new Codex node with the provided configuration. -// The node is not started automatically; you need to call CodexStart +// New creates a new Logos Storage node with the provided configuration. +// The node is not started automatically; you need to call StorageStart // to start it. -// It returns a Codex node that can be used to interact -// with the Codex network. -func New(config Config) (*CodexNode, error) { +// It returns a Logos Storage node that can be used to interact +// with the Logos Storage network. +func New(config Config) (*StorageNode, error) { bridge := newBridgeCtx() defer bridge.free() @@ -433,22 +433,22 @@ func New(config Config) (*CodexNode, error) { cJsonConfig := C.CString(string(jsonConfig)) defer C.free(unsafe.Pointer(cJsonConfig)) - ctx := C.cGoCodexNew(cJsonConfig, bridge.resp) + ctx := C.cGoStorageNew(cJsonConfig, bridge.resp) if _, err := bridge.wait(); err != nil { return nil, bridge.err } - return &CodexNode{ctx: ctx}, bridge.err + return &StorageNode{ctx: ctx}, bridge.err } -// Start starts the Codex node. -func (node CodexNode) Start() error { +// Start starts the Logos Storage node. +func (node StorageNode) Start() error { bridge := newBridgeCtx() defer bridge.free() - if C.cGoCodexStart(node.ctx, bridge.resp) != C.RET_OK { - return bridge.callError("cGoCodexStart") + if C.cGoStorageStart(node.ctx, bridge.resp) != C.RET_OK { + return bridge.callError("cGoStorageStart") } _, err := bridge.wait() @@ -456,34 +456,34 @@ func (node CodexNode) Start() error { } // StartAsync is the asynchronous version of Start. -func (node CodexNode) StartAsync(onDone func(error)) { +func (node StorageNode) StartAsync(onDone func(error)) { go func() { err := node.Start() onDone(err) }() } -// Stop stops the Codex node. -func (node CodexNode) Stop() error { +// Stop stops the Logos Storage node. +func (node StorageNode) Stop() error { bridge := newBridgeCtx() defer bridge.free() - if C.cGoCodexStop(node.ctx, bridge.resp) != C.RET_OK { - return bridge.callError("cGoCodexStop") + if C.cGoStorageStop(node.ctx, bridge.resp) != C.RET_OK { + return bridge.callError("cGoStorageStop") } _, err := bridge.wait() return err } -// Destroy destroys the Codex node, freeing all resources. +// Destroy destroys the Logos Storage node, freeing all resources. // The node must be stopped before calling this method. -func (node CodexNode) Destroy() error { +func (node StorageNode) Destroy() error { bridge := newBridgeCtx() defer bridge.free() - if C.cGoCodexClose(node.ctx, bridge.resp) != C.RET_OK { - return bridge.callError("cGoCodexClose") + if C.cGoStorageClose(node.ctx, bridge.resp) != C.RET_OK { + return bridge.callError("cGoStorageClose") } _, err := bridge.wait() @@ -491,65 +491,65 @@ func (node CodexNode) Destroy() error { return err } - if C.cGoCodexDestroy(node.ctx, bridge.resp) != C.RET_OK { - return errors.New("Failed to destroy the codex node.") + if C.cGoStorageDestroy(node.ctx, bridge.resp) != C.RET_OK { + return errors.New("Failed to destroy the Logos Storage node.") } return err } -// Version returns the version of the Codex node. -func (node CodexNode) Version() (string, error) { +// Version returns the version of the Logos Storage node. +func (node StorageNode) Version() (string, error) { bridge := newBridgeCtx() defer bridge.free() - if C.cGoCodexVersion(node.ctx, bridge.resp) != C.RET_OK { - return "", bridge.callError("cGoCodexVersion") + if C.cGoStorageVersion(node.ctx, bridge.resp) != C.RET_OK { + return "", bridge.callError("cGoStorageVersion") } return bridge.wait() } -func (node CodexNode) Revision() (string, error) { +func (node StorageNode) Revision() (string, error) { bridge := newBridgeCtx() defer bridge.free() - if C.cGoCodexRevision(node.ctx, bridge.resp) != C.RET_OK { - return "", bridge.callError("cGoCodexRevision") + if C.cGoStorageRevision(node.ctx, bridge.resp) != C.RET_OK { + return "", bridge.callError("cGoStorageRevision") } return bridge.wait() } // Repo returns the path of the data dir folder. -func (node CodexNode) Repo() (string, error) { +func (node StorageNode) Repo() (string, error) { bridge := newBridgeCtx() defer bridge.free() - if C.cGoCodexRepo(node.ctx, bridge.resp) != C.RET_OK { - return "", bridge.callError("cGoCodexRepo") + if C.cGoStorageRepo(node.ctx, bridge.resp) != C.RET_OK { + return "", bridge.callError("cGoStorageRepo") } return bridge.wait() } -func (node CodexNode) Spr() (string, error) { +func (node StorageNode) Spr() (string, error) { bridge := newBridgeCtx() defer bridge.free() - if C.cGoCodexSpr(node.ctx, bridge.resp) != C.RET_OK { - return "", bridge.callError("cGoCodexSpr") + if C.cGoStorageSpr(node.ctx, bridge.resp) != C.RET_OK { + return "", bridge.callError("cGoStorageSpr") } return bridge.wait() } -func (node CodexNode) PeerId() (string, error) { +func (node StorageNode) PeerId() (string, error) { bridge := newBridgeCtx() defer bridge.free() - if C.cGoCodexPeerId(node.ctx, bridge.resp) != C.RET_OK { - return "", bridge.callError("cGoCodexPeerId") + if C.cGoStoragePeerId(node.ctx, bridge.resp) != C.RET_OK { + return "", bridge.callError("cGoStoragePeerId") } return bridge.wait() @@ -559,26 +559,26 @@ func (node CodexNode) PeerId() (string, error) { // It returns a session ID that can be used for subsequent upload operations. // This function is called by UploadReader and UploadFile internally. // You should use this function only if you need to manage the upload session manually. -func (node CodexNode) UploadInit(options *UploadOptions) (string, error) { +func (node StorageNode) UploadInit(options *UploadOptions) (string, error) { bridge := newBridgeCtx() defer bridge.free() var cFilename = C.CString(options.Filepath) defer C.free(unsafe.Pointer(cFilename)) - if C.cGoCodexUploadInit(node.ctx, cFilename, options.ChunkSize.toSizeT(), bridge.resp) != C.RET_OK { - return "", bridge.callError("cGoCodexUploadInit") + if C.cGoStorageUploadInit(node.ctx, cFilename, options.ChunkSize.toSizeT(), bridge.resp) != C.RET_OK { + return "", bridge.callError("cGoStorageUploadInit") } return bridge.wait() } -// UploadChunk uploads a chunk of data to the Codex node. +// UploadChunk uploads a chunk of data to the Logos Storage node. // It takes the session ID returned by UploadInit // and a byte slice containing the chunk data. // This function is called by UploadReader internally. // You should use this function only if you need to manage the upload session manually. -func (node CodexNode) UploadChunk(sessionId string, chunk []byte) error { +func (node StorageNode) UploadChunk(sessionId string, chunk []byte) error { bridge := newBridgeCtx() defer bridge.free() @@ -590,8 +590,8 @@ func (node CodexNode) UploadChunk(sessionId string, chunk []byte) error { cChunkPtr = (*C.uint8_t)(unsafe.Pointer(&chunk[0])) } - if C.cGoCodexUploadChunk(node.ctx, cSessionId, cChunkPtr, C.size_t(len(chunk)), bridge.resp) != C.RET_OK { - return bridge.callError("cGoCodexUploadChunk") + if C.cGoStorageUploadChunk(node.ctx, cSessionId, cChunkPtr, C.size_t(len(chunk)), bridge.resp) != C.RET_OK { + return bridge.callError("cGoStorageUploadChunk") } _, err := bridge.wait() @@ -602,15 +602,15 @@ func (node CodexNode) UploadChunk(sessionId string, chunk []byte) error { // It takes the session ID returned by UploadInit. // This function is called by UploadReader and UploadFile internally. // You should use this function only if you need to manage the upload session manually. -func (node CodexNode) UploadFinalize(sessionId string) (string, error) { +func (node StorageNode) UploadFinalize(sessionId string) (string, error) { bridge := newBridgeCtx() defer bridge.free() var cSessionId = C.CString(sessionId) defer C.free(unsafe.Pointer(cSessionId)) - if C.cGoCodexUploadFinalize(node.ctx, cSessionId, bridge.resp) != C.RET_OK { - return "", bridge.callError("cGoCodexUploadFinalize") + if C.cGoStorageUploadFinalize(node.ctx, cSessionId, bridge.resp) != C.RET_OK { + return "", bridge.callError("cGoStorageUploadFinalize") } return bridge.wait() @@ -619,31 +619,31 @@ func (node CodexNode) UploadFinalize(sessionId string) (string, error) { // UploadCancel cancels an ongoing upload session. // It can be only if the upload session is managed manually. // It doesn't work with UploadFile. -func (node CodexNode) UploadCancel(sessionId string) error { +func (node StorageNode) UploadCancel(sessionId string) error { bridge := newBridgeCtx() defer bridge.free() var cSessionId = C.CString(sessionId) defer C.free(unsafe.Pointer(cSessionId)) - if C.cGoCodexUploadCancel(node.ctx, cSessionId, bridge.resp) != C.RET_OK { - return bridge.callError("cGoCodexUploadCancel") + if C.cGoStorageUploadCancel(node.ctx, cSessionId, bridge.resp) != C.RET_OK { + return bridge.callError("cGoStorageUploadCancel") } _, err := bridge.wait() return err } -// UploadReader uploads data from an io.Reader to the Codex node. +// UploadReader uploads data from an io.Reader to the Logos Storage node. // It takes the upload options and the reader as parameters. // It returns the CID of the uploaded file or an error. // // Internally, it calls: // - UploadInit to create the upload session. -// - UploadChunk to upload a chunk to codex. +// - UploadChunk to upload a chunk to Logos Storage. // - UploadFinalize to finalize the upload session. // - UploadCancel if an error occurs. -func (node CodexNode) UploadReader(options UploadOptions, r io.Reader) (string, error) { +func (node StorageNode) UploadReader(options UploadOptions, r io.Reader) (string, error) { sessionId, err := node.UploadInit(&options) if err != nil { return "", err @@ -701,20 +701,20 @@ func (node CodexNode) UploadReader(options UploadOptions, r io.Reader) (string, } // UploadReaderAsync is the asynchronous version of UploadReader using a goroutine. -func (node CodexNode) UploadReaderAsync(options UploadOptions, r io.Reader, onDone func(cid string, err error)) { +func (node StorageNode) UploadReaderAsync(options UploadOptions, r io.Reader, onDone func(cid string, err error)) { go func() { cid, err := node.UploadReader(options, r) onDone(cid, err) }() } -// UploadFile uploads a file to the Codex node. +// UploadFile uploads a file to the Logos Storage node. // It takes the upload options as parameter. // It returns the CID of the uploaded file or an error. // // The options parameter contains the following fields: // - filepath: the full path of the file to upload. -// - chunkSize: the size of each upload chunk, passed as `blockSize` to the Codex node +// - chunkSize: the size of each upload chunk, passed as `blockSize` to the Logos Storage node // store. Default is to 64 KB. // - onProgress: a callback function that is called after each chunk is uploaded with: // - read: the number of bytes read in the last chunk. @@ -728,7 +728,7 @@ func (node CodexNode) UploadReaderAsync(options UploadOptions, r io.Reader, onDo // is sent to the stream. // // Internally, it calls UploadInit to create the upload session. -func (node CodexNode) UploadFile(options UploadOptions) (string, error) { +func (node StorageNode) UploadFile(options UploadOptions) (string, error) { bridge := newBridgeCtx() defer bridge.free() @@ -768,45 +768,45 @@ func (node CodexNode) UploadFile(options UploadOptions) (string, error) { var cSessionId = C.CString(sessionId) defer C.free(unsafe.Pointer(cSessionId)) - if C.cGoCodexUploadFile(node.ctx, cSessionId, bridge.resp) != C.RET_OK { - return "", bridge.callError("cGoCodexUploadFile") + if C.cGoStorageUploadFile(node.ctx, cSessionId, bridge.resp) != C.RET_OK { + return "", bridge.callError("cGoStorageUploadFile") } return bridge.wait() } // UploadFileAsync is the asynchronous version of UploadFile using a goroutine. -func (node CodexNode) UploadFileAsync(options UploadOptions, onDone func(cid string, err error)) { +func (node StorageNode) UploadFileAsync(options UploadOptions, onDone func(cid string, err error)) { go func() { cid, err := node.UploadFile(options) onDone(cid, err) }() } -func (node CodexNode) UpdateLogLevel(logLevel string) error { +func (node StorageNode) UpdateLogLevel(logLevel string) error { bridge := newBridgeCtx() defer bridge.free() var cLogLevel = C.CString(string(logLevel)) defer C.free(unsafe.Pointer(cLogLevel)) - if C.cGoCodexLogLevel(node.ctx, cLogLevel, bridge.resp) != C.RET_OK { - return bridge.callError("cGoCodexLogLevel") + if C.cGoStorageLogLevel(node.ctx, cLogLevel, bridge.resp) != C.RET_OK { + return bridge.callError("cGoStorageLogLevel") } _, err := bridge.wait() return err } -func (node CodexNode) Exists(cid string) (bool, error) { +func (node StorageNode) Exists(cid string) (bool, error) { bridge := newBridgeCtx() defer bridge.free() var cCid = C.CString(cid) defer C.free(unsafe.Pointer(cCid)) - if C.cGoCodexExists(node.ctx, cCid, bridge.resp) != C.RET_OK { - return false, bridge.callError("cGoCodexUploadCancel") + if C.cGoStorageExists(node.ctx, cCid, bridge.resp) != C.RET_OK { + return false, bridge.callError("cGoStorageUploadCancel") } result, err := bridge.wait() @@ -822,20 +822,20 @@ func main() { DataDir: dataDir, }) if err != nil { - log.Fatalf("Failed to create Codex node: %v", err) + log.Fatalf("Failed to create Logos Storage node: %v", err) } defer os.RemoveAll(dataDir) if err := node.Start(); err != nil { - log.Fatalf("Failed to start Codex node: %v", err) + log.Fatalf("Failed to start Logos Storage node: %v", err) } - log.Println("Codex node started") + log.Println("Logos Storage node started") version, err := node.Version() if err != nil { - log.Fatalf("Failed to get Codex version: %v", err) + log.Fatalf("Failed to get Logos Storage version: %v", err) } - log.Printf("Codex version: %s", version) + log.Printf("Logos Storage version: %s", version) err = node.UpdateLogLevel("ERROR") if err != nil { @@ -875,11 +875,11 @@ func main() { <-ch if err := node.Stop(); err != nil { - log.Fatalf("Failed to stop Codex node: %v", err) + log.Fatalf("Failed to stop Storage node: %v", err) } - log.Println("Codex node stopped") + log.Println("Logos Storage node stopped") if err := node.Destroy(); err != nil { - log.Fatalf("Failed to destroy Codex node: %v", err) + log.Fatalf("Failed to destroy Logos Storage node: %v", err) } } diff --git a/flake.lock b/flake.lock index decca52e..5525546b 100644 --- a/flake.lock +++ b/flake.lock @@ -9,13 +9,13 @@ "locked": { "lastModified": 1736521871, "narHash": "sha256-d34XNLg9NGPEOARHW+BIOAWalkHdEUAwsv3mpLZQxds=", - "owner": "codex-storage", + "owner": "logos-storage", "repo": "circom-compat-ffi", "rev": "8cd4ed44fdafe59d4ec1184420639cae4c4dbab9", "type": "github" }, "original": { - "owner": "codex-storage", + "owner": "logos-storage", "repo": "circom-compat-ffi", "type": "github" } diff --git a/flake.nix b/flake.nix index 4302b3d2..401d2346 100644 --- a/flake.nix +++ b/flake.nix @@ -1,10 +1,10 @@ { - description = "Nim Codex build flake"; + description = "Logos Storage build flake"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; circom-compat = { - url = "github:codex-storage/circom-compat-ffi"; + url = "github:logos-storage/circom-compat-ffi"; inputs.nixpkgs.follows = "nixpkgs"; }; }; @@ -68,7 +68,7 @@ machine.start() machine.wait_for_unit("nim-codex.service") machine.succeed("test -d /var/lib/nim-codex-test") - machine.wait_until_succeeds("journalctl -u nim-codex.service | grep 'Started codex node'", 10) + machine.wait_until_succeeds("journalctl -u nim-codex.service | grep 'Started Storage node'", 10) ''; }; }); diff --git a/library/README.md b/library/README.md index db6423fe..655cd9c8 100644 --- a/library/README.md +++ b/library/README.md @@ -1,6 +1,6 @@ -# Codex Library +# Logos Storage Library -Codex exposes a C binding that serves as a stable contract, making it straightforward to integrate Codex into other languages such as Go. +Logos Storage exposes a C binding that serves as a stable contract, making it straightforward to integrate Logos Storage into other languages such as Go. The implementation was inspired by [nim-library-template](https://github.com/logos-co/nim-library-template) and by the [nwaku](https://github.com/waku-org/nwaku/tree/master/library) library. @@ -13,13 +13,13 @@ sequenceDiagram autonumber actor App as App/User participant Go as Go Wrapper - participant C as C API (libcodex.h) - participant Ctx as CodexContext + participant C as C API (libstorage.h) + participant Ctx as StorageContext participant Thr as Worker Thread participant Eng as CodexServer App->>Go: Start - Go->>C: codex_start_node + Go->>C: storage_start_node C->>Ctx: enqueue request C->>Ctx: fire signal Ctx->>Thr: wake worker diff --git a/library/ffi_types.nim b/library/ffi_types.nim index 1a865eaf..38faf551 100644 --- a/library/ffi_types.nim +++ b/library/ffi_types.nim @@ -7,7 +7,7 @@ ### Exported types import results -type CodexCallback* = proc( +type StorageCallback* = proc( callerRet: cint, msg: ptr cchar, len: csize_t, userData: pointer ) {.cdecl, gcsafe, raises: [].} @@ -18,15 +18,15 @@ const RET_PROGRESS*: cint = 3 ## Returns RET_OK as acknowledgment and call the callback ## with RET_OK code and the provided message. -proc success*(callback: CodexCallback, msg: string, userData: pointer): cint = +proc success*(callback: StorageCallback, msg: string, userData: pointer): cint = callback(RET_OK, cast[ptr cchar](msg), cast[csize_t](len(msg)), userData) return RET_OK ## Returns RET_ERR as acknowledgment and call the callback ## with RET_ERR code and the provided message. -proc error*(callback: CodexCallback, msg: string, userData: pointer): cint = - let msg = "libcodex error: " & msg +proc error*(callback: StorageCallback, msg: string, userData: pointer): cint = + let msg = "libstorage error: " & msg callback(RET_ERR, unsafeAddr msg[0], cast[csize_t](len(msg)), userData) return RET_ERR @@ -34,7 +34,7 @@ proc error*(callback: CodexCallback, msg: string, userData: pointer): cint = ## Returns RET_OK as acknowledgment if the result is ok. ## If not, return RET_ERR and call the callback with the error message. proc okOrError*[T]( - callback: CodexCallback, res: Result[T, string], userData: pointer + callback: StorageCallback, res: Result[T, string], userData: pointer ): cint = if res.isOk: return RET_OK diff --git a/library/libcodex.h b/library/libstorage.h similarity index 54% rename from library/libcodex.h rename to library/libstorage.h index bade4c95..76d5e2e1 100644 --- a/library/libcodex.h +++ b/library/libstorage.h @@ -1,15 +1,15 @@ /** -* libcodex.h - C Interface for Example Library +* libstorage.h - C Interface for Example Library * -* This header provides the public API for libcodex +* This header provides the public API for libstorage * -* To see the auto-generated header by Nim, run `make libcodex` from the +* To see the auto-generated header by Nim, run `make libstorage` from the * repository root. The generated file will be created at: -* nimcache/release/libcodex/libcodex.h +* nimcache/release/libstorage/libstorage.h */ -#ifndef __libcodex__ -#define __libcodex__ +#ifndef __libstorage__ +#define __libstorage__ #include #include @@ -24,183 +24,183 @@ extern "C" { #endif -typedef void (*CodexCallback) (int callerRet, const char* msg, size_t len, void* userData); +typedef void (*StorageCallback) (int callerRet, const char* msg, size_t len, void* userData); -void* codex_new( +void* storage_new( const char* configJson, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_version( +int storage_version( void* ctx, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_revision( +int storage_revision( void* ctx, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_repo( +int storage_repo( void* ctx, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_debug( +int storage_debug( void* ctx, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_spr( +int storage_spr( void* ctx, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_peer_id( +int storage_peer_id( void* ctx, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_log_level( +int storage_log_level( void* ctx, const char* logLevel, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_connect( +int storage_connect( void* ctx, const char* peerId, const char** peerAddresses, size_t peerAddressesSize, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_peer_debug( +int storage_peer_debug( void* ctx, const char* peerId, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_upload_init( +int storage_upload_init( void* ctx, const char* filepath, size_t chunkSize, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_upload_chunk( +int storage_upload_chunk( void* ctx, const char* sessionId, const uint8_t* chunk, size_t len, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_upload_finalize( +int storage_upload_finalize( void* ctx, const char* sessionId, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_upload_cancel( +int storage_upload_cancel( void* ctx, const char* sessionId, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_upload_file( +int storage_upload_file( void* ctx, const char* sessionId, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_download_stream( +int storage_download_stream( void* ctx, const char* cid, size_t chunkSize, bool local, const char* filepath, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_download_init( +int storage_download_init( void* ctx, const char* cid, size_t chunkSize, bool local, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_download_chunk( +int storage_download_chunk( void* ctx, const char* cid, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_download_cancel( +int storage_download_cancel( void* ctx, const char* cid, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_download_manifest( +int storage_download_manifest( void* ctx, const char* cid, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_storage_list( +int storage_list( void* ctx, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_storage_space( +int storage_space( void* ctx, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_storage_delete( +int storage_delete( void* ctx, const char* cid, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_storage_fetch( +int storage_fetch( void* ctx, const char* cid, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_storage_exists( +int storage_exists( void* ctx, const char* cid, - CodexCallback callback, + StorageCallback callback, void* userData); -int codex_start(void* ctx, - CodexCallback callback, +int storage_start(void* ctx, + StorageCallback callback, void* userData); -int codex_stop(void* ctx, - CodexCallback callback, +int storage_stop(void* ctx, + StorageCallback callback, void* userData); -int codex_close(void* ctx, - CodexCallback callback, +int storage_close(void* ctx, + StorageCallback callback, void* userData); -// Destroys an instance of a codex node created with codex_new -int codex_destroy(void* ctx, - CodexCallback callback, +// Destroys an instance of a Logos Storage node created with storage_new +int storage_destroy(void* ctx, + StorageCallback callback, void* userData); -void codex_set_event_callback(void* ctx, - CodexCallback callback, +void storage_set_event_callback(void* ctx, + StorageCallback callback, void* userData); #ifdef __cplusplus } #endif -#endif /* __libcodex__ */ \ No newline at end of file +#endif /* __libstorage__ */ \ No newline at end of file diff --git a/library/libcodex.nim b/library/libstorage.nim similarity index 61% rename from library/libcodex.nim rename to library/libstorage.nim index d1c7e052..06b02172 100644 --- a/library/libcodex.nim +++ b/library/libstorage.nim @@ -1,6 +1,6 @@ -# libcodex.nim - C-exported interface for the Codex shared library +# libstorage.nim - C-exported interface for the Storage shared library # -# This file implements the public C API for libcodex. +# This file implements the public C API for libstorage. # It acts as the bridge between C programs and the internal Nim implementation. # # This file defines: @@ -22,30 +22,30 @@ when defined(linux): # Define the canonical name for this library - {.passl: "-Wl,-soname,libcodex.so".} + {.passl: "-Wl,-soname,libstorage.so".} import std/[atomics] import chronicles import chronos import chronos/threadsync -import ./codex_context -import ./codex_thread_requests/codex_thread_request -import ./codex_thread_requests/requests/node_lifecycle_request -import ./codex_thread_requests/requests/node_info_request -import ./codex_thread_requests/requests/node_debug_request -import ./codex_thread_requests/requests/node_p2p_request -import ./codex_thread_requests/requests/node_upload_request -import ./codex_thread_requests/requests/node_download_request -import ./codex_thread_requests/requests/node_storage_request +import ./storage_context +import ./storage_thread_requests/storage_thread_request +import ./storage_thread_requests/requests/node_lifecycle_request +import ./storage_thread_requests/requests/node_info_request +import ./storage_thread_requests/requests/node_debug_request +import ./storage_thread_requests/requests/node_p2p_request +import ./storage_thread_requests/requests/node_upload_request +import ./storage_thread_requests/requests/node_download_request +import ./storage_thread_requests/requests/node_storage_request import ./ffi_types from ../codex/conf import codexVersion logScope: - topics = "codexlib" + topics = "libstorage" -template checkLibcodexParams*( - ctx: ptr CodexContext, callback: CodexCallback, userData: pointer +template checkLibstorageParams*( + ctx: ptr StorageContext, callback: StorageCallback, userData: pointer ) = if not isNil(ctx): ctx[].userData = userData @@ -57,7 +57,7 @@ template checkLibcodexParams*( # "the C targets require you to initialize Nim's internals, which is done calling a NimMain function." # "The name NimMain can be influenced via the --nimMainPrefix:prefix switch." # "Use --nimMainPrefix:MyLib and the function to call is named MyLibNimMain." -proc libcodexNimMain() {.importc.} +proc libstorageNimMain() {.importc.} # Atomic flag to prevent multiple initializations var initialized: Atomic[bool] @@ -74,7 +74,7 @@ if defined(android): proc initializeLibrary() {.exported.} = if not initialized.exchange(true): ## Every Nim library must call `NimMain()` once - libcodexNimMain() + libstorageNimMain() when declared(setupForeignThreadGc): setupForeignThreadGc() when declared(nimGC_setStackBottom): @@ -82,16 +82,16 @@ proc initializeLibrary() {.exported.} = locals = addr(locals) nimGC_setStackBottom(locals) -proc codex_new( - configJson: cstring, callback: CodexCallback, userData: pointer +proc storage_new( + configJson: cstring, callback: StorageCallback, userData: pointer ): pointer {.dynlib, exported.} = initializeLibrary() if isNil(callback): - error "Failed to create codex instance: the callback is missing." + error "Failed to create Storage instance: the callback is missing." return nil - var ctx = codex_context.createCodexContext().valueOr: + var ctx = storage_context.createStorageContext().valueOr: let msg = $error callback(RET_ERR, unsafeAddr msg[0], cast[csize_t](len(msg)), userData) return nil @@ -101,7 +101,7 @@ proc codex_new( let reqContent = NodeLifecycleRequest.createShared(NodeLifecycleMsgType.CREATE_NODE, configJson) - codex_context.sendRequestToCodexThread( + storage_context.sendRequestToStorageThread( ctx, RequestType.LIFECYCLE, reqContent, callback, userData ).isOkOr: let msg = $error @@ -110,11 +110,11 @@ proc codex_new( return ctx -proc codex_version( - ctx: ptr CodexContext, callback: CodexCallback, userData: pointer +proc storage_version( + ctx: ptr StorageContext, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) callback( RET_OK, @@ -125,11 +125,11 @@ proc codex_version( return RET_OK -proc codex_revision( - ctx: ptr CodexContext, callback: CodexCallback, userData: pointer +proc storage_revision( + ctx: ptr StorageContext, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) callback( RET_OK, @@ -140,53 +140,53 @@ proc codex_revision( return RET_OK -proc codex_repo( - ctx: ptr CodexContext, callback: CodexCallback, userData: pointer +proc storage_repo( + ctx: ptr StorageContext, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let reqContent = NodeInfoRequest.createShared(NodeInfoMsgType.REPO) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.INFO, reqContent, callback, userData ) return callback.okOrError(res, userData) -proc codex_debug( - ctx: ptr CodexContext, callback: CodexCallback, userData: pointer +proc storage_debug( + ctx: ptr StorageContext, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let reqContent = NodeDebugRequest.createShared(NodeDebugMsgType.DEBUG) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.DEBUG, reqContent, callback, userData ) return callback.okOrError(res, userData) -proc codex_spr( - ctx: ptr CodexContext, callback: CodexCallback, userData: pointer +proc storage_spr( + ctx: ptr StorageContext, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let reqContent = NodeInfoRequest.createShared(NodeInfoMsgType.SPR) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.INFO, reqContent, callback, userData ) return callback.okOrError(res, userData) -proc codex_peer_id( - ctx: ptr CodexContext, callback: CodexCallback, userData: pointer +proc storage_peer_id( + ctx: ptr StorageContext, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let reqContent = NodeInfoRequest.createShared(NodeInfoMsgType.PEERID) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.INFO, reqContent, callback, userData ) @@ -195,30 +195,33 @@ proc codex_peer_id( ## Set the log level of the library at runtime. ## It uses updateLogLevel which is a synchronous proc and ## cannot be used inside an async context because of gcsafe issue. -proc codex_log_level( - ctx: ptr CodexContext, logLevel: cstring, callback: CodexCallback, userData: pointer +proc storage_log_level( + ctx: ptr StorageContext, + logLevel: cstring, + callback: StorageCallback, + userData: pointer, ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let reqContent = NodeDebugRequest.createShared(NodeDebugMsgType.LOG_LEVEL, logLevel = logLevel) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.DEBUG, reqContent, callback, userData ) return callback.okOrError(res, userData) -proc codex_connect( - ctx: ptr CodexContext, +proc storage_connect( + ctx: ptr StorageContext, peerId: cstring, peerAddressesPtr: ptr cstring, peerAddressesLength: csize_t, - callback: CodexCallback, + callback: StorageCallback, userData: pointer, ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) var peerAddresses = newSeq[cstring](peerAddressesLength) let peers = cast[ptr UncheckedArray[cstring]](peerAddressesPtr) @@ -228,33 +231,36 @@ proc codex_connect( let reqContent = NodeP2PRequest.createShared( NodeP2PMsgType.CONNECT, peerId = peerId, peerAddresses = peerAddresses ) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.P2P, reqContent, callback, userData ) return callback.okOrError(res, userData) -proc codex_peer_debug( - ctx: ptr CodexContext, peerId: cstring, callback: CodexCallback, userData: pointer +proc storage_peer_debug( + ctx: ptr StorageContext, + peerId: cstring, + callback: StorageCallback, + userData: pointer, ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let reqContent = NodeDebugRequest.createShared(NodeDebugMsgType.PEER, peerId = peerId) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.DEBUG, reqContent, callback, userData ) return callback.okOrError(res, userData) -proc codex_close( - ctx: ptr CodexContext, callback: CodexCallback, userData: pointer +proc storage_close( + ctx: ptr StorageContext, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let reqContent = NodeLifecycleRequest.createShared(NodeLifecycleMsgType.CLOSE_NODE) - var res = codex_context.sendRequestToCodexThread( + var res = storage_context.sendRequestToStorageThread( ctx, RequestType.LIFECYCLE, reqContent, callback, userData ) if res.isErr: @@ -262,48 +268,48 @@ proc codex_close( return callback.okOrError(res, userData) -proc codex_destroy( - ctx: ptr CodexContext, callback: CodexCallback, userData: pointer +proc storage_destroy( + ctx: ptr StorageContext, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) - let res = codex_context.destroyCodexContext(ctx) + let res = storage_context.destroyStorageContext(ctx) if res.isErr: return RET_ERR return RET_OK -proc codex_upload_init( - ctx: ptr CodexContext, +proc storage_upload_init( + ctx: ptr StorageContext, filepath: cstring, chunkSize: csize_t, - callback: CodexCallback, + callback: StorageCallback, userData: pointer, ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let reqContent = NodeUploadRequest.createShared( NodeUploadMsgType.INIT, filepath = filepath, chunkSize = chunkSize ) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.UPLOAD, reqContent, callback, userData ) return callback.okOrError(res, userData) -proc codex_upload_chunk( - ctx: ptr CodexContext, +proc storage_upload_chunk( + ctx: ptr StorageContext, sessionId: cstring, data: ptr byte, len: csize_t, - callback: CodexCallback, + callback: StorageCallback, userData: pointer, ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let chunk = newSeq[byte](len) copyMem(addr chunk[0], data, len) @@ -311,111 +317,111 @@ proc codex_upload_chunk( let reqContent = NodeUploadRequest.createShared( NodeUploadMsgType.CHUNK, sessionId = sessionId, chunk = chunk ) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.UPLOAD, reqContent, callback, userData ) return callback.okOrError(res, userData) -proc codex_upload_finalize( - ctx: ptr CodexContext, +proc storage_upload_finalize( + ctx: ptr StorageContext, sessionId: cstring, - callback: CodexCallback, + callback: StorageCallback, userData: pointer, ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let reqContent = NodeUploadRequest.createShared(NodeUploadMsgType.FINALIZE, sessionId = sessionId) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.UPLOAD, reqContent, callback, userData ) return callback.okOrError(res, userData) -proc codex_upload_cancel( - ctx: ptr CodexContext, +proc storage_upload_cancel( + ctx: ptr StorageContext, sessionId: cstring, - callback: CodexCallback, + callback: StorageCallback, userData: pointer, ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let reqContent = NodeUploadRequest.createShared(NodeUploadMsgType.CANCEL, sessionId = sessionId) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.UPLOAD, reqContent, callback, userData ) return callback.okOrError(res, userData) -proc codex_upload_file( - ctx: ptr CodexContext, +proc storage_upload_file( + ctx: ptr StorageContext, sessionId: cstring, - callback: CodexCallback, + callback: StorageCallback, userData: pointer, ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let reqContent = NodeUploadRequest.createShared(NodeUploadMsgType.FILE, sessionId = sessionId) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.UPLOAD, reqContent, callback, userData ) return callback.okOrError(res, userData) -proc codex_download_init( - ctx: ptr CodexContext, +proc storage_download_init( + ctx: ptr StorageContext, cid: cstring, chunkSize: csize_t, local: bool, - callback: CodexCallback, + callback: StorageCallback, userData: pointer, ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let req = NodeDownloadRequest.createShared( NodeDownloadMsgType.INIT, cid = cid, chunkSize = chunkSize, local = local ) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.DOWNLOAD, req, callback, userData ) return callback.okOrError(res, userData) -proc codex_download_chunk( - ctx: ptr CodexContext, cid: cstring, callback: CodexCallback, userData: pointer +proc storage_download_chunk( + ctx: ptr StorageContext, cid: cstring, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let req = NodeDownloadRequest.createShared(NodeDownloadMsgType.CHUNK, cid = cid) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.DOWNLOAD, req, callback, userData ) return callback.okOrError(res, userData) -proc codex_download_stream( - ctx: ptr CodexContext, +proc storage_download_stream( + ctx: ptr StorageContext, cid: cstring, chunkSize: csize_t, local: bool, filepath: cstring, - callback: CodexCallback, + callback: StorageCallback, userData: pointer, ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let req = NodeDownloadRequest.createShared( NodeDownloadMsgType.STREAM, @@ -425,140 +431,140 @@ proc codex_download_stream( filepath = filepath, ) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.DOWNLOAD, req, callback, userData ) return callback.okOrError(res, userData) -proc codex_download_cancel( - ctx: ptr CodexContext, cid: cstring, callback: CodexCallback, userData: pointer +proc storage_download_cancel( + ctx: ptr StorageContext, cid: cstring, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let req = NodeDownloadRequest.createShared(NodeDownloadMsgType.CANCEL, cid = cid) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.DOWNLOAD, req, callback, userData ) return callback.okOrError(res, userData) -proc codex_download_manifest( - ctx: ptr CodexContext, cid: cstring, callback: CodexCallback, userData: pointer +proc storage_download_manifest( + ctx: ptr StorageContext, cid: cstring, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let req = NodeDownloadRequest.createShared(NodeDownloadMsgType.MANIFEST, cid = cid) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.DOWNLOAD, req, callback, userData ) return callback.okOrError(res, userData) -proc codex_storage_list( - ctx: ptr CodexContext, callback: CodexCallback, userData: pointer +proc storage_list( + ctx: ptr StorageContext, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let req = NodeStorageRequest.createShared(NodeStorageMsgType.LIST) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.STORAGE, req, callback, userData ) return callback.okOrError(res, userData) -proc codex_storage_space( - ctx: ptr CodexContext, callback: CodexCallback, userData: pointer +proc storage_space( + ctx: ptr StorageContext, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let req = NodeStorageRequest.createShared(NodeStorageMsgType.SPACE) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.STORAGE, req, callback, userData ) return callback.okOrError(res, userData) -proc codex_storage_delete( - ctx: ptr CodexContext, cid: cstring, callback: CodexCallback, userData: pointer +proc storage_delete( + ctx: ptr StorageContext, cid: cstring, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let req = NodeStorageRequest.createShared(NodeStorageMsgType.DELETE, cid = cid) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.STORAGE, req, callback, userData ) return callback.okOrError(res, userData) -proc codex_storage_fetch( - ctx: ptr CodexContext, cid: cstring, callback: CodexCallback, userData: pointer +proc storage_fetch( + ctx: ptr StorageContext, cid: cstring, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let req = NodeStorageRequest.createShared(NodeStorageMsgType.FETCH, cid = cid) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.STORAGE, req, callback, userData ) return callback.okOrError(res, userData) -proc codex_storage_exists( - ctx: ptr CodexContext, cid: cstring, callback: CodexCallback, userData: pointer +proc storage_exists( + ctx: ptr StorageContext, cid: cstring, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let req = NodeStorageRequest.createShared(NodeStorageMsgType.EXISTS, cid = cid) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.STORAGE, req, callback, userData ) return callback.okOrError(res, userData) -proc codex_start( - ctx: ptr CodexContext, callback: CodexCallback, userData: pointer +proc storage_start( + ctx: ptr StorageContext, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let reqContent: ptr NodeLifecycleRequest = NodeLifecycleRequest.createShared(NodeLifecycleMsgType.START_NODE) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.LIFECYCLE, reqContent, callback, userData ) return callback.okOrError(res, userData) -proc codex_stop( - ctx: ptr CodexContext, callback: CodexCallback, userData: pointer +proc storage_stop( + ctx: ptr StorageContext, callback: StorageCallback, userData: pointer ): cint {.dynlib, exportc.} = initializeLibrary() - checkLibcodexParams(ctx, callback, userData) + checkLibstorageParams(ctx, callback, userData) let reqContent: ptr NodeLifecycleRequest = NodeLifecycleRequest.createShared(NodeLifecycleMsgType.STOP_NODE) - let res = codex_context.sendRequestToCodexThread( + let res = storage_context.sendRequestToStorageThread( ctx, RequestType.LIFECYCLE, reqContent, callback, userData ) return callback.okOrError(res, userData) -proc codex_set_event_callback( - ctx: ptr CodexContext, callback: CodexCallback, userData: pointer +proc storage_set_event_callback( + ctx: ptr StorageContext, callback: StorageCallback, userData: pointer ) {.dynlib, exportc.} = initializeLibrary() ctx[].eventCallback = cast[pointer](callback) diff --git a/library/codex_context.nim b/library/storage_context.nim similarity index 54% rename from library/codex_context.nim rename to library/storage_context.nim index f1b6b1a5..260b6a98 100644 --- a/library/codex_context.nim +++ b/library/storage_context.nim @@ -1,8 +1,8 @@ -## This file defines the Codex context and its thread flow: -## 1. Client enqueues a request and signals the Codex thread. -## 2. The Codex thread dequeues the request and sends an ack (reqReceivedSignal). -## 3. The Codex thread executes the request asynchronously. -## 4. On completion, the Codex thread invokes the client callback with the result and userData. +## This file defines the Logos Storage context and its thread flow: +## 1. Client enqueues a request and signals the Logos Storage thread. +## 2. The Logos Storage thread dequeues the request and sends an ack (reqReceivedSignal). +## 3. The Logos Storage thread executes the request asynchronously. +## 4. On completion, the Logos Storage thread invokes the client callback with the result and userData. {.pragma: exported, exportc, cdecl, raises: [].} {.pragma: callback, cdecl, raises: [], gcsafe.} @@ -14,15 +14,15 @@ import chronos import chronos/threadsync import taskpools/channels_spsc_single import ./ffi_types -import ./codex_thread_requests/[codex_thread_request] +import ./storage_thread_requests/[storage_thread_request] from ../codex/codex import CodexServer logScope: - topics = "codexlib" + topics = "libstorage" -type CodexContext* = object - thread: Thread[(ptr CodexContext)] +type StorageContext* = object + thread: Thread[(ptr StorageContext)] # This lock is only necessary while we use a SP Channel and while the signalling # between threads assumes that there aren't concurrent requests. @@ -30,11 +30,11 @@ type CodexContext* = object # requests concurrently and spare us the need of locks lock: Lock - # Channel to send requests to the Codex thread. + # Channel to send requests to the Logos Storage thread. # Requests will be popped from this channel. - reqChannel: ChannelSPSCSingle[ptr CodexThreadRequest] + reqChannel: ChannelSPSCSingle[ptr StorageThreadRequest] - # To notify the Codex thread that a request is ready + # To notify the Logos Storage thread that a request is ready reqSignal: ThreadSignalPtr # To notify the client thread that the request was received. @@ -52,10 +52,10 @@ type CodexContext* = object # returned with every event callback eventUserData*: pointer - # Set to false to stop the Codex thread (during codex_destroy) + # Set to false to stop the Logos Storage thread (during storage_destroy) running: Atomic[bool] -template callEventCallback(ctx: ptr CodexContext, eventName: string, body: untyped) = +template callEventCallback(ctx: ptr StorageContext, eventName: string, body: untyped) = ## Template used to notify the client of global events ## Example: onConnectionChanged, onProofMissing, etc. if isNil(ctx[].eventCallback): @@ -65,22 +65,22 @@ template callEventCallback(ctx: ptr CodexContext, eventName: string, body: untyp foreignThreadGc: try: let event = body - cast[CodexCallback](ctx[].eventCallback)( + cast[StorageCallback](ctx[].eventCallback)( RET_OK, unsafeAddr event[0], cast[csize_t](len(event)), ctx[].eventUserData ) except CatchableError: let msg = "Exception " & eventName & " when calling 'eventCallBack': " & getCurrentExceptionMsg() - cast[CodexCallback](ctx[].eventCallback)( + cast[StorageCallback](ctx[].eventCallback)( RET_ERR, unsafeAddr msg[0], cast[csize_t](len(msg)), ctx[].eventUserData ) -proc sendRequestToCodexThread*( - ctx: ptr CodexContext, +proc sendRequestToStorageThread*( + ctx: ptr StorageContext, reqType: RequestType, reqContent: pointer, - callback: CodexCallback, + callback: StorageCallback, userData: pointer, timeout = InfiniteDuration, ): Result[void, string] = @@ -89,60 +89,62 @@ proc sendRequestToCodexThread*( defer: ctx.lock.release() - let req = CodexThreadRequest.createShared(reqType, reqContent, callback, userData) + let req = StorageThreadRequest.createShared(reqType, reqContent, callback, userData) - # Send the request to the Codex thread + # Send the request to the Logos Storage thread let sentOk = ctx.reqChannel.trySend(req) if not sentOk: deallocShared(req) - return err("Failed to send request to the codex thread: " & $req[]) + return err("Failed to send request to the Logos Storage thread: " & $req[]) - # Notify the Codex thread that a request is available + # Notify the Logos Storage thread that a request is available let fireSyncRes = ctx.reqSignal.fireSync() if fireSyncRes.isErr(): deallocShared(req) return err( - "Failed to send request to the codex thread: unable to fireSync: " & + "Failed to send request to the Logos Storage thread: unable to fireSync: " & $fireSyncRes.error ) if fireSyncRes.get() == false: deallocShared(req) - return err("Failed to send request to the codex thread: fireSync timed out.") + return + err("Failed to send request to the Logos Storage thread: fireSync timed out.") - # Wait until the Codex Thread properly received the request + # Wait until the Logos Storage thread properly received the request let res = ctx.reqReceivedSignal.waitSync(timeout) if res.isErr(): deallocShared(req) return err( - "Failed to send request to the codex thread: unable to receive reqReceivedSignal signal." + "Failed to send request to the Logos Storage thread: unable to receive reqReceivedSignal signal." ) - ## Notice that in case of "ok", the deallocShared(req) is performed by the Codex Thread in the - ## process proc. See the 'codex_thread_request.nim' module for more details. + ## Notice that in case of "ok", the deallocShared(req) is performed by the Logos Storage thread in the + ## process proc. See the 'storage_thread_request.nim' module for more details. ok() -proc runCodex(ctx: ptr CodexContext) {.async: (raises: []).} = - var codex: CodexServer +proc runStorage(ctx: ptr StorageContext) {.async: (raises: []).} = + var storage: CodexServer while true: try: # Wait until a request is available await ctx.reqSignal.wait() except Exception as e: - error "Failure in run codex thread while waiting for reqSignal.", error = e.msg + error "Failure in run Logos Storage thread while waiting for reqSignal.", + error = e.msg continue - # If codex_destroy was called, exit the loop + # If storage_destroy was called, exit the loop if ctx.running.load == false: break - var request: ptr CodexThreadRequest + var request: ptr StorageThreadRequest # Pop a request from the channel let recvOk = ctx.reqChannel.tryRecv(request) if not recvOk: - error "Failure in run codex: unable to receive request in codex thread." + error "Failure in run Storage: unable to receive request in Logos Storage thread." continue # yield immediately to the event loop @@ -151,42 +153,42 @@ proc runCodex(ctx: ptr CodexContext) {.async: (raises: []).} = asyncSpawn ( proc() {.async.} = await sleepAsync(0) - await CodexThreadRequest.process(request, addr codex) + await StorageThreadRequest.process(request, addr storage) )() # Notify the main thread that we picked up the request let fireRes = ctx.reqReceivedSignal.fireSync() if fireRes.isErr(): - error "Failure in run codex: unable to fire back to requester thread.", + error "Failure in run Storage: unable to fire back to requester thread.", error = fireRes.error -proc run(ctx: ptr CodexContext) {.thread.} = - waitFor runCodex(ctx) +proc run(ctx: ptr StorageContext) {.thread.} = + waitFor runStorage(ctx) -proc createCodexContext*(): Result[ptr CodexContext, string] = +proc createStorageContext*(): Result[ptr StorageContext, string] = ## This proc is called from the main thread and it creates - ## the Codex working thread. + ## the Logos Storage working thread. - # Allocates a CodexContext in shared memory (for the main thread) - var ctx = createShared(CodexContext, 1) + # Allocates a StorageContext in shared memory (for the main thread) + var ctx = createShared(StorageContext, 1) - # This signal is used by the main side to wake the Codex thread + # This signal is used by the main side to wake the Logos Storage thread # when a new request is enqueued. ctx.reqSignal = ThreadSignalPtr.new().valueOr: return err("Failed to create a context: unable to create reqSignal ThreadSignalPtr.") - # Used to let the caller know that the Codex thread has + # Used to let the caller know that the Logos Storage thread has # acknowledged / picked up a request (like a handshake). ctx.reqReceivedSignal = ThreadSignalPtr.new().valueOr: return err( - "Failed to create codex context: unable to create reqReceivedSignal ThreadSignalPtr." + "Failed to create Logos Storage context: unable to create reqReceivedSignal ThreadSignalPtr." ) - # Protects shared state inside CodexContext + # Protects shared state inside StorageContext ctx.lock.initLock() - # Codex thread will loop until codex_destroy is called + # Logos Storage thread will loop until storage_destroy is called ctx.running.store(true) try: @@ -194,23 +196,23 @@ proc createCodexContext*(): Result[ptr CodexContext, string] = except ValueError, ResourceExhaustedError: freeShared(ctx) return err( - "Failed to create codex context: unable to create thread: " & + "Failed to create Logos Storage context: unable to create thread: " & getCurrentExceptionMsg() ) return ok(ctx) -proc destroyCodexContext*(ctx: ptr CodexContext): Result[void, string] = - # Signal the Codex thread to stop +proc destroyStorageContext*(ctx: ptr StorageContext): Result[void, string] = + # Signal the Logos Storage thread to stop ctx.running.store(false) # Wake the worker up if it's waiting let signaledOnTime = ctx.reqSignal.fireSync().valueOr: - return err("Failed to destroy codex context: " & $error) + return err("Failed to destroy Logos Storage context: " & $error) if not signaledOnTime: return err( - "Failed to destroy codex context: unable to get signal reqSignal on time in destroyCodexContext." + "Failed to destroy Logos Storage context: unable to get signal reqSignal on time in destroyStorageContext." ) # Wait for the thread to finish diff --git a/library/codex_thread_requests/requests/node_debug_request.nim b/library/storage_thread_requests/requests/node_debug_request.nim similarity index 82% rename from library/codex_thread_requests/requests/node_debug_request.nim rename to library/storage_thread_requests/requests/node_debug_request.nim index d051ea16..405bce5e 100644 --- a/library/codex_thread_requests/requests/node_debug_request.nim +++ b/library/storage_thread_requests/requests/node_debug_request.nim @@ -1,8 +1,8 @@ {.push raises: [].} -## This file contains the debug info available with Codex. +## This file contains the debug info available with Logos Storage. ## The DEBUG type will return info about the P2P node. -## The PEER type is available only with codex_enable_api_debug_peers flag. +## The PEER type is available only with storage_enable_api_debug_peers flag. ## It will return info about a specific peer if available. import std/[options] @@ -17,7 +17,7 @@ import ../../../codex/node from ../../../codex/codex import CodexServer, node logScope: - topics = "codexlib codexlibdebug" + topics = "libstorage libstoragedebug" type NodeDebugMsgType* = enum DEBUG @@ -47,9 +47,9 @@ proc destroyShared(self: ptr NodeDebugRequest) = deallocShared(self) proc getDebug( - codex: ptr CodexServer + storage: ptr CodexServer ): Future[Result[string, string]] {.async: (raises: []).} = - let node = codex[].node + let node = storage[].node let table = RestRoutingTable.init(node.discovery.protocol.routingTable) let json = @@ -65,10 +65,10 @@ proc getDebug( return ok($json) proc getPeer( - codex: ptr CodexServer, peerId: cstring + storage: ptr CodexServer, peerId: cstring ): Future[Result[string, string]] {.async: (raises: []).} = - when codex_enable_api_debug_peers: - let node = codex[].node + when storage_enable_api_debug_peers: + let node = storage[].node let res = PeerId.init($peerId) if res.isErr: return err("Failed to get peer: invalid peer ID " & $peerId & ": " & $res.error()) @@ -89,7 +89,7 @@ proc getPeer( return err("Failed to get peer: peer debug API is disabled") proc updateLogLevel( - codex: ptr CodexServer, logLevel: cstring + storage: ptr CodexServer, logLevel: cstring ): Future[Result[string, string]] {.async: (raises: []).} = try: {.gcsafe.}: @@ -100,26 +100,26 @@ proc updateLogLevel( return ok("") proc process*( - self: ptr NodeDebugRequest, codex: ptr CodexServer + self: ptr NodeDebugRequest, storage: ptr CodexServer ): Future[Result[string, string]] {.async: (raises: []).} = defer: destroyShared(self) case self.operation of NodeDebugMsgType.DEBUG: - let res = (await getDebug(codex)) + let res = (await getDebug(storage)) if res.isErr: error "Failed to get DEBUG.", error = res.error return err($res.error) return res of NodeDebugMsgType.PEER: - let res = (await getPeer(codex, self.peerId)) + let res = (await getPeer(storage, self.peerId)) if res.isErr: error "Failed to get PEER.", error = res.error return err($res.error) return res of NodeDebugMsgType.LOG_LEVEL: - let res = (await updateLogLevel(codex, self.logLevel)) + let res = (await updateLogLevel(storage, self.logLevel)) if res.isErr: error "Failed to update LOG_LEVEL.", error = res.error return err($res.error) diff --git a/library/codex_thread_requests/requests/node_download_request.nim b/library/storage_thread_requests/requests/node_download_request.nim similarity index 90% rename from library/codex_thread_requests/requests/node_download_request.nim rename to library/storage_thread_requests/requests/node_download_request.nim index 394b667e..1d8ef59c 100644 --- a/library/codex_thread_requests/requests/node_download_request.nim +++ b/library/storage_thread_requests/requests/node_download_request.nim @@ -30,7 +30,7 @@ from ../../../codex/rest/json import `%`, RestContent from libp2p import Cid, init, `$` logScope: - topics = "codexlib codexlibdownload" + topics = "libstorage libstoragedownload" type NodeDownloadMsgType* = enum INIT @@ -80,7 +80,7 @@ proc destroyShared(self: ptr NodeDownloadRequest) = deallocShared(self) proc init( - codex: ptr CodexServer, cCid: cstring = "", chunkSize: csize_t = 0, local: bool + storage: ptr CodexServer, cCid: cstring = "", chunkSize: csize_t = 0, local: bool ): Future[Result[string, string]] {.async: (raises: []).} = ## Init a new session to download the file identified by cid. ## @@ -96,7 +96,7 @@ proc init( if downloadSessions.contains($cid): return ok("Download session already exists.") - let node = codex[].node + let node = storage[].node var stream: LPStream try: @@ -114,7 +114,7 @@ proc init( return ok("") proc chunk( - codex: ptr CodexServer, cCid: cstring = "", onChunk: OnChunkHandler + storage: ptr CodexServer, cCid: cstring = "", onChunk: OnChunkHandler ): Future[Result[string, string]] {.async: (raises: []).} = ## Download the next chunk of the file identified by cid. ## The chunk is passed to the onChunk handler. @@ -164,7 +164,7 @@ proc chunk( return ok("") proc streamData( - codex: ptr CodexServer, + storage: ptr CodexServer, stream: LPStream, onChunk: OnChunkHandler, chunkSize: csize_t, @@ -207,7 +207,7 @@ proc streamData( return ok("") proc stream( - codex: ptr CodexServer, + storage: ptr CodexServer, cCid: cstring, chunkSize: csize_t, local: bool, @@ -232,11 +232,11 @@ proc stream( except KeyError: return err("Failed to stream: no session for cid " & $cid) - let node = codex[].node + let node = storage[].node try: let res = - await noCancel codex.streamData(session.stream, onChunk, chunkSize, filepath) + await noCancel storage.streamData(session.stream, onChunk, chunkSize, filepath) if res.isErr: return err($res.error) except LPStreamError as e: @@ -251,7 +251,7 @@ proc stream( return ok("") proc cancel( - codex: ptr CodexServer, cCid: cstring + storage: ptr CodexServer, cCid: cstring ): Future[Result[string, string]] {.raises: [], async: (raises: []).} = ## Cancel the download session identified by cid. ## This operation is not supported when using the stream mode, @@ -279,14 +279,14 @@ proc cancel( return ok("") proc manifest( - codex: ptr CodexServer, cCid: cstring + storage: ptr CodexServer, cCid: cstring ): Future[Result[string, string]] {.raises: [], async: (raises: []).} = let cid = Cid.init($cCid) if cid.isErr: return err("Failed to fetch manifest: cannot parse cid: " & $cCid) try: - let node = codex[].node + let node = storage[].node let manifest = await node.fetchManifest(cid.get()) if manifest.isErr: return err("Failed to fetch manifest: " & manifest.error.msg) @@ -296,40 +296,42 @@ proc manifest( return err("Failed to fetch manifest: download cancelled.") proc process*( - self: ptr NodeDownloadRequest, codex: ptr CodexServer, onChunk: OnChunkHandler + self: ptr NodeDownloadRequest, storage: ptr CodexServer, onChunk: OnChunkHandler ): Future[Result[string, string]] {.async: (raises: []).} = defer: destroyShared(self) case self.operation of NodeDownloadMsgType.INIT: - let res = (await init(codex, self.cid, self.chunkSize, self.local)) + let res = (await init(storage, self.cid, self.chunkSize, self.local)) if res.isErr: error "Failed to INIT.", error = res.error return err($res.error) return res of NodeDownloadMsgType.CHUNK: - let res = (await chunk(codex, self.cid, onChunk)) + let res = (await chunk(storage, self.cid, onChunk)) if res.isErr: error "Failed to CHUNK.", error = res.error return err($res.error) return res of NodeDownloadMsgType.STREAM: let res = ( - await stream(codex, self.cid, self.chunkSize, self.local, self.filepath, onChunk) + await stream( + storage, self.cid, self.chunkSize, self.local, self.filepath, onChunk + ) ) if res.isErr: error "Failed to STREAM.", error = res.error return err($res.error) return res of NodeDownloadMsgType.CANCEL: - let res = (await cancel(codex, self.cid)) + let res = (await cancel(storage, self.cid)) if res.isErr: error "Failed to CANCEL.", error = res.error return err($res.error) return res of NodeDownloadMsgType.MANIFEST: - let res = (await manifest(codex, self.cid)) + let res = (await manifest(storage, self.cid)) if res.isErr: error "Failed to MANIFEST.", error = res.error return err($res.error) diff --git a/library/codex_thread_requests/requests/node_info_request.nim b/library/storage_thread_requests/requests/node_info_request.nim similarity index 77% rename from library/codex_thread_requests/requests/node_info_request.nim rename to library/storage_thread_requests/requests/node_info_request.nim index 2e397fcf..cbf364e8 100644 --- a/library/codex_thread_requests/requests/node_info_request.nim +++ b/library/storage_thread_requests/requests/node_info_request.nim @@ -12,7 +12,7 @@ import ../../../codex/node from ../../../codex/codex import CodexServer, config, node logScope: - topics = "codexlib codexlibinfo" + topics = "libstorage libstorageinfo" type NodeInfoMsgType* = enum REPO @@ -31,45 +31,45 @@ proc destroyShared(self: ptr NodeInfoRequest) = deallocShared(self) proc getRepo( - codex: ptr CodexServer + storage: ptr CodexServer ): Future[Result[string, string]] {.async: (raises: []).} = - return ok($(codex[].config.dataDir)) + return ok($(storage[].config.dataDir)) proc getSpr( - codex: ptr CodexServer + storage: ptr CodexServer ): Future[Result[string, string]] {.async: (raises: []).} = - let spr = codex[].node.discovery.dhtRecord + let spr = storage[].node.discovery.dhtRecord if spr.isNone: return err("Failed to get SPR: no SPR record found.") return ok(spr.get.toURI) proc getPeerId( - codex: ptr CodexServer + storage: ptr CodexServer ): Future[Result[string, string]] {.async: (raises: []).} = - return ok($codex[].node.switch.peerInfo.peerId) + return ok($storage[].node.switch.peerInfo.peerId) proc process*( - self: ptr NodeInfoRequest, codex: ptr CodexServer + self: ptr NodeInfoRequest, storage: ptr CodexServer ): Future[Result[string, string]] {.async: (raises: []).} = defer: destroyShared(self) case self.operation of REPO: - let res = (await getRepo(codex)) + let res = (await getRepo(storage)) if res.isErr: error "Failed to get REPO.", error = res.error return err($res.error) return res of SPR: - let res = (await getSpr(codex)) + let res = (await getSpr(storage)) if res.isErr: error "Failed to get SPR.", error = res.error return err($res.error) return res of PEERID: - let res = (await getPeerId(codex)) + let res = (await getPeerId(storage)) if res.isErr: error "Failed to get PEERID.", error = res.error return err($res.error) diff --git a/library/codex_thread_requests/requests/node_lifecycle_request.nim b/library/storage_thread_requests/requests/node_lifecycle_request.nim similarity index 81% rename from library/codex_thread_requests/requests/node_lifecycle_request.nim rename to library/storage_thread_requests/requests/node_lifecycle_request.nim index 532facf3..2963f795 100644 --- a/library/codex_thread_requests/requests/node_lifecycle_request.nim +++ b/library/storage_thread_requests/requests/node_lifecycle_request.nim @@ -1,7 +1,7 @@ ## This file contains the lifecycle request type that will be handled. -## CREATE_NODE: create a new Codex node with the provided config.json. -## START_NODE: start the provided Codex node. -## STOP_NODE: stop the provided Codex node. +## CREATE_NODE: create a new Logos Storage node with the provided config.json. +## START_NODE: start the provided Logos Storage node. +## STOP_NODE: stop the provided Logos Storage node. import std/[options, json, strutils, net, os] import codexdht/discv5/spr @@ -25,7 +25,7 @@ import ../../../codex/units from ../../../codex/codex import CodexServer, new, start, stop, close logScope: - topics = "codexlib codexliblifecycle" + topics = "libstorage libstoragelifecycle" type NodeLifecycleMsgType* = enum CREATE_NODE @@ -88,7 +88,7 @@ proc destroyShared(self: ptr NodeLifecycleRequest) = deallocShared(self[].configJson) deallocShared(self) -proc createCodex( +proc createStorage( configJson: cstring ): Future[Result[CodexServer, string]] {.async: (raises: []).} = var conf: CodexConf @@ -96,7 +96,7 @@ proc createCodex( try: conf = CodexConf.load( version = codexFullVersion, - envVarsPrefix = "codex", + envVarsPrefix = "storage", cmdLine = @[], secondarySources = proc( config: CodexConf, sources: auto @@ -106,7 +106,7 @@ proc createCodex( , ) except ConfigurationError as e: - return err("Failed to create codex: unable to load configuration: " & e.msg) + return err("Failed to create Storage: unable to load configuration: " & e.msg) conf.setupLogging() @@ -114,7 +114,7 @@ proc createCodex( {.gcsafe.}: updateLogLevel(conf.logLevel) except ValueError as err: - return err("Failed to create codex: invalid value for log level: " & err.msg) + return err("Failed to create Storage: invalid value for log level: " & err.msg) conf.setupMetrics() @@ -122,14 +122,14 @@ proc createCodex( # We are unable to access/create data folder or data folder's # permissions are insecure. return err( - "Failed to create codex: unable to access/create data folder or data folder's permissions are insecure." + "Failed to create Storage: unable to access/create data folder or data folder's permissions are insecure." ) if not (checkAndCreateDataDir((conf.dataDir / "repo"))): # We are unable to access/create data folder or data folder's # permissions are insecure. return err( - "Failed to create codex: unable to access/create data folder or data folder's permissions are insecure." + "Failed to create Storage: unable to access/create data folder or data folder's permissions are insecure." ) let keyPath = @@ -139,7 +139,7 @@ proc createCodex( conf.dataDir / conf.netPrivKeyFile let privateKey = setupKey(keyPath) if privateKey.isErr: - return err("Failed to create codex: unable to get the private key.") + return err("Failed to create Storage: unable to get the private key.") let pk = privateKey.get() conf.apiBindAddress = string.none @@ -148,20 +148,20 @@ proc createCodex( try: CodexServer.new(conf, pk) except Exception as exc: - return err("Failed to create codex: " & exc.msg) + return err("Failed to create Storage: " & exc.msg) return ok(server) proc process*( - self: ptr NodeLifecycleRequest, codex: ptr CodexServer + self: ptr NodeLifecycleRequest, storage: ptr CodexServer ): Future[Result[string, string]] {.async: (raises: []).} = defer: destroyShared(self) case self.operation of CREATE_NODE: - codex[] = ( - await createCodex( + storage[] = ( + await createStorage( self.configJson # , self.appCallbacks ) ).valueOr: @@ -169,19 +169,19 @@ proc process*( return err($error) of START_NODE: try: - await codex[].start() + await storage[].start() except Exception as e: error "Failed to START_NODE.", error = e.msg return err(e.msg) of STOP_NODE: try: - await codex[].stop() + await storage[].stop() except Exception as e: error "Failed to STOP_NODE.", error = e.msg return err(e.msg) of CLOSE_NODE: try: - await codex[].close() + await storage[].close() except Exception as e: error "Failed to STOP_NODE.", error = e.msg return err(e.msg) diff --git a/library/codex_thread_requests/requests/node_p2p_request.nim b/library/storage_thread_requests/requests/node_p2p_request.nim similarity index 89% rename from library/codex_thread_requests/requests/node_p2p_request.nim rename to library/storage_thread_requests/requests/node_p2p_request.nim index 3bdbbf97..dd06eb39 100644 --- a/library/codex_thread_requests/requests/node_p2p_request.nim +++ b/library/storage_thread_requests/requests/node_p2p_request.nim @@ -13,7 +13,7 @@ import ../../../codex/node from ../../../codex/codex import CodexServer, node logScope: - topics = "codexlib codexlibp2p" + topics = "libstorage libstoragep2p" type NodeP2PMsgType* = enum CONNECT @@ -40,9 +40,9 @@ proc destroyShared(self: ptr NodeP2PRequest) = deallocShared(self) proc connect( - codex: ptr CodexServer, peerId: cstring, peerAddresses: seq[cstring] = @[] + storage: ptr CodexServer, peerId: cstring, peerAddresses: seq[cstring] = @[] ): Future[Result[string, string]] {.async: (raises: []).} = - let node = codex[].node + let node = storage[].node let res = PeerId.init($peerId) if res.isErr: return err("Failed to connect to peer: invalid peer ID: " & $res.error()) @@ -81,14 +81,14 @@ proc connect( return ok("") proc process*( - self: ptr NodeP2PRequest, codex: ptr CodexServer + self: ptr NodeP2PRequest, storage: ptr CodexServer ): Future[Result[string, string]] {.async: (raises: []).} = defer: destroyShared(self) case self.operation of NodeP2PMsgType.CONNECT: - let res = (await connect(codex, self.peerId, self.peerAddresses)) + let res = (await connect(storage, self.peerId, self.peerAddresses)) if res.isErr: error "Failed to CONNECT.", error = res.error return err($res.error) diff --git a/library/codex_thread_requests/requests/node_storage_request.nim b/library/storage_thread_requests/requests/node_storage_request.nim similarity index 87% rename from library/codex_thread_requests/requests/node_storage_request.nim rename to library/storage_thread_requests/requests/node_storage_request.nim index 21eceb17..72ee14f9 100644 --- a/library/codex_thread_requests/requests/node_storage_request.nim +++ b/library/storage_thread_requests/requests/node_storage_request.nim @@ -24,7 +24,7 @@ from ../../../codex/node import from libp2p import Cid, init, `$` logScope: - topics = "codexlib codexlibstorage" + topics = "libstorage libstoragestorage" type NodeStorageMsgType* = enum LIST @@ -61,14 +61,14 @@ type ManifestWithCid = object manifest {.serialize.}: Manifest proc list( - codex: ptr CodexServer + storage: ptr CodexServer ): Future[Result[string, string]] {.async: (raises: []).} = var manifests = newSeq[ManifestWithCid]() proc onManifest(cid: Cid, manifest: Manifest) {.raises: [], gcsafe.} = manifests.add(ManifestWithCid(cid: $cid, manifest: manifest)) try: - let node = codex[].node + let node = storage[].node await node.iterateManifests(onManifest) except CancelledError: return err("Failed to list manifests: cancelled operation.") @@ -78,13 +78,13 @@ proc list( return ok(serde.toJson(manifests)) proc delete( - codex: ptr CodexServer, cCid: cstring + storage: ptr CodexServer, cCid: cstring ): Future[Result[string, string]] {.async: (raises: []).} = let cid = Cid.init($cCid) if cid.isErr: return err("Failed to delete the data: cannot parse cid: " & $cCid) - let node = codex[].node + let node = storage[].node try: let res = await node.delete(cid.get()) if res.isErr: @@ -97,14 +97,14 @@ proc delete( return ok("") proc fetch( - codex: ptr CodexServer, cCid: cstring + storage: ptr CodexServer, cCid: cstring ): Future[Result[string, string]] {.async: (raises: []).} = let cid = Cid.init($cCid) if cid.isErr: return err("Failed to fetch the data: cannot parse cid: " & $cCid) try: - let node = codex[].node + let node = storage[].node let manifest = await node.fetchManifest(cid.get()) if manifest.isErr: return err("Failed to fetch the data: " & manifest.error.msg) @@ -116,9 +116,9 @@ proc fetch( return err("Failed to fetch the data: download cancelled.") proc space( - codex: ptr CodexServer + storage: ptr CodexServer ): Future[Result[string, string]] {.async: (raises: []).} = - let repoStore = codex[].repoStore + let repoStore = storage[].repoStore let space = StorageSpace( totalBlocks: repoStore.totalBlocks, quotaMaxBytes: repoStore.quotaMaxBytes, @@ -128,52 +128,52 @@ proc space( return ok(serde.toJson(space)) proc exists( - codex: ptr CodexServer, cCid: cstring + storage: ptr CodexServer, cCid: cstring ): Future[Result[string, string]] {.async: (raises: []).} = let cid = Cid.init($cCid) if cid.isErr: return err("Failed to check the data existence: cannot parse cid: " & $cCid) try: - let node = codex[].node + let node = storage[].node let exists = await node.hasLocalBlock(cid.get()) return ok($exists) except CancelledError: return err("Failed to check the data existence: operation cancelled.") proc process*( - self: ptr NodeStorageRequest, codex: ptr CodexServer + self: ptr NodeStorageRequest, storage: ptr CodexServer ): Future[Result[string, string]] {.async: (raises: []).} = defer: destroyShared(self) case self.operation of NodeStorageMsgType.LIST: - let res = (await list(codex)) + let res = (await list(storage)) if res.isErr: error "Failed to LIST.", error = res.error return err($res.error) return res of NodeStorageMsgType.DELETE: - let res = (await delete(codex, self.cid)) + let res = (await delete(storage, self.cid)) if res.isErr: error "Failed to DELETE.", error = res.error return err($res.error) return res of NodeStorageMsgType.FETCH: - let res = (await fetch(codex, self.cid)) + let res = (await fetch(storage, self.cid)) if res.isErr: error "Failed to FETCH.", error = res.error return err($res.error) return res of NodeStorageMsgType.SPACE: - let res = (await space(codex)) + let res = (await space(storage)) if res.isErr: error "Failed to SPACE.", error = res.error return err($res.error) return res of NodeStorageMsgType.EXISTS: - let res = (await exists(codex, self.cid)) + let res = (await exists(storage, self.cid)) if res.isErr: error "Failed to EXISTS.", error = res.error return err($res.error) diff --git a/library/codex_thread_requests/requests/node_upload_request.nim b/library/storage_thread_requests/requests/node_upload_request.nim similarity index 93% rename from library/codex_thread_requests/requests/node_upload_request.nim rename to library/storage_thread_requests/requests/node_upload_request.nim index a850abb7..17ef1e8e 100644 --- a/library/codex_thread_requests/requests/node_upload_request.nim +++ b/library/storage_thread_requests/requests/node_upload_request.nim @@ -32,7 +32,7 @@ from ../../../codex/node import store from libp2p import Cid, `$` logScope: - topics = "codexlib codexlibupload" + topics = "libstorage libstorageupload" type NodeUploadMsgType* = enum INIT @@ -86,7 +86,7 @@ proc destroyShared(self: ptr NodeUploadRequest) = deallocShared(self) proc init( - codex: ptr CodexServer, filepath: cstring = "", chunkSize: csize_t = 0 + storage: ptr CodexServer, filepath: cstring = "", chunkSize: csize_t = 0 ): Future[Result[string, string]] {.async: (raises: []).} = ## Init a new session upload and return its ID. ## The session contains the future corresponding to the @@ -133,7 +133,7 @@ proc init( let stream = BufferStream.new() let lpStream = LPStream(stream) - let node = codex[].node + let node = storage[].node let onBlockStored = proc(chunk: seq[byte]): void {.gcsafe, raises: [].} = try: @@ -156,7 +156,7 @@ proc init( return ok(sessionId) proc chunk( - codex: ptr CodexServer, sessionId: cstring, chunk: seq[byte] + storage: ptr CodexServer, sessionId: cstring, chunk: seq[byte] ): Future[Result[string, string]] {.async: (raises: []).} = ## Upload a chunk of data to the session identified by sessionId. ## The chunk is pushed to the BufferStream of the session. @@ -205,7 +205,7 @@ proc chunk( return ok("") proc finalize( - codex: ptr CodexServer, sessionId: cstring + storage: ptr CodexServer, sessionId: cstring ): Future[Result[string, string]] {.async: (raises: []).} = ## Finalize the upload session identified by sessionId. ## This closes the BufferStream and waits for the `node.store` future @@ -242,7 +242,7 @@ proc finalize( session.fut.cancelSoon() proc cancel( - codex: ptr CodexServer, sessionId: cstring + storage: ptr CodexServer, sessionId: cstring ): Future[Result[string, string]] {.async: (raises: []).} = ## Cancel the upload session identified by sessionId. ## This cancels the `node.store` future and removes the session @@ -293,7 +293,7 @@ proc streamFile( return err("Failed to stream the file: " & $e.msg) proc file( - codex: ptr CodexServer, sessionId: cstring, onProgress: OnProgressHandler + storage: ptr CodexServer, sessionId: cstring, onProgress: OnProgressHandler ): Future[Result[string, string]] {.async: (raises: []).} = ## Starts the file upload for the session identified by sessionId. ## Will call finalize when done and return the CID of the uploaded file. @@ -314,7 +314,7 @@ proc file( if res.isErr: return err("Failed to upload the file: " & res.error) - return await codex.finalize(sessionId) + return await storage.finalize(sessionId) except KeyError: return err("Failed to upload the file, the session is not found: " & $sessionId) except LPStreamError, IOError: @@ -333,7 +333,7 @@ proc file( proc process*( self: ptr NodeUploadRequest, - codex: ptr CodexServer, + storage: ptr CodexServer, onUploadProgress: OnProgressHandler = nil, ): Future[Result[string, string]] {.async: (raises: []).} = defer: @@ -341,31 +341,31 @@ proc process*( case self.operation of NodeUploadMsgType.INIT: - let res = (await init(codex, self.filepath, self.chunkSize)) + let res = (await init(storage, self.filepath, self.chunkSize)) if res.isErr: error "Failed to INIT.", error = res.error return err($res.error) return res of NodeUploadMsgType.CHUNK: - let res = (await chunk(codex, self.sessionId, self.chunk)) + let res = (await chunk(storage, self.sessionId, self.chunk)) if res.isErr: error "Failed to CHUNK.", error = res.error return err($res.error) return res of NodeUploadMsgType.FINALIZE: - let res = (await finalize(codex, self.sessionId)) + let res = (await finalize(storage, self.sessionId)) if res.isErr: error "Failed to FINALIZE.", error = res.error return err($res.error) return res of NodeUploadMsgType.CANCEL: - let res = (await cancel(codex, self.sessionId)) + let res = (await cancel(storage, self.sessionId)) if res.isErr: error "Failed to CANCEL.", error = res.error return err($res.error) return res of NodeUploadMsgType.FILE: - let res = (await file(codex, self.sessionId, onUploadProgress)) + let res = (await file(storage, self.sessionId, onUploadProgress)) if res.isErr: error "Failed to FILE.", error = res.error return err($res.error) diff --git a/library/codex_thread_requests/codex_thread_request.nim b/library/storage_thread_requests/storage_thread_request.nim similarity index 79% rename from library/codex_thread_requests/codex_thread_request.nim rename to library/storage_thread_requests/storage_thread_request.nim index 2229cddf..375bf1b8 100644 --- a/library/codex_thread_requests/codex_thread_request.nim +++ b/library/storage_thread_requests/storage_thread_request.nim @@ -1,6 +1,6 @@ ## This file contains the base message request type that will be handled. ## The requests are created by the main thread and processed by -## the Codex Thread. +## the Logos Storage Thread. import std/json import results @@ -25,24 +25,24 @@ type RequestType* {.pure.} = enum DOWNLOAD STORAGE -type CodexThreadRequest* = object +type StorageThreadRequest* = object reqType: RequestType # Request payloed reqContent: pointer # Callback to notify the client thread of the result - callback: CodexCallback + callback: StorageCallback # Custom state attached by the client to the request, # returned when its callback is invoked. userData: pointer proc createShared*( - T: type CodexThreadRequest, + T: type StorageThreadRequest, reqType: RequestType, reqContent: pointer, - callback: CodexCallback, + callback: StorageCallback, userData: pointer, ): ptr type T = var ret = createShared(T) @@ -57,9 +57,9 @@ proc createShared*( # and no further requests can be processed. # We can improve this by dispatching the callbacks to a thread pool or # moving to a MP channel. -# See: https://github.com/codex-storage/nim-codex/pull/1322#discussion_r2340708316 +# See: https://github.com/logos-storage/logos-storage-nim/pull/1322#discussion_r2340708316 proc handleRes[T: string | void | seq[byte]]( - res: Result[T, string], request: ptr CodexThreadRequest + res: Result[T, string], request: ptr StorageThreadRequest ) = ## Handles the Result responses, which can either be Result[string, string] or ## Result[void, string]. @@ -87,22 +87,24 @@ proc handleRes[T: string | void | seq[byte]]( return proc process*( - T: type CodexThreadRequest, request: ptr CodexThreadRequest, codex: ptr CodexServer + T: type StorageThreadRequest, + request: ptr StorageThreadRequest, + storage: ptr CodexServer, ) {.async: (raises: []).} = - ## Processes the request in the Codex thread. + ## Processes the request in the Logos Storage thread. ## Dispatch to the appropriate request handler based on reqType. let retFut = case request[].reqType of LIFECYCLE: - cast[ptr NodeLifecycleRequest](request[].reqContent).process(codex) + cast[ptr NodeLifecycleRequest](request[].reqContent).process(storage) of INFO: - cast[ptr NodeInfoRequest](request[].reqContent).process(codex) + cast[ptr NodeInfoRequest](request[].reqContent).process(storage) of RequestType.DEBUG: - cast[ptr NodeDebugRequest](request[].reqContent).process(codex) + cast[ptr NodeDebugRequest](request[].reqContent).process(storage) of P2P: - cast[ptr NodeP2PRequest](request[].reqContent).process(codex) + cast[ptr NodeP2PRequest](request[].reqContent).process(storage) of STORAGE: - cast[ptr NodeStorageRequest](request[].reqContent).process(codex) + cast[ptr NodeStorageRequest](request[].reqContent).process(storage) of DOWNLOAD: let onChunk = proc(bytes: seq[byte]) = if bytes.len > 0: @@ -113,14 +115,16 @@ proc process*( request[].userData, ) - cast[ptr NodeDownloadRequest](request[].reqContent).process(codex, onChunk) + cast[ptr NodeDownloadRequest](request[].reqContent).process(storage, onChunk) of UPLOAD: let onBlockReceived = proc(bytes: int) = request[].callback(RET_PROGRESS, nil, cast[csize_t](bytes), request[].userData) - cast[ptr NodeUploadRequest](request[].reqContent).process(codex, onBlockReceived) + cast[ptr NodeUploadRequest](request[].reqContent).process( + storage, onBlockReceived + ) handleRes(await retFut, request) -proc `$`*(self: CodexThreadRequest): string = +proc `$`*(self: StorageThreadRequest): string = return $self.reqType diff --git a/metrics/README.md b/metrics/README.md index 411d6357..f21d74e9 100644 --- a/metrics/README.md +++ b/metrics/README.md @@ -1,6 +1,6 @@ -# Codex Metrics and Dashboard +# Logos Storage Metrics and Dashboard -> This readme should help you to get started with collecting and visualizing metrics exposed by the Codex process. +> This readme should help you to get started with collecting and visualizing metrics exposed by the Logos Storage process. ## Metrics @@ -12,7 +12,7 @@ Use the `--metrics-address` and `--metrics-port` flags to to adjust the address Metrics are useful to monitor the health of the process and should aid in identifying and debugging potential issues that would be hard to notice otherwise. -All Codex metrics should be prefixed with the `codex_` prefix to be able to differentiate from metrics exposed by other subsystems. For example libp2p generally prefixed with the `libp2p_` prefix. +All Logos Storage metrics should be prefixed with the `codex_` prefix to be able to differentiate from metrics exposed by other subsystems. For example libp2p generally prefixed with the `libp2p_` prefix. Metrics can be added on an as needed basis, however, keep in mind the potential overhead they might introduce. In particular, be careful with labels as they will generate as many metrics as there are labels for a specific collector. If a metrics or a set of metrics are expensive, it is usually advisable to put them behind a compile time flag. diff --git a/metrics/codex-grafana-dashboard.json b/metrics/codex-grafana-dashboard.json index 3f2913e4..179b597d 100644 --- a/metrics/codex-grafana-dashboard.json +++ b/metrics/codex-grafana-dashboard.json @@ -101,7 +101,7 @@ "refId": "A" } ], - "title": "Codex Inflight Discovery", + "title": "Logos Storage Inflight Discovery", "type": "stat" }, { @@ -1219,7 +1219,7 @@ ] }, "timezone": "", - "title": "Codex Dashboard", + "title": "Logos Storage Dashboard", "uid": "pgeNfj2Wz2b", "version": 24, "weekStart": "" diff --git a/nix/README.md b/nix/README.md index fa34ffe2..f389f568 100644 --- a/nix/README.md +++ b/nix/README.md @@ -9,7 +9,7 @@ nix develop '.?submodules=1#' ## Building -To build a Codex you can use: +To build a Logos Storage you can use: ```sh nix build '.?submodules=1#default' ``` @@ -19,13 +19,13 @@ https://github.com/NixOS/nix/issues/4423 It can be also done without even cloning the repo: ```sh -nix build 'git+https://github.com/codex-storage/nim-codex?submodules=1#' +nix build 'git+https://github.com/logos-storage/logos-storage-nim?submodules=1#' ``` ## Running ```sh -nix run 'git+https://github.com/codex-storage/nim-codex?submodules=1#'' +nix run 'git+https://github.com/logos-storage/logos-storage-nim?submodules=1#'' ``` ## Testing @@ -34,26 +34,26 @@ nix run 'git+https://github.com/codex-storage/nim-codex?submodules=1#'' nix flake check ".?submodules=1#" ``` -## Running Nim-Codex as a service on NixOS +## Running Logos Storage as a service on NixOS -Include nim-codex flake in your flake inputs: +Include logos-storage-nim flake in your flake inputs: ```nix inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; - nim-codex-flake.url = "git+https://github.com/codex-storage/nim-codex?submodules=1#"; + logos-storage-nim-flake.url = "git+https://github.com/logos-storage/logos-storage-nim?submodules=1#"; }; ``` To configure the service, you can use the following example: ```nix -services.nim-codex = { +services.logos-storage-nim = { enable = true; settings = { - data-dir = "/var/lib/codex-test"; + data-dir = "/var/lib/storage-test"; }; }; ``` The settings attribute set corresponds directly to the layout of the TOML configuration file -used by nim-codex. Each option follows the same naming convention as the CLI flags, but +used by logos-storage-nim. Each option follows the same naming convention as the CLI flags, but with the -- prefix removed. For more details on the TOML file structure and options, -refer to the official documentation: [nim-codex configuration file](https://docs.codex.storage/learn/run#configuration-file). \ No newline at end of file +refer to the official documentation: [logos-storage-nim configuration file](https://docs.codex.storage/learn/run#configuration-file). \ No newline at end of file diff --git a/nix/default.nix b/nix/default.nix index b5823f86..3b2d7fad 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -13,7 +13,7 @@ # Perform 2-stage bootstrap instead of 3-stage to save time. quickAndDirty ? true, circomCompatPkg ? ( - builtins.getFlake "github:codex-storage/circom-compat-ffi" + builtins.getFlake "github:logos-storage/circom-compat-ffi" ).packages.${builtins.currentSystem}.default }: @@ -28,7 +28,7 @@ let tools = callPackage ./tools.nix {}; in pkgs.gcc13Stdenv.mkDerivation rec { - pname = "codex"; + pname = "storage"; version = "${tools.findKeyValue "version = \"([0-9]+\.[0-9]+\.[0-9]+)\"" ../codex.nimble}-${revision}"; @@ -84,12 +84,12 @@ in pkgs.gcc13Stdenv.mkDerivation rec { installPhase = '' mkdir -p $out/bin - cp build/codex $out/bin/ + cp build/storage $out/bin/ ''; meta = with pkgs.lib; { - description = "Nim Codex storage system"; - homepage = "https://github.com/codex-storage/nim-codex"; + description = "Logos Storage storage system"; + homepage = "https://github.com/logos-storage/logos-storage-nim"; license = licenses.mit; platforms = stableSystems; }; diff --git a/nix/service.nix b/nix/service.nix index c22a2166..345feb9b 100644 --- a/nix/service.nix +++ b/nix/service.nix @@ -7,18 +7,18 @@ let toml = pkgs.formats.toml { }; - cfg = config.services.nim-codex; + cfg = config.services.logos-storage-nim; in { options = { - services.nim-codex = { - enable = mkEnableOption "Nim Codex Node service."; + services.logos-storage-nim = { + enable = mkEnableOption "Logos Storage Node service."; package = mkOption { type = types.package; default = pkgs.callPackage ./default.nix { src = self; inherit circomCompatPkg; }; defaultText = literalExpression "pkgs.codex"; - description = mdDoc "Package to use as Nim Codex node."; + description = mdDoc "Package to use as Nim Logos Storage node."; }; settings = mkOption { @@ -31,10 +31,10 @@ in config = mkIf cfg.enable { environment.etc = { - "nim-codex/config.toml".source = toml.generate "config.toml" cfg.settings; + "logos-storage-nim/config.toml".source = toml.generate "config.toml" cfg.settings; }; - systemd.services.nim-codex = { - description = "Nim Codex Node"; + systemd.services.logos-storage-nim = { + description = "Logos Storage Node"; wantedBy = [ "multi-user.target" ]; requires = [ "network.target" ]; serviceConfig = { @@ -45,12 +45,12 @@ in NoNewPrivileges = true; PrivateDevices = true; MemoryDenyWriteExecute = true; - ExecStart = "${cfg.package}/bin/codex --config-file=/etc/nim-codex/config.toml"; + ExecStart = "${cfg.package}/bin/storage --config-file=/etc/logos-storage-nim/config.toml"; Restart = "on-failure"; }; restartIfChanged = true; restartTriggers = [ - "/etc/nim-codex/config.toml" + "/etc/logos-storage-nim/config.toml" ]; }; }; diff --git a/openapi.yaml b/openapi.yaml index fab3d334..5922f2c6 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -2,8 +2,8 @@ openapi: 3.0.3 info: version: 0.0.1 - title: Codex API - description: "List of endpoints and interfaces available to Codex API users" + title: Logos Storage API + description: "List of endpoints and interfaces available to Logos Storage API users" security: - {} @@ -115,7 +115,7 @@ components: seen: type: boolean - CodexVersion: + StorageVersion: type: object properties: version: @@ -150,7 +150,7 @@ components: - spr - announceAddresses - table - - codex + - storage properties: id: $ref: "#/components/schemas/PeerId" @@ -169,8 +169,8 @@ components: $ref: "#/components/schemas/MultiAddress" table: $ref: "#/components/schemas/PeersTable" - codex: - $ref: "#/components/schemas/CodexVersion" + storage: + $ref: "#/components/schemas/StorageVersion" SalesAvailability: type: object @@ -485,18 +485,18 @@ components: quotaMaxBytes: type: integer format: int64 - description: "Maximum storage space (in bytes) available for the node in Codex's local repository." + description: "Maximum storage space (in bytes) available for the node in Logos Storage's local repository." quotaUsedBytes: type: integer format: int64 - description: "Amount of storage space (in bytes) currently used for storing files in Codex's local repository." + description: "Amount of storage space (in bytes) currently used for storing files in Logos Storage's local repository." quotaReservedBytes: type: integer format: int64 - description: "Amount of storage reserved (in bytes) in the Codex's local repository for future use when storage requests will be picked up and hosted by the node using node's availabilities. This does not include the storage currently in use." + description: "Amount of storage reserved (in bytes) in the Logos Storage's local repository for future use when storage requests will be picked up and hosted by the node using node's availabilities. This does not include the storage currently in use." servers: - - url: "http://localhost:8080/api/codex/v1" + - url: "http://localhost:8080/api/storage/v1" tags: - name: Marketplace diff --git a/tests/codex/helpers/mockdiscovery.nim b/tests/codex/helpers/mockdiscovery.nim index 69b61d49..f0142650 100644 --- a/tests/codex/helpers/mockdiscovery.nim +++ b/tests/codex/helpers/mockdiscovery.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/tests/codex/helpers/mockrepostore.nim b/tests/codex/helpers/mockrepostore.nim index 52e598d9..3d29f4a3 100644 --- a/tests/codex/helpers/mockrepostore.nim +++ b/tests/codex/helpers/mockrepostore.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/tests/codex/helpers/mocktimer.nim b/tests/codex/helpers/mocktimer.nim index 8d7a5911..162a6e81 100644 --- a/tests/codex/helpers/mocktimer.nim +++ b/tests/codex/helpers/mocktimer.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/tests/codex/stores/testkeyutils.nim b/tests/codex/stores/testkeyutils.nim index f1bff8bd..799e1884 100644 --- a/tests/codex/stores/testkeyutils.nim +++ b/tests/codex/stores/testkeyutils.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/tests/codex/stores/testmaintenance.nim b/tests/codex/stores/testmaintenance.nim index f56adcc3..7c979d4c 100644 --- a/tests/codex/stores/testmaintenance.nim +++ b/tests/codex/stores/testmaintenance.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/tests/codex/utils/testtimer.nim b/tests/codex/utils/testtimer.nim index 47076480..cf05df19 100644 --- a/tests/codex/utils/testtimer.nim +++ b/tests/codex/utils/testtimer.nim @@ -1,4 +1,4 @@ -## Nim-Codex +## Logos Storage ## Copyright (c) 2023 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/tests/integration/5_minutes/testrestapivalidation.nim b/tests/integration/5_minutes/testrestapivalidation.nim index d428402e..6530f355 100644 --- a/tests/integration/5_minutes/testrestapivalidation.nim +++ b/tests/integration/5_minutes/testrestapivalidation.nim @@ -246,7 +246,7 @@ multinodesuite "Rest API validation": let data = await RandomChunker.example(blocks = 2) let cid = (await client.upload(data)).get let duration = (31 * 24 * 60 * 60).uint64 - # 31 days TODO: this should not be hardcoded, but waits for https://github.com/codex-storage/nim-codex/issues/1056 + # 31 days TODO: this should not be hardcoded, but waits for https://github.com/logos-storage/logos-storage-nim/issues/1056 let proofProbability = 3.u256 let expiry = 30.uint let collateralPerByte = 1.u256 diff --git a/tests/integration/codexprocess.nim b/tests/integration/codexprocess.nim index 351a78e2..04c2904f 100644 --- a/tests/integration/codexprocess.nim +++ b/tests/integration/codexprocess.nim @@ -25,7 +25,7 @@ method workingDir(node: CodexProcess): string = return currentSourcePath() / ".." / ".." / ".." method executable(node: CodexProcess): string = - return "build" / "codex" + return "build" / "storage" method startedOutput(node: CodexProcess): string = return "REST service started" @@ -52,7 +52,7 @@ proc ethAccount*(node: CodexProcess): Address = proc apiUrl*(node: CodexProcess): string = let config = CodexConf.load(cmdLine = node.arguments, quitOnFailure = false) return - "http://" & config.apiBindAddress.get() & ":" & $config.apiPort & "/api/codex/v1" + "http://" & config.apiBindAddress.get() & ":" & $config.apiPort & "/api/storage/v1" proc client*(node: CodexProcess): CodexClient = if client =? node.client: @@ -67,7 +67,7 @@ method stop*(node: CodexProcess) {.async.} = await procCall NodeProcess(node).stop() - trace "stopping codex client" + trace "stopping Storage client" if client =? node.client: await client.close() node.client = none CodexClient diff --git a/tests/integration/hardhatprocess.nim b/tests/integration/hardhatprocess.nim index 21bf107f..915c8c53 100644 --- a/tests/integration/hardhatprocess.nim +++ b/tests/integration/hardhatprocess.nim @@ -25,7 +25,8 @@ type HardhatProcess* = ref object of NodeProcess logFile: ?IoHandle method workingDir(node: HardhatProcess): string = - return currentSourcePath() / ".." / ".." / ".." / "vendor" / "codex-contracts-eth" + return + currentSourcePath() / ".." / ".." / ".." / "vendor" / "logos-storage-contracts-eth" method executable(node: HardhatProcess): string = return "node_modules" / ".bin" / "hardhat" diff --git a/tests/integration/multinodes.nim b/tests/integration/multinodes.nim index 42fff157..5f149585 100644 --- a/tests/integration/multinodes.nim +++ b/tests/integration/multinodes.nim @@ -69,7 +69,7 @@ proc sanitize(pathSegment: string): string = sanitized proc getTempDirName*(starttime: string, role: Role, roleIdx: int): string = - getTempDir() / "Codex" / sanitize($starttime) / sanitize($role & "_" & $roleIdx) + getTempDir() / "Storage" / sanitize($starttime) / sanitize($role & "_" & $roleIdx) template multinodesuite*(name: string, body: untyped) = asyncchecksuite name: @@ -230,15 +230,15 @@ template multinodesuite*(name: string, body: untyped) = ) config.addCliOption( PersistenceCmd.prover, "--circom-r1cs", - "vendor/codex-contracts-eth/verifier/networks/hardhat/proof_main.r1cs", + "vendor/logos-storage-contracts-eth/verifier/networks/hardhat/proof_main.r1cs", ) config.addCliOption( PersistenceCmd.prover, "--circom-wasm", - "vendor/codex-contracts-eth/verifier/networks/hardhat/proof_main.wasm", + "vendor/logos-storage-contracts-eth/verifier/networks/hardhat/proof_main.wasm", ) config.addCliOption( PersistenceCmd.prover, "--circom-zkey", - "vendor/codex-contracts-eth/verifier/networks/hardhat/proof_main.zkey", + "vendor/logos-storage-contracts-eth/verifier/networks/hardhat/proof_main.zkey", ) return await newCodexProcess(providerIdx, config, Role.Provider) diff --git a/tests/integration/nodeprocess.nim b/tests/integration/nodeprocess.nim index d50dacbe..9ac0f8c3 100644 --- a/tests/integration/nodeprocess.nim +++ b/tests/integration/nodeprocess.nim @@ -60,7 +60,7 @@ method start*(node: NodeProcess) {.base, async.} = try: if node.debug: - echo "starting codex node with args: ", node.arguments.join(" ") + echo "starting Storage node with args: ", node.arguments.join(" ") node.process = await startProcess( node.executable, node.workingDir, @@ -105,7 +105,7 @@ proc captureOutput( proc startNode*[T: NodeProcess]( _: type T, args: seq[string], debug: string | bool = false, name: string ): Future[T] {.async.} = - ## Starts a Codex Node with the specified arguments. + ## Starts a Logos Storage Node with the specified arguments. ## Set debug to 'true' to see output of the node. let node = T( arguments: @args, diff --git a/tools/cirdl/cirdl.nim b/tools/cirdl/cirdl.nim index 19a94de4..5b363fc3 100644 --- a/tools/cirdl/cirdl.nim +++ b/tools/cirdl/cirdl.nim @@ -28,7 +28,7 @@ proc printHelp() = info "Usage: ./cirdl [circuitPath] [rpcEndpoint] ([marketplaceAddress])" info " circuitPath: path where circuit files will be placed." info " rpcEndpoint: URL of web3 RPC endpoint." - info " marketplaceAddress: Address of deployed Codex marketplace contracts. If left out, will auto-discover based on connected network." + info " marketplaceAddress: Address of deployed Storage marketplace contracts. If left out, will auto-discover based on connected network." proc getMarketplaceAddress( provider: JsonRpcProvider, mpAddressOverride: ?Address @@ -83,7 +83,7 @@ proc copyFiles(unpackDir: string, circuitPath: string): ?!void = success() proc main() {.async.} = - info "Codex Circuit Downloader, Aww yeah!" + info "Storage Circuit Downloader, Aww yeah!" let args = os.commandLineParams() if args.len < 2 or args.len > 3: printHelp() @@ -135,7 +135,7 @@ proc main() {.async.} = # Unpack library cannot unpack into existing directory. We also cannot # delete the targer directory and have the library recreate it because - # Codex has likely created it and set correct permissions. + # Logos Storage has likely created it and set correct permissions. # So, we unpack to a temp folder and move the files. if err =? copyFiles(unpackFolder, circuitPath).errorOption: error "Failed to copy files", msg = err.msg diff --git a/vendor/codex-contracts-eth b/vendor/codex-contracts-eth deleted file mode 160000 index a179deb2..00000000 --- a/vendor/codex-contracts-eth +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a179deb2f99fa74ac7b0e568ec6d05f1d9a7a407 diff --git a/vendor/codex-storage-proofs-circuits b/vendor/codex-storage-proofs-circuits deleted file mode 160000 index ac8d3667..00000000 --- a/vendor/codex-storage-proofs-circuits +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ac8d3667526862458b162bee71dd5dcf6170c209 diff --git a/vendor/logos-storage-contracts-eth b/vendor/logos-storage-contracts-eth new file mode 160000 index 00000000..e159ceee --- /dev/null +++ b/vendor/logos-storage-contracts-eth @@ -0,0 +1 @@ +Subproject commit e159ceee44e91f216533a16e9f14cfd91dee0e02 diff --git a/vendor/logos-storage-nim-dht b/vendor/logos-storage-nim-dht new file mode 160000 index 00000000..99884b59 --- /dev/null +++ b/vendor/logos-storage-nim-dht @@ -0,0 +1 @@ +Subproject commit 99884b5971759a0da437db3d2e834b92a058527d diff --git a/vendor/logos-storage-proofs-circuits b/vendor/logos-storage-proofs-circuits new file mode 160000 index 00000000..82de3564 --- /dev/null +++ b/vendor/logos-storage-proofs-circuits @@ -0,0 +1 @@ +Subproject commit 82de35640d2b05557143354c9a0f28ff81cd5fec diff --git a/vendor/nim-circom-compat b/vendor/nim-circom-compat index d3fb9039..a5d6f766 160000 --- a/vendor/nim-circom-compat +++ b/vendor/nim-circom-compat @@ -1 +1 @@ -Subproject commit d3fb903945c3895f28a2e50685745e0a9762ece5 +Subproject commit a5d6f76654616ed981beb1104997f519ca79c7ed diff --git a/vendor/nim-codex-dht b/vendor/nim-codex-dht deleted file mode 160000 index 6c7de036..00000000 --- a/vendor/nim-codex-dht +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6c7de036224724b064dcaa6b1d898be1c6d03242 diff --git a/vendor/nim-serde b/vendor/nim-serde index 5ced7c88..649ae60e 160000 --- a/vendor/nim-serde +++ b/vendor/nim-serde @@ -1 +1 @@ -Subproject commit 5ced7c88b97d99c582285ce796957fb71fd42434 +Subproject commit 649ae60e05ec432738d41eb8d613c5d7f434c4a3