Skip to content

About

Decentralized Durability Engine

Resources

Stars

85 stars

Watchers

22 watching

Forks

Latest commit

 

History

1,010 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logos Storage Filesharing Client

The Logos Storage project aims to create a filesharing client that allows sharing data privately in p2p networks.

WARNING: This project is under active development and is considered pre-alpha.

License: Apache License: MIT Stability: experimental CI Docker Codecov Discord Docker Pulls

Build and Run

The build needs Nim 2.2.14 or later, which ships Nimble 0.26.

To build the project, clone it and run:

make update && make

# To update the dependencies: edit storage.nimble, then
# nimble lock && make update

The executable will be placed under the build directory under the project root.

Run the client with:

build/storage

Configuration

It is possible to configure a Logos Storage node in several ways:

  1. CLI options
  2. Environment variables
  3. Configuration file

The order of priority is the same as above: CLI options --> Environment variables --> Configuration file.

Please check build/storage --help for more information.

API

The node exposes an HTTP API for testing and debugging only. It is not a public API: applications use the C library, see Bindings.

The OpenAPI spec is in openapi.yaml.

Bindings

Logos Storage provides a C API that can be wrapped by other languages. The C API bindings are located in the library folder.

Currently, only Go bindings are provided in this repo. However, Rust bindings for Logos Storage can be found at https://github.com/nipsysdev/storage-rust-bindings.

Build the C library

make libstorage

This produces the shared library under build/.

Run the Go example

See https://github.com/logos-storage/logos-storage-go-bindings-example.

Static vs Dynamic build

By default, Logos Storage builds a dynamic library (libstorage.so/libstorage.dylib/libstorage.dll), which you can load at runtime.

If you prefer a static library (libstorage.a), set the STATIC flag:

# Build dynamic (default)
make libstorage

# Build static
make STATIC=1 libstorage

Limitation

Callbacks must be fast and non-blocking; otherwise, the working thread will hang and prevent other requests from being processed.

Test Commands

# Run unit tests (tests/storage/)
make test

# Run integration tests (spawns real node processes)
make testIntegration

# Run one integration test file (path from tests/)
STORAGE_INTEGRATION_TEST_INCLUDES="integration/5_minutes/testrestapivalidation.nim" \
  nim testIntegration build.nims

# Keep the node logs, in tests/integration/logs/
STORAGE_INTEGRATION_TEST_INCLUDES="integration/5_minutes/testrestapivalidation.nim" \
  nim testIntegration -d:StorageLogToFile=true build.nims

# Run all tests
make testAll

# Run a single test file directly
nim c -r tests/storage/testblockexchange.nim

# Run C bindings test
make testLibstorage

# Coverage report (requires lcov)
make coverage && make show-coverage

Use as a Nimble dependency

Add Logos Storage to the .nimble file of your project:

requires "https://github.com/logos-storage/logos-storage-nim"

Nimble resolves the version ranges of storage.nimble. It does not read nimble.lock.

Nim reads only the config.nims of the project it compiles, not the one of Logos Storage. Add these settings to your config.nims:

--threads:on
--mm:refc
switch("define", "libp2p_multicodec_exts:storage/multicodec_exts.nim")
switch("define", "libp2p_multihash_exts:storage/multihash_exts.nim")
switch("define", "libp2p_contentids_exts:storage/contentids_exts.nim")
switch("define", "libp2p_multiaddress_exts:storage/multiaddress_exts.nim")
switch("define", "libp2p_pki_schemes=secp256k1")
switch("define", "chronicles_sinks=textlines[dynamic],json[dynamic],textlines[dynamic]")
switch("define", "chronosHandleException")
switch("define", "nimOldCaseObjects")
switch("define", "withoutPCRE")
switch("define", "use_asm_syntax_intel=false")
switch("define", "ctt_asm=true")
switch("legacy", "procParamTypeBackendAliases")

Then import the modules you need, for example import pkg/storage/storage.

Contributing and development

Feel free to dive in, contributions are welcomed! Open an issue or submit PRs.

Linting and formatting

logos-storage-nim uses 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/<file/folder you want to format>. If you want you can install Git pre-commit hook using make install-nph-hook, which will format modified files prior committing them. If you are using VSCode and the NimLang extension you can enable "Format On Save" (eq. the nim.formatOnSave property) that will format the files using nph.

About

Decentralized Durability Engine

Resources

Stars

85 stars

Watchers

22 watching

Forks

Releases

Used by

Contributors

Languages