b2m-cli is a command-line tool for managing Hexmos FreeDevTools databases securely using Backblaze B2 as a backend. It implements a locking mechanism to prevent concurrent writes and ensures data consistency across the team.
- Distributed Locking: Prevents race conditions by locking databases before editing using B2 file-based locks.
- Backblaze B2 Sync: Automatically syncs databases to/from B2 bucket using
rclone. - Version-Aware Sorting: Displays databases with latest versions first (e.g.,
v4beforev3). - Discord Notifications: Notifies the team channel when a database is updated.
- Conflict Detection: Checks for version mismatches and warns if local changes are out of sync with remote.
- Go: Ensure you have
goinstalled (for building). - Rclone: The tool uses
rclonefor syncing. - b3sum: Install
b3sumfor fast hashing.- Rust:
cargo install b3sum. - See also: BLAKE3.
- Download binary (Linux x64):
curl -L -o b3sum https://github.com/BLAKE3-team/BLAKE3/releases/download/1.8.3/b3sum_linux_x64_bin - Make executable & move to path:
chmod +x b3sum && sudo mv b3sum /usr/local/bin/
- Rust:
- Move the binary to your
frontenddirectory (recommended) or add to/frontend/. Make buildinfrontend/to build the frontend../b2mto run the tool.
The application logs its operations and errors to b2m.log in the current working directory.
- INFO logs include application startup/shutdown, status updates, and upload/download milestones.
- ERROR logs capture critical failures, rclone errors, and network issues.
The tool uses fdt-dev.toml for configuration. This file should be present in the frontend directory where you run the tool.
Example fdt-dev.toml:
[b2m]
# Hexmos
b2m_discord_webhook = "<your-discord-webhook-url>"
b2m_remote_root_bucket = "<your-b2-root-bucket>"
b2m_db_dir = "db/all_dbs"It also relies on rclone. The init checks will attempt to install and configure rclone automatically if missing.
The tool is designed to be run from the frontend directory of the FreeDevTools project. This ensures it can correctly locate the local database directory (db/all_dbs/).
Start the interactive shell:
./b2mIn addition to the interactive shell, b2m supports the following command-line arguments:
--help: Show help message.--version: Show version information.--generate-hash: Generate new hash and create metadata in remote (use with caution).--reset: Remove local metadata caches and start a fresh session.
For detailed information on how the tool works, please refer to the following documentation:
- Architecture & Internal Structure: Project layout and code organization.
- Locking Mechanism: How distributed locking works on B2.
- Core Rclone Functions: Low-level rclone interactions.
- Status Workflow: How the tool determines file status (sync/lock check).
- Upload Workflow: The upload process, safety checks, and locking.
- Download Workflow: Downloading databases and anchor verification.
- Hashing & Cache: How
b3sumhashing and caching works. - Cancellation: Handling interruptions and cleanup.