-
Notifications
You must be signed in to change notification settings - Fork 1
Feat: Migrate to Prebuilt libstorage Binaries & Rebrand to Storage #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
0962a68
feat(android): wip implementation of the android patch system
nipsysdev 9057365
refactor(android): cleanup up vibecoded code
nipsysdev f342abf
refactor(android): remove build sh script, let's only use cargo
nipsysdev a7983c9
refactor: remove unused config.toml
nipsysdev 83f14be
fix(android): using git apply instead of patch command
nipsysdev c3a7dd1
feat(android): adding patches to toggle codex build git update/reset
nipsysdev c2d775a
fix(android): fix terminal patch
nipsysdev f3461fe
fix(android): fix some patches while removing the rest, starting over…
nipsysdev 8ca75ba
fix(android): solve pthread issues
nipsysdev 35e3241
feat(android): add more patches
nipsysdev 9e7d8db
feat(android): finally working build with proper patching
nipsysdev 3680a0b
refactor(android): extract android specific logic from build.rs
nipsysdev 73bf91d
docs(android): update readme with basic android build instructions
nipsysdev c9b2c8c
feat(android): improve build system with dynamic Clang version detect…
nipsysdev 5cff0c5
fix(android): add leopard cmake patch/fix
nipsysdev 21093a3
feat(build): use static linking by default
nipsysdev 9120283
docs(android): update readme
nipsysdev 572ebef
fix(android): attempt to solve cmdLine & cmdCount unknown symbols issue
nipsysdev ba89f58
docs: update README
nipsysdev e5c8a4f
fix(android): disable LSE atomics detection on Android
nipsysdev 829c593
feat(android): add support for x86_64
nipsysdev 78e1b2a
fix(android): fix linking issues (pic)
nipsysdev 76ce10d
fix(android): add missing endline in cmdline patch
nipsysdev c09fb7b
fix(android): improve cleaning build to handle static libraries
nipsysdev 2d9c57e
refactor(build): rewrite cleaning logic
nipsysdev 6225819
fix(android): attempt to make leveldb build properly for android
nipsysdev 18e2188
fix: make cmdline symbols fix universal, move build related files to …
nipsysdev c7c5697
fix(build): cleanup build panic message
nipsysdev 78701cd
feat(build): dynamically determine number of jobs for nim-codex build
nipsysdev 9fdcffc
refactor(build): simplify invalid artifact detection & extract cleani…
nipsysdev bd6875c
chore(android): remove useless android-patches feature flag
nipsysdev ba9c2cb
chore: make cargo ignore vendor/nim-codex
nipsysdev 98bb8e0
chore: update package version to 0.1.3-android-1
nipsysdev f41a38a
feat(build): migrate to using libstorage prebuilt binaries
nipsysdev ccd7db6
refactor: rename Codex to Storage following Logos rebranding
nipsysdev 5e11a43
chore(libstorage): bump version
nipsysdev 02511a2
chore: add debug logs
nipsysdev 8fba9bb
refactor(build): Turn prebuilt binary handling into modular local/rem…
nipsysdev 67f4a28
test(two_node_network): fix rebase leftover issues
nipsysdev f2babee
chore: cleanup comments/logs
nipsysdev ed0ac10
chore(gitignore): remove .last_built_architecture
nipsysdev 6a9ee79
docs(readme): use placeholder for integration test name to avoid dupl…
nipsysdev b488913
feat(build): logging prebuilt binaries download progress
nipsysdev 106413d
refactor(build): centralize build URLs and target platform mappings
nipsysdev bb328b5
refactor(build): minor refactoring around storage version env name
nipsysdev ff7497f
chore(deps): remove deps we dont need
nipsysdev d785157
feat(build): implement a proper caching system
nipsysdev efee262
refactor(build): remove old cache marker
nipsysdev fa800f2
chore(clippy): address warnings and errors
nipsysdev c4f5111
chore(hooks): add pre-commit & pre-push hooks
nipsysdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,87 +1,152 @@ | ||
| # Codex Rust Bindings | ||
| # Storage Rust Bindings | ||
|
|
||
| This repository provides Rust bindings for the Codex library, enabling seamless integration with Rust projects. | ||
| This repository provides Rust bindings for the Storage library, enabling seamless integration with Rust projects. | ||
|
|
||
| ## Usage | ||
|
|
||
| Include in your Cargo project: | ||
|
|
||
| ```toml | ||
| [dependencies] | ||
| codex-bindings = "0.1.3" | ||
| storage-bindings = "0.2.0" | ||
| ``` | ||
|
|
||
| To learn how to use those bindings, take a look at the [example project](https://github.com/nipsysdev/example-codex-rust-bindings) or the [integration tests](./tests/). | ||
| To learn how to use those bindings, take a look at the [example project](https://github.com/nipsysdev/example-storage-rust-bindings) or the [integration tests](./tests/) directory. | ||
|
|
||
| ## Building | ||
|
|
||
| ### Requirements | ||
| Building will automatically: | ||
|
|
||
| This crate automatically builds the required libcodex library during compilation, so you don't need to install nim-codex separately. However, you will need: | ||
| 1. Fetch the latest prebuilt libstorage binary for your platform from GitHub | ||
| 2. Generate Rust bindings and compile the crate | ||
|
|
||
| - **Rust and Cargo** | ||
| - **Git** | ||
| - **Make** | ||
| - **C compiler** | ||
| **Note**: The first build will download the prebuilt binary (~50MB). Subsequent builds will use the cached version. | ||
|
|
||
| Building will automatically: | ||
| ## Caching | ||
|
|
||
| 1. Clone the nim-codex repository and it's submodules | ||
| 2. Build the Nim compiler from source | ||
| 3. Build libcodex with the Nim compiler | ||
| 4. Generate Rust bindings and compile the crate | ||
| Prebuilt binaries are automatically cached to improve build performance and reduce network usage. | ||
|
|
||
| **Note**: The first build may take 10-20 minutes as it needs to build the Nim compiler from source. Subsequent builds will be much faster. | ||
| ### Cache Location | ||
|
|
||
| ### Building from source | ||
| Prebuilt binaries are cached in a platform-specific location: | ||
|
|
||
| - **Linux**: `~/.cache/storage-bindings/` | ||
| - **macOS**: `~/Library/Caches/storage-bindings/` | ||
| - **Windows**: `%LOCALAPPDATA%\storage-bindings\cache\` | ||
|
|
||
| The cache is organized by version and platform: | ||
|
|
||
| ``` | ||
| ~/.cache/storage-bindings/ | ||
| ├── master-1acedcf/ | ||
| │ ├── linux-amd64/ | ||
| │ │ ├── libstorage.a | ||
| │ │ ├── libstorage.h | ||
| │ │ └── SHA256SUMS.txt | ||
| │ └── darwin-arm64/ | ||
| │ └── ... | ||
| └── master-2b3d4e5/ | ||
| └── ... | ||
| ``` | ||
|
|
||
| ### Managing the Cache | ||
|
|
||
| #### Force Re-download | ||
|
|
||
| To force a fresh download without clearing the cache: | ||
|
|
||
| ```bash | ||
| cargo build --release | ||
| # or, for debug | ||
| cargo build | ||
| STORAGE_BINDINGS_FORCE_DOWNLOAD=1 cargo build | ||
| ``` | ||
|
|
||
| ### Other Cargo Commands | ||
| #### Clean Entire Cache | ||
|
|
||
| To remove all cached binaries: | ||
|
|
||
| ```bash | ||
| # Run all tests | ||
| cargo test | ||
| # Linux/macOS | ||
| rm -rf ~/.cache/storage-bindings/ | ||
|
|
||
| # Windows | ||
| rmdir /s /q %LOCALAPPDATA%\storage-bindings\cache | ||
|
|
||
| # Run unit tests | ||
| cargo test-unit | ||
| # Or using the build script | ||
| STORAGE_BINDINGS_CLEAN_CACHE=1 cargo build | ||
| ``` | ||
|
|
||
| # Run integration tests | ||
| cargo test-integration | ||
| ### Supported Platforms | ||
|
|
||
| # Run doctests | ||
| cargo test-doc | ||
| - Linux x86_64 (x86_64-unknown-linux-gnu) | ||
| - Linux ARM64 (aarch64-unknown-linux-gnu) | ||
|
|
||
| ### Libstorage Version Pinning | ||
|
|
||
| **Option 1: Cargo.toml metadata** | ||
|
|
||
| Add to your `Cargo.toml`: | ||
|
|
||
| ```toml | ||
| [package.metadata.prebuilt] | ||
| libstorage = "master-60861d6a" | ||
| ``` | ||
|
|
||
| ## Linking Modes | ||
| **Option 2: Environment variable (for local overrides)** | ||
|
|
||
| This crate supports two linking modes via Cargo features: | ||
| ```bash | ||
| export LOGOS_STORAGE_VERSION=master-60861d6a | ||
| cargo build | ||
| ``` | ||
|
|
||
| ### Dynamic Linking (Default) | ||
| Available versions can be found at: https://github.com/nipsysdev/logos-storage-nim-bin/releases | ||
|
|
||
| ### Building from source | ||
|
|
||
| ```bash | ||
| cargo build --release | ||
| # or, for debug | ||
| cargo build | ||
| # or explicitly | ||
| cargo build --features dynamic-linking | ||
| ``` | ||
|
|
||
| ### Static Linking | ||
| ### Building using local libraries | ||
|
|
||
| To use locally built libraries instead of downloading from GitHub, set the `STORAGE_BINDINGS_LOCAL_LIBS` environment variable to the path of the dist folder: | ||
|
|
||
| ```bash | ||
| cargo build --features static-linking | ||
| export STORAGE_BINDINGS_LOCAL_LIBS=/path/to/logos-storage-nim-bin/dist/master-50bd1839-linux-amd64 | ||
| cargo build | ||
| ``` | ||
|
|
||
| ### In your Cargo.toml | ||
| ### Testing | ||
|
|
||
| ```toml | ||
| [dependencies] | ||
| codex-bindings = { version = "0.1.3", features = ["static-linking"] } | ||
| The library includes comprehensive integration tests that demonstrate all major functionality. | ||
|
|
||
| #### Running All Tests | ||
|
|
||
| ```bash | ||
| # Run all tests (unit tests + integration tests) | ||
| cargo test | ||
| ``` | ||
|
|
||
| #### Running Specific Tests | ||
|
|
||
| ```bash | ||
| # Run only unit tests | ||
| cargo test --lib | ||
|
|
||
| # Run only integration tests | ||
| cargo test --test $test_name | ||
| ``` | ||
|
|
||
| #### Available Integration Tests | ||
|
|
||
| - **basic_usage**: Demonstrates basic upload/download functionality | ||
| - **chunk_operations**: Shows chunk-based upload and download operations | ||
| - **debug_operations**: Demonstrates debug operations and logging | ||
| - **p2p_networking**: Shows P2P networking operations | ||
| - **storage_management**: Demonstrates storage management operations | ||
| - **two_node_network**: Shows two-node network setup and data transfer | ||
| - **thread_safe_tests**: Tests thread-safe node lifecycle and concurrent operations | ||
|
|
||
| ## License | ||
|
|
||
| [MIT](./LICENSE) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.