diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 593636c13..d979ad1d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -211,7 +211,7 @@ jobs: # - name: build release # run: | - # cargo build --profile optimized-release -p iroh -p iroh-gateway -p iroh-p2p -p iroh-store -p iroh-one + # cargo build --profile optimized-release -p beetle -p beetle-gateway -p beetle-p2p -p beetle-store -p beetle-one # - name: Setup awscli on linux # if: matrix.name == 'ubuntu-latest' @@ -243,20 +243,20 @@ jobs: # - name: push release # if: matrix.os != 'windows-latest' # run: | - # aws s3 cp ./target/optimized-release/iroh-gateway s3://vorc/iroh-gateway-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress - # aws s3 cp ./target/optimized-release/iroh-p2p s3://vorc/iroh-p2p-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress - # aws s3 cp ./target/optimized-release/iroh-store s3://vorc/iroh-store-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress - # aws s3 cp ./target/optimized-release/iroh s3://vorc/iroh-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress - # aws s3 cp ./target/optimized-release/iroh-one s3://vorc/iroh-one-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress + # aws s3 cp ./target/optimized-release/beetle-gateway s3://vorc/beetle-gateway-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress + # aws s3 cp ./target/optimized-release/beetle-p2p s3://vorc/beetle-p2p-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress + # aws s3 cp ./target/optimized-release/beetle-store s3://vorc/beetle-store-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress + # aws s3 cp ./target/optimized-release/beetle s3://vorc/beetle-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress + # aws s3 cp ./target/optimized-release/beetle-one s3://vorc/beetle-one-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress # - name: push release latest # if: matrix.os != 'windows-latest' # run: | - # aws s3 cp ./target/optimized-release/iroh-gateway s3://vorc/iroh-gateway-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress - # aws s3 cp ./target/optimized-release/iroh-p2p s3://vorc/iroh-p2p-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress - # aws s3 cp ./target/optimized-release/iroh-store s3://vorc/iroh-store-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress - # aws s3 cp ./target/optimized-release/iroh s3://vorc/iroh-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress - # aws s3 cp ./target/optimized-release/iroh-one s3://vorc/iroh-one-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress + # aws s3 cp ./target/optimized-release/beetle-gateway s3://vorc/beetle-gateway-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress + # aws s3 cp ./target/optimized-release/beetle-p2p s3://vorc/beetle-p2p-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress + # aws s3 cp ./target/optimized-release/beetle-store s3://vorc/beetle-store-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress + # aws s3 cp ./target/optimized-release/beetle s3://vorc/beetle-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress + # aws s3 cp ./target/optimized-release/beetle-one s3://vorc/beetle-one-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress coverage: name: Coverage diff --git a/.gitignore b/.gitignore index 699c97053..68abe1446 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ /target -/iroh_gateway/test_files/* +/beetle_gateway/test_files/* .env Cargo.lock diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 93751b316..000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,367 +0,0 @@ -# [v0.2.0](https://github.com/n0-computer/iroh/compare/v0.1.1...v0.2.0) (2022-12-21) - -### First steps for iroh as a library -Many folks have asked for iroh as a library embeddable in other rust projects, and with this release we land the the first version of `iroh-embed`. Check the [example](https://github.com/n0-computer/iroh/blob/e73a731769269c58b5d32e4a207e6577b3c50838/examples/embed/src/main.rs) for an initial guide. - -We still have a _lot_ of work to do on `iroh-api` to expose a clean API to consume as a library, but if you're the kind of project that's intersted in embedded IPFS, and willing to roll up your sleeves on a moving API, Iroh is ready for you to use today. - - -### Gateway Subdomain & ETH domain support -Our gateway [spec compatibility](https://github.com/ipfs/specs/tree/main/http-gateways) continues to grow. Both of these features were outside contributions by [@ppodolsky](https://github.com/ppodolsky), for which we're super grateful. Be sure to check out their work on [summa](https://github.com/izihawa/summa)! - -### QUIC Support -The majority of traffic on public IPFS networks runs over QUIC, which we now support within iroh thanks to a [massive push by the rust-libp2p team](https://github.com/libp2p/rust-libp2p/pull/2289). Huge thanks to the libp2p team! - - -### Bug Fixes - -* actually resolve and check paths ([#623](https://github.com/n0-computer/iroh/issues/623)) ([8b6844f](https://github.com/n0-computer/iroh/commit/8b6844fc8dab620f0477b5e1d6b1341ef11f86b9)) -* **ci:** Call cargo with beta toolchain from env var ([#622](https://github.com/n0-computer/iroh/issues/622)) ([b62030d](https://github.com/n0-computer/iroh/commit/b62030d3beb943f46b300a596a64c1c27a59ea21)) -* **ci:** Set the protoc-arch matrix for weekly job ([#619](https://github.com/n0-computer/iroh/issues/619)) ([22d68df](https://github.com/n0-computer/iroh/commit/22d68df1f60fff5eb9b677bbc7a5862fdcd3588d)), closes [#618](https://github.com/n0-computer/iroh/issues/618) -* **ci:** Use beta toolchain for the clippy run ([#620](https://github.com/n0-computer/iroh/issues/620)) ([03624b5](https://github.com/n0-computer/iroh/commit/03624b55812b16c473e902a265cf7f6f1100f640)) -* **iroh-one:** Wire up mem addresses to each other ([#555](https://github.com/n0-computer/iroh/issues/555)) ([ee9677d](https://github.com/n0-computer/iroh/commit/ee9677d4001f15516068bf0f376e01199a1824aa)) -* **iroh:** do not use self version dep ([6f6fee0](https://github.com/n0-computer/iroh/commit/6f6fee0aed2f0d6d2381ac2b731d05cadfcfff52)) -* **iroh:** exclude tests and fixtures from publishing ([6ebee5f](https://github.com/n0-computer/iroh/commit/6ebee5f3082f08d19662b8ee84b257df27d60d15)) -* only use name if name is set ([#605](https://github.com/n0-computer/iroh/issues/605)) ([4dda2d0](https://github.com/n0-computer/iroh/commit/4dda2d05e4a0d230bcbf1ede35adbaa0cf5a8a00)) -* unixfs seeking ([#606](https://github.com/n0-computer/iroh/issues/606)) ([51e3ddf](https://github.com/n0-computer/iroh/commit/51e3ddf4bad2f815b138c3276bb49b7e1603c94a)) -* update quic-rpc to get rid of debug output ([bf4128b](https://github.com/n0-computer/iroh/commit/bf4128be1f742679dc35f061129b440c325a8c4e)) -* use http when creating hyper URL ([#591](https://github.com/n0-computer/iroh/issues/591)) ([e9e932d](https://github.com/n0-computer/iroh/commit/e9e932d9df54c1d3b8468b387be9ae642ed46347)) -* version handling in tests & git_version ([59c5dc7](https://github.com/n0-computer/iroh/commit/59c5dc78cf8067a3be3a19329d1998b69f9414a9)) - - -### Features - -* **ci:** improve protoc install & add code coverage checks ([#538](https://github.com/n0-computer/iroh/issues/538)) ([bcc20ce](https://github.com/n0-computer/iroh/commit/bcc20ce00fb19abc5ebbe03e9d315a01a7088881)) -* enable quic transport ([18e2f40](https://github.com/n0-computer/iroh/commit/18e2f400ed79c3522e290fe1c77b289879af6154)) -* **gateway:** add info page ([35955d6](https://github.com/n0-computer/iroh/commit/35955d6b9b505d2c35f99e4c618293c70bcca1a7)) -* minimal iroh-embed ([#565](https://github.com/n0-computer/iroh/issues/565)) ([c216440](https://github.com/n0-computer/iroh/commit/c216440ffcf528f406064d9cd4b1e56e7181dedf)) -* Send all the things ([#617](https://github.com/n0-computer/iroh/issues/617)) ([214d9ce](https://github.com/n0-computer/iroh/commit/214d9cecbc3dbb7fb425fb6ce50ca96474d38d98)) -* Support `eth` domains ([1d6b825](https://github.com/n0-computer/iroh/commit/1d6b825fe357a9fa958fdf426967516d3f689259)) -* support of Gateway Subdomain spec ([#546](https://github.com/n0-computer/iroh/issues/546)) ([dfe3134](https://github.com/n0-computer/iroh/commit/dfe3134212d52811aa1ea33fdb19c2769f07be93)) -* switch to released libp2p@0.50 ([ae30f9e](https://github.com/n0-computer/iroh/commit/ae30f9ebadb2e3cf7e8bb53ce955dc043d5a8cfe)) -* **unixfs:** add rabin based chunking ([b0a5783](https://github.com/n0-computer/iroh/commit/b0a57831ed4d5c2fcaeb535e6281216f81f7b108)) - - -# [v0.1.3](https://github.com/n0-computer/iroh/compare/iroh-v0.1.2...iroh-v0.1.3) (2022-11-28) - -Bug fix release, for issues discovered while publishing to crates.io. - -### Bug Fixes - -* **iroh:** do not use self version dep ([6f6fee0](https://github.com/n0-computer/iroh/commit/6f6fee0aed2f0d6d2381ac2b731d05cadfcfff52)) -* **iroh:** exclude tests and fixtures from publishing ([6ebee5f](https://github.com/n0-computer/iroh/commit/6ebee5f3082f08d19662b8ee84b257df27d60d15)) -* version handling in tests & git_version ([59c5dc7](https://github.com/n0-computer/iroh/commit/59c5dc78cf8067a3be3a19329d1998b69f9414a9)) - - -# [v0.1.2](https://github.com/n0-computer/iroh/compare/v0.1.1...iroh-v0.1.2) (2022-11-28) - -This relase brings about a couple of highlights, the first of which is the first relase of all `iroh-*` crates to crates.io. The second one being that we now support the experimental quic transport in libp2p. - -### Bug Fixes - -* **iroh-one:** Wire up mem addresses to each other ([#555](https://github.com/n0-computer/iroh/issues/555)) ([ee9677d](https://github.com/n0-computer/iroh/commit/ee9677d4001f15516068bf0f376e01199a1824aa)) - - -### Features - -* **ci:** improve protoc install & add code coverage checks ([#538](https://github.com/n0-computer/iroh/issues/538)) ([bcc20ce](https://github.com/n0-computer/iroh/commit/bcc20ce00fb19abc5ebbe03e9d315a01a7088881)) -* enable quic transport ([18e2f40](https://github.com/n0-computer/iroh/commit/18e2f400ed79c3522e290fe1c77b289879af6154)) -* **gateway:** add info page ([35955d6](https://github.com/n0-computer/iroh/commit/35955d6b9b505d2c35f99e4c618293c70bcca1a7)) -* Support `eth` domains ([1d6b825](https://github.com/n0-computer/iroh/commit/1d6b825fe357a9fa958fdf426967516d3f689259)) -* switch to released libp2p@0.50 ([ae30f9e](https://github.com/n0-computer/iroh/commit/ae30f9ebadb2e3cf7e8bb53ce955dc043d5a8cfe)) -* **unixfs:** add rabin based chunking ([b0a5783](https://github.com/n0-computer/iroh/commit/b0a57831ed4d5c2fcaeb535e6281216f81f7b108)) - - -# [v0.1.1](https://github.com/n0-computer/iroh/compare/v0.1.0...v0.1.1) (2022-11-21) - -## Bitswap client mode -Iroh can now run in "client mode", which can _fetch_ content from bitswap, but not _provide_ content. This is useful if you're running on a lower-powered device or have limited bandwidth. To use client mode change your `p2p.config.toml`: -``` -bitswap_server = false -``` - -## Use indexer nodes to find content providers -Iroh can use network indexers like [cid.contact](https://cid.contact) to find providers of a given CID. To use the cid.contact indexer adjust your `gateway.config.toml` to add an `indexer_endpoint` URL: - -``` -indexer_endpoint = https://cid.contact/cid/ -``` - -## Docker support -Iroh now ships with docker images! Spin iroh up locally with: -``` -$ cd iroh/docker -$ docker-compose up -``` -then run `iroh status` from another terminal if you already have iroh installed. Now you're backing iroh with docker! `docker-compose down` to stop. The docker compose file also includes helpful guidance on which ports to expose from each iroh service. - -We're shipping multi-arch [distroless](https://github.com/GoogleContainerTools/distroless) builds for amd64 & arm64 architectures. - -## Fixed a critical bug adding files -We fixed a [known bug](https://github.com/n0-computer/iroh/issues/423) in iroh v0.1.0 that would break `iroh add` if files referenced the same CID on the way in. It's now fixed, and now we can happily do roundtrip add/get of the linux kernel, which is always fun 😊. - - -## Benchmarks -Benchmarks for this release coming soon. We'll update this readme once they're up. - -### Production Readiness -Is this production ready? **Maybe**. Numerous projects are now using iroh in the wild. *You'll need to judge for yourself if iroh meets your needs.* Please reach out on our [discussion forums](https://github.com/n0-computer/iroh/discussions) if you have questions. We're going to keep the status at "Maybe" until we release a v1.0. v1.0 is currently slated for Q4 2023. - - -### Bug Fixes - -* **`iroh-p2p`:** implement full local lookup ([#537](https://github.com/n0-computer/iroh/issues/537)) ([0c388b9](https://github.com/n0-computer/iroh/commit/0c388b959852a92e7955e6d2eeb1380948fb6f49)) -* breadcrumb links in gateway directory template ([#513](https://github.com/n0-computer/iroh/issues/513)) ([f429baa](https://github.com/n0-computer/iroh/commit/f429baac42b845de4f47cbacd103198fcba95d50)) -* **cli:** Respect the --cfg flag ([#506](https://github.com/n0-computer/iroh/issues/506)) ([e7bcac6](https://github.com/n0-computer/iroh/commit/e7bcac699dc677e94dd84d16c8b8b5e81eaa965f)) -* convert v0 -> v1 before base32 conversion ([#527](https://github.com/n0-computer/iroh/issues/527)) ([ab3969c](https://github.com/n0-computer/iroh/commit/ab3969c9318b3801bf3fc2ff6c6c5ee53f63c979)) -* Correct dependencies and build checks ([#484](https://github.com/n0-computer/iroh/issues/484)) ([7e9cdc3](https://github.com/n0-computer/iroh/commit/7e9cdc35918409b7c6820a5ba23ae417126cbfa9)) -* docker-compose RPC ports should only listen on loopback ([#524](https://github.com/n0-computer/iroh/issues/524)) ([8471e49](https://github.com/n0-computer/iroh/commit/8471e49b2d3a9031bc44ae47e3d80034b60db806)), closes [#520](https://github.com/n0-computer/iroh/issues/520) -* iroh start service set construction ([#522](https://github.com/n0-computer/iroh/issues/522)) ([070be80](https://github.com/n0-computer/iroh/commit/070be80a56f6cf8f379cc7feeb454aa35c8f91a5)) -* **iroh-store:** `put_many` bug ([#507](https://github.com/n0-computer/iroh/issues/507)) ([88f1a49](https://github.com/n0-computer/iroh/commit/88f1a49feb64b732be82b3e3cc039f703bac8865)) -* Process -> Service in status command, add after help text ([#493](https://github.com/n0-computer/iroh/issues/493)) ([804255c](https://github.com/n0-computer/iroh/commit/804255cac91d637361c106bb2155df766fbbaa31)) -* **store:** Make store operations atomic ([#480](https://github.com/n0-computer/iroh/issues/480)) ([ac8ec35](https://github.com/n0-computer/iroh/commit/ac8ec35f0131347ad125e82b43356e16787ecf08)) -* Switch to tempfile for temporary test directories ([#509](https://github.com/n0-computer/iroh/issues/509)) ([89959cb](https://github.com/n0-computer/iroh/commit/89959cbf7b5d99de5ddc82121e85c111e5ffe055)) -* verify content fetched from racing http gateways ([e281a4a](https://github.com/n0-computer/iroh/commit/e281a4a1cd053f35299da4f735b65cc117b53338)) - - -### Features - -* bitswap client mode ([2a8a515](https://github.com/n0-computer/iroh/commit/2a8a515ad3175cdd68630c17e4a8831ff9e7af3d)) -* **cli:** Environment variables to override directories ([9a2220b](https://github.com/n0-computer/iroh/commit/9a2220b92a4bd008aaad015dea11bd651bbf4dbc)) -* dockerize iroh services ([#494](https://github.com/n0-computer/iroh/issues/494)) ([f8af48a](https://github.com/n0-computer/iroh/commit/f8af48a846e46a59243a8d30963ca188a04e68a3)) -* indexer resolution ([#476](https://github.com/n0-computer/iroh/issues/476)) ([f744949](https://github.com/n0-computer/iroh/commit/f7449493fb1f6b79beaa610c0c9f48224597b393)) -* **p2p:** dial MDNS peers ([5bee5b7](https://github.com/n0-computer/iroh/commit/5bee5b7a836e3948c80f683e28c3f2061df6dd87)) -* support lookup names in RPC addrs ([#500](https://github.com/n0-computer/iroh/issues/500)) ([144eef7](https://github.com/n0-computer/iroh/commit/144eef71681e8d56cb1441c52bd6dfe04c562e50)) - - -# v0.1.0 - 2022-10-28 - -We’re on the board 🎉! This first release of iroh brings a new implementation of IPFS to the world. - -Key things to highlight about the first release of iroh: - -* **Exchange Data with Kubo**. Iroh can interoperate with [kubo](https://github.com/ipfs/kubo) nodes on the IPFS network, pushing & fetching data. -* **Service Oriented architecture**. Don't want p2p? Turn it off! Iroh will still work without it. -* **Single CLI to control all services**. -* **Built for efficiency**. Iroh's memory footprint & CPU usage are either on par or better than the best interoperable IPFS implementations out there. -* **Runs well on a laptop**. We have a custom installer script that will configure iroh for your laptop. See our [install docs](https://iroh.computer/docs/install) - -v0.1.0 ships as 4 binaries for Linux & macOS with zero external dependencies: -* **iroh** - command line client -* **iroh-store** - data storage daemon -* **iroh-p2p** - peer 2 peer networking -* **iroh-gateway** - IPFS-to-HTTP bridge - -You'll need to download all of them & put them on your $PATH to work with iroh. Our [install docs](https://iroh.computer/docs/install) have more info. - -Please do give iroh a try, we'd love to [hear your feedback](https://github.com/n0-computer/iroh/issues/new). Thanks! - -### Benchmarks -We're runnning benchmarks on a relatively stock AWS box for ease-of-replication. We don't have benchmarks for IPFS network retrieval this round. - -### Adding Single Files -Add a single file with `iroh add --no-wrap --offline`: - -| file size | real (s) | user(s) | sys(s) | cpu % | cpu/total % | -| ---------- | -------- | ------- | -------- | ----------- | ------------ | -| 100K | 0.0102 | 0.0162 | 0.0317 | 469.6078431 | 7.337622549 | -| 1M | 0.0167 | 0.004 | 0.0519 | 334.7305389 | 5.230164671 | -| 10M | 0.01345 | 0.0101 | 0.0418 | 385.87 | 6.03 | -| 100M | 0.01345 | 0.0101 | 0.0418 | 385.87 | 6.03 | -| 1G | 0.01345 | 0.0101 | 0.0418 | 385.87 | 6.03 | - -### Fetching Cached Gateway Content -Repeatedly request the same CID of different file sizes to measure cached content throughput via HTTP request - -| File size | cpu/total (%) | rps | throughput/s | avg latency | -|-------------|----------------|-----------|---------------|--------------| -| 100K | 90.48072917 | 40,064.27 | 3.85GB | 5.08ms | -| 1M | 87.66614583 | 6,926.95 | 6.77GB | 29.08ms | -| 10M | 87.34010417 | 711.55 | 6.98GB | 278.86ms | -| 100M | 88.00885417 | 66.52 | 6.82GB | 2.85s | -| 1G | 87.84947917 | 6.65 | 6.85GB | 0.00s | - -### Production Readiness -Is this production ready? **No. We need your help to kick tires & find bugs!**. - -The v0.1.0 moniker should testify to just how new this software is. Please don't deploy it anywhere mission critical until we've had at least a month or two to address bugs & write tests. - -### Things you should know about this release: -There are two problems we couldn't properly address -* _There is no delete command._ Data added to iroh will stay there until a future release where we add content removal. See [issue #432](https://github.com/n0-computer/iroh/issues/432) for details. The workaround for now is to blow away the storage database. -* _We have one particularly nasty known bug that can cause iroh to not persist data for highly nested directories upon add_ we plan to address ASAP in a patch release. See [issue #423](https://github.com/n0-computer/iroh/issues/423). - -### Bug Fixes - -* `check` and `watch` should display the same service names ([#101](https://github.com/n0-computer/iroh/issues/101)) ([ef99fe5](https://github.com/n0-computer/iroh/commit/ef99fe5c6d519eca6f8ad972323526345dd155fb)) -* add --no-metrics support to p2p ([#65](https://github.com/n0-computer/iroh/issues/65)) ([a782fcb](https://github.com/n0-computer/iroh/commit/a782fcbb92af1e6b3a7f20ed0e40ee60b2670cbf)) -* add macos builds to ci ([#33](https://github.com/n0-computer/iroh/issues/33)) ([a0e79fb](https://github.com/n0-computer/iroh/commit/a0e79fb4d70dd56c152dcbd5433ab840ed386c47)) -* add missing metrics and update to fixed libp2p ([0f4f467](https://github.com/n0-computer/iroh/commit/0f4f4671369c12d7e08a6e1968dc96ad87eeb17c)) -* allow `Raw` as `UnixfsType` ([#327](https://github.com/n0-computer/iroh/issues/327)) ([275d88b](https://github.com/n0-computer/iroh/commit/275d88b2f49df0269e384b90a093b4d3f78b8229)) -* allow concurrent rpc calls & de-duplicate provider requests ([#60](https://github.com/n0-computer/iroh/issues/60)) ([a74f8dd](https://github.com/n0-computer/iroh/commit/a74f8dda299b4c58198267ff7921a203c2361eed)) -* auto-raise FD limits where possible ([#215](https://github.com/n0-computer/iroh/issues/215)) ([9e429bb](https://github.com/n0-computer/iroh/commit/9e429bbfbeb12cc0cc050cdc4b973a0deda9d1de)) -* avoid 0 divisions ([#76](https://github.com/n0-computer/iroh/issues/76)) ([8f491d5](https://github.com/n0-computer/iroh/commit/8f491d57c73e2ccc5b5c9d011ed38bfc03622953)) -* bitswap sessions shutdown ([6de85c9](https://github.com/n0-computer/iroh/commit/6de85c93bd541862558d498392256c091626d919)) -* **bitswap:** fetch provider loop ([93517a3](https://github.com/n0-computer/iroh/commit/93517a3157787eecc49b90a5815745adc2ffbce8)) -* ci release aarch64 linux ([#184](https://github.com/n0-computer/iroh/issues/184)) ([4cc66aa](https://github.com/n0-computer/iroh/commit/4cc66aa19877ae66869c395208012eed408f7af2)) -* CI, add macOS & windows builds, cargo audit ([5dbd907](https://github.com/n0-computer/iroh/commit/5dbd9074b8ee1b1945afb3345df21df39bc348ce)) -* correctly check headers parse result ([#227](https://github.com/n0-computer/iroh/issues/227)) ([82a1b82](https://github.com/n0-computer/iroh/commit/82a1b82e035de4210aa5355d798f4e13953c47b9)) -* correctly map memory channels ([0742fb2](https://github.com/n0-computer/iroh/commit/0742fb21cce63d2f3a1e9cc354ad511c69b226dc)), closes [#165](https://github.com/n0-computer/iroh/issues/165) -* default off metrics & tracing ([#174](https://github.com/n0-computer/iroh/issues/174)) ([bbc2ec1](https://github.com/n0-computer/iroh/commit/bbc2ec19ebb082a758d948cb64d0277e71bdb6a0)) -* don't error on empty providers in the wrong place ([414a8f2](https://github.com/n0-computer/iroh/commit/414a8f2470962690b516be1cb015864565d571b7)) -* drop openssl requirement ([#72](https://github.com/n0-computer/iroh/issues/72)) ([b72ce04](https://github.com/n0-computer/iroh/commit/b72ce044bc32f0ccde02946cdd4fa34e577ad42f)) -* error when someone tries to start an unknown service ([#431](https://github.com/n0-computer/iroh/issues/431)) ([9a57fb7](https://github.com/n0-computer/iroh/commit/9a57fb7f36c78a1a395faed7fc984b1da1248f3c)) -* extend metrics ([#32](https://github.com/n0-computer/iroh/issues/32)) ([34c53da](https://github.com/n0-computer/iroh/commit/34c53da9069351821b0c9c56f1f5fc3dc5449074)) -* fix builds ([#173](https://github.com/n0-computer/iroh/issues/173)) ([932161c](https://github.com/n0-computer/iroh/commit/932161cab2b2991af278f0af131318fc7f703979)) -* Fix test that for some reason assumes sort order in a vec ([d57b12a](https://github.com/n0-computer/iroh/commit/d57b12a9ce8ead2a0ddaa1b0ab0e700a6292b8dd)) -* gateway readme ([#31](https://github.com/n0-computer/iroh/issues/31)) ([e94a7e0](https://github.com/n0-computer/iroh/commit/e94a7e055d567c6e2320c4d244d3c84f8bbc3899)) -* gateway upgrade ([#36](https://github.com/n0-computer/iroh/issues/36)) ([0bb4fe9](https://github.com/n0-computer/iroh/commit/0bb4fe915c28e0278c91b83801aed422f30517bf)) -* **gateway:** do not panic on missing location info ([c518ce7](https://github.com/n0-computer/iroh/commit/c518ce7c2ad7dbade6d87da62fbb94f868600e66)) -* **gateway:** populate directory listings ([c7217f1](https://github.com/n0-computer/iroh/commit/c7217f1a864e96c2e45b096245a477295976c5dd)) -* gha disk space hacks ([#387](https://github.com/n0-computer/iroh/issues/387)) ([a9d9c25](https://github.com/n0-computer/iroh/commit/a9d9c25af31795fa9ada3ee94c0757cc9024f19b)) -* hamt directory listings ([5187773](https://github.com/n0-computer/iroh/commit/5187773bfdb07a30c0e33c731105d3add9770fd1)), closes [#192](https://github.com/n0-computer/iroh/issues/192) -* histogram metric assignment ([#119](https://github.com/n0-computer/iroh/issues/119)) ([b75bbbd](https://github.com/n0-computer/iroh/commit/b75bbbda08604c8174e5c0d3e69dcf9d4eb507f8)) -* Improve error handling ([#379](https://github.com/n0-computer/iroh/issues/379)) ([7a945ed](https://github.com/n0-computer/iroh/commit/7a945ed602af50f1a5f0d15f2079f351a3037650)) -* Improve error management and reporting when using unix domain sockets ([#228](https://github.com/n0-computer/iroh/issues/228)) ([8d13e4f](https://github.com/n0-computer/iroh/commit/8d13e4f691bd3eab5a8af93c34e2b93bc5c52995)) -* **iroh-car:** limit to 4MiB not 4GiB ([34eedb8](https://github.com/n0-computer/iroh/commit/34eedb83f39cf9fd581a62c7c91ed7f668a14bc8)) -* **iroh-gateway:** add `FileType::Raw` option ([#332](https://github.com/n0-computer/iroh/issues/332)) ([ff4ef02](https://github.com/n0-computer/iroh/commit/ff4ef0254cc663d1bb757559aed032bc38f25ea5)) -* **iroh-gateway:** increase timeouts ([c3d56c6](https://github.com/n0-computer/iroh/commit/c3d56c6c52a209e1cd850f9c5e89aede8a8073ee)) -* **iroh-one:** use default store path when no --store-path flag present ([#317](https://github.com/n0-computer/iroh/issues/317)) ([643fd43](https://github.com/n0-computer/iroh/commit/643fd43a2256db9e9bf622dcf4981d81b1ff48ff)), closes [#255](https://github.com/n0-computer/iroh/issues/255) [#309](https://github.com/n0-computer/iroh/issues/309) -* limit max memory allocations per node ([9817b5a](https://github.com/n0-computer/iroh/commit/9817b5a77106a12225b457ff42a64b5628737a2e)) -* loger only on p2p ([b24c5fe](https://github.com/n0-computer/iroh/commit/b24c5fe2c8db05e4b75d4893192ba81d7e173ab9)) -* macos releases ([#34](https://github.com/n0-computer/iroh/issues/34)) ([2fc0109](https://github.com/n0-computer/iroh/commit/2fc0109830ba1edfb3d4daa2ddbbfce0e62b5d10)) -* make trace_id visible only if in use ([#359](https://github.com/n0-computer/iroh/issues/359)) ([c29bf85](https://github.com/n0-computer/iroh/commit/c29bf85d2d2a02e2a45bd4e3387c139c9693d20a)) -* metrics rework & update ([#69](https://github.com/n0-computer/iroh/issues/69)) ([6c1d003](https://github.com/n0-computer/iroh/commit/6c1d0035d480592271ddcc13a4f0d9d434a13326)) -* metrics toggle on store ([2b12158](https://github.com/n0-computer/iroh/commit/2b1215833bcea718f4e0ba47a3b9b71ffa0b8181)) -* move bitswap msg counters out of encode/decode ([#374](https://github.com/n0-computer/iroh/issues/374)) ([85d80b9](https://github.com/n0-computer/iroh/commit/85d80b9d5fc9441e1912d07adc67130f9b0fa6b2)) -* p2p subcommand output cleanup ([#427](https://github.com/n0-computer/iroh/issues/427)) ([0ca029c](https://github.com/n0-computer/iroh/commit/0ca029c143f5d6f9a9f5ebbfaafc0ccdd18340ad)) -* **p2p:** cleanup sessions when they are canceled ([#419](https://github.com/n0-computer/iroh/issues/419)) ([efa9e82](https://github.com/n0-computer/iroh/commit/efa9e820a8288746b6196dc3eb25fe64c4c32e63)) -* **p2p:** do not panic on shutdown of bs req ([b05b94a](https://github.com/n0-computer/iroh/commit/b05b94a124f81e8ca9eb180b751688d7c0cd3ba5)) -* **p2p:** enable rsa key keys again ([afeafb4](https://github.com/n0-computer/iroh/commit/afeafb4383b4428936b0bb14f50b95e623e29557)) -* **p2p:** ensure default grpc connections work ([eec218d](https://github.com/n0-computer/iroh/commit/eec218d1a7548aaac40a41b1cbd009babcd3d868)) -* **p2p:** Increase the size of the kad mem store ([#320](https://github.com/n0-computer/iroh/issues/320)) ([00f5660](https://github.com/n0-computer/iroh/commit/00f56604e2bd85cd418018d349a17105aaffbf03)) -* **p2p:** record Kad, Identify and Ping metrics ([af8eaa9](https://github.com/n0-computer/iroh/commit/af8eaa96b7f5a751ed703cbc61a3eaa76a025962)) -* **p2p:** remove debug logs ([#420](https://github.com/n0-computer/iroh/issues/420)) ([23e1b3a](https://github.com/n0-computer/iroh/commit/23e1b3aedf1efaa566db5495bb691cbb4a8ba487)) -* parameters and connection handling ([96514d3](https://github.com/n0-computer/iroh/commit/96514d36d54e604d97db8994805246838412e005)) -* params ([#128](https://github.com/n0-computer/iroh/issues/128)) ([1f47d7c](https://github.com/n0-computer/iroh/commit/1f47d7c946a2e4497d5c17058908cc34c03cad4b)) -* pass links to store when adding data ([#299](https://github.com/n0-computer/iroh/issues/299)) ([9476d9c](https://github.com/n0-computer/iroh/commit/9476d9ca3272e95630dc041400e0f6fadcd3d4a9)) -* prom metrics no longer ping on --no-metrics ([#44](https://github.com/n0-computer/iroh/issues/44)) ([7f9c81a](https://github.com/n0-computer/iroh/commit/7f9c81adc4ef186ea7d215ccadd379e1a83348d6)) -* properly saves filenames for hamt dirs ([#422](https://github.com/n0-computer/iroh/issues/422)) ([1fe8e69](https://github.com/n0-computer/iroh/commit/1fe8e69f690b1e28d20cc2f407054caca04663a1)) -* properly setup the default config for iroh-one ([#256](https://github.com/n0-computer/iroh/issues/256)) ([a1e4940](https://github.com/n0-computer/iroh/commit/a1e494055ceb06a07347e94c733acb0246544ef5)) -* protoc from release bins ([#42](https://github.com/n0-computer/iroh/issues/42)) ([28cc3ab](https://github.com/n0-computer/iroh/commit/28cc3ab8f761173795be00d933ebee60c1ef859c)) -* require passing providers to fetch_bitswap ([771ee00](https://github.com/n0-computer/iroh/commit/771ee001361ec19a3d8f62ea4edbe71308b144df)), closes [#73](https://github.com/n0-computer/iroh/issues/73) -* **resolver:** handle trailing slashes in the path with more sense ([#414](https://github.com/n0-computer/iroh/issues/414)) ([9ef95e8](https://github.com/n0-computer/iroh/commit/9ef95e81f034cc9c36ed3e35367992fde8d1a8c0)) -* **resolver:** ipld, double-fetching, and trailing slash fixes ([#408](https://github.com/n0-computer/iroh/issues/408)) ([f861102](https://github.com/n0-computer/iroh/commit/f861102becd3d2f20f073c29e181805d01b8932d)) -* **resolver:** stop sessions when requests are done ([9c46cb0](https://github.com/n0-computer/iroh/commit/9c46cb07cb52a57e41d0a51296fd0b781d1861d7)) -* rpc creation no longer blocks the gateway ([#111](https://github.com/n0-computer/iroh/issues/111)) ([8f1d93c](https://github.com/n0-computer/iroh/commit/8f1d93c4955e95ed19f470176e76219982a066b9)) -* **rpc-client:** correct address format for clients ([8cde5cf](https://github.com/n0-computer/iroh/commit/8cde5cf4d405f1230acd1464c6b190ad12fe6973)) -* **rpc-client:** use multihash to query providers ([2b11a14](https://github.com/n0-computer/iroh/commit/2b11a142de5fa0fc7d68528909e3c1bb6846cdb2)) -* stop preventing any directory or file `foo` from existing in the project ([#334](https://github.com/n0-computer/iroh/issues/334)) ([3ef7ccc](https://github.com/n0-computer/iroh/commit/3ef7cccea1475bd288d53b70f753ca37c8b47944)) -* switch back to rust-libp2p master ([1336e9e](https://github.com/n0-computer/iroh/commit/1336e9ee1f56b4233659b36c49d52bf5b4199bcb)) -* tracing on request level ([#85](https://github.com/n0-computer/iroh/issues/85)) ([562e6d8](https://github.com/n0-computer/iroh/commit/562e6d8cc702c9ba1c82a61ae42031d2a760532a)) -* undo label change ([#219](https://github.com/n0-computer/iroh/issues/219)) ([3433340](https://github.com/n0-computer/iroh/commit/34333403f99d593276561fbbe43a35d8160cb048)) -* Update ipld in iroh-car to limit prost duplicates ([#307](https://github.com/n0-computer/iroh/issues/307)) ([ee43bd7](https://github.com/n0-computer/iroh/commit/ee43bd7063fcf6174025aea023151f519bd4b4fc)) -* use rustls ([#64](https://github.com/n0-computer/iroh/issues/64)) ([0c37cef](https://github.com/n0-computer/iroh/commit/0c37cef26981807aee1cb3b60122ba15c05f09cd)) -* use the uds-gateway feature only to control the http uds endpoint ([#252](https://github.com/n0-computer/iroh/issues/252)) ([9bcbb59](https://github.com/n0-computer/iroh/commit/9bcbb59ec0282ae3dfa962d20ceb25dfff5505b5)) -* windows symlink support ([#386](https://github.com/n0-computer/iroh/issues/386)) ([563aac0](https://github.com/n0-computer/iroh/commit/563aac0bfc42c662b69c418c2f1004d1c5f82e12)) - - -### Features - -* `iroh-ctl add` & `iroh-ctl get` ([#164](https://github.com/n0-computer/iroh/issues/164)) ([979a36f](https://github.com/n0-computer/iroh/commit/979a36f15ad982015743b288ec35d92510d6620a)) -* `iroh-ctl status -w` watches the health of each iroh process ([#84](https://github.com/n0-computer/iroh/issues/84)) ([22b2bb5](https://github.com/n0-computer/iroh/commit/22b2bb5cfd4a4cae0f2a58bd0872a34aef5b95fe)) -* abstract over internal rpc mechanism & add support for UDS & Mem RPC ([6e859c2](https://github.com/n0-computer/iroh/commit/6e859c2c3d4e12e1dfd1e795ec139b47cdee140a)) -* add car importer ([aabfb9a](https://github.com/n0-computer/iroh/commit/aabfb9a4df18ab8dc3bd9394fd73007704958817)) -* add iroh-car ([#27](https://github.com/n0-computer/iroh/issues/27)) ([26a1b86](https://github.com/n0-computer/iroh/commit/26a1b86b785f2dda1cf0d8027ec1549383b35336)), closes [#9](https://github.com/n0-computer/iroh/issues/9) -* add placeholder iroh-bitswap and iroh-p2p crates ([9c4ab10](https://github.com/n0-computer/iroh/commit/9c4ab108796a4fb4179c95b3787bb8591eff3e47)) -* add rust-toolchain@1.61 ([b08ac2b](https://github.com/n0-computer/iroh/commit/b08ac2b52aa8078d3403f5458c85f204685a0340)) -* add trace id to responses ([#28](https://github.com/n0-computer/iroh/issues/28)) ([9d9c89e](https://github.com/n0-computer/iroh/commit/9d9c89e946096b5736e39917a1b2a696dd695bc7)) -* Allow to pass custom resolvers ([#220](https://github.com/n0-computer/iroh/issues/220)) ([9d319c5](https://github.com/n0-computer/iroh/commit/9d319c58468e583a809f058d82c0146b3ddacff8)) -* bad bits implementation ([#172](https://github.com/n0-computer/iroh/issues/172)) ([bda0173](https://github.com/n0-computer/iroh/commit/bda01739d6678d491726594a07c7e98679f41c30)) -* **bitswap:** add dial timeouts ([06e0104](https://github.com/n0-computer/iroh/commit/06e0104e4ba520252bf18130ca5d7620c0c0509b)) -* **bitswap:** add query errors and start cleanups ([72ae431](https://github.com/n0-computer/iroh/commit/72ae431c704bb4f20820f039050bd3d666cdf365)) -* **bitswap:** allow tracking queries based on ids ([21f75d5](https://github.com/n0-computer/iroh/commit/21f75d5c2967e001a3246ba89487e8fc5519e290)) -* **bitswap:** custom protocol handler for bitswap ([ff2ebc3](https://github.com/n0-computer/iroh/commit/ff2ebc3cedbd583632b753af10b2a7fb94d51a88)) -* **bitswap:** refactor & improve general strategy ([0747310](https://github.com/n0-computer/iroh/commit/07473107dc92419573d97c10cf132c1630eca5b2)) -* CLI get command improvements ([#331](https://github.com/n0-computer/iroh/issues/331)) ([b18b6c8](https://github.com/n0-computer/iroh/commit/b18b6c835af523ba8b300392af0d74cd4ad9f7a6)), closes [#269](https://github.com/n0-computer/iroh/issues/269) -* CLI tests for iroh add, and API changes ([#343](https://github.com/n0-computer/iroh/issues/343)) ([fdf2170](https://github.com/n0-computer/iroh/commit/fdf2170bb62a646537aa976e18c1e01f9895dd47)) -* connect the dots ([4b15df5](https://github.com/n0-computer/iroh/commit/4b15df5a2a003ff28ebf843197cc204dcd57dc97)) -* connection pooling ([#404](https://github.com/n0-computer/iroh/issues/404)) ([b499751](https://github.com/n0-computer/iroh/commit/b4997515edadcbbba85d6ad1e8f1aa5c16c3d84f)) -* ctl ci ([#175](https://github.com/n0-computer/iroh/issues/175)) ([b7ebf02](https://github.com/n0-computer/iroh/commit/b7ebf021d4160c5ec1dad8288086f7c06084b7b2)) -* **deps:** update libp2p to 0.47 ([9dadadc](https://github.com/n0-computer/iroh/commit/9dadadca25c518b1f6bf21853c8ebd52dad8dbdb)) -* distributed tracing ([#46](https://github.com/n0-computer/iroh/issues/46)) ([3e555bc](https://github.com/n0-computer/iroh/commit/3e555bcab38faee61ff4da6689d28710f0e68018)) -* don't run 'dht_nice_tick()' when kadmelia is disabled ([#242](https://github.com/n0-computer/iroh/issues/242)) ([050ad48](https://github.com/n0-computer/iroh/commit/050ad4862c95f7535cae062d31b7014c5c0a00d9)) -* Enable the CompressionLayer middleware ([#236](https://github.com/n0-computer/iroh/issues/236)) ([9151fc1](https://github.com/n0-computer/iroh/commit/9151fc13daaf5c2535c2708ec81d69fe6a234ed2)) -* fetch providers via bitswap ([b16be5a](https://github.com/n0-computer/iroh/commit/b16be5a98430374ac7b86d93e4a70f170621c309)) -* gateway upgrade ([#87](https://github.com/n0-computer/iroh/issues/87)) ([4732a76](https://github.com/n0-computer/iroh/commit/4732a76a435b7b46b23d574c337ee9b81cee2449)) -* **gateway:** initial directory listing support ([#328](https://github.com/n0-computer/iroh/issues/328)) ([3316a53](https://github.com/n0-computer/iroh/commit/3316a53776311a38287b92126fdbacb21ad35897)) -* get config from files, environment vars, & command line flags ([#112](https://github.com/n0-computer/iroh/issues/112)) ([652b7ff](https://github.com/n0-computer/iroh/commit/652b7ffd3750b2bc40f8a305bb0626e446f4fc3c)) -* implement basic iroh-store ([a1b9586](https://github.com/n0-computer/iroh/commit/a1b9586a3b9829c0989232c9e910c4d6945b7802)) -* implement iroh-ctl find-provs ([#182](https://github.com/n0-computer/iroh/issues/182)) ([ec06238](https://github.com/n0-computer/iroh/commit/ec06238fe137c7e0fcd51a5f48aa1a9a9ba34d65)) -* import flatfs-store and rocks-store crates ([4ac82a8](https://github.com/n0-computer/iroh/commit/4ac82a88c5f2fe8566cca2d7ae6f265a96e00375)) -* **importer:** add hash verification ([96eda12](https://github.com/n0-computer/iroh/commit/96eda1247683d5f23be60381d7bb9dd8fc7b31da)) -* improve add experience ([#401](https://github.com/n0-computer/iroh/issues/401)) ([4f86388](https://github.com/n0-computer/iroh/commit/4f8638816d0fc4e8260ce06781b22baa4dbc2f44)) -* improve CLI texts and flags ([#342](https://github.com/n0-computer/iroh/issues/342)) ([9e0a03e](https://github.com/n0-computer/iroh/commit/9e0a03e7cc207e7ac76d7659db4a5500f97d131e)) -* improve provider fetching ([38ce246](https://github.com/n0-computer/iroh/commit/38ce24653261469c74ee354b4071340907bdd804)) -* iroh-api rename, iroh get basics, rpc client construction ([d24edc1](https://github.com/n0-computer/iroh/commit/d24edc1344fb2c14e58cd5272d9d968009d187de)) -* **iroh-api:** implement lookup & connect ([#372](https://github.com/n0-computer/iroh/issues/372)) ([a93dfb4](https://github.com/n0-computer/iroh/commit/a93dfb4eb77d5eb5d53a1504b3aed7fa19027e73)) -* **iroh-ctl:** implement available commands ([#123](https://github.com/n0-computer/iroh/issues/123)) ([c6bdca3](https://github.com/n0-computer/iroh/commit/c6bdca30401ac85be1076ce6cee574a8fc57efd6)) -* iroh-one ([#212](https://github.com/n0-computer/iroh/issues/212)) ([11fe705](https://github.com/n0-computer/iroh/commit/11fe705496e3b450aa677368bc32f5b1c5a3c0b1)) -* **iroh-resolver:** create a balanced tree dag ([3285d1f](https://github.com/n0-computer/iroh/commit/3285d1f50f170721e7c1abbe778f71f85621854c)) -* **iroh-resolver:** implement unixfs dir listing ([263b3c2](https://github.com/n0-computer/iroh/commit/263b3c2c91b53d00fa675a47f00946e2c85ea5f8)) -* **iroh-store:** add minimal main implementation ([b1c49a1](https://github.com/n0-computer/iroh/commit/b1c49a19c6436a3c2e89e9880fb5250fb22f4daf)) -* Map id to cid instead of multihash ([#336](https://github.com/n0-computer/iroh/issues/336)) ([092bdf7](https://github.com/n0-computer/iroh/commit/092bdf72b32e01099a6e3fd8ded818e3eeeebe41)), closes [#335](https://github.com/n0-computer/iroh/issues/335) -* offline adding ([#415](https://github.com/n0-computer/iroh/issues/415)) ([7725508](https://github.com/n0-computer/iroh/commit/772550834f3861d3c38c2e9a0b97a24440df778d)) -* p2p api service calls with a p2p-specific error, better feedback ([#402](https://github.com/n0-computer/iroh/issues/402)) ([b565231](https://github.com/n0-computer/iroh/commit/b56523103224f3b77bf0b6d455911cf87b628c4f)) -* **p2p:** add `gossipsub` to p2p node & `gossipsub` rpc methods ([#132](https://github.com/n0-computer/iroh/issues/132)) ([f18d726](https://github.com/n0-computer/iroh/commit/f18d726c4f26f9ad91a3f28ed428a884a5583140)) -* **p2p:** improve default configurations for dht and bs ([791181a](https://github.com/n0-computer/iroh/commit/791181a9b11fdbcbedcad5c367f935a9762fb261)) -* **p2p:** integrate autonat protocol ([5c5c1b0](https://github.com/n0-computer/iroh/commit/5c5c1b046f55c5eaeb600dff882010c376854e02)) -* **p2p:** integrate relay and dcutr ([6555090](https://github.com/n0-computer/iroh/commit/6555090245c688f232d95a90338f2b277b0bfefe)) -* **p2p:** make bitswap toglable ([648bcbf](https://github.com/n0-computer/iroh/commit/648bcbffc8d08f7bb5d57644954063e8d3566c38)) -* **p2p:** make gossipsub configurable ([071fd1b](https://github.com/n0-computer/iroh/commit/071fd1bad42c8d3228a478a92af74bf321195dd8)) -* **p2p:** persist identity ([8f57278](https://github.com/n0-computer/iroh/commit/8f57278e2738baac0d528a28da5fcd89d6a658c3)) -* **p2p:** refresh kad buckets & rebootstrap regularly ([339ed13](https://github.com/n0-computer/iroh/commit/339ed13789352eb0abf56e18ea1e23593647e9c7)) -* **p2p:** respond to bitswap requests ([965e21c](https://github.com/n0-computer/iroh/commit/965e21c68d10e381e20f771e948e96ebf7a39c85)) -* progress bar for iroh add command ([#368](https://github.com/n0-computer/iroh/issues/368)) ([bff3560](https://github.com/n0-computer/iroh/commit/bff3560a22e4240e61d4558c7cf1f11b129b30df)) -* provide a mechanism to check if an iroh program is already running. ([#293](https://github.com/n0-computer/iroh/issues/293)) ([bddbae9](https://github.com/n0-computer/iroh/commit/bddbae90f49c7ea45a2900ad1fa4560d9482bd60)) -* provide only root, and only at the end of add ([#406](https://github.com/n0-computer/iroh/issues/406)) ([96c6148](https://github.com/n0-computer/iroh/commit/96c614839127a0b881ac100e3102abca70cb3a87)) -* race a http gateway with p2p in iroh-one's content loader ([#338](https://github.com/n0-computer/iroh/issues/338)) ([40cb232](https://github.com/n0-computer/iroh/commit/40cb232dc3ff69bfed90242eb986f853cab093c6)) -* range request support ([#330](https://github.com/n0-computer/iroh/issues/330)) ([074f0c6](https://github.com/n0-computer/iroh/commit/074f0c664578ff4f9108cb388aeb376f0baf3b9c)) -* recursive directories & directory link limits ([#213](https://github.com/n0-computer/iroh/issues/213)) ([be4e931](https://github.com/n0-computer/iroh/commit/be4e9311b3bf28ad3ae97bdffd8aa20164a0873c)) -* relases for p2p, store & some refactoring ([#45](https://github.com/n0-computer/iroh/issues/45)) ([d101e5a](https://github.com/n0-computer/iroh/commit/d101e5a5883dfaf378d2e15b384ae61c37dae1d7)) -* rename the iroh-ctl crate to the iroh crate ([#321](https://github.com/n0-computer/iroh/issues/321)) ([8b02977](https://github.com/n0-computer/iroh/commit/8b0297792cffb9cebf84ed1c64d2ff48b64aaf41)) -* **resolver:** add support for raw leaves in unixfs ([1d6d57d](https://github.com/n0-computer/iroh/commit/1d6d57d9de1c0ef1328bf1e5e982544d89982040)) -* **resolver:** expose metadata about the resolution result ([a229875](https://github.com/n0-computer/iroh/commit/a229875b1585e122552c3117c38aedae93fa07dd)) -* **resolver:** expose way to get directory content ([9b59326](https://github.com/n0-computer/iroh/commit/9b5932624b12866527310e6886354a201ed998a3)) -* **resolver:** handle symlinks properly ([5cc84ea](https://github.com/n0-computer/iroh/commit/5cc84eaa655f6f4ac3dfb1209877aed3f9b1ea18)) -* **resolver:** implement dsnlink resolution ([5fa893d](https://github.com/n0-computer/iroh/commit/5fa893d0d7550ddc541763f0b52670a15a2acf34)) -* **resolver:** stream content ([3d419b5](https://github.com/n0-computer/iroh/commit/3d419b5f59ea05badf95d90a25a52afbc6ba1e2b)) -* **resolver:** support raw codec ([25d5b28](https://github.com/n0-computer/iroh/commit/25d5b283387b7594b92e5f3579fd86ce3836840a)) -* **resolver:** unixfs: resolve simple multi chunk files ([fa94b6d](https://github.com/n0-computer/iroh/commit/fa94b6d064a8f1df65eea4b1bf622415e7203ac0)) -* rpc client that can handle out-going commands and incoming requests ([#26](https://github.com/n0-computer/iroh/issues/26)) ([f2fd5cb](https://github.com/n0-computer/iroh/commit/f2fd5cbae5ac7023f8e5c304323fe8f8be3ab946)) -* **rpc:** add rpc client and server for `store` process ([#41](https://github.com/n0-computer/iroh/issues/41)) ([854b605](https://github.com/n0-computer/iroh/commit/854b605e80c311152ecff54ceccf6b0f91b18e3c)) -* streaming providers ([a810e07](https://github.com/n0-computer/iroh/commit/a810e0744a66825413ae5772ae7445a4df4d922a)) -* switch to libp2p@0.45 ([f1dd5f7](https://github.com/n0-computer/iroh/commit/f1dd5f73341f0c8c71c21bc5d69f026fd3482267)) -* Unixfs Improvements ([42dee06](https://github.com/n0-computer/iroh/commit/42dee0644fe3605bbf6df3bd2415409fccb6bfe2)) -* **unixfs:** add `filesize` and `blocksizes` for `UnixfsNode::File` nodes ([#254](https://github.com/n0-computer/iroh/issues/254)) ([6ba6b57](https://github.com/n0-computer/iroh/commit/6ba6b576de067c44fc3fea80e67a5edcf05ec2c9)) -* **unixfs:** add symlink support ([#337](https://github.com/n0-computer/iroh/issues/337)) ([3157c15](https://github.com/n0-computer/iroh/commit/3157c15fb1dc359f3d45b53744d29f1dd548a1ec)) -* update libp2p to latest ([39b25e8](https://github.com/n0-computer/iroh/commit/39b25e874284d8f4218f75b82a6c73fcb10a25df)) -* update rust-libp2p ([c595c4d](https://github.com/n0-computer/iroh/commit/c595c4dbdeeb61b9bdd2aa1fba44e890e7eeb529)) -* update to libp2p@0.50 ([#391](https://github.com/n0-computer/iroh/issues/391)) ([8a906ee](https://github.com/n0-computer/iroh/commit/8a906eeb9889c28c28c3a6fd3802065ad5aadf82)) -* upload gateway builds to s3 (linux/amd64) ([#29](https://github.com/n0-computer/iroh/issues/29)) ([1918a83](https://github.com/n0-computer/iroh/commit/1918a8386dd90ac5e7c0c5b634ebb3e849719ed9)) -* use the store to cache received data ([9dac53a](https://github.com/n0-computer/iroh/commit/9dac53ae689e3ef46a4800aa5c1df22913daf1c3)) - - -### Performance Improvements - -* add parallelism to hashing ([#411](https://github.com/n0-computer/iroh/issues/411)) ([12db7ed](https://github.com/n0-computer/iroh/commit/12db7ede56ed16ecc18e83ec1e9f5b9f507239b9)) -* impl put_many and reuse column families ([#412](https://github.com/n0-computer/iroh/issues/412)) ([4cab5c7](https://github.com/n0-computer/iroh/commit/4cab5c79f5ba7c206be92729aad337ad3274e81e)) -* **resolver:** avoid some allocations ([9f2d718](https://github.com/n0-computer/iroh/commit/9f2d718b3e3717e9a8971b3d28652fa4434273e6)) -* use content_bytes instead of content_reader ([9dd0c22](https://github.com/n0-computer/iroh/commit/9dd0c228af91712a4a948a24e79068061078dbb9)) -* Use the libipld built in way to scrape references ([93546b1](https://github.com/n0-computer/iroh/commit/93546b11139bd54cfd4792613a3000d1ec8c8a27)) - - -### Reverts - -* Revert "fix dial metrics" ([5f4c063](https://github.com/n0-computer/iroh/commit/5f4c063cbd29aa1231c56334b4197cca0ff536a2)) -* Revert "update to libp2p@0.49 (#266)" ([59d7a3d](https://github.com/n0-computer/iroh/commit/59d7a3d4833001d1d22a54819337d80136183a80)), closes [#266](https://github.com/n0-computer/iroh/issues/266) diff --git a/CONTRIBUTOR.md b/CONTRIBUTOR.md index 78f8ae7cd..5f53baf0e 100644 --- a/CONTRIBUTOR.md +++ b/CONTRIBUTOR.md @@ -73,7 +73,7 @@ the effort we can spend fixing issues and adding new features, by not reporting ## Pull Request Submission Guidelines Before you submit your pull request consider the following guidelines: -* Search [GitHub](https://github.com/n0-computer/iroh/pulls) for an open or closed Pull Request +* Search [GitHub](https://github.com/n0-computer/beetle/pulls) for an open or closed Pull Request that relates to your submission. You don't want to duplicate effort. * Create the [development environment][developers.setup] * Make your changes in a new git branch: @@ -99,7 +99,7 @@ Before you submit your pull request consider the following guidelines: git push origin my-fix-branch ``` -* In GitHub, send a pull request to ` iroh:main`. +* In GitHub, send a pull request to ` beetle:main`. * Follow our [Pull Request Guidelines](developers.prs) to understand who to tag for review and how best to merge your work. * If we suggest changes, then: @@ -139,13 +139,13 @@ from the main (upstream) repository: git pull --ff upstream main ``` -[coc]: https://github.com/n0-computer/iroh/blob/main/code_of_conduct.md +[coc]: https://github.com/n0-computer/beetle/blob/main/code_of_conduct.md [developers]: DEVELOPERS.md [developers.setup]: DEVELOPERS.md#setup [developers.commits]: DEVELOPERS.md#commits [developers.rules]: DEVELOPERS.md#rules -[github-issues]: https://github.com/n0-computer/iroh/issues -[github]: https://github.com/n0-computer/iroh +[github-issues]: https://github.com/n0-computer/beetle/issues +[github]: https://github.com/n0-computer/beetle [jsfiddle]: http://jsfiddle.net/ [plunker]: http://plnkr.co/edit diff --git a/Cargo.toml b/Cargo.toml index acbba7a43..cb955e9a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,23 +2,23 @@ members = [ "examples/embed", "examples/importer", - "iroh", - "iroh-api", - "iroh-bitswap", - "iroh-car", - "iroh-embed", - "iroh-gateway", - "iroh-localops", - "iroh-metrics", - "iroh-one", - "iroh-p2p", - "iroh-resolver", - "iroh-rpc-client", - "iroh-rpc-types", - "iroh-share", - "iroh-unixfs", - "iroh-store", - "iroh-util", + "beetle", + "beetle-api", + "beetle-bitswap", + "beetle-car", + "beetle-embed", + "beetle-gateway", + "beetle-localops", + "beetle-metrics", + "beetle-one", + "beetle-p2p", + "beetle-resolver", + "beetle-rpc-client", + "beetle-rpc-types", + "beetle-share", + "beetle-unixfs", + "beetle-store", + "beetle-util", "xtask", ] # even if all crates are set to edition 2021, we still need to force the @@ -31,7 +31,7 @@ version = "0.2.0" edition = "2021" license = "Apache-2.0/MIT" rust-version = "1.65" -repository = "https://github.com/n0-computer/iroh" +repository = "https://github.com/n0-computer/beetle" [workspace.dependencies] # We prefer to place all dependencies for our workspace crates here. @@ -90,22 +90,22 @@ hyper = "0.14.23" ignore = "0.4.18" indicatif = "0.17.1" integer-encoding = "3.0" -iroh = { version = "0.2.0", path = "./iroh" } -iroh-api = { version = "0.2.0", path = "./iroh-api" } -iroh-bitswap = { version = "0.2.0", path = "./iroh-bitswap" } -iroh-car = { version = "0.2.0", path = "./iroh-car" } -iroh-embed = { version = "0.2.0", path = "./iroh-embed" } -iroh-gateway = { version = "0.2.0", path = "./iroh-gateway" } -iroh-localops = { version = "0.2.0", path = "./iroh-localops" } -iroh-metrics = { version = "0.2.0", path = "./iroh-metrics" } -iroh-one = { version = "0.2.0", path = "./iroh-one" } -iroh-p2p = { version = "0.2.0", path = "./iroh-p2p" } -iroh-resolver = { version = "0.2.0", path = "./iroh-resolver" } -iroh-rpc-client = { version = "0.2.0", path = "./iroh-rpc-client" } -iroh-rpc-types = { version = "0.2.0", path = "./iroh-rpc-types" } -iroh-store = { version = "0.2.0", path = "./iroh-store" } -iroh-unixfs = { version = "0.2.0", path = "./iroh-unixfs" } -iroh-util = { version = "0.2.0", path = "./iroh-util" } +beetle = { version = "0.2.0", path = "./beetle" } +beetle-api = { version = "0.2.0", path = "./beetle-api" } +beetle-bitswap = { version = "0.2.0", path = "./beetle-bitswap" } +beetle-car = { version = "0.2.0", path = "./beetle-car" } +beetle-embed = { version = "0.2.0", path = "./beetle-embed" } +beetle-gateway = { version = "0.2.0", path = "./beetle-gateway" } +beetle-localops = { version = "0.2.0", path = "./beetle-localops" } +beetle-metrics = { version = "0.2.0", path = "./beetle-metrics" } +beetle-one = { version = "0.2.0", path = "./beetle-one" } +beetle-p2p = { version = "0.2.0", path = "./beetle-p2p" } +beetle-resolver = { version = "0.2.0", path = "./beetle-resolver" } +beetle-rpc-client = { version = "0.2.0", path = "./beetle-rpc-client" } +beetle-rpc-types = { version = "0.2.0", path = "./beetle-rpc-types" } +beetle-store = { version = "0.2.0", path = "./beetle-store" } +beetle-unixfs = { version = "0.2.0", path = "./beetle-unixfs" } +beetle-util = { version = "0.2.0", path = "./beetle-util" } keyed_priority_queue = "0.4.1" lazy_static = "1.4" libipld = "0.15" diff --git a/DEVELOPERS.md b/DEVELOPERS.md index f70b34ba5..b70f3917a 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -52,15 +52,15 @@ Use `cargo` commands to build and run the various Iroh binaries. For example: ```shell -# run each command in a different terminal to simulate running iroh as +# run each command in a different terminal to simulate running beetle as # microservices on different boxes: -$ cargo run -p iroh-p2p -$ cargo run -p iroh-gateway -$ cargo run -p iroh-store -$ cargo run -p iroh -- status --watch +$ cargo run -p beetle-p2p +$ cargo run -p beetle-gateway +$ cargo run -p beetle-store +$ cargo run -p beetle -- status --watch ``` -If you want to use the `iroh` binary to start and stop the services, you can +If you want to use the `beetle` binary to start and stop the services, you can use `xtask` to move previously built binaries to the correct bin: ```shell @@ -94,7 +94,7 @@ cargo clippy --workspace --all-features --all-targets && cargo test --workspace ## Dependencies -Any crate added to iroh will need to use a license compatible with ours. Any PR that introduces a new crate will require additional review time to audit the crate being introduced, including rationale on why you chose *this* crate, and what alternatives you considered willl speed up the review process. +Any crate added to beetle will need to use a license compatible with ours. Any PR that introduces a new crate will require additional review time to audit the crate being introduced, including rationale on why you chose *this* crate, and what alternatives you considered willl speed up the review process. Crate lists in `Cargo.toml` files must be kept alphabetically sorted. @@ -102,13 +102,13 @@ Crate lists in `Cargo.toml` files must be kept alphabetically sorted. The tests must pass and you must get an approval from someone on the Iroh team before you can merge your PR. -Depending on your permissions in the `iroh` repo, you may not have the the ability to "request a review". Instead, please tag your selected reviewers in the PR itself (using the `@`) and specify that you would like them to review. If you are a member of our discord community, you can and should ping your reviewer(s) there as well. +Depending on your permissions in the `beetle` repo, you may not have the the ability to "request a review". Instead, please tag your selected reviewers in the PR itself (using the `@`) and specify that you would like them to review. If you are a member of our discord community, you can and should ping your reviewer(s) there as well. -If you don't know who to tag for review, here are some good guidelines. For any markdown documentations changes, tag `ramfox` or `b5`. If your PR solves an issue that someone else created, tag that person in review. If it's an issue you have created, tag team members who have been discussing the issue. Otherwise, create the PR and note that you aren't sure who to tag! Someone will drop in to give you guidance. If you are apart of our discord community, ask who should be tagged in the `iroh` channel. +If you don't know who to tag for review, here are some good guidelines. For any markdown documentations changes, tag `ramfox` or `b5`. If your PR solves an issue that someone else created, tag that person in review. If it's an issue you have created, tag team members who have been discussing the issue. Otherwise, create the PR and note that you aren't sure who to tag! Someone will drop in to give you guidance. If you are apart of our discord community, ask who should be tagged in the `beetle` channel. ### A note about our current CI testing set up -The MacOS testing infrastructure currently does not work on forked branches of `iroh`. If you are working on a forked branch, you will notice that the MacOS tests on your PRs will always fail (because they will not run). This is the only case where you may have a "failing" test and still merge your PR. +The MacOS testing infrastructure currently does not work on forked branches of `beetle`. If you are working on a forked branch, you will notice that the MacOS tests on your PRs will always fail (because they will not run). This is the only case where you may have a "failing" test and still merge your PR. ### Merging @@ -163,7 +163,7 @@ Must be one of the following: ### Scope -The scope could be anything specifying place of the commit change. For example, if I am refactoring something in the `iroh` package, I may start my commit with "refactor(iroh)". +The scope could be anything specifying place of the commit change. For example, if I am refactoring something in the `beetle` package, I may start my commit with "refactor(beetle)". You can use `*` when the change affects more than a single scope. @@ -192,7 +192,7 @@ A detailed explanation can be found in this [document][commit-message-format]. [closing-issues]: https://help.github.com/articles/closing-issues-via-commit-messages/ [commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit# -[github]: https://github.com/n0-computer/iroh +[github]: https://github.com/n0-computer/beetle [git-revert]: https://git-scm.com/docs/git-revert [git-setup]: https://help.github.com/articles/set-up-git [git-hook]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks diff --git a/Dockerfile-ci b/Dockerfile-ci index 257c0b7c3..6da2c0b44 100644 --- a/Dockerfile-ci +++ b/Dockerfile-ci @@ -1,7 +1,7 @@ # Dockerfile for CircleCI # build with -# `docker build -t dignifiedquire/iroh-ci:latest -f ./Dockerfile-ci .` -# rebuild: `docker build --pull --no-cache -t dignifiedquire/iroh-ci:latest -f ./Dockerfile-ci .` +# `docker build -t dignifiedquire/beetle-ci:latest -f ./Dockerfile-ci .` +# rebuild: `docker build --pull --no-cache -t dignifiedquire/beetle-ci:latest -f ./Dockerfile-ci .` FROM cimg/rust:1.62.0 diff --git a/README.md b/README.md index 7a8d9282c..0ec36bfa3 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,21 @@ -# iroh +# beetle -[![crates.io](https://img.shields.io/crates/v/iroh.svg?style=flat-square)](https://crates.io/crates/iroh) -[![Released API docs](https://img.shields.io/docsrs/iroh?style=flat-square)](https://docs.rs/iroh) -[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/iroh?style=flat-square)](./LICENSE-MIT) -[![CI](https://img.shields.io/github/workflow/status/n0-computer/iroh/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/iroh/actions?query=workflow%3A%22Continuous+integration%22) +[![crates.io](https://img.shields.io/crates/v/beetle.svg?style=flat-square)](https://crates.io/crates/beetle) +[![Released API docs](https://img.shields.io/docsrs/beetle?style=flat-square)](https://docs.rs/beetle) +[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/beetle?style=flat-square)](./LICENSE-MIT) +[![CI](https://img.shields.io/github/workflow/status/n0-computer/beetle/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/beetle/actions?query=workflow%3A%22Continuous+integration%22) Iroh is a next-generation implementation of the Interplanetary File System ([IPFS](https://ipfs.io)) for Cloud & Mobile platforms. IPFS is a networking protocol for exchanging _content-addressed_ blocks of immutable data. “Content-addressed” means referring to data by the *hash of its content*, which makes the reference unique and verifiable. These two properties make it possible to get data from *any* node in the network that speaks the IPFS protocol, including IPFS content being served by other implementations of IPFS. -This repo is a common core for three distributions of iroh: +This repo is a common core for three distributions of beetle: -- **Iroh Cloud:** core features of iroh split into configurable microservices, optimized for running at datacenter scale. -- **Iroh One:** A select set of iroh cloud features packaged as a single binary for simplified deployment. +- **Iroh Cloud:** core features of beetle split into configurable microservices, optimized for running at datacenter scale. +- **Iroh One:** A select set of beetle cloud features packaged as a single binary for simplified deployment. - **Iroh Mobile:** iOS & Android libraries that bring efficient data distribution to mobile apps. -Here is an [install guide](https://iroh.computer/install). +Here is an [install guide](https://beetle.computer/install). ## Working on Iroh Check out the [CONTRIBUTOR docs](./CONTRIBUTOR.md) to get familiar with ways you can contribute to the Iroh project. The [DEVELOPERS docs](./DEVELOPERS.md) will help you get starting with building and developing Iroh. @@ -26,7 +26,7 @@ A full suite of automated benchmarks is in the works. [this talk](https://www.yo ## Who's behind this? -[Iroh](https://iroh.computer) is built & maintained by [number 0](https://n0.computer). We're a founder-backed startup hell-bent on building efficient distributed systems software. +[Iroh](https://beetle.computer) is built & maintained by [number 0](https://n0.computer). We're a founder-backed startup hell-bent on building efficient distributed systems software. ## License diff --git a/RELEASE.md b/RELEASE.md index 5280fb773..6404b3678 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -7,7 +7,7 @@ Install dependencies ```sh $ npm install -g conventional-changelog-cli -$ cd iroh +$ cd beetle $ conventional-changelog -p angular ``` @@ -15,11 +15,11 @@ Add the output of that to `CHANGELOG.md`, and write a human-centric summary of c Update the linked output to reference the new version, which conventional-changelog doesn't know about: ```md -# [](https://github.com/n0-computer/iroh/compare/v0.1.1...v) (2022-11-28) +# [](https://github.com/n0-computer/beetle/compare/v0.1.1...v) (2022-11-28) ``` becomes: ```md -# [v0.1.2](https://github.com/n0-computer/iroh/compare/v0.1.1...v0.1.2) (2022-11-28) +# [v0.1.2](https://github.com/n0-computer/beetle/compare/v0.1.1...v0.1.2) (2022-11-28) ``` ## Publishing @@ -28,7 +28,7 @@ Publishing on crates.io, bumping version & generating tags is done using [`cargo This requires the following permissions -- on github.com/n0-computer/iroh +- on github.com/n0-computer/beetle - creating tags - pushing to `main` - on crates.io diff --git a/iroh-api/Cargo.toml b/beetle-api/Cargo.toml similarity index 72% rename from iroh-api/Cargo.toml rename to beetle-api/Cargo.toml index 8d750c0c8..d2e5245ee 100644 --- a/iroh-api/Cargo.toml +++ b/beetle-api/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "iroh-api" +name = "beetle-api" readme = "README.md" description = "Rust API for Iroh" version.workspace = true @@ -16,12 +16,12 @@ bytes.workspace = true cid.workspace = true config.workspace = true futures.workspace = true -iroh-metrics.workspace = true -iroh-resolver.workspace = true -iroh-rpc-client.workspace = true -iroh-rpc-types.workspace = true -iroh-unixfs.workspace = true -iroh-util.workspace = true +beetle-metrics.workspace = true +beetle-resolver.workspace = true +beetle-rpc-client.workspace = true +beetle-rpc-types.workspace = true +beetle-unixfs.workspace = true +beetle-util.workspace = true libp2p.workspace = true relative-path.workspace = true serde = { workspace = true, features = ["derive"] } @@ -31,8 +31,8 @@ tracing.workspace = true [dev-dependencies] criterion = { workspace = true, features = ["async_tokio"] } -iroh-rpc-types.workspace = true -iroh-store.workspace = true +beetle-rpc-types.workspace = true +beetle-store.workspace = true tempfile.workspace = true [[bench]] diff --git a/beetle-api/README.md b/beetle-api/README.md new file mode 100644 index 000000000..b800929b2 --- /dev/null +++ b/beetle-api/README.md @@ -0,0 +1,23 @@ +# beetle-api + +[![crates.io](https://img.shields.io/crates/v/beetle-api.svg?style=flat-square)](https://crates.io/crates/beetle-api) +[![Released API docs](https://img.shields.io/docsrs/beetle-api?style=flat-square)](https://docs.rs/beetle-api) +[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/beetle-api?style=flat-square)](../LICENSE-MIT) +[![CI](https://img.shields.io/github/workflow/status/n0-computer/beetle/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/beetle/actions?query=workflow%3A%22Continuous+integration%22) + +This contains the API for controlling [beetle](https://github.com/n0-computer/beetle). + +## License + + +Licensed under either of Apache License, Version +2.0 or MIT license at your option. + + +
+ + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this crate by you, as defined in the Apache-2.0 license, shall +be dual licensed as above, without any additional terms or conditions. + diff --git a/iroh-api/benches/add.rs b/beetle-api/benches/add.rs similarity index 90% rename from iroh-api/benches/add.rs rename to beetle-api/benches/add.rs index 170c0d4a6..65d91af35 100644 --- a/iroh-api/benches/add.rs +++ b/beetle-api/benches/add.rs @@ -1,16 +1,16 @@ -use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; -use futures::TryStreamExt; -use iroh_resolver::resolver::Resolver; -use iroh_rpc_client::{Client, Config as RpcClientConfig}; -use iroh_rpc_types::Addr; -use iroh_store::{Config as StoreConfig, Store}; -use iroh_unixfs::{ +use beetle_resolver::resolver::Resolver; +use beetle_rpc_client::{Client, Config as RpcClientConfig}; +use beetle_rpc_types::Addr; +use beetle_store::{Config as StoreConfig, Store}; +use beetle_unixfs::{ chunker::{ChunkerConfig, DEFAULT_CHUNKS_SIZE}, content_loader::{FullLoader, FullLoaderConfig}, }; +use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; +use futures::TryStreamExt; use tokio::runtime::Runtime; -use iroh_api::{Api, UnixfsConfig, UnixfsEntry}; +use beetle_api::{Api, UnixfsConfig, UnixfsEntry}; fn add_benchmark(c: &mut Criterion) { let mut group = c.benchmark_group("unixfs_add_file"); @@ -43,7 +43,7 @@ fn add_benchmark(c: &mut Criterion) { let (_task, client, resolver) = executor.block_on(async { let store = Store::create(config).await.unwrap(); let task = executor.spawn(async move { - iroh_store::rpc::new(server_addr, store).await.unwrap() + beetle_store::rpc::new(server_addr, store).await.unwrap() }); // wait for a moment until the transport is setup // TODO: signal this more clearly diff --git a/iroh-api/src/api.rs b/beetle-api/src/api.rs similarity index 92% rename from iroh-api/src/api.rs rename to beetle-api/src/api.rs index 947dd786c..51d31fa36 100644 --- a/iroh-api/src/api.rs +++ b/beetle-api/src/api.rs @@ -6,27 +6,27 @@ use crate::config::{Config, CONFIG_FILE_NAME, ENV_PREFIX}; use crate::IpfsPath; use crate::P2pApi; use anyhow::{ensure, Context, Result}; -use cid::Cid; -use futures::stream::BoxStream; -use futures::{StreamExt, TryStreamExt}; -use iroh_resolver::resolver::Resolver; -use iroh_rpc_client::{Client, ClientStatus}; -use iroh_unixfs::{ +use beetle_resolver::resolver::Resolver; +use beetle_rpc_client::{Client, ClientStatus}; +use beetle_unixfs::{ builder::Entry as UnixfsEntry, content_loader::{FullLoader, FullLoaderConfig}, }; -use iroh_util::{iroh_config_path, make_config}; +use beetle_util::{beetle_config_path, make_config}; +use cid::Cid; +use futures::stream::BoxStream; +use futures::{StreamExt, TryStreamExt}; use relative_path::RelativePathBuf; use tokio::io::{AsyncRead, AsyncReadExt}; use crate::store::add_blocks_to_store; -/// API to interact with an iroh system. +/// API to interact with an beetle system. /// -/// This provides an API to use the iroh system consisting of several services working +/// This provides an API to use the beetle system consisting of several services working /// together. It offers both a higher level API as well as some lower-level APIs. /// -/// Unless working on iroh directly this should probably be constructed via the `iroh-embed` +/// Unless working on beetle directly this should probably be constructed via the `beetle-embed` /// crate rather then directly. #[derive(Debug, Clone)] pub struct Api { @@ -51,7 +51,7 @@ impl fmt::Debug for OutType { } impl Api { - /// Creates a new instance from the iroh configuration. + /// Creates a new instance from the beetle configuration. /// /// This loads configuration from an optional configuration file and environment /// variables. @@ -61,7 +61,7 @@ impl Api { config_path: Option<&'a Path>, overrides_map: HashMap, ) -> Result { - let cfg_path = iroh_config_path(CONFIG_FILE_NAME)?; + let cfg_path = beetle_config_path(CONFIG_FILE_NAME)?; let sources = [Some(cfg_path.as_path()), config_path]; let config = make_config( // default @@ -114,7 +114,7 @@ impl Api { Ok(P2pApi::new(p2p_client)) } - /// High level get, equivalent of CLI `iroh get`. + /// High level get, equivalent of CLI `beetle get`. /// /// Returns a stream of items, where items can be either blobs or UnixFs components. /// Each blob will be a full object, a file in case of UnixFs, and not raw chunks. diff --git a/iroh-api/src/config.rs b/beetle-api/src/config.rs similarity index 90% rename from iroh-api/src/config.rs rename to beetle-api/src/config.rs index 564a9be2b..d33b91ea7 100644 --- a/iroh-api/src/config.rs +++ b/beetle-api/src/config.rs @@ -1,17 +1,17 @@ +use beetle_metrics::config::Config as MetricsConfig; +use beetle_rpc_client::Config as RpcClientConfig; +use beetle_unixfs::indexer::IndexerUrl; +use beetle_util::insert_into_config_map; use config::{ConfigError, Map, Source, Value}; -use iroh_metrics::config::Config as MetricsConfig; -use iroh_rpc_client::Config as RpcClientConfig; -use iroh_unixfs::indexer::IndexerUrl; -use iroh_util::insert_into_config_map; use serde::{Deserialize, Serialize}; -/// CONFIG_FILE_NAME is the name of the optional config file located in the iroh home directory +/// CONFIG_FILE_NAME is the name of the optional config file located in the beetle home directory pub const CONFIG_FILE_NAME: &str = "ctl.config.toml"; /// ENV_PREFIX should be used along side the config field name to set a config field using /// environment variables -pub const ENV_PREFIX: &str = "IROH_CTL"; +pub const ENV_PREFIX: &str = "BEETLE_CTL"; -/// Configuration for [`iroh-api`]. +/// Configuration for [`beetle-api`]. #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Config { pub rpc_client: RpcClientConfig, diff --git a/iroh-api/src/error.rs b/beetle-api/src/error.rs similarity index 100% rename from iroh-api/src/error.rs rename to beetle-api/src/error.rs diff --git a/iroh-api/src/fs.rs b/beetle-api/src/fs.rs similarity index 100% rename from iroh-api/src/fs.rs rename to beetle-api/src/fs.rs diff --git a/iroh-api/src/lib.rs b/beetle-api/src/lib.rs similarity index 62% rename from iroh-api/src/lib.rs rename to beetle-api/src/lib.rs index 370bd21c9..46947cd5a 100644 --- a/iroh-api/src/lib.rs +++ b/beetle-api/src/lib.rs @@ -4,15 +4,15 @@ pub use crate::config::Config; pub use crate::error::ApiError; pub use crate::p2p::P2p as P2pApi; pub use crate::p2p::PeerIdOrAddr; -pub use bytes::Bytes; -pub use cid::Cid; -pub use iroh_resolver::resolver::Path as IpfsPath; -pub use iroh_rpc_client::{ClientStatus, Lookup, ServiceStatus, ServiceType, StatusType}; -pub use iroh_unixfs::builder::{ +pub use beetle_resolver::resolver::Path as IpfsPath; +pub use beetle_rpc_client::{ClientStatus, Lookup, ServiceStatus, ServiceType, StatusType}; +pub use beetle_unixfs::builder::{ Config as UnixfsConfig, DirectoryBuilder, Entry as UnixfsEntry, FileBuilder, SymlinkBuilder, }; -pub use iroh_unixfs::chunker::{ChunkerConfig, DEFAULT_CHUNKS_SIZE}; -pub use iroh_unixfs::Block; +pub use beetle_unixfs::chunker::{ChunkerConfig, DEFAULT_CHUNKS_SIZE}; +pub use beetle_unixfs::Block; +pub use bytes::Bytes; +pub use cid::Cid; pub use libp2p::gossipsub::MessageId; pub use libp2p::{Multiaddr, PeerId}; diff --git a/iroh-api/src/p2p.rs b/beetle-api/src/p2p.rs similarity index 97% rename from iroh-api/src/p2p.rs rename to beetle-api/src/p2p.rs index 82bb77ca8..b3e9505dd 100644 --- a/iroh-api/src/p2p.rs +++ b/beetle-api/src/p2p.rs @@ -1,6 +1,6 @@ use crate::error::map_service_error; use anyhow::Result; -use iroh_rpc_client::{Lookup, P2pClient}; +use beetle_rpc_client::{Lookup, P2pClient}; use libp2p::{multiaddr::Protocol, Multiaddr, PeerId}; use std::collections::HashMap; diff --git a/iroh-api/src/store.rs b/beetle-api/src/store.rs similarity index 98% rename from iroh-api/src/store.rs rename to beetle-api/src/store.rs index 921f39e1a..5cdbe7101 100644 --- a/iroh-api/src/store.rs +++ b/beetle-api/src/store.rs @@ -3,11 +3,11 @@ use std::{pin::Pin, sync::Arc}; use anyhow::Result; use async_stream::stream; use async_trait::async_trait; +use beetle_rpc_client::Client; +use beetle_unixfs::Block; use bytes::Bytes; use cid::Cid; use futures::{Stream, StreamExt}; -use iroh_rpc_client::Client; -use iroh_unixfs::Block; /// How many chunks to buffer up when adding content. const _ADD_PAR: usize = 24; diff --git a/iroh-bitswap/Cargo.toml b/beetle-bitswap/Cargo.toml similarity index 93% rename from iroh-bitswap/Cargo.toml rename to beetle-bitswap/Cargo.toml index a063467f6..feb133769 100644 --- a/iroh-bitswap/Cargo.toml +++ b/beetle-bitswap/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "iroh-bitswap" +name = "beetle-bitswap" authors = ["dignifiedquire "] description = "Implementation of the bitswap protocol" version.workspace = true @@ -24,8 +24,8 @@ cid.workspace = true deadqueue.workspace = true derivative.workspace = true futures.workspace = true -iroh-metrics = { workspace = true, features = ["bitswap"] } -iroh-util.workspace = true +beetle-metrics = { workspace = true, features = ["bitswap"] } +beetle-util.workspace = true keyed_priority_queue.workspace = true libp2p = { workspace = true, features = ["ping"] } multihash.workspace = true diff --git a/iroh-bitswap/README.md b/beetle-bitswap/README.md similarity index 55% rename from iroh-bitswap/README.md rename to beetle-bitswap/README.md index e817e22af..b12f86202 100644 --- a/iroh-bitswap/README.md +++ b/beetle-bitswap/README.md @@ -1,16 +1,16 @@ -# iroh bitswap +# beetle bitswap -[![crates.io](https://img.shields.io/crates/v/iroh-bitswap.svg?style=flat-square)](https://crates.io/crates/iroh-bitswap) -[![Released API docs](https://img.shields.io/docsrs/iroh-bitswap?style=flat-square)](https://docs.rs/iroh-bitswap) -[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/iroh-bitswap?style=flat-square)](../LICENSE-MIT) -[![CI](https://img.shields.io/github/workflow/status/n0-computer/iroh/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/iroh/actions?query=workflow%3A%22Continuous+integration%22) +[![crates.io](https://img.shields.io/crates/v/beetle-bitswap.svg?style=flat-square)](https://crates.io/crates/beetle-bitswap) +[![Released API docs](https://img.shields.io/docsrs/beetle-bitswap?style=flat-square)](https://docs.rs/beetle-bitswap) +[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/beetle-bitswap?style=flat-square)](../LICENSE-MIT) +[![CI](https://img.shields.io/github/workflow/status/n0-computer/beetle/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/beetle/actions?query=workflow%3A%22Continuous+integration%22) This contains an implementation of the [IPFS bitswap protocol](https://docs.ipfs.tech/concepts/bitswap/). It sends blocks of data to other peers in the IPFS network who want them, and receives blocks requested by the client from the network. -It is part of [iroh](https://github.com/n0-computer/iroh). +It is part of [beetle](https://github.com/n0-computer/beetle). ## License diff --git a/iroh-bitswap/benches/message.rs b/beetle-bitswap/benches/message.rs similarity index 99% rename from iroh-bitswap/benches/message.rs rename to beetle-bitswap/benches/message.rs index e50c7d77a..f08a114e3 100644 --- a/iroh-bitswap/benches/message.rs +++ b/beetle-bitswap/benches/message.rs @@ -1,9 +1,9 @@ -use bytes::Bytes; -use criterion::{black_box, criterion_group, criterion_main, BatchSize, Criterion}; -use iroh_bitswap::{ +use beetle_bitswap::{ create_block_v1 as create_test_block, message::{BitswapMessage, Priority, WantType}, }; +use bytes::Bytes; +use criterion::{black_box, criterion_group, criterion_main, BatchSize, Criterion}; pub fn criterion_benchmark(c: &mut Criterion) { { diff --git a/iroh-bitswap/build.rs b/beetle-bitswap/build.rs similarity index 100% rename from iroh-bitswap/build.rs rename to beetle-bitswap/build.rs diff --git a/iroh-bitswap/src/bitswap_pb.proto b/beetle-bitswap/src/bitswap_pb.proto similarity index 100% rename from iroh-bitswap/src/bitswap_pb.proto rename to beetle-bitswap/src/bitswap_pb.proto diff --git a/iroh-bitswap/src/block.rs b/beetle-bitswap/src/block.rs similarity index 100% rename from iroh-bitswap/src/block.rs rename to beetle-bitswap/src/block.rs diff --git a/iroh-bitswap/src/client.rs b/beetle-bitswap/src/client.rs similarity index 99% rename from iroh-bitswap/src/client.rs rename to beetle-bitswap/src/client.rs index 3f648abe2..fc4c20214 100644 --- a/iroh-bitswap/src/client.rs +++ b/beetle-bitswap/src/client.rs @@ -1,7 +1,7 @@ use std::{sync::Arc, time::Duration}; -use iroh_metrics::bitswap::BitswapMetrics; -use iroh_metrics::{core::MRecorder, inc, record}; +use beetle_metrics::bitswap::BitswapMetrics; +use beetle_metrics::{core::MRecorder, inc, record}; use ahash::AHashSet; use anyhow::Result; diff --git a/iroh-bitswap/src/client/block_presence_manager.rs b/beetle-bitswap/src/client/block_presence_manager.rs similarity index 100% rename from iroh-bitswap/src/client/block_presence_manager.rs rename to beetle-bitswap/src/client/block_presence_manager.rs diff --git a/iroh-bitswap/src/client/message_queue.rs b/beetle-bitswap/src/client/message_queue.rs similarity index 99% rename from iroh-bitswap/src/client/message_queue.rs rename to beetle-bitswap/src/client/message_queue.rs index 7c9676b9a..e8e027709 100644 --- a/iroh-bitswap/src/client/message_queue.rs +++ b/beetle-bitswap/src/client/message_queue.rs @@ -5,9 +5,9 @@ use std::{ use ahash::AHashSet; use anyhow::{ensure, Result}; +use beetle_metrics::core::MRecorder; +use beetle_metrics::{bitswap::BitswapMetrics, inc}; use cid::Cid; -use iroh_metrics::core::MRecorder; -use iroh_metrics::{bitswap::BitswapMetrics, inc}; use libp2p::PeerId; use tokio::{sync::mpsc, task::JoinHandle}; use tracing::{debug, error, warn}; diff --git a/iroh-bitswap/src/client/message_queue/dont_have_timeout_manager.rs b/beetle-bitswap/src/client/message_queue/dont_have_timeout_manager.rs similarity index 99% rename from iroh-bitswap/src/client/message_queue/dont_have_timeout_manager.rs rename to beetle-bitswap/src/client/message_queue/dont_have_timeout_manager.rs index 6a45551b7..056441180 100644 --- a/iroh-bitswap/src/client/message_queue/dont_have_timeout_manager.rs +++ b/beetle-bitswap/src/client/message_queue/dont_have_timeout_manager.rs @@ -6,10 +6,10 @@ use std::{ use ahash::{AHashMap, AHashSet}; use anyhow::Result; +use beetle_metrics::core::MRecorder; +use beetle_metrics::{bitswap::BitswapMetrics, inc}; use cid::Cid; use derivative::Derivative; -use iroh_metrics::core::MRecorder; -use iroh_metrics::{bitswap::BitswapMetrics, inc}; use libp2p::PeerId; use tokio::{ sync::{oneshot, Mutex}, diff --git a/iroh-bitswap/src/client/message_queue/wantlist.rs b/beetle-bitswap/src/client/message_queue/wantlist.rs similarity index 100% rename from iroh-bitswap/src/client/message_queue/wantlist.rs rename to beetle-bitswap/src/client/message_queue/wantlist.rs diff --git a/iroh-bitswap/src/client/peer_manager.rs b/beetle-bitswap/src/client/peer_manager.rs similarity index 99% rename from iroh-bitswap/src/client/peer_manager.rs rename to beetle-bitswap/src/client/peer_manager.rs index 58d3d21a0..629d3dfb8 100644 --- a/iroh-bitswap/src/client/peer_manager.rs +++ b/beetle-bitswap/src/client/peer_manager.rs @@ -2,10 +2,10 @@ use std::{fmt::Debug, sync::Arc}; use ahash::{AHashMap, AHashSet}; use anyhow::{Context, Result}; +use beetle_metrics::{bitswap::BitswapMetrics, core::MRecorder, inc}; use cid::Cid; use derivative::Derivative; use futures::{future::BoxFuture, FutureExt}; -use iroh_metrics::{bitswap::BitswapMetrics, core::MRecorder, inc}; use libp2p::PeerId; use tokio::sync::{mpsc, oneshot}; use tracing::{debug, error, trace, warn}; diff --git a/iroh-bitswap/src/client/peer_want_manager.rs b/beetle-bitswap/src/client/peer_want_manager.rs similarity index 100% rename from iroh-bitswap/src/client/peer_want_manager.rs rename to beetle-bitswap/src/client/peer_want_manager.rs diff --git a/iroh-bitswap/src/client/session.rs b/beetle-bitswap/src/client/session.rs similarity index 99% rename from iroh-bitswap/src/client/session.rs rename to beetle-bitswap/src/client/session.rs index 55137e31f..9640eacdd 100644 --- a/iroh-bitswap/src/client/session.rs +++ b/beetle-bitswap/src/client/session.rs @@ -2,9 +2,9 @@ use std::{ops::Deref, pin::Pin, sync::Arc, time::Duration}; use ahash::AHashSet; use anyhow::{anyhow, ensure, Result}; +use beetle_metrics::{bitswap::BitswapMetrics, core::MRecorder, inc, record}; use cid::Cid; use futures::{future, stream, StreamExt}; -use iroh_metrics::{bitswap::BitswapMetrics, core::MRecorder, inc, record}; use libp2p::PeerId; use tokio::{ sync::oneshot, diff --git a/iroh-bitswap/src/client/session/cid_queue.rs b/beetle-bitswap/src/client/session/cid_queue.rs similarity index 100% rename from iroh-bitswap/src/client/session/cid_queue.rs rename to beetle-bitswap/src/client/session/cid_queue.rs diff --git a/iroh-bitswap/src/client/session/peer_response_tracker.rs b/beetle-bitswap/src/client/session/peer_response_tracker.rs similarity index 100% rename from iroh-bitswap/src/client/session/peer_response_tracker.rs rename to beetle-bitswap/src/client/session/peer_response_tracker.rs diff --git a/iroh-bitswap/src/client/session/sent_want_blocks_tracker.rs b/beetle-bitswap/src/client/session/sent_want_blocks_tracker.rs similarity index 100% rename from iroh-bitswap/src/client/session/sent_want_blocks_tracker.rs rename to beetle-bitswap/src/client/session/sent_want_blocks_tracker.rs diff --git a/iroh-bitswap/src/client/session/session_want_sender.rs b/beetle-bitswap/src/client/session/session_want_sender.rs similarity index 99% rename from iroh-bitswap/src/client/session/session_want_sender.rs rename to beetle-bitswap/src/client/session/session_want_sender.rs index 858b142f2..44dc2683e 100644 --- a/iroh-bitswap/src/client/session/session_want_sender.rs +++ b/beetle-bitswap/src/client/session/session_want_sender.rs @@ -2,9 +2,9 @@ use std::cmp::Ordering; use ahash::{AHashMap, AHashSet}; use anyhow::Result; +use beetle_metrics::core::MRecorder; +use beetle_metrics::{bitswap::BitswapMetrics, inc}; use cid::Cid; -use iroh_metrics::core::MRecorder; -use iroh_metrics::{bitswap::BitswapMetrics, inc}; use libp2p::PeerId; use tokio::{sync::oneshot, task::JoinHandle}; use tracing::{debug, error, info, warn}; diff --git a/iroh-bitswap/src/client/session/session_wants.rs b/beetle-bitswap/src/client/session/session_wants.rs similarity index 100% rename from iroh-bitswap/src/client/session/session_wants.rs rename to beetle-bitswap/src/client/session/session_wants.rs diff --git a/iroh-bitswap/src/client/session_interest_manager.rs b/beetle-bitswap/src/client/session_interest_manager.rs similarity index 100% rename from iroh-bitswap/src/client/session_interest_manager.rs rename to beetle-bitswap/src/client/session_interest_manager.rs diff --git a/iroh-bitswap/src/client/session_manager.rs b/beetle-bitswap/src/client/session_manager.rs similarity index 99% rename from iroh-bitswap/src/client/session_manager.rs rename to beetle-bitswap/src/client/session_manager.rs index 9b843e914..32c399cd2 100644 --- a/iroh-bitswap/src/client/session_manager.rs +++ b/beetle-bitswap/src/client/session_manager.rs @@ -8,9 +8,9 @@ use std::{ use ahash::AHashMap; use anyhow::{anyhow, Result}; +use beetle_metrics::{bitswap::BitswapMetrics, core::MRecorder, inc}; use cid::Cid; use futures::FutureExt; -use iroh_metrics::{bitswap::BitswapMetrics, core::MRecorder, inc}; use libp2p::PeerId; use tokio::sync::RwLock; use tracing::debug; diff --git a/iroh-bitswap/src/client/wantlist.rs b/beetle-bitswap/src/client/wantlist.rs similarity index 100% rename from iroh-bitswap/src/client/wantlist.rs rename to beetle-bitswap/src/client/wantlist.rs diff --git a/iroh-bitswap/src/error.rs b/beetle-bitswap/src/error.rs similarity index 100% rename from iroh-bitswap/src/error.rs rename to beetle-bitswap/src/error.rs diff --git a/iroh-bitswap/src/handler.rs b/beetle-bitswap/src/handler.rs similarity index 73% rename from iroh-bitswap/src/handler.rs rename to beetle-bitswap/src/handler.rs index 0cff541d4..68605ad17 100644 --- a/iroh-bitswap/src/handler.rs +++ b/beetle-bitswap/src/handler.rs @@ -6,12 +6,12 @@ use std::{ }; use asynchronous_codec::Framed; +use beetle_metrics::{bitswap::BitswapMetrics, core::MRecorder, inc}; use futures::StreamExt; use futures::{ prelude::*, stream::{BoxStream, SelectAll}, }; -use iroh_metrics::{bitswap::BitswapMetrics, core::MRecorder, inc}; use libp2p::core::{ muxing::SubstreamBox, upgrade::{InboundUpgrade, NegotiationError, OutboundUpgrade, UpgradeError}, @@ -173,65 +173,124 @@ impl ConnectionHandler for BitswapHandler { self.listen_protocol.clone() } - fn inject_fully_negotiated_inbound( - &mut self, - substream: >::Output, - _info: Self::InboundOpenInfo, - ) { - let protocol_id = substream.codec().protocol; - if self.protocol.is_none() { - self.protocol = Some(protocol_id); + fn map_in_event( + self, + map: TMap, + ) -> libp2p::swarm::handler::MapInEvent + where + Self: Sized, + TMap: Fn(&TNewIn) -> Option<&Self::InEvent>, + { + libp2p::swarm::handler::MapInEvent { + inner: self, + map, + marker: None, } - - trace!("New inbound substream request: {:?}", protocol_id); - self.inbound_substreams - .push(Box::pin(inbound_substream(substream))); } - fn inject_fully_negotiated_outbound( - &mut self, - substream: >::Output, - message: Self::OutboundOpenInfo, - ) { - let protocol_id = substream.codec().protocol; - if self.protocol.is_none() { - self.protocol = Some(protocol_id); - } - - trace!("New outbound substream: {:?}", protocol_id); - self.outbound_substreams - .push(Box::pin(outbound_substream(substream, message))); + fn map_out_event( + self, + map: TMap, + ) -> libp2p::swarm::handler::MapOutEvent + where + Self: Sized, + TMap: FnMut(Self::OutEvent) -> TNewOut, + { } - fn inject_event(&mut self, message: BitswapHandlerIn) { - match message { - BitswapHandlerIn::Message(m, response) => { - self.send_queue.push_back((m, response)); + fn on_behaviour_event(&mut self, _event: Self::InEvent) {} - // sending a message, reset keepalive - self.keep_alive = KeepAlive::Until(Instant::now() + self.idle_timeout); - } - BitswapHandlerIn::Protect => { - self.keep_alive = KeepAlive::Yes; - } - BitswapHandlerIn::Unprotect => { - self.keep_alive = - KeepAlive::Until(Instant::now() + Duration::from_secs(INITIAL_KEEP_ALIVE)); - } - } - } - - fn inject_dial_upgrade_error( + fn on_connection_event( &mut self, - _: Self::OutboundOpenInfo, - e: ConnectionHandlerUpgrErr< - >::Error, + event: libp2p::swarm::handler::ConnectionEvent< + Self::InboundProtocol, + Self::OutboundProtocol, + Self::InboundOpenInfo, + Self::OutboundOpenInfo, >, ) { - warn!("Dial upgrade error {:?}", e); - self.upgrade_errors.push_back(e); } + fn select( + self, + other: TProto2, + ) -> libp2p::swarm::ConnectionHandlerSelect + where + Self: Sized, + { + return self; + } + + // fn map_in_event( + // self, + // map: TMap, + // ) -> libp2p::swarm::handler::MapInEvent + // where + // Self: Sized, + // TMap: Fn(&TNewIn) -> Option<&Self::InEvent>, + // { + // libp2p::swarm::handler::MapInEvent::new(self, map) + // } + + // fn inject_fully_negotiated_inbound( + // &mut self, + // substream: >::Output, + // _info: Self::InboundOpenInfo, + // ) { + // let protocol_id = substream.codec().protocol; + // if self.protocol.is_none() { + // self.protocol = Some(protocol_id); + // } + + // trace!("New inbound substream request: {:?}", protocol_id); + // self.inbound_substreams + // .push(Box::pin(inbound_substream(substream))); + // } + + // fn inject_fully_negotiated_outbound( + // &mut self, + // substream: >::Output, + // message: Self::OutboundOpenInfo, + // ) { + // let protocol_id = substream.codec().protocol; + // if self.protocol.is_none() { + // self.protocol = Some(protocol_id); + // } + + // trace!("New outbound substream: {:?}", protocol_id); + // self.outbound_substreams + // .push(Box::pin(outbound_substream(substream, message))); + // } + + // fn inject_event(&mut self, message: BitswapHandlerIn) { + // match message { + // BitswapHandlerIn::Message(m, response) => { + // self.send_queue.push_back((m, response)); + + // // sending a message, reset keepalive + // self.keep_alive = KeepAlive::Until(Instant::now() + self.idle_timeout); + // } + // BitswapHandlerIn::Protect => { + // self.keep_alive = KeepAlive::Yes; + // } + // BitswapHandlerIn::Unprotect => { + // self.keep_alive = + // KeepAlive::Until(Instant::now() + Duration::from_secs(INITIAL_KEEP_ALIVE)); + // } + // } + // } + + // fn inject_dial_upgrade_error( + // &mut self, + // _: Self::OutboundOpenInfo, + // e: ConnectionHandlerUpgrErr< + // >::Error, + // >, + // ) { + // warn!("Dial upgrade error {:?}", e); + // self.upgrade_errors.push_back(e); + // } + fn connection_keep_alive(&self) -> KeepAlive { self.keep_alive } diff --git a/iroh-bitswap/src/lib.rs b/beetle-bitswap/src/lib.rs similarity index 83% rename from iroh-bitswap/src/lib.rs rename to beetle-bitswap/src/lib.rs index ae1b3f1ba..9144a34d8 100644 --- a/iroh-bitswap/src/lib.rs +++ b/beetle-bitswap/src/lib.rs @@ -12,13 +12,13 @@ use std::time::{Duration, Instant}; use ahash::AHashMap; use anyhow::Result; use async_trait::async_trait; +use beetle_metrics::record; +use beetle_metrics::{bitswap::BitswapMetrics, core::MRecorder, inc}; use cid::Cid; use handler::{BitswapHandler, HandlerEvent}; -use iroh_metrics::record; -use iroh_metrics::{bitswap::BitswapMetrics, core::MRecorder, inc}; -use libp2p::core::connection::ConnectionId; use libp2p::core::ConnectedPoint; use libp2p::swarm::dial_opts::DialOpts; +use libp2p::swarm::ConnectionId; use libp2p::swarm::{ CloseConnection, DialError, IntoConnectionHandler, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, PollParameters, @@ -410,101 +410,153 @@ impl NetworkBehaviour for Bitswap { Default::default() } - fn inject_connection_established( + // fn inject_connection_established( + // &mut self, + // peer_id: &PeerId, + // connection: &ConnectionId, + // _endpoint: &ConnectedPoint, + // _failed_addresses: Option<&Vec>, + // other_established: usize, + // ) { + // trace!("connection established {} ({})", peer_id, other_established); + // self.set_peer_state(peer_id, PeerState::Connected(*connection)); + // self.pause_dialing = false; + // } + + fn handle_established_inbound_connection( &mut self, - peer_id: &PeerId, - connection: &ConnectionId, - _endpoint: &ConnectedPoint, - _failed_addresses: Option<&Vec>, - other_established: usize, - ) { - trace!("connection established {} ({})", peer_id, other_established); - self.set_peer_state(peer_id, PeerState::Connected(*connection)); + connection_id: ConnectionId, + peer: PeerId, + local_addr: &Multiaddr, + remote_addr: &Multiaddr, + ) -> std::result::Result, libp2p::swarm::ConnectionDenied> { + trace!("connection established {} (inbound)", peer); + self.set_peer_state(&peer, PeerState::Connected(connection_id)); self.pause_dialing = false; + Ok(self.new_handler()) } - fn inject_connection_closed( + fn handle_established_outbound_connection( &mut self, - peer_id: &PeerId, - _conn: &ConnectionId, - _endpoint: &ConnectedPoint, - _handler: ::Handler, - remaining_established: usize, - ) { + connection_id: ConnectionId, + peer: PeerId, + addr: &Multiaddr, + role_override: libp2p::core::Endpoint, + ) -> std::result::Result, libp2p::swarm::ConnectionDenied> { + trace!("connection established {} (outbound)", peer); + self.set_peer_state(&peer, PeerState::Connected(connection_id)); self.pause_dialing = false; - if remaining_established == 0 { - // Last connection, close it - self.set_peer_state(peer_id, PeerState::Disconnected) - } - } - - fn inject_dial_failure( + Ok(self.new_handler()) + } + + // fn inject_connection_closed( + // &mut self, + // peer_id: &PeerId, + // _conn: &ConnectionId, + // _endpoint: &ConnectedPoint, + // _handler: ::Handler, + // remaining_established: usize, + // ) { + // self.pause_dialing = false; + // if remaining_established == 0 { + // // Last connection, close it + // self.set_peer_state(peer_id, PeerState::Disconnected) + // } + // } + + // fn inject_dial_failure( + // &mut self, + // peer_id: Option, + // _handler: Self::ConnectionHandler, + // error: &DialError, + // ) { + // if let Some(peer_id) = peer_id { + // if let DialError::ConnectionLimit(_) = error { + // self.pause_dialing = true; + // self.set_peer_state(&peer_id, PeerState::Disconnected); + // } else { + // self.set_peer_state(&peer_id, PeerState::DialFailure(Instant::now())); + // } + + // trace!("inject_dial_failure {}, {:?}", peer_id, error); + // let dials = &mut self.dials.lock().unwrap(); + // if let Some(mut dials) = dials.remove(&peer_id) { + // while let Some((_id, sender)) = dials.pop() { + // let _ = sender.send(Err(error.to_string())); + // } + // } + // } + // } + + // fn on_swarm_event(&mut self, event: libp2p::swarm::FromSwarm) { + + // } + + fn handle_pending_inbound_connection( &mut self, - peer_id: Option, - _handler: Self::ConnectionHandler, - error: &DialError, - ) { - if let Some(peer_id) = peer_id { - if let DialError::ConnectionLimit(_) = error { - self.pause_dialing = true; - self.set_peer_state(&peer_id, PeerState::Disconnected); - } else { - self.set_peer_state(&peer_id, PeerState::DialFailure(Instant::now())); - } - - trace!("inject_dial_failure {}, {:?}", peer_id, error); - let dials = &mut self.dials.lock().unwrap(); - if let Some(mut dials) = dials.remove(&peer_id) { - while let Some((_id, sender)) = dials.pop() { - let _ = sender.send(Err(error.to_string())); - } - } - } + _connection_id: ConnectionId, + _local_addr: &Multiaddr, + _remote_addr: &Multiaddr, + ) -> std::result::Result<(), libp2p::swarm::ConnectionDenied> { + Ok(()) } - fn inject_event(&mut self, peer_id: PeerId, connection: ConnectionId, event: HandlerEvent) { - // trace!("inject_event from {}, event: {:?}", peer_id, event); - match event { - HandlerEvent::Connected { protocol } => { - self.set_peer_state(&peer_id, PeerState::Responsive(connection, protocol)); - { - let dials = &mut *self.dials.lock().unwrap(); - if let Some(mut dials) = dials.remove(&peer_id) { - while let Some((id, sender)) = dials.pop() { - if let Err(err) = sender.send(Ok((connection, Some(protocol)))) { - warn!("dial:{}: failed to send dial response {:?}", id, err) - } - } - } - } - } - HandlerEvent::ProtocolNotSuppported => { - self.set_peer_state(&peer_id, PeerState::Unresponsive); - - let dials = &mut *self.dials.lock().unwrap(); - if let Some(mut dials) = dials.remove(&peer_id) { - while let Some((id, sender)) = dials.pop() { - if let Err(err) = sender.send(Err("protocol not supported".into())) { - warn!("dial:{} failed to send dial response {:?}", id, err) - } - } - } - } - HandlerEvent::Message { - mut message, - protocol, - } => { - // mark peer as responsive - self.set_peer_state(&peer_id, PeerState::Responsive(connection, protocol)); - - message.verify_blocks(); - self.receive_message(peer_id, message); - } - HandlerEvent::FailedToSendMessage { .. } => { - // Handle - } + fn handle_pending_outbound_connection( + &mut self, + _connection_id: ConnectionId, + maybe_peer: Option, + _addresses: &[Multiaddr], + _effective_role: libp2p::core::Endpoint, + ) -> std::result::Result, libp2p::swarm::ConnectionDenied> { + if let Some(peer) = maybe_peer { + self.set_peer_state(&peer, PeerState::Disconnected); } - } + Ok(Vec::new()) + } + + // fn inject_event(&mut self, peer_id: PeerId, connection: ConnectionId, event: HandlerEvent) { + // // trace!("inject_event from {}, event: {:?}", peer_id, event); + // match event { + // HandlerEvent::Connected { protocol } => { + // self.set_peer_state(&peer_id, PeerState::Responsive(connection, protocol)); + // { + // let dials = &mut *self.dials.lock().unwrap(); + // if let Some(mut dials) = dials.remove(&peer_id) { + // while let Some((id, sender)) = dials.pop() { + // if let Err(err) = sender.send(Ok((connection, Some(protocol)))) { + // warn!("dial:{}: failed to send dial response {:?}", id, err) + // } + // } + // } + // } + // } + // HandlerEvent::ProtocolNotSuppported => { + // self.set_peer_state(&peer_id, PeerState::Unresponsive); + + // let dials = &mut *self.dials.lock().unwrap(); + // if let Some(mut dials) = dials.remove(&peer_id) { + // while let Some((id, sender)) = dials.pop() { + // if let Err(err) = sender.send(Err("protocol not supported".into())) { + // warn!("dial:{} failed to send dial response {:?}", id, err) + // } + // } + // } + // } + // HandlerEvent::Message { + // mut message, + // protocol, + // } => { + // // mark peer as responsive + // self.set_peer_state(&peer_id, PeerState::Responsive(connection, protocol)); + + // message.verify_blocks(); + // self.receive_message(peer_id, message); + // } + // HandlerEvent::FailedToSendMessage { .. } => { + // // Handle + // } + // } + // } #[allow(clippy::type_complexity)] fn poll( diff --git a/iroh-bitswap/src/message.rs b/beetle-bitswap/src/message.rs similarity index 99% rename from iroh-bitswap/src/message.rs rename to beetle-bitswap/src/message.rs index 92248192d..cb0917187 100644 --- a/iroh-bitswap/src/message.rs +++ b/beetle-bitswap/src/message.rs @@ -219,7 +219,7 @@ impl BitswapMessage { pub fn verify_blocks(&mut self) { self.blocks.retain(|_, block| { let now = Instant::now(); - let is_valid = iroh_util::verify_hash(&block.cid, &block.data); + let is_valid = beetle_util::verify_hash(&block.cid, &block.data); trace!("block validated in {}ms", now.elapsed().as_millis()); match is_valid { Some(true) => { diff --git a/iroh/src/metrics.rs b/beetle-bitswap/src/metrics.rs similarity index 89% rename from iroh/src/metrics.rs rename to beetle-bitswap/src/metrics.rs index 339f97d08..a6017b40a 100644 --- a/iroh/src/metrics.rs +++ b/beetle-bitswap/src/metrics.rs @@ -1,4 +1,4 @@ -use iroh_metrics::config::Config as MetricsConfig; +use beetle_metrics::config::Config as MetricsConfig; pub fn metrics_config_with_compile_time_info(cfg: MetricsConfig) -> MetricsConfig { // compile time configuration diff --git a/iroh-bitswap/src/network.rs b/beetle-bitswap/src/network.rs similarity index 98% rename from iroh-bitswap/src/network.rs rename to beetle-bitswap/src/network.rs index 1180e9b21..df868c276 100644 --- a/iroh-bitswap/src/network.rs +++ b/beetle-bitswap/src/network.rs @@ -6,12 +6,13 @@ use std::{ time::Duration, }; -use anyhow::{anyhow, bail, Context as _, Result}; +use anyhow::{anyhow, bail, Result}; +use beetle_metrics::{bitswap::BitswapMetrics, inc}; +use beetle_metrics::{core::MRecorder, record}; use cid::Cid; use futures::Stream; -use iroh_metrics::{bitswap::BitswapMetrics, inc}; -use iroh_metrics::{core::MRecorder, record}; -use libp2p::{core::connection::ConnectionId, PeerId}; +use libp2p::swarm::ConnectionId; +use libp2p::PeerId; use tokio::sync::{mpsc, oneshot}; use tracing::{debug, error, info, trace}; diff --git a/iroh-bitswap/src/peer_task_queue.rs b/beetle-bitswap/src/peer_task_queue.rs similarity index 100% rename from iroh-bitswap/src/peer_task_queue.rs rename to beetle-bitswap/src/peer_task_queue.rs diff --git a/iroh-bitswap/src/peer_task_queue/peer_task.rs b/beetle-bitswap/src/peer_task_queue/peer_task.rs similarity index 100% rename from iroh-bitswap/src/peer_task_queue/peer_task.rs rename to beetle-bitswap/src/peer_task_queue/peer_task.rs diff --git a/iroh-bitswap/src/peer_task_queue/peer_tracker.rs b/beetle-bitswap/src/peer_task_queue/peer_tracker.rs similarity index 100% rename from iroh-bitswap/src/peer_task_queue/peer_tracker.rs rename to beetle-bitswap/src/peer_task_queue/peer_tracker.rs diff --git a/iroh-bitswap/src/prefix.rs b/beetle-bitswap/src/prefix.rs similarity index 100% rename from iroh-bitswap/src/prefix.rs rename to beetle-bitswap/src/prefix.rs diff --git a/iroh-bitswap/src/protocol.rs b/beetle-bitswap/src/protocol.rs similarity index 100% rename from iroh-bitswap/src/protocol.rs rename to beetle-bitswap/src/protocol.rs diff --git a/iroh-bitswap/src/server.rs b/beetle-bitswap/src/server.rs similarity index 98% rename from iroh-bitswap/src/server.rs rename to beetle-bitswap/src/server.rs index c43feb305..00310c92f 100644 --- a/iroh-bitswap/src/server.rs +++ b/beetle-bitswap/src/server.rs @@ -1,12 +1,12 @@ use std::sync::Arc; use anyhow::{anyhow, Result}; +use beetle_metrics::bitswap::BitswapMetrics; +use beetle_metrics::core::MRecorder; +use beetle_metrics::inc; use cid::Cid; use futures::future::BoxFuture; use futures::FutureExt; -use iroh_metrics::bitswap::BitswapMetrics; -use iroh_metrics::core::MRecorder; -use iroh_metrics::inc; use libp2p::PeerId; use tokio::sync::{mpsc, oneshot, Mutex}; use tokio::task::JoinHandle; @@ -58,8 +58,8 @@ pub struct Stat { #[derive(Debug, Clone)] pub struct Server { - // sent_histogram -> iroh-metrics - // send_time_histogram -> iroh-metric + // sent_histogram -> beetle-metrics + // send_time_histogram -> beetle-metric /// Decision engine for which who to send which blocks to. engine: Arc>, inner: Arc, diff --git a/iroh-bitswap/src/server/blockstore_manager.rs b/beetle-bitswap/src/server/blockstore_manager.rs similarity index 96% rename from iroh-bitswap/src/server/blockstore_manager.rs rename to beetle-bitswap/src/server/blockstore_manager.rs index 318a9411b..cd08354c9 100644 --- a/iroh-bitswap/src/server/blockstore_manager.rs +++ b/beetle-bitswap/src/server/blockstore_manager.rs @@ -9,8 +9,8 @@ use crate::{block::Block, Store}; #[derive(Debug)] pub struct BlockstoreManager { store: S, - // pending_gauge -> iroh-metrics - // active_gauge -> iroh-metrics + // pending_gauge -> beetle-metrics + // active_gauge -> beetle-metrics } impl BlockstoreManager { diff --git a/iroh-bitswap/src/server/decision.rs b/beetle-bitswap/src/server/decision.rs similarity index 99% rename from iroh-bitswap/src/server/decision.rs rename to beetle-bitswap/src/server/decision.rs index 1b832032c..b1a2ececf 100644 --- a/iroh-bitswap/src/server/decision.rs +++ b/beetle-bitswap/src/server/decision.rs @@ -2,8 +2,8 @@ use std::{fmt::Debug, sync::Arc, time::Duration}; use ahash::{AHashMap, AHashSet}; use anyhow::{anyhow, Result}; +use beetle_metrics::{bitswap::BitswapMetrics, inc, record}; use cid::Cid; -use iroh_metrics::{bitswap::BitswapMetrics, inc, record}; use libp2p::PeerId; use tokio::{ sync::{oneshot, Mutex, Notify, RwLock}, @@ -26,7 +26,7 @@ use super::{ score_ledger::{DefaultScoreLedger, Receipt}, task_merger::{TaskData, TaskMerger}, }; -use iroh_metrics::core::MRecorder; +use beetle_metrics::core::MRecorder; #[derive(Debug, Clone, PartialEq, Eq)] pub struct TaskInfo { @@ -111,8 +111,8 @@ pub struct Engine { /// replace a want-have with a want-block. max_block_size_replace_has_with_block: usize, send_dont_haves: bool, - // pending_gauge -> iroh-metrics - // active_guage -> iroh-metrics + // pending_gauge -> beetle-metrics + // active_guage -> beetle-metrics metrics_update_counter: Mutex, // ?? atomic peer_block_request_filter: Option>, /// List of handles to worker threads. diff --git a/iroh-bitswap/src/server/ewma.rs b/beetle-bitswap/src/server/ewma.rs similarity index 100% rename from iroh-bitswap/src/server/ewma.rs rename to beetle-bitswap/src/server/ewma.rs diff --git a/iroh-bitswap/src/server/ledger.rs b/beetle-bitswap/src/server/ledger.rs similarity index 100% rename from iroh-bitswap/src/server/ledger.rs rename to beetle-bitswap/src/server/ledger.rs diff --git a/iroh-bitswap/src/server/peer_ledger.rs b/beetle-bitswap/src/server/peer_ledger.rs similarity index 100% rename from iroh-bitswap/src/server/peer_ledger.rs rename to beetle-bitswap/src/server/peer_ledger.rs diff --git a/iroh-bitswap/src/server/score_ledger.rs b/beetle-bitswap/src/server/score_ledger.rs similarity index 99% rename from iroh-bitswap/src/server/score_ledger.rs rename to beetle-bitswap/src/server/score_ledger.rs index e26a6ae05..b03ede927 100644 --- a/iroh-bitswap/src/server/score_ledger.rs +++ b/beetle-bitswap/src/server/score_ledger.rs @@ -6,8 +6,8 @@ use std::{ use ahash::AHashMap; use anyhow::{anyhow, Result}; -use iroh_metrics::core::MRecorder; -use iroh_metrics::{bitswap::BitswapMetrics, inc}; +use beetle_metrics::core::MRecorder; +use beetle_metrics::{bitswap::BitswapMetrics, inc}; use libp2p::PeerId; use tokio::{ sync::{oneshot, RwLock}, diff --git a/iroh-bitswap/src/server/task_merger.rs b/beetle-bitswap/src/server/task_merger.rs similarity index 100% rename from iroh-bitswap/src/server/task_merger.rs rename to beetle-bitswap/src/server/task_merger.rs diff --git a/iroh-car/Cargo.toml b/beetle-car/Cargo.toml similarity index 89% rename from iroh-car/Cargo.toml rename to beetle-car/Cargo.toml index 4a4be28fe..a51caaed4 100644 --- a/iroh-car/Cargo.toml +++ b/beetle-car/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "iroh-car" +name = "beetle-car" authors = ["dignifiedquire "] -description = "Implementation the car files for iroh" +description = "Implementation the car files for beetle" version.workspace = true edition.workspace = true license.workspace = true diff --git a/iroh-car/README.md b/beetle-car/README.md similarity index 55% rename from iroh-car/README.md rename to beetle-car/README.md index a46c65b4d..71accc6f0 100644 --- a/iroh-car/README.md +++ b/beetle-car/README.md @@ -1,11 +1,11 @@ -# iroh-car +# beetle-car -[![crates.io](https://img.shields.io/crates/v/iroh-car.svg?style=flat-square)](https://crates.io/crates/iroh-car) -[![Released API docs](https://img.shields.io/docsrs/iroh-car?style=flat-square)](https://docs.rs/iroh-car) -[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/iroh-car?style=flat-square)](../LICENSE-MIT) -[![CI](https://img.shields.io/github/workflow/status/n0-computer/iroh/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/iroh/actions?query=workflow%3A%22Continuous+integration%22) +[![crates.io](https://img.shields.io/crates/v/beetle-car.svg?style=flat-square)](https://crates.io/crates/beetle-car) +[![Released API docs](https://img.shields.io/docsrs/beetle-car?style=flat-square)](https://docs.rs/beetle-car) +[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/beetle-car?style=flat-square)](../LICENSE-MIT) +[![CI](https://img.shields.io/github/workflow/status/n0-computer/beetle/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/beetle/actions?query=workflow%3A%22Continuous+integration%22) -[CAR file](https://ipld.io/specs/transport/car/) support for iroh. "CAR" stands +[CAR file](https://ipld.io/specs/transport/car/) support for beetle. "CAR" stands for Content Addressable aRchives. A CAR file typically contains a serialized representation of an [IPLD DAG](https://docs.ipfs.tech/concepts/merkle-dag/#merkle-directed-acyclic-graphs-dags), @@ -13,7 +13,7 @@ though is general enough to contain arbitrary IPLD blocks. Currently supports only [v1](https://ipld.io/specs/transport/car/carv1/). -It is part of [iroh](https://github.com/n0-computer/iroh). +It is part of [beetle](https://github.com/n0-computer/beetle). ## License diff --git a/iroh-car/src/error.rs b/beetle-car/src/error.rs similarity index 100% rename from iroh-car/src/error.rs rename to beetle-car/src/error.rs diff --git a/iroh-car/src/header.rs b/beetle-car/src/header.rs similarity index 100% rename from iroh-car/src/header.rs rename to beetle-car/src/header.rs diff --git a/iroh-car/src/lib.rs b/beetle-car/src/lib.rs similarity index 100% rename from iroh-car/src/lib.rs rename to beetle-car/src/lib.rs diff --git a/iroh-car/src/reader.rs b/beetle-car/src/reader.rs similarity index 100% rename from iroh-car/src/reader.rs rename to beetle-car/src/reader.rs diff --git a/iroh-car/src/util.rs b/beetle-car/src/util.rs similarity index 100% rename from iroh-car/src/util.rs rename to beetle-car/src/util.rs diff --git a/iroh-car/src/writer.rs b/beetle-car/src/writer.rs similarity index 100% rename from iroh-car/src/writer.rs rename to beetle-car/src/writer.rs diff --git a/iroh-car/tests/car_file_test.rs b/beetle-car/tests/car_file_test.rs similarity index 99% rename from iroh-car/tests/car_file_test.rs rename to beetle-car/tests/car_file_test.rs index 28340d48e..c8ce0136b 100644 --- a/iroh-car/tests/car_file_test.rs +++ b/beetle-car/tests/car_file_test.rs @@ -1,5 +1,5 @@ +use beetle_car::*; use futures::TryStreamExt; -use iroh_car::*; use tokio::fs::{self, File}; use tokio::io::BufReader; diff --git a/iroh-car/tests/carv1_basic.car b/beetle-car/tests/carv1_basic.car similarity index 100% rename from iroh-car/tests/carv1_basic.car rename to beetle-car/tests/carv1_basic.car diff --git a/iroh-car/tests/testv1.car b/beetle-car/tests/testv1.car similarity index 100% rename from iroh-car/tests/testv1.car rename to beetle-car/tests/testv1.car diff --git a/iroh-embed/Cargo.toml b/beetle-embed/Cargo.toml similarity index 52% rename from iroh-embed/Cargo.toml rename to beetle-embed/Cargo.toml index 7738d75d6..b2f9ec415 100644 --- a/iroh-embed/Cargo.toml +++ b/beetle-embed/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "iroh-embed" +name = "beetle-embed" authors = ["Floris Bruynooghe "] -description = "Embedable iroh library" +description = "Embedable beetle library" version.workspace = true edition.workspace = true license.workspace = true @@ -11,16 +11,16 @@ rust-version.workspace = true [dependencies] anyhow.workspace = true futures.workspace = true -iroh-api.workspace = true -iroh-gateway.workspace = true -iroh-metrics.workspace = true -iroh-one.workspace = true -iroh-p2p.workspace = true -iroh-resolver.workspace = true -iroh-rpc-client.workspace = true -iroh-rpc-types.workspace = true -iroh-store.workspace = true -iroh-unixfs.workspace = true +beetle-api.workspace = true +beetle-gateway.workspace = true +beetle-metrics.workspace = true +beetle-one.workspace = true +beetle-p2p.workspace = true +beetle-resolver.workspace = true +beetle-rpc-client.workspace = true +beetle-rpc-types.workspace = true +beetle-store.workspace = true +beetle-unixfs.workspace = true reqwest = { workspace = true, features = ["rustls-tls", "json"] } tokio.workspace = true diff --git a/iroh-embed/README.md b/beetle-embed/README.md similarity index 50% rename from iroh-embed/README.md rename to beetle-embed/README.md index 547259dd7..19e3da6d8 100644 --- a/iroh-embed/README.md +++ b/beetle-embed/README.md @@ -1,12 +1,12 @@ -# iroh embed +# beetle embed -[![crates.io](https://img.shields.io/crates/v/iroh-embed.svg?style=flat-square)](https://crates.io/crates/iroh-embed) -[![Released API docs](https://img.shields.io/docsrs/iroh-embed?style=flat-square)](https://docs.rs/iroh-embed) -[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/iroh-embed?style=flat-square)](../LICENSE-MIT) -[![CI](https://img.shields.io/github/workflow/status/n0-computer/iroh/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/iroh/actions?query=workflow%3A%22Continuous+integration%22) +[![crates.io](https://img.shields.io/crates/v/beetle-embed.svg?style=flat-square)](https://crates.io/crates/beetle-embed) +[![Released API docs](https://img.shields.io/docsrs/beetle-embed?style=flat-square)](https://docs.rs/beetle-embed) +[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/beetle-embed?style=flat-square)](../LICENSE-MIT) +[![CI](https://img.shields.io/github/workflow/status/n0-computer/beetle/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/beetle/actions?query=workflow%3A%22Continuous+integration%22) This provides an API to embed -[iroh](https://github.com/n0-computer/iroh) into other applications, +[beetle](https://github.com/n0-computer/beetle) into other applications, allowing them to interact directly with [IPFS](https://ipfs.tech/). ## License diff --git a/iroh-embed/src/lib.rs b/beetle-embed/src/lib.rs similarity index 81% rename from iroh-embed/src/lib.rs rename to beetle-embed/src/lib.rs index 9a09b17a8..096d52e82 100644 --- a/iroh-embed/src/lib.rs +++ b/beetle-embed/src/lib.rs @@ -1,10 +1,10 @@ -//! Using iroh's peer-to-peer IPFS as a library. +//! Using beetle's peer-to-peer IPFS as a library. //! -//! This crate supports embedding iroh in another application, enables running an IPFS node. -//! By default the system will not interfere with any other IPFS node, iroh or otherwise, on +//! This crate supports embedding beetle in another application, enables running an IPFS node. +//! By default the system will not interfere with any other IPFS node, beetle or otherwise, on //! the same host. //! -//! An iroh system consists of several services, depending on how the IPFS node should +//! An beetle system consists of several services, depending on how the IPFS node should //! behave not all of them may be needed: //! //! - The **store** service. Iroh needs somewhere to store data, currently only an on-disk @@ -12,14 +12,14 @@ //! be available too. //! - The **p2p** service. This service communicates with the wider IPFS network. //! - The **gateway** service. This provides an HTTP gateway into IPFS. Currently not yet -//! supported in iroh-embed. +//! supported in beetle-embed. //! -//! The current work-in-progress version of iroh-embed only allows using both a store and +//! The current work-in-progress version of beetle-embed only allows using both a store and //! p2p service. Future combinations will become available as features are added. //! //! # Getting started //! -//! To create an iroh system you will need a few things: +//! To create an beetle system you will need a few things: //! //! - Create a store service using [`RocksStoreService`]. //! - Create a p2p service using [`P2pService`] and hooking it up to your earlier created @@ -30,28 +30,28 @@ //! An example is available in the repository under `examples/embed`. use anyhow::{bail, Result}; -use iroh_rpc_client::Config as RpcClientConfig; +use beetle_rpc_client::Config as RpcClientConfig; -pub use iroh_api::Api; -pub use iroh_p2p::Libp2pConfig; -pub use iroh_unixfs::indexer::IndexerUrl; +pub use beetle_api::Api; +pub use beetle_p2p::Libp2pConfig; +pub use beetle_unixfs::indexer::IndexerUrl; pub use reqwest::Url; -/// An address allowing internal communication with the iroh peer-to-peer service. +/// An address allowing internal communication with the beetle peer-to-peer service. /// /// This is only needed to wire up the several services together and should not be used to /// communicate directly to the service. /// /// Can be created from [`p2p::P2pService::addr`]. -pub use iroh_rpc_types::p2p::P2pAddr; +pub use beetle_rpc_types::p2p::P2pAddr; -/// An address allowing internal communication with the iroh store service. +/// An address allowing internal communication with the beetle store service. /// /// This is only needed to wire up the several services together and should not be used to /// communicate directly to the service. /// /// Can be created from [`store::RocksStoreService::addr`]. -pub use iroh_rpc_types::store::StoreAddr; +pub use beetle_rpc_types::store::StoreAddr; mod p2p; mod store; @@ -67,7 +67,7 @@ pub use store::RocksStoreService; /// # Examples /// /// ```no_run -/// use iroh_embed::{Iroh, IrohBuilder, Libp2pConfig, P2pService, RocksStoreService}; +/// use beetle_embed::{Iroh, IrohBuilder, Libp2pConfig, P2pService, RocksStoreService}; /// use testdir::testdir; /// # tokio_test::block_on(async { /// let dir = testdir!(); @@ -78,7 +78,7 @@ pub use store::RocksStoreService; /// "/ip4/0.0.0.0/udp/0/quic-v1".parse().unwrap(), // random port /// ]; /// let p2p = P2pService::new(p2p_config, dir, store.addr()).await.unwrap(); -/// let _iroh: Iroh = IrohBuilder::new() +/// let _beetle: Iroh = IrohBuilder::new() /// .store(store) /// .p2p(p2p) /// .build() @@ -130,7 +130,7 @@ impl IrohBuilder { self } - /// Adds IPFS HTTP gateways as resolvers to the iroh system. + /// Adds IPFS HTTP gateways as resolvers to the beetle system. /// /// IPFS HTTP gateways can be used to resolve IPFS content in addition to retrieving the /// content from the IPFS peer-to-peer system. @@ -140,12 +140,12 @@ impl IrohBuilder { self } - /// Use the given IPFS indexer with this iroh system. + /// Use the given IPFS indexer with this beetle system. /// /// An IPFS indexer keeps an index of CIDs and IPFS nodes which currently provide the /// data for the CID. /// - /// By default this uses the [`iroh_unixfs::indexer::CID_CONTACT`] indexer. + /// By default this uses the [`beetle_unixfs::indexer::CID_CONTACT`] indexer. pub fn indexer(mut self, indexer: IndexerUrl) -> Self { self.indexer = Some(indexer); self @@ -157,7 +157,7 @@ impl IrohBuilder { self } - /// Builds the iroh system. + /// Builds the beetle system. pub async fn build(self) -> Result { // TODO: would be good if we can verify the p2p service is correctly hooked up to // the store service. @@ -180,7 +180,7 @@ impl IrohBuilder { store_addr: Some(store.addr()), channels: Some(1), }; - let api_config = iroh_api::config::Config { + let api_config = beetle_api::config::Config { rpc_client: rpc_config, metrics: Default::default(), http_resolvers, @@ -192,9 +192,9 @@ impl IrohBuilder { } } -/// The full iroh system. +/// The full beetle system. /// -/// This is constructed using [`IrohBuilder`]. Creating an iroh system will start various +/// This is constructed using [`IrohBuilder`]. Creating an beetle system will start various /// tokio tasks, which can be gracefully terminated again using [`Iroh::stop`] or they will /// be aborted when dropping this struct. /// @@ -207,7 +207,7 @@ pub struct Iroh { } impl Iroh { - /// Returns a reference to the iroh API. + /// Returns a reference to the beetle API. /// /// This API gives you some high level functionality using the built-in p2p and store /// nodes as well as a few lower-level and p2p-specific functions. @@ -215,7 +215,7 @@ impl Iroh { &self.api } - /// Gracefully stop the iroh system. + /// Gracefully stop the beetle system. pub async fn stop(self) -> Result<()> { self.p2p.stop().await?; self.store.stop().await?; @@ -245,7 +245,7 @@ impl Iroh { // .await // .unwrap(); -// let iroh = IrohBuilder::new() +// let beetle = IrohBuilder::new() // .store(store) // .p2p(p2p) // .build() @@ -254,7 +254,7 @@ impl Iroh { // // TODO: call an API function, e.g. version would be good. -// let res = dbg!(iroh.stop().await); +// let res = dbg!(beetle.stop().await); // assert!(res.is_ok()); // } diff --git a/iroh-embed/src/p2p.rs b/beetle-embed/src/p2p.rs similarity index 87% rename from iroh-embed/src/p2p.rs rename to beetle-embed/src/p2p.rs index a35b2f12e..15c947f73 100644 --- a/iroh-embed/src/p2p.rs +++ b/beetle-embed/src/p2p.rs @@ -1,13 +1,13 @@ -//! The p2p service to use in an iroh system. +//! The p2p service to use in an beetle system. use std::path::PathBuf; use anyhow::Result; -use iroh_one::mem_p2p; -use iroh_p2p::{Config as P2pConfig, Libp2pConfig}; -use iroh_rpc_types::p2p::P2pAddr; -use iroh_rpc_types::store::StoreAddr; -use iroh_rpc_types::Addr; +use beetle_one::mem_p2p; +use beetle_p2p::{Config as P2pConfig, Libp2pConfig}; +use beetle_rpc_types::p2p::P2pAddr; +use beetle_rpc_types::store::StoreAddr; +use beetle_rpc_types::Addr; use tokio::task::JoinHandle; // TODO: @@ -15,9 +15,9 @@ use tokio::task::JoinHandle; // - Need to allow configuring in memory keystore // - make Lib2p2Config non_exhaustive and provide a builder -/// The iroh peer-to-peer (p2p) service. +/// The beetle peer-to-peer (p2p) service. /// -/// An iroh system needs a p2p service to participate in the IPFS network. +/// An beetle system needs a p2p service to participate in the IPFS network. #[derive(Debug)] pub struct P2pService { task: JoinHandle<()>, @@ -25,7 +25,7 @@ pub struct P2pService { } impl P2pService { - /// Starts a new iroh peer-to-peer service. + /// Starts a new beetle peer-to-peer service. /// /// This implicitly starts a task on the tokio runtime to manage the storage node. /// @@ -53,7 +53,7 @@ impl P2pService { /// Returns the internal RPC address of this p2p service. /// - /// This can be used to connect this service to other iroh services, like the gateway + /// This can be used to connect this service to other beetle services, like the gateway /// service. pub fn addr(&self) -> P2pAddr { self.addr.clone() diff --git a/iroh-embed/src/store.rs b/beetle-embed/src/store.rs similarity index 83% rename from iroh-embed/src/store.rs rename to beetle-embed/src/store.rs index 1fc6a321b..be7afab48 100644 --- a/iroh-embed/src/store.rs +++ b/beetle-embed/src/store.rs @@ -1,17 +1,17 @@ -//! Store services to use in an iroh system. +//! Store services to use in an beetle system. use std::path::PathBuf; use anyhow::Result; -use iroh_one::mem_store; -use iroh_rpc_types::store::StoreAddr; -use iroh_rpc_types::Addr; -use iroh_store::Config as StoreConfig; +use beetle_one::mem_store; +use beetle_rpc_types::store::StoreAddr; +use beetle_rpc_types::Addr; +use beetle_store::Config as StoreConfig; use tokio::task::JoinHandle; -/// A iroh store backed by an on-disk RocksDB. +/// A beetle store backed by an on-disk RocksDB. /// -/// An iroh system needs a store service for keeping local state and IPFS data. This one +/// An beetle system needs a store service for keeping local state and IPFS data. This one /// uses RocksDB in a directory on disk. #[derive(Debug)] pub struct RocksStoreService { @@ -20,7 +20,7 @@ pub struct RocksStoreService { } impl RocksStoreService { - /// Starts a new iroh Store service with RocksDB storage. + /// Starts a new beetle Store service with RocksDB storage. /// /// This implicitly starts a task on the tokio runtime to manage the storage node. pub async fn new(path: PathBuf) -> Result { @@ -32,7 +32,7 @@ impl RocksStoreService { /// Returns the internal RPC address of this store node. /// - /// This is used by the other iroh services, like the p2p and gateway services, to use + /// This is used by the other beetle services, like the p2p and gateway services, to use /// the store. pub fn addr(&self) -> StoreAddr { self.addr.clone() diff --git a/iroh-gateway/Cargo.toml b/beetle-gateway/Cargo.toml similarity index 85% rename from iroh-gateway/Cargo.toml rename to beetle-gateway/Cargo.toml index 69f3c5a56..24ea0a577 100644 --- a/iroh-gateway/Cargo.toml +++ b/beetle-gateway/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "iroh-gateway" +name = "beetle-gateway" readme = "README.md" description = "IPFS gateway" version.workspace = true @@ -28,13 +28,13 @@ http-body.workspace = true http-serde.workspace = true http.workspace = true hyper.workspace = true -iroh-car.workspace = true -iroh-metrics = { workspace = true, features = ["gateway"] } -iroh-resolver.workspace = true -iroh-rpc-client.workspace = true -iroh-rpc-types.workspace = true -iroh-unixfs.workspace = true -iroh-util.workspace = true +beetle-car.workspace = true +beetle-metrics = { workspace = true, features = ["gateway"] } +beetle-resolver.workspace = true +beetle-rpc-client.workspace = true +beetle-rpc-types.workspace = true +beetle-unixfs.workspace = true +beetle-util.workspace = true libp2p.workspace = true mime.workspace = true mime_classifier.workspace = true @@ -64,5 +64,5 @@ urlencoding.workspace = true testdir.workspace = true [dev-dependencies] -iroh-store.workspace = true +beetle-store.workspace = true tempfile.workspace = true diff --git a/iroh-gateway/README.md b/beetle-gateway/README.md similarity index 74% rename from iroh-gateway/README.md rename to beetle-gateway/README.md index 2f0540e80..db5b97b44 100644 --- a/iroh-gateway/README.md +++ b/beetle-gateway/README.md @@ -1,12 +1,12 @@ -# iroh gateway +# beetle gateway -[![crates.io](https://img.shields.io/crates/v/iroh-gateway.svg?style=flat-square)](https://crates.io/crates/iroh-gateway) -[![Released API docs](https://img.shields.io/docsrs/iroh-gateway?style=flat-square)](https://docs.rs/iroh-gateway) -[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/iroh-gateway?style=flat-square)](../LICENSE-MIT) -[![CI](https://img.shields.io/github/workflow/status/n0-computer/iroh/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/iroh/actions?query=workflow%3A%22Continuous+integration%22) +[![crates.io](https://img.shields.io/crates/v/beetle-gateway.svg?style=flat-square)](https://crates.io/crates/beetle-gateway) +[![Released API docs](https://img.shields.io/docsrs/beetle-gateway?style=flat-square)](https://docs.rs/beetle-gateway) +[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/beetle-gateway?style=flat-square)](../LICENSE-MIT) +[![CI](https://img.shields.io/github/workflow/status/n0-computer/beetle/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/beetle/actions?query=workflow%3A%22Continuous+integration%22) A Rust implementation of an [IPFS gateway](https://docs.ipfs.tech/concepts/ipfs-gateway/) based on -[iroh](https://github.com/n0-computer/iroh). An IPFS gateway allows you to +[beetle](https://github.com/n0-computer/beetle). An IPFS gateway allows you to access content on the IPFS network over HTTP. ## Running / Building @@ -21,8 +21,8 @@ access content on the IPFS network over HTTP. ## ENV Variables -- `IROH_INSTANCE_ID` - unique instance identifier, preferably some name than hard id (default: generated lower & snake case name) -- `IROH_ENV` - indicates the service environment (default: `dev`) +- `BEETLE_INSTANCE_ID` - unique instance identifier, preferably some name than hard id (default: generated lower & snake case name) +- `BEETLE_ENV` - indicates the service environment (default: `dev`) ## Endpoints diff --git a/iroh-gateway/assets/404.html b/beetle-gateway/assets/404.html similarity index 92% rename from iroh-gateway/assets/404.html rename to beetle-gateway/assets/404.html index e2d50089e..beb20f4f3 100644 --- a/iroh-gateway/assets/404.html +++ b/beetle-gateway/assets/404.html @@ -54,16 +54,12 @@
- - - - + + + +
- - - - + + + + diff --git a/iroh-gateway/assets/icons.css b/beetle-gateway/assets/icons.css similarity index 100% rename from iroh-gateway/assets/icons.css rename to beetle-gateway/assets/icons.css diff --git a/iroh-gateway/assets/style.css b/beetle-gateway/assets/style.css similarity index 100% rename from iroh-gateway/assets/style.css rename to beetle-gateway/assets/style.css diff --git a/iroh-gateway/src/bad_bits.rs b/beetle-gateway/src/bad_bits.rs similarity index 97% rename from iroh-gateway/src/bad_bits.rs rename to beetle-gateway/src/bad_bits.rs index e60a626f1..4534ca931 100644 --- a/iroh-gateway/src/bad_bits.rs +++ b/beetle-gateway/src/bad_bits.rs @@ -104,11 +104,11 @@ pub fn spawn_bad_bits_updater(bad_bits: Arc>>) -> Option< mod tests { use std::str::FromStr; + use beetle_resolver::dns_resolver::Config as DnsResolverConfig; + use beetle_rpc_client::{Client as RpcClient, Config as RpcClientConfig}; + use beetle_unixfs::content_loader::{FullLoader, FullLoaderConfig, GatewayUrl}; use hex_literal::hex; use http::StatusCode; - use iroh_resolver::dns_resolver::Config as DnsResolverConfig; - use iroh_rpc_client::{Client as RpcClient, Config as RpcClientConfig}; - use iroh_unixfs::content_loader::{FullLoader, FullLoaderConfig, GatewayUrl}; use super::*; use crate::config::Config; diff --git a/iroh-gateway/src/cli.rs b/beetle-gateway/src/cli.rs similarity index 100% rename from iroh-gateway/src/cli.rs rename to beetle-gateway/src/cli.rs diff --git a/iroh-gateway/src/client.rs b/beetle-gateway/src/client.rs similarity index 94% rename from iroh-gateway/src/client.rs rename to beetle-gateway/src/client.rs index 3873a70a5..272d92f3e 100644 --- a/iroh-gateway/src/client.rs +++ b/beetle-gateway/src/client.rs @@ -3,20 +3,20 @@ use std::pin::Pin; use std::task::Poll; use anyhow::Result; -use bytes::Bytes; -use cid::Cid; -use futures::{StreamExt, TryStream}; -use http::HeaderMap; -use iroh_car::{CarHeader, CarWriter}; -use iroh_metrics::{ +use beetle_car::{CarHeader, CarWriter}; +use beetle_metrics::{ core::{MObserver, MRecorder}, gateway::{GatewayHistograms, GatewayMetrics}, observe, record, resolver::OutMetrics, }; -use iroh_resolver::dns_resolver::Config; -use iroh_resolver::resolver::{CidOrDomain, Metadata, Out, OutPrettyReader, OutType, Resolver}; -use iroh_unixfs::{content_loader::ContentLoader, Source}; +use beetle_resolver::dns_resolver::Config; +use beetle_resolver::resolver::{CidOrDomain, Metadata, Out, OutPrettyReader, OutType, Resolver}; +use beetle_unixfs::{content_loader::ContentLoader, Source}; +use bytes::Bytes; +use cid::Cid; +use futures::{StreamExt, TryStream}; +use http::HeaderMap; use mime::Mime; use tokio::io::{AsyncBufReadExt, AsyncReadExt, AsyncSeekExt, AsyncWrite}; use tokio_util::io::ReaderStream; @@ -98,7 +98,7 @@ impl Client { #[tracing::instrument(skip(self))] pub async fn retrieve_path_metadata( &self, - path: iroh_resolver::resolver::Path, + path: beetle_resolver::resolver::Path, format: Option, ) -> Result { info!("retrieve path metadata {}", path); @@ -117,7 +117,7 @@ impl Client { #[tracing::instrument(skip(self))] pub async fn get_file( &self, - path: iroh_resolver::resolver::Path, + path: beetle_resolver::resolver::Path, path_metadata: Option, start_time: std::time::Instant, range: Option>, @@ -167,7 +167,7 @@ impl Client { #[tracing::instrument(skip(self))] pub async fn get_car_recursive( self, - path: iroh_resolver::resolver::Path, + path: beetle_resolver::resolver::Path, start_time: std::time::Instant, ) -> Result>, String> { info!("get car {}", path); @@ -187,7 +187,7 @@ impl Client { #[tracing::instrument(skip(self))] pub async fn get_file_recursive( self, - path: iroh_resolver::resolver::Path, + path: beetle_resolver::resolver::Path, start_time: std::time::Instant, ) -> Result { info!("get file {}", path); @@ -245,7 +245,7 @@ impl Client { pub struct IpfsRequest { pub format: ResponseFormat, pub cid: CidOrDomain, - pub resolved_path: iroh_resolver::resolver::Path, + pub resolved_path: beetle_resolver::resolver::Path, pub query_file_name: String, pub download: bool, pub query_params: GetParams, @@ -265,7 +265,7 @@ impl IpfsRequest { async fn fetch_car_recursive( resolver: &Resolver, - path: iroh_resolver::resolver::Path, + path: beetle_resolver::resolver::Path, writer: W, start_time: std::time::Instant, ) -> Result<(), anyhow::Error> diff --git a/iroh-gateway/src/config.rs b/beetle-gateway/src/config.rs similarity index 94% rename from iroh-gateway/src/config.rs rename to beetle-gateway/src/config.rs index f84f59385..2fb2fbdac 100644 --- a/iroh-gateway/src/config.rs +++ b/beetle-gateway/src/config.rs @@ -1,31 +1,31 @@ use crate::constants::*; use anyhow::Result; use axum::http::{header::*, Method}; +use beetle_metrics::config::Config as MetricsConfig; +use beetle_resolver::dns_resolver::Config as DnsResolverConfig; +use beetle_rpc_client::Config as RpcClientConfig; +use beetle_rpc_types::gateway::GatewayAddr; +use beetle_util::insert_into_config_map; use config::{ConfigError, Map, Source, Value}; use headers::{ AcceptRanges, AccessControlAllowHeaders, AccessControlAllowMethods, AccessControlAllowOrigin, AccessControlExposeHeaders, HeaderMapExt, }; -use iroh_metrics::config::Config as MetricsConfig; -use iroh_resolver::dns_resolver::Config as DnsResolverConfig; -use iroh_rpc_client::Config as RpcClientConfig; -use iroh_rpc_types::gateway::GatewayAddr; -use iroh_util::insert_into_config_map; use serde::{Deserialize, Serialize}; -/// CONFIG_FILE_NAME is the name of the optional config file located in the iroh home directory +/// CONFIG_FILE_NAME is the name of the optional config file located in the beetle home directory pub const CONFIG_FILE_NAME: &str = "gateway.config.toml"; /// ENV_PREFIX should be used along side the config field name to set a config field using /// environment variables -/// For example, `IROH_GATEWAY_PORT=1000` would set the value of the `Config.port` field -pub const ENV_PREFIX: &str = "IROH_GATEWAY"; +/// For example, `BEETLE_GATEWAY_PORT=1000` would set the value of the `Config.port` field +pub const ENV_PREFIX: &str = "BEETLE_GATEWAY"; pub const DEFAULT_PORT: u16 = 9050; /// The configuration for the gateway server. /// /// This is the configuration which the gateway server binary needs to run. This is a /// superset from the configuration needed by the gateway service, which can also run -/// integrated into another binary like iroh-one, iroh-share or iroh-embed. +/// integrated into another binary like beetle-one, beetle-share or beetle-embed. // NOTE: If this was moved into main.rs it would not need to be public. Our binary is build // as being outside of the lib crate, hence here it needs to be public. #[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)] @@ -58,7 +58,7 @@ impl Source for ServerConfig { } } -/// Configuration for [`iroh-gateway`]. +/// Configuration for [`beetle-gateway`]. #[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] pub struct Config { /// Pretty URL to redirect to @@ -211,7 +211,7 @@ impl Source for Config { } impl crate::handlers::StateConfig for Config { - fn rpc_client(&self) -> &iroh_rpc_client::Config { + fn rpc_client(&self) -> &beetle_rpc_client::Config { &self.rpc_client } @@ -346,7 +346,7 @@ mod tests { ) .unwrap(); let sources = [Some(cfg_file.as_path())]; - let cfg = iroh_util::make_config( + let cfg = beetle_util::make_config( ServerConfig::default(), &sources, ENV_PREFIX, diff --git a/iroh-gateway/src/constants.rs b/beetle-gateway/src/constants.rs similarity index 100% rename from iroh-gateway/src/constants.rs rename to beetle-gateway/src/constants.rs diff --git a/iroh-gateway/src/core.rs b/beetle-gateway/src/core.rs similarity index 96% rename from iroh-gateway/src/core.rs rename to beetle-gateway/src/core.rs index 32b971721..ba6118a5c 100644 --- a/iroh-gateway/src/core.rs +++ b/beetle-gateway/src/core.rs @@ -1,9 +1,9 @@ use std::{collections::HashMap, sync::Arc}; use axum::Router; -use iroh_resolver::dns_resolver::Config as DnsResolverConfig; -use iroh_rpc_types::gateway::GatewayAddr; -use iroh_unixfs::content_loader::ContentLoader; +use beetle_resolver::dns_resolver::Config as DnsResolverConfig; +use beetle_rpc_types::gateway::GatewayAddr; +use beetle_unixfs::content_loader::ContentLoader; use tokio::sync::RwLock; use crate::{ @@ -121,18 +121,18 @@ mod tests { use super::*; use axum::response::Response; + use beetle_rpc_client::Client as RpcClient; + use beetle_rpc_client::Config as RpcClientConfig; + use beetle_rpc_types::store::StoreAddr; + use beetle_rpc_types::Addr; + use beetle_unixfs::builder::{DirectoryBuilder, FileBuilder}; + use beetle_unixfs::content_loader::{FullLoader, FullLoaderConfig}; + use beetle_unixfs::unixfs::UnixfsNode; use cid::Cid; use futures::{StreamExt, TryStreamExt}; use http::header::CONTENT_RANGE; use http::HeaderValue; use hyper::Body; - use iroh_rpc_client::Client as RpcClient; - use iroh_rpc_client::Config as RpcClientConfig; - use iroh_rpc_types::store::StoreAddr; - use iroh_rpc_types::Addr; - use iroh_unixfs::builder::{DirectoryBuilder, FileBuilder}; - use iroh_unixfs::content_loader::{FullLoader, FullLoaderConfig}; - use iroh_unixfs::unixfs::UnixfsNode; use rand::distributions::{Alphanumeric, DistString}; use rand::rngs::SmallRng; use rand::SeedableRng; @@ -194,10 +194,10 @@ mod tests { let server_addr = Addr::new_mem(); let client_addr = server_addr.clone(); let store_dir = tempfile::tempdir().unwrap(); - let config = iroh_store::Config::new(store_dir.path().join("db")); - let store = iroh_store::Store::create(config).await.unwrap(); + let config = beetle_store::Config::new(store_dir.path().join("db")); + let store = beetle_store::Store::create(config).await.unwrap(); let task = - tokio::spawn(async move { iroh_store::rpc::new(server_addr, store).await.unwrap() }); + tokio::spawn(async move { beetle_store::rpc::new(server_addr, store).await.unwrap() }); (client_addr, task) } @@ -424,8 +424,8 @@ mod tests { .await; assert_eq!(http::StatusCode::OK, res.status()); let body = hyper::body::to_bytes(res.into_body()).await.unwrap(); - let ufs = iroh_unixfs::unixfs::UnixfsNode::decode(&test_setup.root_cid, body).unwrap(); - assert_eq!(ufs.typ().unwrap(), iroh_unixfs::unixfs::DataType::File); + let ufs = beetle_unixfs::unixfs::UnixfsNode::decode(&test_setup.root_cid, body).unwrap(); + assert_eq!(ufs.typ().unwrap(), beetle_unixfs::unixfs::DataType::File); } // TODO(b5) - refactor to return anyhow::Result<()> @@ -453,7 +453,7 @@ mod tests { res.into_body() .map_err(|err| io::Error::new(io::ErrorKind::Other, err.to_string())), ); - let car_reader = iroh_car::CarReader::new(body).await.unwrap(); + let car_reader = beetle_car::CarReader::new(body).await.unwrap(); let (nodes, cids): (Vec, Vec) = car_reader .stream() .map(|res| res.unwrap()) @@ -541,7 +541,7 @@ mod tests { res.into_body() .map_err(|err| io::Error::new(io::ErrorKind::Other, err.to_string())), ); - let car_reader = iroh_car::CarReader::new(body).await.unwrap(); + let car_reader = beetle_car::CarReader::new(body).await.unwrap(); let (nodes, cids): (Vec, Vec) = car_reader .stream() .map(|res| res.unwrap()) diff --git a/iroh-gateway/src/cors.rs b/beetle-gateway/src/cors.rs similarity index 100% rename from iroh-gateway/src/cors.rs rename to beetle-gateway/src/cors.rs diff --git a/iroh-gateway/src/error.rs b/beetle-gateway/src/error.rs similarity index 97% rename from iroh-gateway/src/error.rs rename to beetle-gateway/src/error.rs index 528d7ed8d..bff07a1af 100644 --- a/iroh-gateway/src/error.rs +++ b/beetle-gateway/src/error.rs @@ -8,8 +8,8 @@ use axum::{ http::StatusCode, response::{IntoResponse, Response}, }; +use beetle_metrics::{core::MRecorder, gateway::GatewayMetrics, get_current_trace_id, inc}; use http::{HeaderMap, HeaderValue}; -use iroh_metrics::{core::MRecorder, gateway::GatewayMetrics, get_current_trace_id, inc}; use opentelemetry::trace::TraceId; use serde_json::json; diff --git a/iroh-gateway/src/handler_params.rs b/beetle-gateway/src/handler_params.rs similarity index 97% rename from iroh-gateway/src/handler_params.rs rename to beetle-gateway/src/handler_params.rs index 0663edbbf..cfacbcb78 100644 --- a/iroh-gateway/src/handler_params.rs +++ b/beetle-gateway/src/handler_params.rs @@ -1,6 +1,6 @@ +use beetle_resolver::resolver::{CidOrDomain, Path, PathType}; use cid::multibase; use cid::multibase::Base; -use iroh_resolver::resolver::{CidOrDomain, Path, PathType}; use serde::{Deserialize, Serialize}; #[derive(Debug, Deserialize, Serialize, Clone)] @@ -78,7 +78,7 @@ pub fn inlined_dns_link_to_dns_link(dns_link: &str) -> String { #[cfg(test)] mod tests { - use iroh_resolver::resolver::Path; + use beetle_resolver::resolver::Path; use crate::handler_params::inlined_dns_link_to_dns_link; use crate::handler_params::recode_path_to_inlined_dns_link; diff --git a/iroh-gateway/src/handlers.rs b/beetle-gateway/src/handlers.rs similarity index 99% rename from iroh-gateway/src/handlers.rs rename to beetle-gateway/src/handlers.rs index 73343ee2f..e9801064a 100644 --- a/iroh-gateway/src/handlers.rs +++ b/beetle-gateway/src/handlers.rs @@ -11,14 +11,14 @@ use axum::{ routing::{get, head}, BoxError, Router, }; +use beetle_metrics::{core::MRecorder, gateway::GatewayMetrics, inc, resolver::OutMetrics}; +use beetle_resolver::resolver::{CidOrDomain, UnixfsType}; +use beetle_unixfs::{content_loader::ContentLoader, Link}; +use beetle_util::human::format_bytes; use cid::Cid; use futures::TryStreamExt; use handlebars::Handlebars; use http::Method; -use iroh_metrics::{core::MRecorder, gateway::GatewayMetrics, inc, resolver::OutMetrics}; -use iroh_resolver::resolver::{CidOrDomain, UnixfsType}; -use iroh_unixfs::{content_loader::ContentLoader, Link}; -use iroh_util::human::format_bytes; use serde_json::{ json, value::{Map, Value as Json}, @@ -31,7 +31,7 @@ use std::{ time::{self, Duration}, }; -use iroh_resolver::Path; +use beetle_resolver::Path; use tower::{ServiceBuilder, ServiceExt}; use tower_http::{compression::CompressionLayer, trace::TraceLayer}; use tracing::info_span; @@ -61,7 +61,7 @@ enum RequestPreprocessingResult { /// Trait describing what needs to be accessed on the configuration /// from the shared state. pub trait StateConfig: std::fmt::Debug + Sync + Send { - fn rpc_client(&self) -> &iroh_rpc_client::Config; + fn rpc_client(&self) -> &beetle_rpc_client::Config; fn public_url_base(&self) -> &str; fn port(&self) -> u16; fn user_headers(&self) -> &HeaderMap; diff --git a/iroh-gateway/src/headers.rs b/beetle-gateway/src/headers.rs similarity index 97% rename from iroh-gateway/src/headers.rs rename to beetle-gateway/src/headers.rs index 7d1fdf2c2..436235330 100644 --- a/iroh-gateway/src/headers.rs +++ b/beetle-gateway/src/headers.rs @@ -1,7 +1,7 @@ use crate::{constants::*, response::ResponseFormat}; use ::time::OffsetDateTime; use axum::http::header::*; -use iroh_resolver::resolver::{CidOrDomain, Metadata, PathType}; +use beetle_resolver::resolver::{CidOrDomain, Metadata, PathType}; use mime::Mime; use once_cell::sync::Lazy; use sha2::Digest; @@ -45,7 +45,7 @@ pub fn add_content_type_headers( pub fn add_content_disposition_headers( headers: &mut HeaderMap, filename: &str, - content_path: &iroh_resolver::resolver::Path, + content_path: &beetle_resolver::resolver::Path, should_download: bool, ) -> String { let mut name = get_filename(&content_path.to_string()); @@ -362,7 +362,7 @@ mod tests { // inline let mut headers = HeaderMap::new(); let filename = "test.txt"; - let content_path: iroh_resolver::resolver::Path = + let content_path: beetle_resolver::resolver::Path = "/ipfs/bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy" .parse() .unwrap(); @@ -378,7 +378,7 @@ mod tests { // attachment let mut headers = HeaderMap::new(); let filename = "test.txt"; - let content_path: iroh_resolver::resolver::Path = + let content_path: beetle_resolver::resolver::Path = "/ipfs/bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy" .parse() .unwrap(); @@ -394,7 +394,7 @@ mod tests { // no filename & no content path filename let mut headers = HeaderMap::new(); let filename = ""; - let content_path: iroh_resolver::resolver::Path = + let content_path: beetle_resolver::resolver::Path = "/ipfs/bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy" .parse() .unwrap(); @@ -409,7 +409,7 @@ mod tests { // no filename & with content path filename let mut headers = HeaderMap::new(); let filename = ""; - let content_path: iroh_resolver::resolver::Path = + let content_path: beetle_resolver::resolver::Path = "/ipfs/bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy/folder/test.txt" .parse() .unwrap(); diff --git a/iroh-gateway/src/lib.rs b/beetle-gateway/src/lib.rs similarity index 100% rename from iroh-gateway/src/lib.rs rename to beetle-gateway/src/lib.rs diff --git a/iroh-gateway/src/main.rs b/beetle-gateway/src/main.rs similarity index 84% rename from iroh-gateway/src/main.rs rename to beetle-gateway/src/main.rs index 5e6fc7af0..549be8a15 100644 --- a/iroh-gateway/src/main.rs +++ b/beetle-gateway/src/main.rs @@ -1,28 +1,28 @@ use std::sync::Arc; use anyhow::{anyhow, Context, Result}; -use clap::Parser; -use iroh_gateway::{ +use beetle_gateway::{ bad_bits::{self, BadBits}, cli::Args, config::{Config, ServerConfig, CONFIG_FILE_NAME, ENV_PREFIX}, core::Core, metrics, }; -use iroh_rpc_client::Client as RpcClient; -use iroh_unixfs::content_loader::{FullLoader, FullLoaderConfig}; -use iroh_util::lock::ProgramLock; -use iroh_util::{iroh_config_path, make_config}; +use beetle_rpc_client::Client as RpcClient; +use beetle_unixfs::content_loader::{FullLoader, FullLoaderConfig}; +use beetle_util::lock::ProgramLock; +use beetle_util::{beetle_config_path, make_config}; +use clap::Parser; use tokio::sync::RwLock; #[tokio::main(flavor = "multi_thread")] async fn main() -> Result<()> { - let mut lock = ProgramLock::new("iroh-gateway")?; + let mut lock = ProgramLock::new("beetle-gateway")?; lock.acquire_or_exit(); let args = Args::parse(); - let cfg_path = iroh_config_path(CONFIG_FILE_NAME)?; + let cfg_path = beetle_config_path(CONFIG_FILE_NAME)?; let sources = [Some(cfg_path.as_path()), args.cfg.as_deref()]; let mut config = make_config( // default @@ -78,13 +78,13 @@ async fn main() -> Result<()> { let bad_bits_handle = bad_bits::spawn_bad_bits_updater(Arc::clone(&bad_bits)); - let metrics_handle = iroh_metrics::MetricsHandle::new(metrics_config) + let metrics_handle = beetle_metrics::MetricsHandle::new(metrics_config) .await .expect("failed to initialize metrics"); #[cfg(unix)] { - match iroh_util::increase_fd_limit() { + match beetle_util::increase_fd_limit() { Ok(soft) => tracing::debug!("NOFILE limit: soft = {}", soft), Err(err) => tracing::error!("Error increasing NOFILE limit: {}", err), } @@ -96,7 +96,7 @@ async fn main() -> Result<()> { server.await.unwrap(); }); - iroh_util::block_until_sigint().await; + beetle_util::block_until_sigint().await; core_task.abort(); metrics_handle.shutdown(); diff --git a/iroh-gateway/src/metrics.rs b/beetle-gateway/src/metrics.rs similarity index 89% rename from iroh-gateway/src/metrics.rs rename to beetle-gateway/src/metrics.rs index 6b157766b..0678327e2 100644 --- a/iroh-gateway/src/metrics.rs +++ b/beetle-gateway/src/metrics.rs @@ -1,4 +1,4 @@ -use iroh_metrics::config::Config as MetricsConfig; +use beetle_metrics::config::Config as MetricsConfig; use crate::VERSION; diff --git a/iroh-gateway/src/response.rs b/beetle-gateway/src/response.rs similarity index 99% rename from iroh-gateway/src/response.rs rename to beetle-gateway/src/response.rs index 489cee19c..262c5e0cc 100644 --- a/iroh-gateway/src/response.rs +++ b/beetle-gateway/src/response.rs @@ -5,8 +5,8 @@ use axum::{ http::{header::*, HeaderValue, StatusCode}, response::{IntoResponse, Redirect, Response}, }; +use beetle_metrics::get_current_trace_id; use bytes::Bytes; -use iroh_metrics::get_current_trace_id; use opentelemetry::trace::TraceId; use std::error::Error; diff --git a/iroh-gateway/src/rpc.rs b/beetle-gateway/src/rpc.rs similarity index 90% rename from iroh-gateway/src/rpc.rs rename to beetle-gateway/src/rpc.rs index 304bb6fd3..e9530363c 100644 --- a/iroh-gateway/src/rpc.rs +++ b/beetle-gateway/src/rpc.rs @@ -1,12 +1,14 @@ use std::result; use anyhow::Result; -use futures::stream::Stream; -use iroh_rpc_client::{create_server, GatewayServer, ServerError, ServerSocket, HEALTH_POLL_WAIT}; -use iroh_rpc_types::{ +use beetle_rpc_client::{ + create_server, GatewayServer, ServerError, ServerSocket, HEALTH_POLL_WAIT, +}; +use beetle_rpc_types::{ gateway::{GatewayAddr, GatewayRequest, GatewayService}, VersionRequest, VersionResponse, WatchRequest, WatchResponse, }; +use futures::stream::Stream; use tracing::info; use crate::VERSION; @@ -33,7 +35,7 @@ impl Gateway { } } -impl iroh_rpc_types::NamedService for Gateway { +impl beetle_rpc_types::NamedService for Gateway { const NAME: &'static str = "gateway"; } diff --git a/iroh-gateway/src/templates.rs b/beetle-gateway/src/templates.rs similarity index 100% rename from iroh-gateway/src/templates.rs rename to beetle-gateway/src/templates.rs diff --git a/iroh-gateway/src/text.rs b/beetle-gateway/src/text.rs similarity index 100% rename from iroh-gateway/src/text.rs rename to beetle-gateway/src/text.rs diff --git a/iroh-localops/Cargo.toml b/beetle-localops/Cargo.toml similarity index 94% rename from iroh-localops/Cargo.toml rename to beetle-localops/Cargo.toml index da51584a3..251cbccbf 100644 --- a/iroh-localops/Cargo.toml +++ b/beetle-localops/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "iroh-localops" +name = "beetle-localops" authors = ["dignifiedquire ", "b5 "] description = "Iroh specific process management." version.workspace = true diff --git a/iroh-localops/README.md b/beetle-localops/README.md similarity index 50% rename from iroh-localops/README.md rename to beetle-localops/README.md index 759fe7b33..02d945a05 100644 --- a/iroh-localops/README.md +++ b/beetle-localops/README.md @@ -1,11 +1,11 @@ -# iroh localops +# beetle localops -[![crates.io](https://img.shields.io/crates/v/iroh-localops.svg?style=flat-square)](https://crates.io/crates/iroh-localops) -[![Released API docs](https://img.shields.io/docsrs/iroh-localops?style=flat-square)](https://docs.rs/iroh-localops) -[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/iroh-localops?style=flat-square)](../LICENSE-MIT) -[![CI](https://img.shields.io/github/workflow/status/n0-computer/iroh/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/iroh/actions?query=workflow%3A%22Continuous+integration%22) +[![crates.io](https://img.shields.io/crates/v/beetle-localops.svg?style=flat-square)](https://crates.io/crates/beetle-localops) +[![Released API docs](https://img.shields.io/docsrs/beetle-localops?style=flat-square)](https://docs.rs/beetle-localops) +[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/beetle-localops?style=flat-square)](../LICENSE-MIT) +[![CI](https://img.shields.io/github/workflow/status/n0-computer/beetle/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/beetle/actions?query=workflow%3A%22Continuous+integration%22) -Think "devops on localhost". This crate contains iroh-specific tools for starting & stopping processes in a cross platform way. +Think "devops on localhost". This crate contains beetle-specific tools for starting & stopping processes in a cross platform way. This crate targets three operating systems via [conditional compilation](https://doc.rust-lang.org/reference/conditional-compilation.html): * `macos` diff --git a/iroh-localops/src/lib.rs b/beetle-localops/src/lib.rs similarity index 100% rename from iroh-localops/src/lib.rs rename to beetle-localops/src/lib.rs diff --git a/iroh-localops/src/process.rs b/beetle-localops/src/process.rs similarity index 97% rename from iroh-localops/src/process.rs rename to beetle-localops/src/process.rs index 6b4696916..a9b12caa6 100644 --- a/iroh-localops/src/process.rs +++ b/beetle-localops/src/process.rs @@ -69,7 +69,7 @@ fn daemonize_process(_bin_path: PathBuf, _log_path: PathBuf) -> Result<()> { // TODO(b5) - this level of indirection isn't necessary, factor `stop_process` // directly into `stop` -// https://github.com/n0-computer/iroh/pull/360#discussion_r1002000769 +// https://github.com/n0-computer/beetle/pull/360#discussion_r1002000769 pub fn stop(pid: u32) -> Result<()> { stop_process(pid) } diff --git a/iroh-metrics/Cargo.toml b/beetle-metrics/Cargo.toml similarity index 96% rename from iroh-metrics/Cargo.toml rename to beetle-metrics/Cargo.toml index 53a7fe5f8..9fd370268 100644 --- a/iroh-metrics/Cargo.toml +++ b/beetle-metrics/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "iroh-metrics" +name = "beetle-metrics" version.workspace = true edition.workspace = true license.workspace = true @@ -12,7 +12,7 @@ rust-version.workspace = true async-trait.workspace = true config.workspace = true console-subscriber = { workspace = true, optional = true } -iroh-util.workspace = true +beetle-util.workspace = true lazy_static.workspace = true names.workspace = true opentelemetry = { workspace = true, features = ["rt-tokio"] } diff --git a/beetle-metrics/README.md b/beetle-metrics/README.md new file mode 100644 index 000000000..35fab0000 --- /dev/null +++ b/beetle-metrics/README.md @@ -0,0 +1,30 @@ +# beetle metrics + +[![crates.io](https://img.shields.io/crates/v/beetle-metrics.svg?style=flat-square)](https://crates.io/crates/beetle-metrics) +[![Released API docs](https://img.shields.io/docsrs/beetle-metrics?style=flat-square)](https://docs.rs/beetle-metrics) +[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/beetle-metrics?style=flat-square)](../LICENSE-MIT) +[![CI](https://img.shields.io/github/workflow/status/n0-computer/beetle/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/beetle/actions?query=workflow%3A%22Continuous+integration%22) + + +The metrics collection interface for [beetle](https://github.com/n0-computer/beetle) services. + +## ENV Variables + +- `BEETLE_METRICS_DEBUG` - redirects traces to stdout if the flag is set to `true` (default: ``) +- `BEETLE_METRICS_COLLECTOR_ENDPOINT` - endpoint where traces will be routed (default: `http://localhost:4317`) +- `BEETLE_METRICS_PROM_GATEWAY_ENDPOINT` - endpoint where prometheus metrics will be pushed (default: `http://localhost:9091`) + +## License + + +Licensed under either of Apache License, Version +2.0 or MIT license at your option. + + +
+ + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this crate by you, as defined in the Apache-2.0 license, shall +be dual licensed as above, without any additional terms or conditions. + diff --git a/iroh-metrics/src/bitswap.rs b/beetle-metrics/src/bitswap.rs similarity index 100% rename from iroh-metrics/src/bitswap.rs rename to beetle-metrics/src/bitswap.rs diff --git a/iroh-metrics/src/config.rs b/beetle-metrics/src/config.rs similarity index 99% rename from iroh-metrics/src/config.rs rename to beetle-metrics/src/config.rs index 42f0c0328..281f49604 100644 --- a/iroh-metrics/src/config.rs +++ b/beetle-metrics/src/config.rs @@ -1,5 +1,5 @@ +use beetle_util::insert_into_config_map; use config::{ConfigError, Map, Source, Value}; -use iroh_util::insert_into_config_map; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] diff --git a/iroh-metrics/src/core.rs b/beetle-metrics/src/core.rs similarity index 100% rename from iroh-metrics/src/core.rs rename to beetle-metrics/src/core.rs diff --git a/iroh-metrics/src/gateway.rs b/beetle-metrics/src/gateway.rs similarity index 100% rename from iroh-metrics/src/gateway.rs rename to beetle-metrics/src/gateway.rs diff --git a/iroh-metrics/src/lib.rs b/beetle-metrics/src/lib.rs similarity index 100% rename from iroh-metrics/src/lib.rs rename to beetle-metrics/src/lib.rs diff --git a/iroh-metrics/src/macros.rs b/beetle-metrics/src/macros.rs similarity index 100% rename from iroh-metrics/src/macros.rs rename to beetle-metrics/src/macros.rs diff --git a/iroh-metrics/src/p2p.rs b/beetle-metrics/src/p2p.rs similarity index 100% rename from iroh-metrics/src/p2p.rs rename to beetle-metrics/src/p2p.rs diff --git a/iroh-metrics/src/resolver.rs b/beetle-metrics/src/resolver.rs similarity index 100% rename from iroh-metrics/src/resolver.rs rename to beetle-metrics/src/resolver.rs diff --git a/iroh-metrics/src/store.rs b/beetle-metrics/src/store.rs similarity index 100% rename from iroh-metrics/src/store.rs rename to beetle-metrics/src/store.rs diff --git a/iroh-one/Cargo.toml b/beetle-one/Cargo.toml similarity index 70% rename from iroh-one/Cargo.toml rename to beetle-one/Cargo.toml index d2869f35d..4c2dafb73 100644 --- a/iroh-one/Cargo.toml +++ b/beetle-one/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "iroh-one" +name = "beetle-one" readme = "README.md" -description = "all of iroh in a single binary" +description = "all of beetle in a single binary" edition.workspace = true license.workspace = true repository.workspace = true @@ -20,15 +20,15 @@ futures.workspace = true headers.workspace = true http-serde.workspace = true hyper.workspace = true -iroh-gateway.workspace = true -iroh-metrics.workspace = true -iroh-p2p.workspace = true -iroh-resolver.workspace = true -iroh-unixfs.workspace = true -iroh-rpc-client.workspace = true -iroh-rpc-types.workspace = true -iroh-store.workspace = true -iroh-util.workspace = true +beetle-gateway.workspace = true +beetle-metrics.workspace = true +beetle-p2p.workspace = true +beetle-resolver.workspace = true +beetle-unixfs.workspace = true +beetle-rpc-client.workspace = true +beetle-rpc-types.workspace = true +beetle-store.workspace = true +beetle-util.workspace = true reqwest = { workspace = true, features = ["rustls-tls"] } serde = { workspace = true, features = ["derive"] } tempfile = { workspace = true, optional = true } diff --git a/iroh-one/README.md b/beetle-one/README.md similarity index 51% rename from iroh-one/README.md rename to beetle-one/README.md index ad7e5dcf7..b095fd55a 100644 --- a/iroh-one/README.md +++ b/beetle-one/README.md @@ -1,15 +1,15 @@ -# iroh one - -[![crates.io](https://img.shields.io/crates/v/iroh-one.svg?style=flat-square)](https://crates.io/crates/iroh-one) -[![Released API docs](https://img.shields.io/docsrs/iroh-one?style=flat-square)](https://docs.rs/iroh-one) -[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/iroh-one?style=flat-square)](../LICENSE-MIT) -[![CI](https://img.shields.io/github/workflow/status/n0-computer/iroh/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/iroh/actions?query=workflow%3A%22Continuous+integration%22) - -Single binary of [iroh](https://github.com/n0-computer/iroh) services -([gateway](https://github.com/n0-computer/iroh/tree/main/iroh-gateway), -[p2p](https://github.com/n0-computer/iroh/tree/main/iroh-p2p), -[store](https://github.com/n0-computer/iroh/tree/main/iroh-store)) -communicating via mem channels. This is an alternative to deploying the iroh +# beetle one + +[![crates.io](https://img.shields.io/crates/v/beetle-one.svg?style=flat-square)](https://crates.io/crates/beetle-one) +[![Released API docs](https://img.shields.io/docsrs/beetle-one?style=flat-square)](https://docs.rs/beetle-one) +[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/beetle-one?style=flat-square)](../LICENSE-MIT) +[![CI](https://img.shields.io/github/workflow/status/n0-computer/beetle/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/beetle/actions?query=workflow%3A%22Continuous+integration%22) + +Single binary of [beetle](https://github.com/n0-computer/beetle) services +([gateway](https://github.com/n0-computer/beetle/tree/main/beetle-gateway), +[p2p](https://github.com/n0-computer/beetle/tree/main/beetle-p2p), +[store](https://github.com/n0-computer/beetle/tree/main/beetle-store)) +communicating via mem channels. This is an alternative to deploying the beetle services as micro services. ## Running / Building @@ -21,17 +21,17 @@ services as micro services. - Run with `cargo run --release -- -h` for details - `-wcf` Writeable, Cache, Fetch (options to toggle write enable, caching mechanics and fetching from the network); currently exists but is not implemented - `-p` Port the gateway should listen on -- `--store-path` Path for the iroh-store +- `--store-path` Path for the beetle-store ### Features -- `http-uds-gateway` - enables the usage and binding of the http gateway over UDS. This is independent from the rpc control endpoint which uses the same default and configuration as `iroh-gateway`. +- `http-uds-gateway` - enables the usage and binding of the http gateway over UDS. This is independent from the rpc control endpoint which uses the same default and configuration as `beetle-gateway`. ### Reference -- [Gateway](../iroh-gateway/README.md) -- [P2P](../iroh-p2p/README.md) -- [Store](../iroh-store/README.md) +- [Gateway](../beetle-gateway/README.md) +- [P2P](../beetle-p2p/README.md) +- [Store](../beetle-store/README.md) ## License diff --git a/iroh-one/src/cli.rs b/beetle-one/src/cli.rs similarity index 100% rename from iroh-one/src/cli.rs rename to beetle-one/src/cli.rs diff --git a/iroh-one/src/config.rs b/beetle-one/src/config.rs similarity index 79% rename from iroh-one/src/config.rs rename to beetle-one/src/config.rs index caf875897..41407f9a3 100644 --- a/iroh-one/src/config.rs +++ b/beetle-one/src/config.rs @@ -2,23 +2,23 @@ use anyhow::Result; use axum::http::header::*; use config::{ConfigError, Map, Source, Value}; -use iroh_metrics::config::Config as MetricsConfig; -use iroh_p2p::Libp2pConfig; -use iroh_rpc_client::Config as RpcClientConfig; -use iroh_store::config::config_data_path; -use iroh_util::insert_into_config_map; +use beetle_metrics::config::Config as MetricsConfig; +use beetle_p2p::Libp2pConfig; +use beetle_rpc_client::Config as RpcClientConfig; +use beetle_store::config::config_data_path; +use beetle_util::insert_into_config_map; use serde::{Deserialize, Serialize}; use std::path::PathBuf; -/// CONFIG_FILE_NAME is the name of the optional config file located in the iroh home directory +/// CONFIG_FILE_NAME is the name of the optional config file located in the beetle home directory pub const CONFIG_FILE_NAME: &str = "one.config.toml"; /// ENV_PREFIX should be used along side the config field name to set a config field using /// environment variables -/// For example, `IROH_ONE_PORT=1000` would set the value of the `Config.port` field -pub const ENV_PREFIX: &str = "IROH_ONE"; +/// For example, `BEETLE_ONE_PORT=1000` would set the value of the `Config.port` field +pub const ENV_PREFIX: &str = "BEETLE_ONE"; pub const DEFAULT_PORT: u16 = 9050; -/// Configuration for [`iroh-one`]. +/// Configuration for [`beetle-one`]. /// /// The configuration includes gateway, store and p2p specific items as well as the common /// rpc & metrics ones. @@ -28,11 +28,11 @@ pub struct Config { #[cfg(all(feature = "http-uds-gateway", unix))] pub gateway_uds_path: Option, /// Gateway specific configuration. - pub gateway: iroh_gateway::config::Config, + pub gateway: beetle_gateway::config::Config, /// Store specific configuration. - pub store: iroh_store::config::Config, + pub store: beetle_store::config::Config, /// P2P specific configuration. - pub p2p: iroh_p2p::config::Config, + pub p2p: beetle_p2p::config::Config, /// rpc addresses for the gateway & addresses for the rpc client to dial pub rpc_client: RpcClientConfig, /// metrics configuration @@ -41,9 +41,9 @@ pub struct Config { impl Config { pub fn new( - gateway: iroh_gateway::config::Config, - store: iroh_store::config::Config, - p2p: iroh_p2p::config::Config, + gateway: beetle_gateway::config::Config, + store: beetle_store::config::Config, + p2p: beetle_p2p::config::Config, rpc_client: RpcClientConfig, #[cfg(all(feature = "http-uds-gateway", unix))] gateway_uds_path: Option, ) -> Self { @@ -83,7 +83,7 @@ impl Default for Config { fn default() -> Self { #[cfg(all(feature = "http-uds-gateway", unix))] let gateway_uds_path: PathBuf = tempfile::Builder::new() - .prefix("iroh") + .prefix("beetle") .tempfile() .unwrap() .path() @@ -91,11 +91,11 @@ impl Default for Config { let rpc_client = Self::default_rpc_config(); let metrics_config = MetricsConfig::default(); let store_config = default_store_config(None, rpc_client.clone()).unwrap(); - let key_store_path = iroh_util::iroh_data_root().unwrap(); + let key_store_path = beetle_util::beetle_data_root().unwrap(); Self { rpc_client: rpc_client.clone(), metrics: metrics_config, - gateway: iroh_gateway::config::Config::default(), + gateway: beetle_gateway::config::Config::default(), store: store_config, p2p: default_p2p_config(rpc_client, key_store_path), #[cfg(all(feature = "http-uds-gateway", unix))] @@ -107,16 +107,19 @@ impl Default for Config { fn default_store_config( store_path: Option, ipfsd: RpcClientConfig, -) -> Result { +) -> Result { let path = config_data_path(store_path)?; - Ok(iroh_store::config::Config { + Ok(beetle_store::config::Config { path, rpc_client: ipfsd, }) } -fn default_p2p_config(ipfsd: RpcClientConfig, key_store_path: PathBuf) -> iroh_p2p::config::Config { - iroh_p2p::config::Config { +fn default_p2p_config( + ipfsd: RpcClientConfig, + key_store_path: PathBuf, +) -> beetle_p2p::config::Config { + beetle_p2p::config::Config { key_store_path, libp2p: Libp2pConfig::default(), rpc_client: ipfsd, @@ -148,8 +151,8 @@ impl Source for Config { } } -impl iroh_gateway::handlers::StateConfig for Config { - fn rpc_client(&self) -> &iroh_rpc_client::Config { +impl beetle_gateway::handlers::StateConfig for Config { + fn rpc_client(&self) -> &beetle_rpc_client::Config { &self.rpc_client } diff --git a/iroh-one/src/lib.rs b/beetle-one/src/lib.rs similarity index 100% rename from iroh-one/src/lib.rs rename to beetle-one/src/lib.rs diff --git a/iroh-one/src/main.rs b/beetle-one/src/main.rs similarity index 82% rename from iroh-one/src/main.rs rename to beetle-one/src/main.rs index 9f2e90c7f..be250d7e5 100644 --- a/iroh-one/src/main.rs +++ b/beetle-one/src/main.rs @@ -2,29 +2,29 @@ use std::sync::Arc; #[allow(unused_imports)] use anyhow::{anyhow, Result}; -use clap::Parser; -use iroh_gateway::{bad_bits::BadBits, core::Core, metrics}; +use beetle_gateway::{bad_bits::BadBits, core::Core, metrics}; #[cfg(all(feature = "http-uds-gateway", unix))] -use iroh_one::uds; -use iroh_one::{ +use beetle_one::uds; +use beetle_one::{ cli::Args, config::{Config, CONFIG_FILE_NAME, ENV_PREFIX}, }; -use iroh_rpc_client::Client as RpcClient; -use iroh_rpc_types::Addr; -use iroh_unixfs::content_loader::{FullLoader, FullLoaderConfig}; -use iroh_util::lock::ProgramLock; -use iroh_util::{iroh_config_path, make_config}; +use beetle_rpc_client::Client as RpcClient; +use beetle_rpc_types::Addr; +use beetle_unixfs::content_loader::{FullLoader, FullLoaderConfig}; +use beetle_util::lock::ProgramLock; +use beetle_util::{beetle_config_path, make_config}; +use clap::Parser; use tokio::sync::RwLock; #[tokio::main(flavor = "multi_thread")] async fn main() -> Result<()> { - let mut lock = ProgramLock::new("iroh-one")?; + let mut lock = ProgramLock::new("beetle-one")?; lock.acquire_or_exit(); let args = Args::parse(); - let cfg_path = iroh_config_path(CONFIG_FILE_NAME)?; + let cfg_path = beetle_config_path(CONFIG_FILE_NAME)?; let sources = [Some(cfg_path.as_path()), args.cfg.as_deref()]; let mut config = make_config( // default @@ -40,7 +40,7 @@ async fn main() -> Result<()> { #[cfg(unix)] { - match iroh_util::increase_fd_limit() { + match beetle_util::increase_fd_limit() { Ok(soft) => tracing::debug!("NOFILE limit: soft = {}", soft), Err(err) => tracing::error!("Error increasing NOFILE limit: {}", err), } @@ -55,9 +55,9 @@ async fn main() -> Result<()> { config.rpc_client.p2p_addr = Some(p2p_sender); config.synchronize_subconfigs(); - let store_rpc = iroh_one::mem_store::start(store_recv, config.store.clone()).await?; + let store_rpc = beetle_one::mem_store::start(store_recv, config.store.clone()).await?; - let p2p_rpc = iroh_one::mem_p2p::start(p2p_recv, config.p2p.clone()).await?; + let p2p_rpc = beetle_one::mem_p2p::start(p2p_recv, config.p2p.clone()).await?; (store_rpc, p2p_rpc) }; @@ -99,7 +99,7 @@ async fn main() -> Result<()> { let handler = Core::new_with_state(gateway_rpc_addr, Arc::clone(&shared_state)).await?; - let metrics_handle = iroh_metrics::MetricsHandle::new(metrics_config) + let metrics_handle = beetle_metrics::MetricsHandle::new(metrics_config) .await .expect("failed to initialize metrics"); let server = handler.server(); @@ -111,7 +111,7 @@ async fn main() -> Result<()> { #[cfg(all(feature = "http-uds-gateway", unix))] let uds_server_task = { let mut path = tempfile::Builder::new() - .prefix("iroh") + .prefix("beetle") .tempdir()? .path() .join("ipfsd.http"); @@ -134,7 +134,7 @@ async fn main() -> Result<()> { }) }; - iroh_util::block_until_sigint().await; + beetle_util::block_until_sigint().await; store_rpc.abort(); p2p_rpc.abort(); diff --git a/iroh-one/src/mem_p2p.rs b/beetle-one/src/mem_p2p.rs similarity index 83% rename from iroh-one/src/mem_p2p.rs rename to beetle-one/src/mem_p2p.rs index caf8e9a77..e57c3a312 100644 --- a/iroh-one/src/mem_p2p.rs +++ b/beetle-one/src/mem_p2p.rs @@ -1,7 +1,7 @@ /// A p2p instance listening on a memory rpc channel. -use iroh_p2p::config::Config; -use iroh_p2p::{DiskStorage, Keychain, Node}; -use iroh_rpc_types::p2p::P2pAddr; +use beetle_p2p::config::Config; +use beetle_p2p::{DiskStorage, Keychain, Node}; +use beetle_rpc_types::p2p::P2pAddr; use tokio::task; use tokio::task::JoinHandle; use tracing::error; diff --git a/iroh-one/src/mem_store.rs b/beetle-one/src/mem_store.rs similarity index 92% rename from iroh-one/src/mem_store.rs rename to beetle-one/src/mem_store.rs index c613d2de2..9a6fea2b6 100644 --- a/iroh-one/src/mem_store.rs +++ b/beetle-one/src/mem_store.rs @@ -1,7 +1,7 @@ /// A store instance listening on a memory rpc channel. use anyhow::Context; -use iroh_rpc_types::store::StoreAddr; -use iroh_store::{rpc, Config, Store}; +use beetle_rpc_types::store::StoreAddr; +use beetle_store::{rpc, Config, Store}; use tokio::task::JoinHandle; use tracing::info; diff --git a/iroh-one/src/uds.rs b/beetle-one/src/uds.rs similarity index 95% rename from iroh-one/src/uds.rs rename to beetle-one/src/uds.rs index 6c08e15b8..e732f48a2 100644 --- a/iroh-one/src/uds.rs +++ b/beetle-one/src/uds.rs @@ -2,10 +2,10 @@ /// From https://github.com/tokio-rs/axum/blob/1fe45583626a4c9c890cc01131d38c57f8728686/examples/unix-domain-socket/src/main.rs use axum::extract::connect_info; use axum::{Router, Server}; +use beetle_gateway::{core::State, handlers::get_app_routes}; +use beetle_unixfs::content_loader::ContentLoader; use futures::ready; use hyper::server::accept::Accept; -use iroh_gateway::{core::State, handlers::get_app_routes}; -use iroh_unixfs::content_loader::ContentLoader; use std::path::PathBuf; use std::{ pin::Pin, diff --git a/iroh-p2p/Cargo.toml b/beetle-p2p/Cargo.toml similarity index 84% rename from iroh-p2p/Cargo.toml rename to beetle-p2p/Cargo.toml index 0ddd4e788..433243a2a 100644 --- a/iroh-p2p/Cargo.toml +++ b/beetle-p2p/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "iroh-p2p" +name = "beetle-p2p" version.workspace = true edition.workspace = true authors = ["dignifiedquire "] license.workspace = true repository.workspace = true -description = "Implementation of the p2p part of iroh" +description = "Implementation of the p2p part of beetle" rust-version.workspace = true [dependencies] @@ -21,11 +21,11 @@ config.workspace = true futures.workspace = true futures-util.workspace = true git-version.workspace = true -iroh-bitswap.workspace = true -iroh-metrics = { workspace = true, features = ["bitswap", "p2p"] } -iroh-rpc-client.workspace = true -iroh-rpc-types.workspace = true -iroh-util.workspace = true +beetle-bitswap.workspace = true +beetle-metrics = { workspace = true, features = ["bitswap", "p2p"] } +beetle-rpc-client.workspace = true +beetle-rpc-types.workspace = true +beetle-util.workspace = true lazy_static.workspace = true lru.workspace = true names.workspace = true diff --git a/iroh-p2p/README.md b/beetle-p2p/README.md similarity index 51% rename from iroh-p2p/README.md rename to beetle-p2p/README.md index 37f83a287..cdd95abc4 100644 --- a/iroh-p2p/README.md +++ b/beetle-p2p/README.md @@ -1,12 +1,12 @@ -# iroh-p2p +# beetle-p2p -[![crates.io](https://img.shields.io/crates/v/iroh-p2p.svg?style=flat-square)](https://crates.io/crates/iroh-p2p) -[![Released API docs](https://img.shields.io/docsrs/iroh-p2p?style=flat-square)](https://docs.rs/iroh-p2p) -[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/iroh-p2p?style=flat-square)](../LICENSE-MIT) -[![CI](https://img.shields.io/github/workflow/status/n0-computer/iroh/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/iroh/actions?query=workflow%3A%22Continuous+integration%22) +[![crates.io](https://img.shields.io/crates/v/beetle-p2p.svg?style=flat-square)](https://crates.io/crates/beetle-p2p) +[![Released API docs](https://img.shields.io/docsrs/beetle-p2p?style=flat-square)](https://docs.rs/beetle-p2p) +[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/beetle-p2p?style=flat-square)](../LICENSE-MIT) +[![CI](https://img.shields.io/github/workflow/status/n0-computer/beetle/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/beetle/actions?query=workflow%3A%22Continuous+integration%22) -P2P networking for [iroh](https://github.com/n0-computer/iroh). This implements +P2P networking for [beetle](https://github.com/n0-computer/beetle). This implements an [IPFS node](https://docs.ipfs.tech/concepts/nodes/). The IPFS network consists of a collection of nodes. @@ -14,7 +14,7 @@ consists of a collection of nodes. ```sh # From the root of the workspace -> cargo run --release -p iroh-p2p +> cargo run --release -p beetle-p2p ``` ## License diff --git a/iroh-p2p/benches/lru_cache.rs b/beetle-p2p/benches/lru_cache.rs similarity index 98% rename from iroh-p2p/benches/lru_cache.rs rename to beetle-p2p/benches/lru_cache.rs index a13681244..b65c27f6e 100644 --- a/iroh-p2p/benches/lru_cache.rs +++ b/beetle-p2p/benches/lru_cache.rs @@ -8,7 +8,7 @@ //! You can run the benchmarks either by directly using cargo: //! //! ```shell -//! cargo bench -p iroh-p2p +//! cargo bench -p beetle-p2p //! ``` //! //! Or by installing `cargo-criterion`, which gives you slightly prettier output: @@ -20,7 +20,7 @@ //! Run the benchmarks: //! //! ```shell -//! cargo criterion -p iroh-p2p +//! cargo criterion -p beetle-p2p //! ``` use criterion::{criterion_group, criterion_main, BatchSize, Criterion}; diff --git a/iroh-p2p/src/behaviour.rs b/beetle-p2p/src/behaviour.rs similarity index 97% rename from iroh-p2p/src/behaviour.rs rename to beetle-p2p/src/behaviour.rs index 8167d28ae..63f0f33c1 100644 --- a/iroh-p2p/src/behaviour.rs +++ b/beetle-p2p/src/behaviour.rs @@ -2,9 +2,9 @@ use std::time::Duration; use anyhow::Result; use async_trait::async_trait; +use beetle_bitswap::{Bitswap, Block, Config as BitswapConfig, Store}; +use beetle_rpc_client::Client; use cid::Cid; -use iroh_bitswap::{Bitswap, Block, Config as BitswapConfig, Store}; -use iroh_rpc_client::Client; use libp2p::core::identity::Keypair; use libp2p::core::PeerId; use libp2p::gossipsub::{self, MessageAuthenticity}; @@ -28,7 +28,7 @@ mod event; mod peer_manager; pub const PROTOCOL_VERSION: &str = "ipfs/0.1.0"; -pub const AGENT_VERSION: &str = concat!("iroh/", env!("CARGO_PKG_VERSION")); +pub const AGENT_VERSION: &str = concat!("beetle/", env!("CARGO_PKG_VERSION")); /// Libp2p behaviour for the node. #[derive(NetworkBehaviour)] diff --git a/iroh-p2p/src/behaviour/event.rs b/beetle-p2p/src/behaviour/event.rs similarity index 98% rename from iroh-p2p/src/behaviour/event.rs rename to beetle-p2p/src/behaviour/event.rs index d5fb27f6b..6cb0c118d 100644 --- a/iroh-p2p/src/behaviour/event.rs +++ b/beetle-p2p/src/behaviour/event.rs @@ -1,4 +1,4 @@ -use iroh_bitswap::BitswapEvent; +use beetle_bitswap::BitswapEvent; use libp2p::{ autonat, dcutr, gossipsub::GossipsubEvent, identify::Event as IdentifyEvent, kad::KademliaEvent, mdns::Event as MdnsEvent, ping::Event as PingEvent, relay, diff --git a/iroh-p2p/src/behaviour/peer_manager.rs b/beetle-p2p/src/behaviour/peer_manager.rs similarity index 99% rename from iroh-p2p/src/behaviour/peer_manager.rs rename to beetle-p2p/src/behaviour/peer_manager.rs index 393811a3a..ee7a43fd9 100644 --- a/iroh-p2p/src/behaviour/peer_manager.rs +++ b/beetle-p2p/src/behaviour/peer_manager.rs @@ -5,7 +5,7 @@ use std::{ }; use ahash::AHashMap; -use iroh_metrics::{core::MRecorder, inc, p2p::P2PMetrics}; +use beetle_metrics::{core::MRecorder, inc, p2p::P2PMetrics}; use libp2p::{ core::{connection::ConnectionId, transport::ListenerId, ConnectedPoint}, identify::Info as IdentifyInfo, diff --git a/iroh-p2p/src/cli.rs b/beetle-p2p/src/cli.rs similarity index 100% rename from iroh-p2p/src/cli.rs rename to beetle-p2p/src/cli.rs diff --git a/iroh-p2p/src/config.rs b/beetle-p2p/src/config.rs similarity index 95% rename from iroh-p2p/src/config.rs rename to beetle-p2p/src/config.rs index 926ad3d13..0bad5441e 100644 --- a/iroh-p2p/src/config.rs +++ b/beetle-p2p/src/config.rs @@ -1,20 +1,20 @@ use std::path::PathBuf; use anyhow::Result; +use beetle_metrics::config::Config as MetricsConfig; +use beetle_rpc_client::Config as RpcClientConfig; +use beetle_rpc_types::p2p::P2pAddr; +use beetle_util::{beetle_data_root, insert_into_config_map}; use config::{ConfigError, Map, Source, Value}; -use iroh_metrics::config::Config as MetricsConfig; -use iroh_rpc_client::Config as RpcClientConfig; -use iroh_rpc_types::p2p::P2pAddr; -use iroh_util::{insert_into_config_map, iroh_data_root}; use libp2p::Multiaddr; use serde::{Deserialize, Serialize}; -/// CONFIG_FILE_NAME is the name of the optional config file located in the iroh home directory +/// CONFIG_FILE_NAME is the name of the optional config file located in the beetle home directory pub const CONFIG_FILE_NAME: &str = "p2p.config.toml"; /// ENV_PREFIX should be used along side the config field name to set a config field using /// environment variables -/// For example, `IROH_P2P_MDNS=true` would set the value of the `Libp2pConfig.mdns` field -pub const ENV_PREFIX: &str = "IROH_P2P"; +/// For example, `BEETLE_P2P_MDNS=true` would set the value of the `Libp2pConfig.mdns` field +pub const ENV_PREFIX: &str = "BEETLE_P2P"; /// Default bootstrap nodes /// @@ -34,7 +34,7 @@ pub const DEFAULT_BOOTSTRAP: &[&str] = &[ /// /// This is the configuration which the p2p server binary needs to run. It is a superset /// from the configuration needed by the p2p service, which can also run integrated into -/// another binary like in iroh-one, iroh-share or iroh-embed. +/// another binary like in beetle-one, beetle-share or beetle-embed. #[derive(PartialEq, Debug, Deserialize, Serialize, Clone)] pub struct ServerConfig { pub p2p: Config, @@ -103,12 +103,12 @@ pub struct Libp2pConfig { pub dial_concurrency_factor: u8, } -/// Configuration for the [`iroh-p2p`] node. +/// Configuration for the [`beetle-p2p`] node. #[derive(PartialEq, Debug, Clone, Deserialize, Serialize)] pub struct Config { /// Configuration for libp2p. pub libp2p: Libp2pConfig, - /// Configuration of RPC to other iroh services. + /// Configuration of RPC to other beetle services. pub rpc_client: RpcClientConfig, /// Directory where cryptographic keys are stored. /// @@ -243,7 +243,7 @@ impl Config { p2p_addr: Some(client_addr), ..Default::default() }, - key_store_path: iroh_data_root().unwrap(), + key_store_path: beetle_data_root().unwrap(), } } @@ -253,7 +253,7 @@ impl Config { Self { libp2p: Libp2pConfig::default(), rpc_client, - key_store_path: iroh_data_root().unwrap(), + key_store_path: beetle_data_root().unwrap(), } } diff --git a/iroh-p2p/src/keys.rs b/beetle-p2p/src/keys.rs similarity index 99% rename from iroh-p2p/src/keys.rs rename to beetle-p2p/src/keys.rs index fd280adb4..64f914072 100644 --- a/iroh-p2p/src/keys.rs +++ b/beetle-p2p/src/keys.rs @@ -112,7 +112,7 @@ impl Keychain { } impl Keychain { - /// Creates a new on disk keychain, with the root defaulting to `.iroh`. + /// Creates a new on disk keychain, with the root defaulting to `.beetle`. pub async fn new(root: PathBuf) -> Result { Self::with_root(root).await } diff --git a/iroh-p2p/src/lib.rs b/beetle-p2p/src/lib.rs similarity index 100% rename from iroh-p2p/src/lib.rs rename to beetle-p2p/src/lib.rs diff --git a/iroh-p2p/src/main.rs b/beetle-p2p/src/main.rs similarity index 74% rename from iroh-p2p/src/main.rs rename to beetle-p2p/src/main.rs index 61426ae4b..0e0216431 100644 --- a/iroh-p2p/src/main.rs +++ b/beetle-p2p/src/main.rs @@ -1,16 +1,16 @@ use anyhow::{anyhow, Context, Result}; +use beetle_p2p::config::{Config, CONFIG_FILE_NAME, ENV_PREFIX}; +use beetle_p2p::ServerConfig; +use beetle_p2p::{cli::Args, metrics, DiskStorage, Keychain, Node}; +use beetle_util::lock::ProgramLock; +use beetle_util::{beetle_config_path, make_config}; use clap::Parser; -use iroh_p2p::config::{Config, CONFIG_FILE_NAME, ENV_PREFIX}; -use iroh_p2p::ServerConfig; -use iroh_p2p::{cli::Args, metrics, DiskStorage, Keychain, Node}; -use iroh_util::lock::ProgramLock; -use iroh_util::{iroh_config_path, make_config}; use tokio::task; use tracing::error; /// Starts daemon process fn main() -> Result<()> { - let mut lock = ProgramLock::new("iroh-p2p")?; + let mut lock = ProgramLock::new("beetle-p2p")?; lock.acquire_or_exit(); let runtime = tokio::runtime::Builder::new_multi_thread() @@ -21,13 +21,13 @@ fn main() -> Result<()> { .unwrap(); runtime.block_on(async move { - let version = option_env!("IROH_VERSION").unwrap_or(env!("CARGO_PKG_VERSION")); - println!("Starting iroh-p2p, version {version}"); + let version = option_env!("BEETLE_VERSION").unwrap_or(env!("CARGO_PKG_VERSION")); + println!("Starting beetle-p2p, version {version}"); let args = Args::parse(); // TODO: configurable network - let cfg_path = iroh_config_path(CONFIG_FILE_NAME)?; + let cfg_path = beetle_config_path(CONFIG_FILE_NAME)?; let sources = [Some(cfg_path.as_path()), args.cfg.as_deref()]; let network_config = make_config( // default @@ -44,13 +44,13 @@ fn main() -> Result<()> { let metrics_config = metrics::metrics_config_with_compile_time_info(network_config.metrics.clone()); - let metrics_handle = iroh_metrics::MetricsHandle::new(metrics_config) + let metrics_handle = beetle_metrics::MetricsHandle::new(metrics_config) .await .map_err(|e| anyhow!("metrics init failed: {:?}", e))?; #[cfg(unix)] { - match iroh_util::increase_fd_limit() { + match beetle_util::increase_fd_limit() { Ok(soft) => tracing::debug!("NOFILE limit: soft = {}", soft), Err(err) => error!("Error increasing NOFILE limit: {}", err), } @@ -70,7 +70,7 @@ fn main() -> Result<()> { } }); - iroh_util::block_until_sigint().await; + beetle_util::block_until_sigint().await; // Cancel all async services p2p_task.abort(); diff --git a/iroh-store/src/metrics.rs b/beetle-p2p/src/metrics.rs similarity index 89% rename from iroh-store/src/metrics.rs rename to beetle-p2p/src/metrics.rs index 9f3dac4bd..b9b6c98cd 100644 --- a/iroh-store/src/metrics.rs +++ b/beetle-p2p/src/metrics.rs @@ -1,5 +1,5 @@ use crate::VERSION; -use iroh_metrics::config::Config as MetricsConfig; +use beetle_metrics::config::Config as MetricsConfig; pub fn metrics_config_with_compile_time_info(cfg: MetricsConfig) -> MetricsConfig { // compile time configuration diff --git a/iroh-p2p/src/node.rs b/beetle-p2p/src/node.rs similarity index 99% rename from iroh-p2p/src/node.rs rename to beetle-p2p/src/node.rs index 7b9b128d0..a6c2e0a6c 100644 --- a/iroh-p2p/src/node.rs +++ b/beetle-p2p/src/node.rs @@ -4,11 +4,11 @@ use std::time::Duration; use ahash::AHashMap; use anyhow::{anyhow, bail, Context, Result}; +use beetle_metrics::{core::MRecorder, inc, libp2p_metrics, p2p::P2PMetrics}; +use beetle_rpc_client::Client as RpcClient; +use beetle_rpc_types::p2p::P2pAddr; use cid::Cid; use futures_util::stream::StreamExt; -use iroh_metrics::{core::MRecorder, inc, libp2p_metrics, p2p::P2PMetrics}; -use iroh_rpc_client::Client as RpcClient; -use iroh_rpc_types::p2p::P2pAddr; use libp2p::core::Multiaddr; use libp2p::gossipsub::{GossipsubMessage, MessageId, TopicHash}; pub use libp2p::gossipsub::{IdentTopic, Topic}; @@ -31,8 +31,8 @@ use tokio::sync::oneshot::{self, Sender as OneShotSender}; use tokio::task::JoinHandle; use tracing::{debug, error, info, trace, warn}; -use iroh_bitswap::{BitswapEvent, Block}; -use iroh_rpc_client::Lookup; +use beetle_bitswap::{BitswapEvent, Block}; +use beetle_rpc_client::Lookup; use crate::keys::{Keychain, Storage}; use crate::providers::Providers; @@ -1098,8 +1098,8 @@ mod tests { use super::*; use anyhow::Result; - use iroh_rpc_client::P2pClient; - use iroh_rpc_types::{p2p::P2pAddr, Addr}; + use beetle_rpc_client::P2pClient; + use beetle_rpc_types::{p2p::P2pAddr, Addr}; use tracing_subscriber::{fmt, prelude::*, EnvFilter}; #[tokio::test] @@ -1224,7 +1224,7 @@ mod tests { let kc = Keychain::from_storage(storage); let mut p2p = Node::new(network_config, rpc_server_addr, kc).await?; - let cfg = iroh_rpc_client::Config { + let cfg = beetle_rpc_client::Config { p2p_addr: Some(rpc_client_addr), channels: Some(1), ..Default::default() @@ -1423,7 +1423,7 @@ mod tests { ]; let expected_protocol_version = "ipfs/0.1.0"; let expected_agent_version = - format!("iroh/{}", std::env::var("CARGO_PKG_VERSION").unwrap()); + format!("beetle/{}", std::env::var("CARGO_PKG_VERSION").unwrap()); assert_eq!(expected_peer_id, got.peer_id); assert!(got.listen_addrs.contains(expected_addr)); diff --git a/iroh-p2p/src/providers.rs b/beetle-p2p/src/providers.rs similarity index 100% rename from iroh-p2p/src/providers.rs rename to beetle-p2p/src/providers.rs diff --git a/iroh-p2p/src/rpc.rs b/beetle-p2p/src/rpc.rs similarity index 99% rename from iroh-p2p/src/rpc.rs rename to beetle-p2p/src/rpc.rs index 70b10e506..cffae40a4 100644 --- a/iroh-p2p/src/rpc.rs +++ b/beetle-p2p/src/rpc.rs @@ -1,4 +1,11 @@ use anyhow::{anyhow, ensure, Context, Result}; +use beetle_bitswap::Block; +use beetle_rpc_client::{ + create_server, Lookup, P2pServer, ServerError, ServerSocket, HEALTH_POLL_WAIT, +}; +use beetle_rpc_types::{ + p2p::*, RpcError, RpcResult, VersionRequest, VersionResponse, WatchRequest, WatchResponse, +}; use bytes::Bytes; use cid::Cid; use futures::StreamExt; @@ -6,13 +13,6 @@ use futures::{ stream::{BoxStream, Stream}, TryFutureExt, }; -use iroh_bitswap::Block; -use iroh_rpc_client::{ - create_server, Lookup, P2pServer, ServerError, ServerSocket, HEALTH_POLL_WAIT, -}; -use iroh_rpc_types::{ - p2p::*, RpcError, RpcResult, VersionRequest, VersionResponse, WatchRequest, WatchResponse, -}; use libp2p::gossipsub::{ error::{PublishError, SubscriptionError}, MessageId, TopicHash, diff --git a/iroh-p2p/src/swarm.rs b/beetle-p2p/src/swarm.rs similarity index 99% rename from iroh-p2p/src/swarm.rs rename to beetle-p2p/src/swarm.rs index 8d42c9bdb..7b86b6502 100644 --- a/iroh-p2p/src/swarm.rs +++ b/beetle-p2p/src/swarm.rs @@ -1,7 +1,7 @@ use std::time::Duration; use anyhow::Result; -use iroh_rpc_client::Client; +use beetle_rpc_client::Client; use libp2p::{ core::{ self, diff --git a/iroh-resolver/Cargo.toml b/beetle-resolver/Cargo.toml similarity index 74% rename from iroh-resolver/Cargo.toml rename to beetle-resolver/Cargo.toml index 5c57e761c..4b52d2df7 100644 --- a/iroh-resolver/Cargo.toml +++ b/beetle-resolver/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "iroh-resolver" +name = "beetle-resolver" authors = ["dignifiedquire "] -description = "Implementation of path resolution for iroh" +description = "Implementation of path resolution for beetle" version.workspace = true edition.workspace = true license.workspace = true @@ -22,10 +22,10 @@ bs58.workspace = true bytes.workspace = true cid.workspace = true futures.workspace = true -iroh-metrics = { workspace = true, features = ["resolver", "gateway"] } -iroh-rpc-client.workspace = true -iroh-util.workspace = true -iroh-unixfs.workspace = true +beetle-metrics = { workspace = true, features = ["resolver", "gateway"] } +beetle-rpc-client.workspace = true +beetle-util.workspace = true +beetle-unixfs.workspace = true libipld.workspace = true libp2p.workspace = true serde = { workspace = true, features = ["derive"] } @@ -35,9 +35,9 @@ trust-dns-resolver = { workspace = true, features = ["dns-over-https-rustls", "s fnv.workspace = true [dev-dependencies] -iroh-car.workspace = true -iroh-rpc-types.workspace = true -iroh-store.workspace = true +beetle-car.workspace = true +beetle-rpc-types.workspace = true +beetle-store.workspace = true proptest.workspace = true rand.workspace = true async-recursion.workspace = true diff --git a/beetle-resolver/README.md b/beetle-resolver/README.md new file mode 100644 index 000000000..67ac69220 --- /dev/null +++ b/beetle-resolver/README.md @@ -0,0 +1,33 @@ +# beetle resolver + +[![crates.io](https://img.shields.io/crates/v/beetle-resolver.svg?style=flat-square)](https://crates.io/crates/beetle-resolver) +[![Released API docs](https://img.shields.io/docsrs/beetle-resolver?style=flat-square)](https://docs.rs/beetle-resolver) +[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/beetle-resolver?style=flat-square)](../LICENSE-MIT) +[![CI](https://img.shields.io/github/workflow/status/n0-computer/beetle/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/beetle/actions?query=workflow%3A%22Continuous+integration%22) + +Resolver for [beetle](https://github.com/n0-computer/beetle). It retrieves data +associated with an IPFS CID from the [beetle +store](https://github.com/n0-computer/beetle/tree/main/beetle-store), or if not +available, uses [beetle +p2p](https://github.com/n0-computer/beetle/tree/main/beetle-p2p) to retrieve it +from the IPFS network. + +This crate also provides a way to take a directory of files, or a single file, +and chunk it into smaller parts that can be stored, and assemble them back +together again. + +## License + + +Licensed under either of Apache License, Version +2.0 or MIT license at your option. + + +
+ + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this crate by you, as defined in the Apache-2.0 license, shall +be dual licensed as above, without any additional terms or conditions. + + diff --git a/iroh-resolver/fixtures/QmNyLad1dWGS6mv2zno4iEviBSYSUR2SrQ8JoZNDz1UHYy b/beetle-resolver/fixtures/QmNyLad1dWGS6mv2zno4iEviBSYSUR2SrQ8JoZNDz1UHYy similarity index 100% rename from iroh-resolver/fixtures/QmNyLad1dWGS6mv2zno4iEviBSYSUR2SrQ8JoZNDz1UHYy rename to beetle-resolver/fixtures/QmNyLad1dWGS6mv2zno4iEviBSYSUR2SrQ8JoZNDz1UHYy diff --git a/iroh-resolver/fixtures/QmP9yKRwuji5i7RTgrevwJwXp7uqQu1prv88nxq9uj99rW b/beetle-resolver/fixtures/QmP9yKRwuji5i7RTgrevwJwXp7uqQu1prv88nxq9uj99rW similarity index 100% rename from iroh-resolver/fixtures/QmP9yKRwuji5i7RTgrevwJwXp7uqQu1prv88nxq9uj99rW rename to beetle-resolver/fixtures/QmP9yKRwuji5i7RTgrevwJwXp7uqQu1prv88nxq9uj99rW diff --git a/iroh-resolver/fixtures/QmRZQMR6cpczdJAF4xXtisda3DbvFrHxuwi5nF2NJKZvzC b/beetle-resolver/fixtures/QmRZQMR6cpczdJAF4xXtisda3DbvFrHxuwi5nF2NJKZvzC similarity index 100% rename from iroh-resolver/fixtures/QmRZQMR6cpczdJAF4xXtisda3DbvFrHxuwi5nF2NJKZvzC rename to beetle-resolver/fixtures/QmRZQMR6cpczdJAF4xXtisda3DbvFrHxuwi5nF2NJKZvzC diff --git a/iroh-resolver/fixtures/QmT7qkMZnZNDACJ8CT4PnVkxXKJfcKNVggkygzRcvZE72B b/beetle-resolver/fixtures/QmT7qkMZnZNDACJ8CT4PnVkxXKJfcKNVggkygzRcvZE72B similarity index 100% rename from iroh-resolver/fixtures/QmT7qkMZnZNDACJ8CT4PnVkxXKJfcKNVggkygzRcvZE72B rename to beetle-resolver/fixtures/QmT7qkMZnZNDACJ8CT4PnVkxXKJfcKNVggkygzRcvZE72B diff --git a/iroh-resolver/fixtures/QmTh6zphkkZXhLimR5hfy1QnWrzf6EwP15r5aQqSzhUCYz b/beetle-resolver/fixtures/QmTh6zphkkZXhLimR5hfy1QnWrzf6EwP15r5aQqSzhUCYz similarity index 100% rename from iroh-resolver/fixtures/QmTh6zphkkZXhLimR5hfy1QnWrzf6EwP15r5aQqSzhUCYz rename to beetle-resolver/fixtures/QmTh6zphkkZXhLimR5hfy1QnWrzf6EwP15r5aQqSzhUCYz diff --git a/iroh-resolver/fixtures/QmUajVwSkEp9JvdW914Qh1BCMRSUf2ztiQa6jqy1aWhwJv b/beetle-resolver/fixtures/QmUajVwSkEp9JvdW914Qh1BCMRSUf2ztiQa6jqy1aWhwJv similarity index 100% rename from iroh-resolver/fixtures/QmUajVwSkEp9JvdW914Qh1BCMRSUf2ztiQa6jqy1aWhwJv rename to beetle-resolver/fixtures/QmUajVwSkEp9JvdW914Qh1BCMRSUf2ztiQa6jqy1aWhwJv diff --git a/iroh-resolver/fixtures/QmUr9cs4mhWxabKqm9PYPSQQ6AQGbHJBtyrNmxtKgxqUx9 b/beetle-resolver/fixtures/QmUr9cs4mhWxabKqm9PYPSQQ6AQGbHJBtyrNmxtKgxqUx9 similarity index 100% rename from iroh-resolver/fixtures/QmUr9cs4mhWxabKqm9PYPSQQ6AQGbHJBtyrNmxtKgxqUx9 rename to beetle-resolver/fixtures/QmUr9cs4mhWxabKqm9PYPSQQ6AQGbHJBtyrNmxtKgxqUx9 diff --git a/iroh-resolver/fixtures/QmZSCBhytmu1Mr5gVrsXsB6D8S2XMQXSoofHdPxtPGrZBj b/beetle-resolver/fixtures/QmZSCBhytmu1Mr5gVrsXsB6D8S2XMQXSoofHdPxtPGrZBj similarity index 100% rename from iroh-resolver/fixtures/QmZSCBhytmu1Mr5gVrsXsB6D8S2XMQXSoofHdPxtPGrZBj rename to beetle-resolver/fixtures/QmZSCBhytmu1Mr5gVrsXsB6D8S2XMQXSoofHdPxtPGrZBj diff --git a/iroh-resolver/fixtures/QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN b/beetle-resolver/fixtures/QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN similarity index 100% rename from iroh-resolver/fixtures/QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN rename to beetle-resolver/fixtures/QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN diff --git a/iroh-resolver/fixtures/QmaRGe7bVmVaLmxbrMiVNXqW4pRNNp3xq7hFtyRKA3mtJL b/beetle-resolver/fixtures/QmaRGe7bVmVaLmxbrMiVNXqW4pRNNp3xq7hFtyRKA3mtJL similarity index 100% rename from iroh-resolver/fixtures/QmaRGe7bVmVaLmxbrMiVNXqW4pRNNp3xq7hFtyRKA3mtJL rename to beetle-resolver/fixtures/QmaRGe7bVmVaLmxbrMiVNXqW4pRNNp3xq7hFtyRKA3mtJL diff --git a/iroh-resolver/fixtures/QmcHTZfwWWYG2Gbv9wR6bWZBvAgpFV5BcDoLrC2XMCkggn b/beetle-resolver/fixtures/QmcHTZfwWWYG2Gbv9wR6bWZBvAgpFV5BcDoLrC2XMCkggn similarity index 100% rename from iroh-resolver/fixtures/QmcHTZfwWWYG2Gbv9wR6bWZBvAgpFV5BcDoLrC2XMCkggn rename to beetle-resolver/fixtures/QmcHTZfwWWYG2Gbv9wR6bWZBvAgpFV5BcDoLrC2XMCkggn diff --git a/iroh-resolver/fixtures/QmcXoBdCgmFMoNbASaQCNVswRuuuqbw4VvA7e5GtHbhRNp b/beetle-resolver/fixtures/QmcXoBdCgmFMoNbASaQCNVswRuuuqbw4VvA7e5GtHbhRNp similarity index 100% rename from iroh-resolver/fixtures/QmcXoBdCgmFMoNbASaQCNVswRuuuqbw4VvA7e5GtHbhRNp rename to beetle-resolver/fixtures/QmcXoBdCgmFMoNbASaQCNVswRuuuqbw4VvA7e5GtHbhRNp diff --git a/iroh-resolver/fixtures/QmccJ8pV5hG7DEbq66ih1ZtowxgvqVS6imt98Ku62J2WRw b/beetle-resolver/fixtures/QmccJ8pV5hG7DEbq66ih1ZtowxgvqVS6imt98Ku62J2WRw similarity index 87% rename from iroh-resolver/fixtures/QmccJ8pV5hG7DEbq66ih1ZtowxgvqVS6imt98Ku62J2WRw rename to beetle-resolver/fixtures/QmccJ8pV5hG7DEbq66ih1ZtowxgvqVS6imt98Ku62J2WRw index 3232b8a9c..a8546ae42 100644 --- a/iroh-resolver/fixtures/QmccJ8pV5hG7DEbq66ih1ZtowxgvqVS6imt98Ku62J2WRw +++ b/beetle-resolver/fixtures/QmccJ8pV5hG7DEbq66ih1ZtowxgvqVS6imt98Ku62J2WRw @@ -1,5 +1,5 @@ -jd# iroh +jd# beetle ## License diff --git a/iroh-resolver/fixtures/QmdkGfDx42RNdAZFALHn5hjHqUq7L9o6Ef4zLnFEu3Y4Go b/beetle-resolver/fixtures/QmdkGfDx42RNdAZFALHn5hjHqUq7L9o6Ef4zLnFEu3Y4Go similarity index 100% rename from iroh-resolver/fixtures/QmdkGfDx42RNdAZFALHn5hjHqUq7L9o6Ef4zLnFEu3Y4Go rename to beetle-resolver/fixtures/QmdkGfDx42RNdAZFALHn5hjHqUq7L9o6Ef4zLnFEu3Y4Go diff --git a/iroh-resolver/fixtures/QmfTVUNatSpmZUERu62hwSEuLHEUNuY8FFuzFL5n187yGq b/beetle-resolver/fixtures/QmfTVUNatSpmZUERu62hwSEuLHEUNuY8FFuzFL5n187yGq similarity index 100% rename from iroh-resolver/fixtures/QmfTVUNatSpmZUERu62hwSEuLHEUNuY8FFuzFL5n187yGq rename to beetle-resolver/fixtures/QmfTVUNatSpmZUERu62hwSEuLHEUNuY8FFuzFL5n187yGq diff --git a/iroh-resolver/fixtures/bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am b/beetle-resolver/fixtures/bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am similarity index 100% rename from iroh-resolver/fixtures/bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am rename to beetle-resolver/fixtures/bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am diff --git a/iroh-resolver/fixtures/bafkreihcldjer7njjrrxknqh67cestxa7s7jf4nhnp62y6k4twcbahvtc4 b/beetle-resolver/fixtures/bafkreihcldjer7njjrrxknqh67cestxa7s7jf4nhnp62y6k4twcbahvtc4 similarity index 100% rename from iroh-resolver/fixtures/bafkreihcldjer7njjrrxknqh67cestxa7s7jf4nhnp62y6k4twcbahvtc4 rename to beetle-resolver/fixtures/bafkreihcldjer7njjrrxknqh67cestxa7s7jf4nhnp62y6k4twcbahvtc4 diff --git a/iroh-resolver/fixtures/bafybeietod5kx72jgbngoontthoax6nva4edkjnieghwqfzenstg4gil5i b/beetle-resolver/fixtures/bafybeietod5kx72jgbngoontthoax6nva4edkjnieghwqfzenstg4gil5i similarity index 100% rename from iroh-resolver/fixtures/bafybeietod5kx72jgbngoontthoax6nva4edkjnieghwqfzenstg4gil5i rename to beetle-resolver/fixtures/bafybeietod5kx72jgbngoontthoax6nva4edkjnieghwqfzenstg4gil5i diff --git a/iroh-resolver/fixtures/bafybeihmgpuwcdrfi47gfxisll7kmurvi6kd7rht5hlq2ed5omxobfip3a b/beetle-resolver/fixtures/bafybeihmgpuwcdrfi47gfxisll7kmurvi6kd7rht5hlq2ed5omxobfip3a similarity index 100% rename from iroh-resolver/fixtures/bafybeihmgpuwcdrfi47gfxisll7kmurvi6kd7rht5hlq2ed5omxobfip3a rename to beetle-resolver/fixtures/bafybeihmgpuwcdrfi47gfxisll7kmurvi6kd7rht5hlq2ed5omxobfip3a diff --git a/iroh-resolver/fixtures/big-foo.car b/beetle-resolver/fixtures/big-foo.car similarity index 100% rename from iroh-resolver/fixtures/big-foo.car rename to beetle-resolver/fixtures/big-foo.car diff --git a/iroh-resolver/fixtures/large_repeat_1GiB.zst b/beetle-resolver/fixtures/large_repeat_1GiB.zst similarity index 100% rename from iroh-resolver/fixtures/large_repeat_1GiB.zst rename to beetle-resolver/fixtures/large_repeat_1GiB.zst diff --git a/iroh-resolver/fixtures/large_repeat_5GiB.zst b/beetle-resolver/fixtures/large_repeat_5GiB.zst similarity index 100% rename from iroh-resolver/fixtures/large_repeat_5GiB.zst rename to beetle-resolver/fixtures/large_repeat_5GiB.zst diff --git a/iroh-resolver/fixtures/repeat_0.04GiB_174.zst b/beetle-resolver/fixtures/repeat_0.04GiB_174.zst similarity index 100% rename from iroh-resolver/fixtures/repeat_0.04GiB_174.zst rename to beetle-resolver/fixtures/repeat_0.04GiB_174.zst diff --git a/iroh-resolver/fixtures/repeat_0.04GiB_174_1.zst b/beetle-resolver/fixtures/repeat_0.04GiB_174_1.zst similarity index 100% rename from iroh-resolver/fixtures/repeat_0.04GiB_174_1.zst rename to beetle-resolver/fixtures/repeat_0.04GiB_174_1.zst diff --git a/iroh-resolver/fixtures/repeat_0.04GiB_175.zst b/beetle-resolver/fixtures/repeat_0.04GiB_175.zst similarity index 100% rename from iroh-resolver/fixtures/repeat_0.04GiB_175.zst rename to beetle-resolver/fixtures/repeat_0.04GiB_175.zst diff --git a/iroh-resolver/fixtures/repeat_0.04GiB_175_1.zst b/beetle-resolver/fixtures/repeat_0.04GiB_175_1.zst similarity index 100% rename from iroh-resolver/fixtures/repeat_0.04GiB_175_1.zst rename to beetle-resolver/fixtures/repeat_0.04GiB_175_1.zst diff --git a/iroh-resolver/fixtures/uicro_1B.zst b/beetle-resolver/fixtures/uicro_1B.zst similarity index 100% rename from iroh-resolver/fixtures/uicro_1B.zst rename to beetle-resolver/fixtures/uicro_1B.zst diff --git a/iroh-resolver/fixtures/uicro_34B.zst b/beetle-resolver/fixtures/uicro_34B.zst similarity index 100% rename from iroh-resolver/fixtures/uicro_34B.zst rename to beetle-resolver/fixtures/uicro_34B.zst diff --git a/iroh-resolver/fixtures/uicro_50B.zst b/beetle-resolver/fixtures/uicro_50B.zst similarity index 100% rename from iroh-resolver/fixtures/uicro_50B.zst rename to beetle-resolver/fixtures/uicro_50B.zst diff --git a/iroh-resolver/fixtures/zero_0B.zst b/beetle-resolver/fixtures/zero_0B.zst similarity index 100% rename from iroh-resolver/fixtures/zero_0B.zst rename to beetle-resolver/fixtures/zero_0B.zst diff --git a/iroh-resolver/src/dns_resolver.rs b/beetle-resolver/src/dns_resolver.rs similarity index 100% rename from iroh-resolver/src/dns_resolver.rs rename to beetle-resolver/src/dns_resolver.rs diff --git a/iroh-resolver/src/lib.rs b/beetle-resolver/src/lib.rs similarity index 100% rename from iroh-resolver/src/lib.rs rename to beetle-resolver/src/lib.rs diff --git a/iroh-resolver/src/resolver.rs b/beetle-resolver/src/resolver.rs similarity index 99% rename from iroh-resolver/src/resolver.rs rename to beetle-resolver/src/resolver.rs index 98aa59719..5aa41d69a 100644 --- a/iroh-resolver/src/resolver.rs +++ b/beetle-resolver/src/resolver.rs @@ -8,17 +8,17 @@ use std::task::{Context, Poll}; use anyhow::{anyhow, bail, Context as _, Result}; use async_trait::async_trait; -use bytes::Bytes; -use cid::Cid; -use futures::{Future, Stream, TryStreamExt}; -use iroh_metrics::inc; -use iroh_unixfs::{ +use beetle_metrics::inc; +use beetle_unixfs::{ codecs::Codec, content_loader::{ContentLoader, ContextId, LoaderContext}, parse_links, unixfs::{read_data_to_buf, DataType, UnixfsChildStream, UnixfsContentReader, UnixfsNode}, Block, Link, LoadedCid, Source, }; +use bytes::Bytes; +use cid::Cid; +use futures::{Future, Stream, TryStreamExt}; use libipld::codec::Encode; use libipld::prelude::Codec as _; use libipld::{Ipld, IpldCodec}; @@ -26,17 +26,17 @@ use tokio::io::{AsyncRead, AsyncSeek}; use tokio::task::JoinHandle; use tracing::{debug, trace, warn}; -use iroh_metrics::{ +use beetle_metrics::{ core::MRecorder, resolver::{OutMetrics, ResolverMetrics}, }; use crate::dns_resolver::{Config, DnsResolver}; -pub const IROH_STORE: &str = "iroh-store"; +pub const BEETLE_STORE: &str = "beetle-store"; // ToDo: Remove this function -// Related issue: https://github.com/n0-computer/iroh/issues/593 +// Related issue: https://github.com/n0-computer/beetle/issues/593 fn from_peer_id(id: &str) -> Option { static MAX_INLINE_KEY_LENGTH: usize = 42; let multihash = @@ -82,7 +82,7 @@ impl Path { } else if let Some(multihash) = from_peer_id(cid_or_domain) { CidOrDomain::Cid(Cid::new_v1(Codec::Libp2pKey.into(), multihash)) // ToDo: Bring back commented "else if" instead of "else if" above - // Related issue: https://github.com/n0-computer/iroh/issues/593 + // Related issue: https://github.com/n0-computer/beetle/issues/593 // } else if let Ok(peer_id) = PeerId::from_str(cid_or_domain) { // CidOrDomain::Cid(Cid::new_v1(Codec::Libp2pKey.into(), *peer_id.as_ref())) } else { @@ -1264,7 +1264,7 @@ mod tests { let digest = Code::Blake3_256.digest(&bytes); let c = Cid::new_v1(codec.into(), digest); - assert_eq!(iroh_util::verify_hash(&c, &bytes), Some(true)); + assert_eq!(beetle_util::verify_hash(&c, &bytes), Some(true)); } } @@ -1684,7 +1684,7 @@ mod tests { let cr = seek_and_clip(ctx.clone(), &node, resolver.clone(), 1..size - 1).await; let content = read_to_string(cr).await; assert_eq!(content.len(), (size - 2) as usize); - assert!(content.starts_with(" iroh")); // without seeking '# iroh' + assert!(content.starts_with(" beetle")); // without seeking '# beetle' assert!(content.ends_with("\n")); // without clipping '\n\n' let cr = seek_and_clip(ctx, &node, resolver.clone(), 101..size - 101).await; @@ -1971,7 +1971,7 @@ mod tests { .await; print!("{content}"); assert_eq!(content.len(), 426); - assert!(content.starts_with("# iroh")); + assert!(content.starts_with("# beetle")); assert!(content.ends_with("\n\n")); } else { panic!("invalid result: {ipld_readme:?}"); @@ -2361,7 +2361,7 @@ mod tests { .await .unwrap(), ); - let car_reader = iroh_car::CarReader::new(reader).await.unwrap(); + let car_reader = beetle_car::CarReader::new(reader).await.unwrap(); let files: HashMap = car_reader .stream() .map(|r| r.map(|(k, v)| (k, Bytes::from(v)))) diff --git a/iroh-resolver/tests/roundtrip.rs b/beetle-resolver/tests/roundtrip.rs similarity index 95% rename from iroh-resolver/tests/roundtrip.rs rename to beetle-resolver/tests/roundtrip.rs index b509bdd16..d857fb403 100644 --- a/iroh-resolver/tests/roundtrip.rs +++ b/beetle-resolver/tests/roundtrip.rs @@ -1,21 +1,21 @@ use anyhow::Result; use async_recursion::async_recursion; -use bytes::Bytes; -use futures::{Stream, TryStreamExt}; -use iroh_metrics::resolver::OutMetrics; -use iroh_unixfs::{ +use beetle_metrics::resolver::OutMetrics; +use beetle_unixfs::{ balanced_tree::DEFAULT_DEGREE, builder::{Directory, DirectoryBuilder, FileBuilder, SymlinkBuilder}, chunker::DEFAULT_CHUNKS_SIZE, content_loader::ContentLoader, }; +use bytes::Bytes; +use futures::{Stream, TryStreamExt}; use proptest::prelude::*; use rand::prelude::*; use rand_chacha::ChaCha8Rng; use std::collections::BTreeMap; use tokio::io::AsyncReadExt; -use iroh_resolver::resolver::{read_to_vec, stream_to_resolver, Out, Resolver}; +use beetle_resolver::resolver::{read_to_vec, stream_to_resolver, Out, Resolver}; #[derive(Debug, Clone, PartialEq, Eq)] enum TestDirEntry { @@ -52,7 +52,7 @@ async fn build_directory(name: &str, dir: &TestDir, hamt: bool) -> Result>, + stream: impl Stream>, resolver: Resolver, ) -> Result { tokio::pin!(stream); @@ -113,7 +113,7 @@ async fn dir_roundtrip_test(dir: TestDir, hamt: bool) -> Result { let stream = directory.encode(); let (root, resolver) = stream_to_resolver(stream).await?; let stream = - resolver.resolve_recursive_with_paths(iroh_resolver::resolver::Path::from_cid(root)); + resolver.resolve_recursive_with_paths(beetle_resolver::resolver::Path::from_cid(root)); let reference = build_testdir(stream, resolver).await?; Ok(dir == reference) } @@ -143,7 +143,7 @@ async fn file_roundtrip_test( let stream = file.encode().await?; let (root, resolver) = stream_to_resolver(stream).await?; let out = resolver - .resolve(iroh_resolver::resolver::Path::from_cid(root)) + .resolve(beetle_resolver::resolver::Path::from_cid(root)) .await?; let t = read_to_vec(out.pretty(resolver, OutMetrics::default(), None)?).await?; Ok((t, data.to_vec())) @@ -162,7 +162,7 @@ async fn symlink_roundtrip_test() -> Result<()> { }; let (root, resolver) = stream_to_resolver(stream).await?; let out = resolver - .resolve(iroh_resolver::resolver::Path::from_cid(root)) + .resolve(beetle_resolver::resolver::Path::from_cid(root)) .await?; let mut reader = out.pretty(resolver, OutMetrics::default(), None)?; let mut t = String::new(); diff --git a/iroh-resolver/tests/unixfs.rs b/beetle-resolver/tests/unixfs.rs similarity index 95% rename from iroh-resolver/tests/unixfs.rs rename to beetle-resolver/tests/unixfs.rs index 9cd62505a..254175840 100644 --- a/iroh-resolver/tests/unixfs.rs +++ b/beetle-resolver/tests/unixfs.rs @@ -1,14 +1,14 @@ use std::{io::Read, path::PathBuf, time::Instant}; use anyhow::Result; -use bytes::Bytes; -use iroh_metrics::resolver::OutMetrics; -use iroh_resolver::resolver::{read_to_vec, stream_to_resolver, Path}; -use iroh_unixfs::{ +use beetle_metrics::resolver::OutMetrics; +use beetle_resolver::resolver::{read_to_vec, stream_to_resolver, Path}; +use beetle_unixfs::{ self, builder::FileBuilder, chunker::{self, Chunker}, }; +use bytes::Bytes; async fn read_fixture(path: impl AsRef) -> Result> { let path = path.as_ref().to_owned(); diff --git a/iroh-rpc-client/Cargo.toml b/beetle-rpc-client/Cargo.toml similarity index 81% rename from iroh-rpc-client/Cargo.toml rename to beetle-rpc-client/Cargo.toml index bdd896e0d..d568c8d5e 100644 --- a/iroh-rpc-client/Cargo.toml +++ b/beetle-rpc-client/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "iroh-rpc-client" +name = "beetle-rpc-client" authors = ["Friedel Ziegelmayer ", "ramfox"] -description = "RPC type client for iroh" +description = "RPC type client for beetle" version.workspace = true edition.workspace = true license.workspace = true @@ -16,9 +16,9 @@ cid.workspace = true config.workspace = true futures.workspace = true hyper.workspace = true -iroh-metrics.workspace = true -iroh-rpc-types.workspace = true -iroh-util.workspace = true +beetle-metrics.workspace = true +beetle-rpc-types.workspace = true +beetle-util.workspace = true libp2p = { workspace = true, features = ["gossipsub"] } quic-rpc = { workspace = true, features = ["http2"] } serde = { workspace = true, features = ["derive"] } diff --git a/iroh-rpc-client/README.md b/beetle-rpc-client/README.md similarity index 78% rename from iroh-rpc-client/README.md rename to beetle-rpc-client/README.md index 8b0d1bbf1..b075e186d 100644 --- a/iroh-rpc-client/README.md +++ b/beetle-rpc-client/README.md @@ -1,6 +1,6 @@ -# iroh-rpc-client +# beetle-rpc-client -[iroh](https://github.com/n0-computer/iroh) services internally communicate via +[beetle](https://github.com/n0-computer/beetle) services internally communicate via RPC, using the [quic-rpc](https://github.com/n0-computer/quic-rpc) RPC system. TLDR: currently bincode encoded messages sent as http2 frames. @@ -8,7 +8,7 @@ TLDR: currently bincode encoded messages sent as http2 frames. These channels are meant for internal communication and are not a stable API. The types that define the RPC protocol are maintained in -[iroh-rpc-types](https://github.com/n0-computer/iroh/tree/main/iroh-rpc-types). +[beetle-rpc-types](https://github.com/n0-computer/beetle/tree/main/beetle-rpc-types). ## License diff --git a/iroh-rpc-client/src/client.rs b/beetle-rpc-client/src/client.rs similarity index 100% rename from iroh-rpc-client/src/client.rs rename to beetle-rpc-client/src/client.rs diff --git a/iroh-rpc-client/src/config.rs b/beetle-rpc-client/src/config.rs similarity index 96% rename from iroh-rpc-client/src/config.rs rename to beetle-rpc-client/src/config.rs index 32da0af95..493350f76 100644 --- a/iroh-rpc-client/src/config.rs +++ b/beetle-rpc-client/src/config.rs @@ -1,6 +1,6 @@ +use beetle_rpc_types::{gateway::GatewayAddr, p2p::P2pAddr, store::StoreAddr}; +use beetle_util::insert_into_config_map; use config::{ConfigError, Map, Source, Value}; -use iroh_rpc_types::{gateway::GatewayAddr, p2p::P2pAddr, store::StoreAddr}; -use iroh_util::insert_into_config_map; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug, PartialEq, Clone, Default)] diff --git a/iroh-rpc-client/src/gateway.rs b/beetle-rpc-client/src/gateway.rs similarity index 96% rename from iroh-rpc-client/src/gateway.rs rename to beetle-rpc-client/src/gateway.rs index a6008ef5e..98aa08cad 100644 --- a/iroh-rpc-client/src/gateway.rs +++ b/beetle-rpc-client/src/gateway.rs @@ -2,8 +2,8 @@ use std::fmt; use anyhow::Result; use async_stream::stream; +use beetle_rpc_types::{gateway::*, VersionRequest, WatchRequest}; use futures::{Stream, StreamExt}; -use iroh_rpc_types::{gateway::*, VersionRequest, WatchRequest}; use crate::{StatusType, HEALTH_POLL_WAIT}; diff --git a/iroh-rpc-client/src/lib.rs b/beetle-rpc-client/src/lib.rs similarity index 97% rename from iroh-rpc-client/src/lib.rs rename to beetle-rpc-client/src/lib.rs index b4181d5c0..bd804af70 100644 --- a/iroh-rpc-client/src/lib.rs +++ b/beetle-rpc-client/src/lib.rs @@ -5,8 +5,8 @@ pub mod network; pub mod status; pub mod store; pub use self::config::Config; +use beetle_rpc_types::{gateway::GatewayService, p2p::P2pService, store::StoreService, Addr}; pub use client::Client; -use iroh_rpc_types::{gateway::GatewayService, p2p::P2pService, store::StoreService, Addr}; pub use network::{Lookup, P2pClient}; use quic_rpc::{ transport::{combined, http2, CombinedChannelTypes, Http2ChannelTypes, MemChannelTypes}, diff --git a/iroh-rpc-client/src/network.rs b/beetle-rpc-client/src/network.rs similarity index 99% rename from iroh-rpc-client/src/network.rs rename to beetle-rpc-client/src/network.rs index 420d1f972..b7093086d 100644 --- a/iroh-rpc-client/src/network.rs +++ b/beetle-rpc-client/src/network.rs @@ -1,9 +1,9 @@ use anyhow::Result; use async_stream::stream; +use beetle_rpc_types::{p2p::*, VersionRequest, WatchRequest}; use bytes::Bytes; use cid::Cid; use futures::{Stream, StreamExt}; -use iroh_rpc_types::{p2p::*, VersionRequest, WatchRequest}; use libp2p::gossipsub::{MessageId, TopicHash}; use libp2p::{Multiaddr, PeerId}; use std::collections::{HashMap, HashSet}; diff --git a/iroh-rpc-client/src/status.rs b/beetle-rpc-client/src/status.rs similarity index 100% rename from iroh-rpc-client/src/status.rs rename to beetle-rpc-client/src/status.rs diff --git a/iroh-rpc-client/src/store.rs b/beetle-rpc-client/src/store.rs similarity index 97% rename from iroh-rpc-client/src/store.rs rename to beetle-rpc-client/src/store.rs index ba18df3b7..26c11a0cd 100644 --- a/iroh-rpc-client/src/store.rs +++ b/beetle-rpc-client/src/store.rs @@ -1,9 +1,9 @@ use anyhow::Result; use async_stream::stream; +use beetle_rpc_types::{store::*, VersionRequest, WatchRequest}; use bytes::Bytes; use cid::Cid; use futures::{Stream, StreamExt}; -use iroh_rpc_types::{store::*, VersionRequest, WatchRequest}; use crate::open_client; use crate::{StatusType, HEALTH_POLL_WAIT}; diff --git a/iroh-rpc-types/Cargo.toml b/beetle-rpc-types/Cargo.toml similarity index 89% rename from iroh-rpc-types/Cargo.toml rename to beetle-rpc-types/Cargo.toml index b29dffe8f..e46b7895c 100644 --- a/iroh-rpc-types/Cargo.toml +++ b/beetle-rpc-types/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "iroh-rpc-types" +name = "beetle-rpc-types" authors = ["Friedel Ziegelmayer ", "ramfox"] -description = "RPC type definitions for iroh" +description = "RPC type definitions for beetle" version.workspace = true edition.workspace = true license.workspace = true diff --git a/iroh-rpc-types/README.md b/beetle-rpc-types/README.md similarity index 79% rename from iroh-rpc-types/README.md rename to beetle-rpc-types/README.md index 27d8f3973..d21f5337d 100644 --- a/iroh-rpc-types/README.md +++ b/beetle-rpc-types/README.md @@ -1,8 +1,8 @@ -# iroh-rpc-types +# beetle-rpc-types This crate defines the protocol for use by the -[iroh-rpc-client](https://github.com/n0-computer/iroh/tree/main/iroh-rpc-client), -which is used for [iroh](https://github.com/n0-computer/iroh) services to +[beetle-rpc-client](https://github.com/n0-computer/beetle/tree/main/beetle-rpc-client), +which is used for [beetle](https://github.com/n0-computer/beetle) services to communicate internally via RPC. It defines a set of messages and traits that specify how each message is to be diff --git a/iroh-rpc-types/src/addr.rs b/beetle-rpc-types/src/addr.rs similarity index 100% rename from iroh-rpc-types/src/addr.rs rename to beetle-rpc-types/src/addr.rs diff --git a/iroh-rpc-types/src/gateway.rs b/beetle-rpc-types/src/gateway.rs similarity index 100% rename from iroh-rpc-types/src/gateway.rs rename to beetle-rpc-types/src/gateway.rs diff --git a/iroh-rpc-types/src/lib.rs b/beetle-rpc-types/src/lib.rs similarity index 100% rename from iroh-rpc-types/src/lib.rs rename to beetle-rpc-types/src/lib.rs diff --git a/iroh-rpc-types/src/p2p.rs b/beetle-rpc-types/src/p2p.rs similarity index 100% rename from iroh-rpc-types/src/p2p.rs rename to beetle-rpc-types/src/p2p.rs diff --git a/iroh-rpc-types/src/store.rs b/beetle-rpc-types/src/store.rs similarity index 100% rename from iroh-rpc-types/src/store.rs rename to beetle-rpc-types/src/store.rs diff --git a/iroh-share/Cargo.toml b/beetle-share/Cargo.toml similarity index 71% rename from iroh-share/Cargo.toml rename to beetle-share/Cargo.toml index cc5b41c8f..801ae0ca1 100644 --- a/iroh-share/Cargo.toml +++ b/beetle-share/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "iroh-share" +name = "beetle-share" authors = ["dignifiedquire "] -description = "Sharing files with iroh" +description = "Sharing files with beetle" version.workspace = true edition.workspace = true license.workspace = true @@ -16,14 +16,14 @@ bytes.workspace = true cid = { workspace = true, features = ["serde-codec"] } clap = { workspace = true, features = ["derive"] } futures.workspace = true -iroh-metrics.workspace = true -iroh-p2p.workspace = true -iroh-resolver.workspace = true -iroh-rpc-client.workspace = true -iroh-rpc-types.workspace = true -iroh-store.workspace = true -iroh-unixfs.workspace = true -iroh-util.workspace = true +beetle-metrics.workspace = true +beetle-p2p.workspace = true +beetle-resolver.workspace = true +beetle-rpc-client.workspace = true +beetle-rpc-types.workspace = true +beetle-store.workspace = true +beetle-unixfs.workspace = true +beetle-util.workspace = true libp2p = { workspace = true, features = ["gossipsub"] } multibase.workspace = true rand.workspace = true diff --git a/iroh-share/README.md b/beetle-share/README.md similarity index 51% rename from iroh-share/README.md rename to beetle-share/README.md index 22fc14965..50521216f 100644 --- a/iroh-share/README.md +++ b/beetle-share/README.md @@ -1,12 +1,12 @@ -# iroh share +# beetle share -[![crates.io](https://img.shields.io/crates/v/iroh-share.svg?style=flat-square)](https://crates.io/crates/iroh-share) -[![Released API docs](https://img.shields.io/docsrs/iroh-share?style=flat-square)](https://docs.rs/iroh-share) -[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/iroh-share?style=flat-square)](../LICENSE-MIT) -[![CI](https://img.shields.io/github/workflow/status/n0-computer/iroh/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/iroh/actions?query=workflow%3A%22Continuous+integration%22) +[![crates.io](https://img.shields.io/crates/v/beetle-share.svg?style=flat-square)](https://crates.io/crates/beetle-share) +[![Released API docs](https://img.shields.io/docsrs/beetle-share?style=flat-square)](https://docs.rs/beetle-share) +[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/beetle-share?style=flat-square)](../LICENSE-MIT) +[![CI](https://img.shields.io/github/workflow/status/n0-computer/beetle/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/beetle/actions?query=workflow%3A%22Continuous+integration%22) This provides an application that lets you easily share files accross devices -using [iroh](https://github.com/n0-computer/iroh) and +using [beetle](https://github.com/n0-computer/beetle) and [IPFS](https://ipfs.tech/). ## License diff --git a/iroh-share/src/lib.rs b/beetle-share/src/lib.rs similarity index 99% rename from iroh-share/src/lib.rs rename to beetle-share/src/lib.rs index 720134553..01d944646 100644 --- a/iroh-share/src/lib.rs +++ b/beetle-share/src/lib.rs @@ -35,9 +35,9 @@ mod tests { use super::*; use anyhow::{Context, Result}; + use beetle_unixfs::builder::{DirectoryBuilder, FileBuilder}; use bytes::Bytes; use futures::TryStreamExt; - use iroh_unixfs::builder::{DirectoryBuilder, FileBuilder}; use rand::RngCore; use tokio::io::AsyncReadExt; use tracing_subscriber::{fmt, prelude::*, EnvFilter}; diff --git a/iroh-share/src/main.rs b/beetle-share/src/main.rs similarity index 98% rename from iroh-share/src/main.rs rename to beetle-share/src/main.rs index 027368d7f..246abcff0 100644 --- a/iroh-share/src/main.rs +++ b/beetle-share/src/main.rs @@ -1,9 +1,9 @@ use std::path::PathBuf; use anyhow::{ensure, Context, Result}; +use beetle_share::{ProgressEvent, Receiver, Sender, Ticket}; use clap::{Parser, Subcommand}; use futures::stream::StreamExt; -use iroh_share::{ProgressEvent, Receiver, Sender, Ticket}; use tokio::io::AsyncWriteExt; use tracing_subscriber::{fmt, prelude::*, EnvFilter}; diff --git a/iroh-share/src/p2p_node.rs b/beetle-share/src/p2p_node.rs similarity index 88% rename from iroh-share/src/p2p_node.rs rename to beetle-share/src/p2p_node.rs index ec22d7b40..5b1a79cf8 100644 --- a/iroh-share/src/p2p_node.rs +++ b/beetle-share/src/p2p_node.rs @@ -2,15 +2,15 @@ use std::{collections::HashSet, path::Path, sync::Arc}; use anyhow::{ensure, Result}; use async_trait::async_trait; -use cid::Cid; -use iroh_p2p::{config, Config, Keychain, MemoryStorage, NetworkEvent, Node}; -use iroh_resolver::resolver::Resolver; -use iroh_rpc_client::Client; -use iroh_rpc_types::Addr; -use iroh_unixfs::{ - content_loader::{ContentLoader, ContextId, LoaderContext, IROH_STORE}, +use beetle_p2p::{config, Config, Keychain, MemoryStorage, NetworkEvent, Node}; +use beetle_resolver::resolver::Resolver; +use beetle_rpc_client::Client; +use beetle_rpc_types::Addr; +use beetle_unixfs::{ + content_loader::{ContentLoader, ContextId, LoaderContext, BEETLE_STORE}, parse_links, LoadedCid, Source, }; +use cid::Cid; use libp2p::{Multiaddr, PeerId}; use serde::{Deserialize, Serialize}; use tokio::sync::mpsc::Receiver; @@ -73,7 +73,7 @@ impl ContentLoader for Loader { Ok(Some(data)) => { return Ok(LoadedCid { data, - source: Source::Store(IROH_STORE), + source: Source::Store(BEETLE_STORE), }); } Ok(None) => {} @@ -136,13 +136,13 @@ impl P2pNode { let rpc_store_addr_server = Addr::new_mem(); let rpc_store_addr_client = rpc_store_addr_server.clone(); - let rpc_store_client_config = iroh_rpc_client::Config { + let rpc_store_client_config = beetle_rpc_client::Config { p2p_addr: Some(rpc_p2p_addr_client.clone()), store_addr: Some(rpc_store_addr_client.clone()), gateway_addr: None, channels: Some(1), }; - let rpc_p2p_client_config = iroh_rpc_client::Config { + let rpc_p2p_client_config = beetle_rpc_client::Config { p2p_addr: Some(rpc_p2p_addr_client.clone()), store_addr: Some(rpc_store_addr_client.clone()), gateway_addr: None, @@ -167,17 +167,17 @@ impl P2pNode { let rpc = Client::new(rpc_p2p_client_config).await?; let loader = Loader::new(rpc.clone()); - let resolver = iroh_resolver::resolver::Resolver::new(loader); + let resolver = beetle_resolver::resolver::Resolver::new(loader); - let store_config = iroh_store::Config { + let store_config = beetle_store::Config { path: db_path.to_path_buf(), rpc_client: rpc_store_client_config, }; let store = if store_config.path.exists() { - iroh_store::Store::open(store_config).await? + beetle_store::Store::open(store_config).await? } else { - iroh_store::Store::create(store_config).await? + beetle_store::Store::create(store_config).await? }; let kc = Keychain::::new(); @@ -191,7 +191,7 @@ impl P2pNode { }); let store_task = tokio::spawn(async move { - iroh_store::rpc::new(rpc_store_addr_server, store) + beetle_store::rpc::new(rpc_store_addr_server, store) .await .unwrap() }); diff --git a/iroh-share/src/receiver.rs b/beetle-share/src/receiver.rs similarity index 97% rename from iroh-share/src/receiver.rs rename to beetle-share/src/receiver.rs index a57b18165..1854cbcae 100644 --- a/iroh-share/src/receiver.rs +++ b/beetle-share/src/receiver.rs @@ -1,11 +1,11 @@ use anyhow::{anyhow, ensure, Context, Result}; +use beetle_p2p::NetworkEvent; +use beetle_resolver::resolver::{Out, OutPrettyReader, OutType, Path, Resolver, UnixfsType}; +use beetle_unixfs::Link; use futures::{ channel::{oneshot::channel as oneshot, oneshot::Receiver as OneShotReceiver}, Stream, StreamExt, }; -use iroh_p2p::NetworkEvent; -use iroh_resolver::resolver::{Out, OutPrettyReader, OutType, Path, Resolver, UnixfsType}; -use iroh_unixfs::Link; use libp2p::gossipsub::{GossipsubMessage, MessageId, TopicHash}; use libp2p::PeerId; use tokio::sync::mpsc::{channel, Receiver as ChannelReceiver}; @@ -33,7 +33,7 @@ impl Receiver { let gossip_task = tokio::task::spawn(async move { while let Some(event) = events.recv().await { - if let NetworkEvent::Gossipsub(iroh_p2p::GossipsubEvent::Message { + if let NetworkEvent::Gossipsub(beetle_p2p::GossipsubEvent::Message { from, id, message, diff --git a/iroh-share/src/sender.rs b/beetle-share/src/sender.rs similarity index 97% rename from iroh-share/src/sender.rs rename to beetle-share/src/sender.rs index 5b6174961..a958e5fa8 100644 --- a/iroh-share/src/sender.rs +++ b/beetle-share/src/sender.rs @@ -1,11 +1,11 @@ use std::path::Path; use anyhow::{anyhow, Context, Result}; +use beetle_p2p::{GossipsubEvent, NetworkEvent}; +use beetle_unixfs::builder::{DirectoryBuilder, FileBuilder}; use bytes::Bytes; use futures::channel::oneshot::{channel as oneshot, Receiver as OneShotReceiver}; use futures::StreamExt; -use iroh_p2p::{GossipsubEvent, NetworkEvent}; -use iroh_unixfs::builder::{DirectoryBuilder, FileBuilder}; use libp2p::gossipsub::Sha256Topic; use rand::Rng; use tokio::sync::mpsc::{channel, Receiver}; @@ -57,7 +57,7 @@ impl Sender { gossip_task, } = self; - let t = Sha256Topic::new(format!("iroh-share-{id}")); + let t = Sha256Topic::new(format!("beetle-share-{id}")); let root_dir = dir_builder.build().await?; let (done_sender, done_receiver) = oneshot(); diff --git a/iroh-store/Cargo.toml b/beetle-store/Cargo.toml similarity index 84% rename from iroh-store/Cargo.toml rename to beetle-store/Cargo.toml index 578e726d4..cb8a341b8 100644 --- a/iroh-store/Cargo.toml +++ b/beetle-store/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "iroh-store" +name = "beetle-store" authors = ["dignifiedquire "] -description = "Implementation of the storage part of iroh" +description = "Implementation of the storage part of beetle" version.workspace = true edition.workspace = true license.workspace = true @@ -21,10 +21,10 @@ config.workspace = true ctrlc.workspace = true futures.workspace = true git-version.workspace = true -iroh-metrics = { workspace = true, features = ["store"] } -iroh-rpc-client.workspace = true -iroh-rpc-types.workspace = true -iroh-util.workspace = true +beetle-metrics = { workspace = true, features = ["store"] } +beetle-rpc-client.workspace = true +beetle-rpc-types.workspace = true +beetle-util.workspace = true multihash.workspace = true names.workspace = true opentelemetry = { workspace = true, features = ["rt-tokio"] } diff --git a/beetle-store/README.md b/beetle-store/README.md new file mode 100644 index 000000000..10160f049 --- /dev/null +++ b/beetle-store/README.md @@ -0,0 +1,32 @@ +# beetle store + +[![crates.io](https://img.shields.io/crates/v/beetle-store.svg?style=flat-square)](https://crates.io/crates/beetle-store) +[![Released API docs](https://img.shields.io/docsrs/beetle-store?style=flat-square)](https://docs.rs/beetle-store) +[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/beetle-store?style=flat-square)](../LICENSE-MIT) +[![CI](https://img.shields.io/github/workflow/status/n0-computer/beetle/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/beetle/actions?query=workflow%3A%22Continuous+integration%22) + +Storage for [beetle](https://github.com/n0-computer/beetle). This provides an gRPC +API for storing IPFS data in a [RocksDB database](http://rocksdb.org/). + +## How to run + +```sh +# From the root of the workspace +> cargo run --release -p beetle-store +``` + +## License + + +Licensed under either of Apache License, Version +2.0 or MIT license at your option. + + +
+ + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this crate by you, as defined in the Apache-2.0 license, shall +be dual licensed as above, without any additional terms or conditions. + + diff --git a/iroh-store/benches/rpc.rs b/beetle-store/benches/rpc.rs similarity index 95% rename from iroh-store/benches/rpc.rs rename to beetle-store/benches/rpc.rs index df9d1164e..51efe2268 100644 --- a/iroh-store/benches/rpc.rs +++ b/beetle-store/benches/rpc.rs @@ -1,11 +1,11 @@ use std::time::Instant; +use beetle_rpc_client::{Client, Config as RpcClientConfig}; +use beetle_rpc_types::{store::StoreAddr, Addr}; +use beetle_store::{Config, Store}; use bytes::Bytes; use cid::multihash::{Code, MultihashDigest}; use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; -use iroh_rpc_client::{Client, Config as RpcClientConfig}; -use iroh_rpc_types::{store::StoreAddr, Addr}; -use iroh_store::{Config, Store}; use tokio::runtime::Runtime; const RAW: u64 = 0x55; @@ -62,7 +62,7 @@ pub fn put_benchmark(c: &mut Criterion) { let (_task, rpc) = executor.block_on(async { let store = Store::create(config).await.unwrap(); let task = executor.spawn(async move { - iroh_store::rpc::new(server_addr, store).await.unwrap() + beetle_store::rpc::new(server_addr, store).await.unwrap() }); // wait for a moment until the transport is setup // TODO: signal this more clearly @@ -110,7 +110,7 @@ pub fn get_benchmark(c: &mut Criterion) { let (_task, rpc) = executor.block_on(async { let store = Store::create(config).await.unwrap(); let task = executor.spawn(async move { - iroh_store::rpc::new(server_addr, store).await.unwrap() + beetle_store::rpc::new(server_addr, store).await.unwrap() }); // wait for a moment until the transport is setup // TODO: signal this more clearly diff --git a/iroh-store/benches/store.rs b/beetle-store/benches/store.rs similarity index 98% rename from iroh-store/benches/store.rs rename to beetle-store/benches/store.rs index f5212a8b6..6f08eb919 100644 --- a/iroh-store/benches/store.rs +++ b/beetle-store/benches/store.rs @@ -1,8 +1,8 @@ use std::time::Instant; +use beetle_store::{Config, Store}; use cid::multihash::{Code, MultihashDigest}; use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; -use iroh_store::{Config, Store}; use tokio::runtime::Runtime; const RAW: u64 = 0x55; diff --git a/iroh-store/src/cf.rs b/beetle-store/src/cf.rs similarity index 100% rename from iroh-store/src/cf.rs rename to beetle-store/src/cf.rs diff --git a/iroh-store/src/cli.rs b/beetle-store/src/cli.rs similarity index 100% rename from iroh-store/src/cli.rs rename to beetle-store/src/cli.rs diff --git a/iroh-store/src/config.rs b/beetle-store/src/config.rs similarity index 87% rename from iroh-store/src/config.rs rename to beetle-store/src/config.rs index 6e3d0bb14..4adfbdd44 100644 --- a/iroh-store/src/config.rs +++ b/beetle-store/src/config.rs @@ -1,25 +1,25 @@ use anyhow::{anyhow, Result}; +use beetle_metrics::config::Config as MetricsConfig; +use beetle_rpc_client::Config as RpcClientConfig; +use beetle_rpc_types::store::StoreAddr; +use beetle_util::{beetle_data_path, insert_into_config_map}; use config::{ConfigError, Map, Source, Value}; -use iroh_metrics::config::Config as MetricsConfig; -use iroh_rpc_client::Config as RpcClientConfig; -use iroh_rpc_types::store::StoreAddr; -use iroh_util::{insert_into_config_map, iroh_data_path}; use serde::{Deserialize, Serialize}; use std::path::PathBuf; -/// CONFIG_FILE_NAME is the name of the optional config file located in the iroh home directory +/// CONFIG_FILE_NAME is the name of the optional config file located in the beetle home directory pub const CONFIG_FILE_NAME: &str = "store.config.toml"; /// ENV_PREFIX should be used along side the config field name to set a config field using /// environment variables -/// For example, `IROH_STORE_PATH=/path/to/config` would set the value of the `Config.path` field -pub const ENV_PREFIX: &str = "IROH_STORE"; +/// For example, `BEETLE_STORE_PATH=/path/to/config` would set the value of the `Config.path` field +pub const ENV_PREFIX: &str = "BEETLE_STORE"; -/// the path to data directory. If arg_path is `None`, the default iroh_data_path()/store is used -/// iroh_data_path() returns an operating system-specific directory +/// the path to data directory. If arg_path is `None`, the default beetle_data_path()/store is used +/// beetle_data_path() returns an operating system-specific directory pub fn config_data_path(arg_path: Option) -> Result { match arg_path { Some(p) => Ok(p), - None => iroh_data_path("store").map_err(|e| anyhow!("{}", e)), + None => beetle_data_path("store").map_err(|e| anyhow!("{}", e)), } } @@ -27,7 +27,7 @@ pub fn config_data_path(arg_path: Option) -> Result { /// /// This is the configuration which the store server binary needs to run. This is a /// superset from the configuration needed by the store service, which can also run -/// integrated into another binary like in iroh-one, iroh-share or iroh-embed. +/// integrated into another binary like in beetle-one, beetle-share or beetle-embed. #[derive(PartialEq, Debug, Deserialize, Serialize, Clone)] pub struct ServerConfig { /// Configuration of the store service. @@ -63,7 +63,7 @@ impl Source for ServerConfig { /// /// As opposed to the [`ServerConfig`] this is only the configuration needed to run the /// store service. It can still be deserialised from a file, which is e.g. used by -/// iroh-one. +/// beetle-one. #[derive(PartialEq, Debug, Deserialize, Serialize, Clone)] pub struct Config { /// The location of the content database. @@ -85,7 +85,7 @@ impl Config { /// Creates a new store config. /// /// This config will not have any RpcClientConfig, but that is fine because it is mostly - /// unused: `iroh_rpc::rpc::new` which is used takes the RPC address as a separate + /// unused: `beetle_rpc::rpc::new` which is used takes the RPC address as a separate /// argument. Once #672 is merged we can probably remove the `rpc_client` field. pub fn new(path: PathBuf) -> Self { Self { diff --git a/iroh-store/src/lib.rs b/beetle-store/src/lib.rs similarity index 100% rename from iroh-store/src/lib.rs rename to beetle-store/src/lib.rs diff --git a/iroh-store/src/main.rs b/beetle-store/src/main.rs similarity index 81% rename from iroh-store/src/main.rs rename to beetle-store/src/main.rs index 20a53ab33..3507579a2 100644 --- a/iroh-store/src/main.rs +++ b/beetle-store/src/main.rs @@ -1,25 +1,25 @@ use anyhow::anyhow; -use clap::Parser; -use iroh_store::{ +use beetle_store::{ cli::Args, config::{config_data_path, Config, ServerConfig, CONFIG_FILE_NAME, ENV_PREFIX}, metrics, rpc, Store, }; -use iroh_util::lock::ProgramLock; -use iroh_util::{block_until_sigint, iroh_config_path, make_config}; +use beetle_util::lock::ProgramLock; +use beetle_util::{beetle_config_path, block_until_sigint, make_config}; +use clap::Parser; use tracing::info; #[tokio::main(flavor = "multi_thread")] async fn main() -> anyhow::Result<()> { - let mut lock = ProgramLock::new("iroh-store")?; + let mut lock = ProgramLock::new("beetle-store")?; lock.acquire_or_exit(); let args = Args::parse(); let version = env!("CARGO_PKG_VERSION"); - println!("Starting iroh-store, version {version}"); + println!("Starting beetle-store, version {version}"); - let config_path = iroh_config_path(CONFIG_FILE_NAME)?; + let config_path = beetle_config_path(CONFIG_FILE_NAME)?; let sources = &[Some(config_path.as_path()), args.cfg.as_deref()]; let config_data_path = config_data_path(args.path.clone())?; let config = make_config( @@ -35,7 +35,7 @@ async fn main() -> anyhow::Result<()> { .unwrap(); let metrics_config = config.metrics.clone(); - let metrics_handle = iroh_metrics::MetricsHandle::new( + let metrics_handle = beetle_metrics::MetricsHandle::new( metrics::metrics_config_with_compile_time_info(metrics_config), ) .await @@ -43,7 +43,7 @@ async fn main() -> anyhow::Result<()> { #[cfg(unix)] { - match iroh_util::increase_fd_limit() { + match beetle_util::increase_fd_limit() { Ok(soft) => tracing::debug!("NOFILE limit: soft = {}", soft), Err(err) => tracing::error!("Error increasing NOFILE limit: {}", err), } diff --git a/iroh-p2p/src/metrics.rs b/beetle-store/src/metrics.rs similarity index 89% rename from iroh-p2p/src/metrics.rs rename to beetle-store/src/metrics.rs index 9f3dac4bd..b9b6c98cd 100644 --- a/iroh-p2p/src/metrics.rs +++ b/beetle-store/src/metrics.rs @@ -1,5 +1,5 @@ use crate::VERSION; -use iroh_metrics::config::Config as MetricsConfig; +use beetle_metrics::config::Config as MetricsConfig; pub fn metrics_config_with_compile_time_info(cfg: MetricsConfig) -> MetricsConfig { // compile time configuration diff --git a/iroh-store/src/rpc.rs b/beetle-store/src/rpc.rs similarity index 96% rename from iroh-store/src/rpc.rs rename to beetle-store/src/rpc.rs index fb75ff9e7..0e95cd445 100644 --- a/iroh-store/src/rpc.rs +++ b/beetle-store/src/rpc.rs @@ -1,10 +1,8 @@ use std::result; use anyhow::Result; -use bytes::BytesMut; -use futures::stream::Stream; -use iroh_rpc_client::{create_server, ServerError, ServerSocket, StoreServer, HEALTH_POLL_WAIT}; -use iroh_rpc_types::{ +use beetle_rpc_client::{create_server, ServerError, ServerSocket, StoreServer, HEALTH_POLL_WAIT}; +use beetle_rpc_types::{ store::{ GetLinksRequest, GetLinksResponse, GetRequest, GetResponse, GetSizeRequest, GetSizeResponse, HasRequest, HasResponse, PutManyRequest, PutRequest, StoreAddr, @@ -12,11 +10,13 @@ use iroh_rpc_types::{ }, VersionRequest, VersionResponse, WatchRequest, WatchResponse, }; +use bytes::BytesMut; +use futures::stream::Stream; use tracing::info; use crate::{store::Store, VERSION}; -impl iroh_rpc_types::NamedService for Store { +impl beetle_rpc_types::NamedService for Store { const NAME: &'static str = "store"; } diff --git a/iroh-store/src/store.rs b/beetle-store/src/store.rs similarity index 99% rename from iroh-store/src/store.rs rename to beetle-store/src/store.rs index dc1883351..282fd7da9 100644 --- a/iroh-store/src/store.rs +++ b/beetle-store/src/store.rs @@ -2,13 +2,13 @@ use std::{fmt, sync::Arc, thread::available_parallelism}; use ahash::AHashSet; use anyhow::{anyhow, bail, Context, Result}; -use bytes::Bytes; -use cid::Cid; -use iroh_metrics::{ +use beetle_metrics::{ core::{MObserver, MRecorder}, inc, observe, record, store::{StoreHistograms, StoreMetrics}, }; +use bytes::Bytes; +use cid::Cid; use multihash::Multihash; use rocksdb::{ BlockBasedOptions, Cache, ColumnFamily, DBPinnableSlice, Direction, IteratorMode, Options, diff --git a/iroh-unixfs/Cargo.toml b/beetle-unixfs/Cargo.toml similarity index 82% rename from iroh-unixfs/Cargo.toml rename to beetle-unixfs/Cargo.toml index d105c1d0f..fd717b46a 100644 --- a/iroh-unixfs/Cargo.toml +++ b/beetle-unixfs/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "iroh-unixfs" +name = "beetle-unixfs" authors = ["dignifiedquire "] -description = "Implementation of unixfs for iroh" +description = "Implementation of unixfs for beetle" version.workspace = true edition.workspace = true license.workspace = true @@ -20,9 +20,9 @@ cid.workspace = true config.workspace = true fastmurmur3.workspace = true futures.workspace = true -iroh-metrics = { workspace = true, features = ["resolver", "gateway"] } -iroh-rpc-client.workspace = true -iroh-util.workspace = true +beetle-metrics = { workspace = true, features = ["resolver", "gateway"] } +beetle-rpc-client.workspace = true +beetle-util.workspace = true libipld.workspace = true libp2p = { workspace = true, features = ["serde"] } multihash.workspace = true @@ -41,8 +41,8 @@ unsigned-varint.workspace = true [dev-dependencies] criterion = { workspace = true, features = ["async_tokio"] } -iroh-rpc-types.workspace = true -iroh-store.workspace = true +beetle-rpc-types.workspace = true +beetle-store.workspace = true proptest.workspace = true tempfile.workspace = true tokio = { workspace = true, features = ["rt", "macros", "rt-multi-thread", "fs"] } diff --git a/iroh-unixfs/build.rs b/beetle-unixfs/build.rs similarity index 100% rename from iroh-unixfs/build.rs rename to beetle-unixfs/build.rs diff --git a/iroh-unixfs/src/balanced_tree.rs b/beetle-unixfs/src/balanced_tree.rs similarity index 99% rename from iroh-unixfs/src/balanced_tree.rs rename to beetle-unixfs/src/balanced_tree.rs index 9b11584ad..6dd0a1468 100644 --- a/iroh-unixfs/src/balanced_tree.rs +++ b/beetle-unixfs/src/balanced_tree.rs @@ -88,7 +88,7 @@ fn stream_balanced_tree( tokio::pin!(in_stream); while let Some(chunk) = in_stream.next().await { - let ((block, link_info)) = chunk?; + let (block, link_info) = chunk?; let tree_len = tree.len(); // check if the leaf node of the tree is full diff --git a/iroh-unixfs/src/builder.rs b/beetle-unixfs/src/builder.rs similarity index 100% rename from iroh-unixfs/src/builder.rs rename to beetle-unixfs/src/builder.rs diff --git a/iroh-unixfs/src/chunker.rs b/beetle-unixfs/src/chunker.rs similarity index 100% rename from iroh-unixfs/src/chunker.rs rename to beetle-unixfs/src/chunker.rs diff --git a/iroh-unixfs/src/chunker/fixed.rs b/beetle-unixfs/src/chunker/fixed.rs similarity index 100% rename from iroh-unixfs/src/chunker/fixed.rs rename to beetle-unixfs/src/chunker/fixed.rs diff --git a/iroh-unixfs/src/chunker/rabin.rs b/beetle-unixfs/src/chunker/rabin.rs similarity index 100% rename from iroh-unixfs/src/chunker/rabin.rs rename to beetle-unixfs/src/chunker/rabin.rs diff --git a/iroh-unixfs/src/codecs.rs b/beetle-unixfs/src/codecs.rs similarity index 100% rename from iroh-unixfs/src/codecs.rs rename to beetle-unixfs/src/codecs.rs diff --git a/iroh-unixfs/src/content_loader.rs b/beetle-unixfs/src/content_loader.rs similarity index 98% rename from iroh-unixfs/src/content_loader.rs rename to beetle-unixfs/src/content_loader.rs index 0399253c7..3f4e6effb 100644 --- a/iroh-unixfs/src/content_loader.rs +++ b/beetle-unixfs/src/content_loader.rs @@ -9,10 +9,10 @@ use std::{ use anyhow::{anyhow, bail, Result}; use async_trait::async_trait; +use beetle_rpc_client::Client; use bytes::Bytes; use cid::{multibase::Base, Cid}; use futures::future::Either; -use iroh_rpc_client::Client; use rand::seq::SliceRandom; use reqwest::Url; use tracing::{debug, info, trace, warn}; @@ -23,7 +23,7 @@ use crate::{ types::{LoadedCid, Source}, }; -pub const IROH_STORE: &str = "iroh-store"; +pub const BEETLE_STORE: &str = "beetle-store"; #[async_trait] pub trait ContentLoader: Sync + Send + std::fmt::Debug + Clone + 'static { @@ -133,7 +133,7 @@ impl FullLoader { match self.client.try_store() { Ok(store) => Ok(store.get(*cid).await?.map(|data| LoadedCid { data, - source: Source::Store(IROH_STORE), + source: Source::Store(BEETLE_STORE), })), Err(err) => { info!("No store available: {:?}", err); @@ -178,7 +178,7 @@ impl FullLoader { } let data = response.bytes().await?; // Make sure the content is not tampered with. - if iroh_util::verify_hash(cid, &data) == Some(true) { + if beetle_util::verify_hash(cid, &data) == Some(true) { Ok(Some(LoadedCid { data, source: Source::Http(url.as_string()), diff --git a/iroh-unixfs/src/hamt.rs b/beetle-unixfs/src/hamt.rs similarity index 100% rename from iroh-unixfs/src/hamt.rs rename to beetle-unixfs/src/hamt.rs diff --git a/iroh-unixfs/src/hamt/bitfield.rs b/beetle-unixfs/src/hamt/bitfield.rs similarity index 100% rename from iroh-unixfs/src/hamt/bitfield.rs rename to beetle-unixfs/src/hamt/bitfield.rs diff --git a/iroh-unixfs/src/hamt/hash_bits.rs b/beetle-unixfs/src/hamt/hash_bits.rs similarity index 100% rename from iroh-unixfs/src/hamt/hash_bits.rs rename to beetle-unixfs/src/hamt/hash_bits.rs diff --git a/iroh-unixfs/src/indexer.rs b/beetle-unixfs/src/indexer.rs similarity index 99% rename from iroh-unixfs/src/indexer.rs rename to beetle-unixfs/src/indexer.rs index baca6d957..534fd1f73 100644 --- a/iroh-unixfs/src/indexer.rs +++ b/beetle-unixfs/src/indexer.rs @@ -25,7 +25,7 @@ pub const CID_CONTACT: &str = "https://cid.contact/cid/"; /// indexers. /// /// This is an ordinary URL, newtyped so we can easily provide a default value. Use -/// the [`Default`] trait to get iroh's default indexer. +/// the [`Default`] trait to get beetle's default indexer. #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct IndexerUrl(Url); diff --git a/iroh-unixfs/src/lib.rs b/beetle-unixfs/src/lib.rs similarity index 100% rename from iroh-unixfs/src/lib.rs rename to beetle-unixfs/src/lib.rs diff --git a/iroh-unixfs/src/merkledag.proto b/beetle-unixfs/src/merkledag.proto similarity index 100% rename from iroh-unixfs/src/merkledag.proto rename to beetle-unixfs/src/merkledag.proto diff --git a/iroh-unixfs/src/types.rs b/beetle-unixfs/src/types.rs similarity index 100% rename from iroh-unixfs/src/types.rs rename to beetle-unixfs/src/types.rs diff --git a/iroh-unixfs/src/unixfs.proto b/beetle-unixfs/src/unixfs.proto similarity index 100% rename from iroh-unixfs/src/unixfs.proto rename to beetle-unixfs/src/unixfs.proto diff --git a/iroh-unixfs/src/unixfs.rs b/beetle-unixfs/src/unixfs.rs similarity index 99% rename from iroh-unixfs/src/unixfs.rs rename to beetle-unixfs/src/unixfs.rs index 4fe8553e0..c7e78d167 100644 --- a/iroh-unixfs/src/unixfs.rs +++ b/beetle-unixfs/src/unixfs.rs @@ -6,10 +6,10 @@ use std::{ }; use anyhow::{anyhow, bail, ensure, Result}; +use beetle_metrics::resolver::OutMetrics; use bytes::{Buf, Bytes}; use cid::{multihash::MultihashDigest, Cid}; use futures::{future::BoxFuture, stream::BoxStream, FutureExt, Stream, StreamExt}; -use iroh_metrics::resolver::OutMetrics; use prost::Message; use tokio::io::{AsyncRead, AsyncSeek}; diff --git a/iroh-util/.gitignore b/beetle-util/.gitignore similarity index 100% rename from iroh-util/.gitignore rename to beetle-util/.gitignore diff --git a/iroh-util/Cargo.toml b/beetle-util/Cargo.toml similarity index 92% rename from iroh-util/Cargo.toml rename to beetle-util/Cargo.toml index 7fefedf3a..1dccad51e 100644 --- a/iroh-util/Cargo.toml +++ b/beetle-util/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "iroh-util" +name = "beetle-util" authors = ["dignifiedquire "] -description = "Utilities for iroh" +description = "Utilities for beetle" version.workspace = true edition.workspace = true license.workspace = true diff --git a/beetle-util/README.md b/beetle-util/README.md new file mode 100644 index 000000000..86dd10e65 --- /dev/null +++ b/beetle-util/README.md @@ -0,0 +1,25 @@ +# beetle util + +[![crates.io](https://img.shields.io/crates/v/beetle-util.svg?style=flat-square)](https://crates.io/crates/beetle-util) +[![Released API docs](https://img.shields.io/docsrs/beetle-util?style=flat-square)](https://docs.rs/beetle-util) +[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/beetle-util?style=flat-square)](../LICENSE-MIT) +[![CI](https://img.shields.io/github/workflow/status/n0-computer/beetle/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/beetle/actions?query=workflow%3A%22Continuous+integration%22) + +Utility functions for [beetle](https://github.com/n0-computer/beetle). This +provides shared functionality to be used in other beetle crates. + +## License + + +Licensed under either of Apache License, Version +2.0 or MIT license at your option. + + +
+ + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this crate by you, as defined in the Apache-2.0 license, shall +be dual licensed as above, without any additional terms or conditions. + + diff --git a/iroh-util/src/exitcodes.rs b/beetle-util/src/exitcodes.rs similarity index 77% rename from iroh-util/src/exitcodes.rs rename to beetle-util/src/exitcodes.rs index a10a3ee9f..5d7ae717f 100644 --- a/iroh-util/src/exitcodes.rs +++ b/beetle-util/src/exitcodes.rs @@ -1,9 +1,9 @@ -//! iroh exit codes +//! beetle exit codes //! //! Exit code constants intended to be passed to //! `std::process::exit()` -/// Alias for the numeric type that holds iroh exit codes. +/// Alias for the numeric type that holds beetle exit codes. pub type IrohExitCode = i32; /// Successful exit diff --git a/iroh-util/src/human.rs b/beetle-util/src/human.rs similarity index 100% rename from iroh-util/src/human.rs rename to beetle-util/src/human.rs diff --git a/iroh-util/src/lib.rs b/beetle-util/src/lib.rs similarity index 67% rename from iroh-util/src/lib.rs rename to beetle-util/src/lib.rs index 1922a640d..f39725a5d 100644 --- a/iroh-util/src/lib.rs +++ b/beetle-util/src/lib.rs @@ -21,8 +21,8 @@ pub mod exitcodes; pub mod human; pub mod lock; -/// name of directory that wraps all iroh files in a given application directory -const IROH_DIR: &str = "iroh"; +/// name of directory that wraps all beetle files in a given application directory +const BEETLE_DIR: &str = "beetle"; #[cfg(unix)] const DEFAULT_NOFILE_LIMIT: u64 = 65536; #[cfg(unix)] @@ -51,83 +51,83 @@ pub async fn block_until_sigint() { ctrlc_oneshot.await.unwrap(); } -/// Returns the path to the user's iroh config directory. +/// Returns the path to the user's beetle config directory. /// -/// If the `IROH_CONFIG_DIR` environment variable is set it will be used unconditionally. +/// If the `BEETLE_CONFIG_DIR` environment variable is set it will be used unconditionally. /// Otherwise the returned value depends on the operating system according to the following /// table. /// /// | Platform | Value | Example | /// | -------- | ------------------------------------- | -------------------------------- | -/// | Linux | `$XDG_CONFIG_HOME` or `$HOME`/.config/iroh | /home/alice/.config/iroh | -/// | macOS | `$HOME`/Library/Application Support/iroh | /Users/Alice/Library/Application Support/iroh | -/// | Windows | `{FOLDERID_RoamingAppData}`/iroh | C:\Users\Alice\AppData\Roaming\iroh | -pub fn iroh_config_root() -> Result { - if let Some(val) = env::var_os("IROH_CONFIG_DIR") { +/// | Linux | `$XDG_CONFIG_HOME` or `$HOME`/.config/beetle | /home/alice/.config/beetle | +/// | macOS | `$HOME`/Library/Application Support/beetle | /Users/Alice/Library/Application Support/beetle | +/// | Windows | `{FOLDERID_RoamingAppData}`/beetle | C:\Users\Alice\AppData\Roaming\beetle | +pub fn beetle_config_root() -> Result { + if let Some(val) = env::var_os("BEETLE_CONFIG_DIR") { return Ok(PathBuf::from(val)); } let cfg = dirs_next::config_dir() .ok_or_else(|| anyhow!("operating environment provides no directory for configuration"))?; - Ok(cfg.join(IROH_DIR)) + Ok(cfg.join(BEETLE_DIR)) } -// Path that leads to a file in the iroh config directory. -pub fn iroh_config_path(file_name: &str) -> Result { - let path = iroh_config_root()?.join(file_name); +// Path that leads to a file in the beetle config directory. +pub fn beetle_config_path(file_name: &str) -> Result { + let path = beetle_config_root()?.join(file_name); Ok(path) } -/// Returns the path to the user's iroh data directory. +/// Returns the path to the user's beetle data directory. /// -/// If the `IROH_DATA_DIR` environment variable is set it will be used unconditionally. +/// If the `BEETLE_DATA_DIR` environment variable is set it will be used unconditionally. /// Otherwise the returned value depends on the operating system according to the following /// table. /// /// | Platform | Value | Example | /// | -------- | --------------------------------------------- | ---------------------------------------- | -/// | Linux | `$XDG_DATA_HOME`/iroh or `$HOME`/.local/share/iroh | /home/alice/.local/share/iroh | -/// | macOS | `$HOME`/Library/Application Support/iroh | /Users/Alice/Library/Application Support/iroh | -/// | Windows | `{FOLDERID_RoamingAppData}/iroh` | C:\Users\Alice\AppData\Roaming\iroh | -pub fn iroh_data_root() -> Result { - if let Some(val) = env::var_os("IROH_DATA_DIR") { +/// | Linux | `$XDG_DATA_HOME`/beetle or `$HOME`/.local/share/beetle | /home/alice/.local/share/beetle | +/// | macOS | `$HOME`/Library/Application Support/beetle | /Users/Alice/Library/Application Support/beetle | +/// | Windows | `{FOLDERID_RoamingAppData}/beetle` | C:\Users\Alice\AppData\Roaming\beetle | +pub fn beetle_data_root() -> Result { + if let Some(val) = env::var_os("BEETLE_DATA_DIR") { return Ok(PathBuf::from(val)); } let path = dirs_next::data_dir().ok_or_else(|| { anyhow!("operating environment provides no directory for application data") })?; - Ok(path.join(IROH_DIR)) + Ok(path.join(BEETLE_DIR)) } -/// Path that leads to a file in the iroh data directory. -pub fn iroh_data_path(file_name: &str) -> Result { - let path = iroh_data_root()?.join(file_name); +/// Path that leads to a file in the beetle data directory. +pub fn beetle_data_path(file_name: &str) -> Result { + let path = beetle_data_root()?.join(file_name); Ok(path) } -/// Returns the path to the user's iroh cache directory. +/// Returns the path to the user's beetle cache directory. /// -/// If the `IROH_CACHE_DIR` environment variable is set it will be used unconditionally. +/// If the `BEETLE_CACHE_DIR` environment variable is set it will be used unconditionally. /// Otherwise the returned value depends on the operating system according to the following /// table. /// /// | Platform | Value | Example | /// | -------- | --------------------------------------------- | ---------------------------------------- | -/// | Linux | `$XDG_CACHE_HOME`/iroh or `$HOME`/.cache/iroh | /home/.cache/iroh | -/// | macOS | `$HOME`/Library/Caches/iroh | /Users/Alice/Library/Caches/iroh | -/// | Windows | `{FOLDERID_LocalAppData}/iroh` | C:\Users\Alice\AppData\Roaming\iroh | -pub fn iroh_cache_root() -> Result { - if let Some(val) = env::var_os("IROH_CACHE_DIR") { +/// | Linux | `$XDG_CACHE_HOME`/beetle or `$HOME`/.cache/beetle | /home/.cache/beetle | +/// | macOS | `$HOME`/Library/Caches/beetle | /Users/Alice/Library/Caches/beetle | +/// | Windows | `{FOLDERID_LocalAppData}/beetle` | C:\Users\Alice\AppData\Roaming\beetle | +pub fn beetle_cache_root() -> Result { + if let Some(val) = env::var_os("BEETLE_CACHE_DIR") { return Ok(PathBuf::from(val)); } let path = dirs_next::cache_dir().ok_or_else(|| { anyhow!("operating environment provides no directory for application data") })?; - Ok(path.join(IROH_DIR)) + Ok(path.join(BEETLE_DIR)) } -/// Path that leads to a file in the iroh cache directory. -pub fn iroh_cache_path(file_name: &str) -> Result { - let path = iroh_cache_root()?.join(file_name); +/// Path that leads to a file in the beetle cache directory. +pub fn beetle_cache_path(file_name: &str) -> Result { + let path = beetle_cache_root()?.join(file_name); Ok(path) } @@ -140,7 +140,7 @@ pub fn insert_into_config_map, V: Into>( map.insert(field.into(), Value::new(None, val)); } -// struct made to shoe-horn in the ability to use the `IROH_METRICS` env var prefix +// struct made to shoe-horn in the ability to use the `BEETLE_METRICS` env var prefix #[derive(Debug, Clone)] struct MetricsSource { metrics: Config, @@ -166,8 +166,8 @@ impl Source for MetricsSource { /// accessed using `.`, if your environment allows env vars with `.` /// /// Note: For the metrics configuration env vars, it is recommended to use the metrics -/// specific prefix `IROH_METRICS` to set a field in the metrics config. You can use the -/// above dot notation to set a metrics field, eg, `IROH_CONFIG_METRICS.SERVICE_NAME`, but +/// specific prefix `BEETLE_METRICS` to set a field in the metrics config. You can use the +/// above dot notation to set a metrics field, eg, `BEETLE_CONFIG_METRICS.SERVICE_NAME`, but /// only if your environment allows it pub fn make_config( default: T, @@ -200,19 +200,19 @@ where // pull metrics config from env variables // nesting into this odd `MetricsSource` struct, gives us the option of - // using the more convienient prefix `IROH_METRICS` to set metrics env vars + // using the more convienient prefix `BEETLE_METRICS` to set metrics env vars let mut metrics = Config::builder().add_source( - Environment::with_prefix("IROH_METRICS") + Environment::with_prefix("BEETLE_METRICS") .separator("__") .try_parsing(true), ); - // allow custom `IROH_INSTANCE_ID` env var - if let Ok(instance_id) = env::var("IROH_INSTANCE_ID") { + // allow custom `BEETLE_INSTANCE_ID` env var + if let Ok(instance_id) = env::var("BEETLE_INSTANCE_ID") { metrics = metrics.set_override("instance_id", instance_id)?; } - // allow custom `IROH_ENV` env var - if let Ok(service_env) = env::var("IROH_ENV") { + // allow custom `BEETLE_ENV` env var + if let Ok(service_env) = env::var("BEETLE_ENV") { metrics = metrics.set_override("service_env", service_env)?; } let metrics = metrics.build().unwrap(); @@ -262,28 +262,28 @@ mod tests { use super::*; #[test] - fn test_iroh_directory_paths() { - let got = iroh_config_path("foo.bar").unwrap(); + fn test_beetle_directory_paths() { + let got = beetle_config_path("foo.bar").unwrap(); let got = got.to_str().unwrap().to_string(); let got = got.replace('\\', "/"); // handle windows paths - assert!(dbg!(got).ends_with("/iroh/foo.bar")); + assert!(dbg!(got).ends_with("/beetle/foo.bar")); // Now test the overrides by environment variable. We have to do this in the same // test since tests are run in parallel but changing environment variables affects // the entire process. - temp_env::with_var("IROH_CONFIG_DIR", Some("/a/config/dir"), || { - let res = iroh_config_path("iroh-test").unwrap(); - assert_eq!(res, PathBuf::from("/a/config/dir/iroh-test")); + temp_env::with_var("BEETLE_CONFIG_DIR", Some("/a/config/dir"), || { + let res = beetle_config_path("beetle-test").unwrap(); + assert_eq!(res, PathBuf::from("/a/config/dir/beetle-test")); }); - temp_env::with_var("IROH_DATA_DIR", Some("/a/data/dir"), || { - let res = iroh_data_path("iroh-test").unwrap(); - assert_eq!(res, PathBuf::from("/a/data/dir/iroh-test")); + temp_env::with_var("BEETLE_DATA_DIR", Some("/a/data/dir"), || { + let res = beetle_data_path("beetle-test").unwrap(); + assert_eq!(res, PathBuf::from("/a/data/dir/beetle-test")); }); - temp_env::with_var("IROH_CACHE_DIR", Some("/a/cache/dir"), || { - let res = iroh_cache_path("iroh-test").unwrap(); - assert_eq!(res, PathBuf::from("/a/cache/dir/iroh-test")); + temp_env::with_var("BEETLE_CACHE_DIR", Some("/a/cache/dir"), || { + let res = beetle_cache_path("beetle-test").unwrap(); + assert_eq!(res, PathBuf::from("/a/cache/dir/beetle-test")); }); } diff --git a/iroh-util/src/lock.rs b/beetle-util/src/lock.rs similarity index 96% rename from iroh-util/src/lock.rs rename to beetle-util/src/lock.rs index 2a7f91a25..b7716a0e2 100644 --- a/iroh-util/src/lock.rs +++ b/beetle-util/src/lock.rs @@ -7,8 +7,8 @@ use tracing::warn; use crate::exitcodes; -/// Manages a lock file used to track if an iroh program is already running. -/// Aquired locks write a file to iroh's application data path containing the +/// Manages a lock file used to track if an beetle program is already running. +/// Aquired locks write a file to beetle's application data path containing the /// process identifier (PID) of the process with the lock. /// The lock exclusion test requires both a lockfile AND a running process /// listed at the PID in the file @@ -25,7 +25,7 @@ pub struct ProgramLock { impl ProgramLock { /// Create a new lock for the given program. This does not yet acquire the lock. pub fn new(prog_name: &str) -> Result { - let path = crate::iroh_data_path(&format!("{prog_name}.lock")) + let path = crate::beetle_data_path(&format!("{prog_name}.lock")) .map_err(|e| LockError::InvalidPath { source: e })?; Ok(Self { path, @@ -140,7 +140,7 @@ impl ProgramLock { fn write(&mut self) -> Result<()> { // create lock. ensure path to lock exists - std::fs::create_dir_all(crate::iroh_data_root()?)?; + std::fs::create_dir_all(crate::beetle_data_root()?)?; let mut file = File::create(&self.path)?; let pid = sysinfo::get_current_pid().unwrap(); file.write_all(pid.to_string().as_bytes())?; @@ -165,7 +165,7 @@ impl Drop for ProgramLock { /// Report Process ID stored in a lock file pub fn read_lock_pid(prog_name: &str) -> Result { - let path = crate::iroh_data_path(&format!("{prog_name}.lock"))?; + let path = crate::beetle_data_path(&format!("{prog_name}.lock"))?; read_lock(&path) } diff --git a/iroh-util/tests/config.a.toml b/beetle-util/tests/config.a.toml similarity index 100% rename from iroh-util/tests/config.a.toml rename to beetle-util/tests/config.a.toml diff --git a/iroh-util/tests/config.b.toml b/beetle-util/tests/config.b.toml similarity index 100% rename from iroh-util/tests/config.b.toml rename to beetle-util/tests/config.b.toml diff --git a/iroh-util/tests/config.rs b/beetle-util/tests/config.rs similarity index 93% rename from iroh-util/tests/config.rs rename to beetle-util/tests/config.rs index ba214ef5e..cbcebd212 100644 --- a/iroh-util/tests/config.rs +++ b/beetle-util/tests/config.rs @@ -5,7 +5,7 @@ use std::path::PathBuf; use config::{ConfigError, Map, Source, Value}; use serde::{Deserialize, Serialize}; -use iroh_util::{insert_into_config_map, make_config}; +use beetle_util::{insert_into_config_map, make_config}; const CONFIG_A: &str = "tests/config.a.toml"; const CONFIG_B: &str = "tests/config.b.toml"; @@ -165,16 +165,16 @@ fn test_make_config() { temp_env::with_vars( vec![ // set config field using env var - ("IROH_TEST__PORT", Some("4000")), + ("BEETLE_TEST__PORT", Some("4000")), // set metrics fiels using `env_prefix`, double-underbar for deep // nesting - ("IROH_TEST__METRICS__FOO", Some("true")), - // set metrics field using `IROH_METRICS` prefix - ("IROH_METRICS__BAR", Some("10")), + ("BEETLE_TEST__METRICS__FOO", Some("true")), + // set metrics field using `BEETLE_METRICS` prefix + ("BEETLE_METRICS__BAR", Some("10")), // custom metrics env var - ("IROH_INSTANCE_ID", Some("new_id")), + ("BEETLE_INSTANCE_ID", Some("new_id")), // custom metrics env var - ("IROH_ENV", Some("new_service_env")), + ("BEETLE_ENV", Some("new_service_env")), ], || { let got = make_config( @@ -184,7 +184,7 @@ fn test_make_config() { Some(&PathBuf::from(CONFIG_B)), None, ], - "IROH_TEST", + "BEETLE_TEST", HashMap::from([("enabled", "false"), ("metrics.debug", "true")]), ) .unwrap(); diff --git a/iroh/Cargo.toml b/beetle/Cargo.toml similarity index 74% rename from iroh/Cargo.toml rename to beetle/Cargo.toml index 973790ac5..2a2d5b843 100644 --- a/iroh/Cargo.toml +++ b/beetle/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "iroh" +name = "beetle" authors = ["Kasey Huizinga ", "Martijn Faassen "] -description = "Command line interface for interacting with iroh." +description = "Command line interface for interacting with beetle." version.workspace = true edition.workspace = true license.workspace = true @@ -23,12 +23,12 @@ crossterm.workspace = true futures.workspace = true git-version.workspace = true indicatif.workspace = true -iroh-api.workspace = true -iroh-localops.workspace = true -iroh-metrics.workspace = true -iroh-rpc-client.workspace = true -iroh-util.workspace = true -iroh-unixfs.workspace = true +beetle-api.workspace = true +beetle-localops.workspace = true +beetle-metrics.workspace = true +beetle-rpc-client.workspace = true +beetle-util.workspace = true +beetle-unixfs.workspace = true relative-path = { workspace = true, optional = true } serde = { workspace = true, features = ["derive"] } sysinfo.workspace = true diff --git a/beetle/README.md b/beetle/README.md new file mode 100644 index 000000000..a1d5addcf --- /dev/null +++ b/beetle/README.md @@ -0,0 +1,31 @@ +# beetle + +[![crates.io](https://img.shields.io/crates/v/beetle.svg?style=flat-square)](https://crates.io/crates/beetle) +[![Released API docs](https://img.shields.io/docsrs/beetle?style=flat-square)](https://docs.rs/beetle) +[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/beetle?style=flat-square)](../LICENSE-MIT) +[![CI](https://img.shields.io/github/workflow/status/n0-computer/beetle/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/beetle/actions?query=workflow%3A%22Continuous+integration%22) + +This contains the implementation of a command-line tool for controlling +[beetle](https://github.com/n0-computer/beetle). + +## usage + +``` +// Track the status of your different beetle processes +$ beetle-ctl status --watch +``` + +## License + + +Licensed under either of Apache License, Version +2.0 or MIT license at your option. + + +
+ + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this crate by you, as defined in the Apache-2.0 license, shall +be dual licensed as above, without any additional terms or conditions. + diff --git a/iroh/fixtures/dir/a.txt b/beetle/fixtures/dir/a.txt similarity index 100% rename from iroh/fixtures/dir/a.txt rename to beetle/fixtures/dir/a.txt diff --git a/iroh/fixtures/dir/subdir/b.txt b/beetle/fixtures/dir/subdir/b.txt similarity index 100% rename from iroh/fixtures/dir/subdir/b.txt rename to beetle/fixtures/dir/subdir/b.txt diff --git a/iroh/fixtures/dir/subdir/c.txt b/beetle/fixtures/dir/subdir/c.txt similarity index 100% rename from iroh/fixtures/dir/subdir/c.txt rename to beetle/fixtures/dir/subdir/c.txt diff --git a/iroh/fixtures/file.txt b/beetle/fixtures/file.txt similarity index 100% rename from iroh/fixtures/file.txt rename to beetle/fixtures/file.txt diff --git a/iroh/src/config.rs b/beetle/src/config.rs similarity index 89% rename from iroh/src/config.rs rename to beetle/src/config.rs index 30c1918fd..45e5a8efe 100644 --- a/iroh/src/config.rs +++ b/beetle/src/config.rs @@ -1,19 +1,19 @@ use anyhow::Result; +use beetle_util::insert_into_config_map; use config::{ConfigError, Map, Source, Value}; -use iroh_util::insert_into_config_map; use serde::{Deserialize, Serialize}; -/// CONFIG_FILE_NAME is the name of the optional config file located in the iroh home directory +/// CONFIG_FILE_NAME is the name of the optional config file located in the beetle home directory pub const CONFIG_FILE_NAME: &str = "cli.config.toml"; /// ENV_PREFIX should be used along side the config field name to set a config field using /// environment variables -/// For example, `IROH_CLI_PATH=/path/to/config` would set the value of the `Config.path` field -pub const ENV_PREFIX: &str = "IROH_CLI"; +/// For example, `BEETLE_CLI_PATH=/path/to/config` would set the value of the `Config.path` field +pub const ENV_PREFIX: &str = "BEETLE_CLI"; -/// The configuration for the iroh cli. +/// The configuration for the beetle cli. #[derive(PartialEq, Eq, Debug, Deserialize, Serialize, Clone)] pub struct Config { - /// The set of services to start if no arguments are given to 'iroh start' + /// The set of services to start if no arguments are given to 'beetle start' pub start_default_services: Vec, } diff --git a/iroh/src/doc.rs b/beetle/src/doc.rs similarity index 77% rename from iroh/src/doc.rs rename to beetle/src/doc.rs index 512c89d1a..ae5f46424 100644 --- a/iroh/src/doc.rs +++ b/beetle/src/doc.rs @@ -1,4 +1,4 @@ -pub const IROH_LONG_DESCRIPTION: &str = " +pub const BEETLE_LONG_DESCRIPTION: &str = " Iroh is a next-generation implementation the Interplanetary File System (IPFS). IPFS is a networking protocol for exchanging content-addressed blocks of immutable data. 'content-addressed' means referring to data by the hash of it's @@ -7,18 +7,18 @@ properties make it possible to get data from any node in the network that speaks the IPFS protocol, including IPFS content being served by other implementations of the protocol. -For more info see https://iroh.computer/docs"; +For more info see https://beetle.computer/docs"; pub const ADD_LONG_DESCRIPTION: &str = " -WARNING 1: IROH CURRENTLY PROVIDES NO WAY TO REMOVE CONTENT ONCE ADDED. +WARNING 1: BEETLE CURRENTLY PROVIDES NO WAY TO REMOVE CONTENT ONCE ADDED. This will be addressed in a future release. -Add copies the file or directory specified by into the iroh store, +Add copies the file or directory specified by into the beetle store, splitting the input file into a tree of immutable blocks. Each block is labeled by the hash of its content. The final output of the add command is the hash of the root of the tree, which contains references to all other blocks: - > iroh add cat.jpg + > beetle add cat.jpg [1/2] Calculating size... [2/2] Importing content 643 B... /ipfs/bafybeihjgu5w6wbbxqevdgccj5xm453dbzpkwmkyoepvs3vh6wft4uvf2q @@ -28,13 +28,13 @@ different things will always be a different set of characters. Once content is in IPFS, we refer to it by the CID. The opposite of the add command is the get command, which accepts a CID and turns it back into files or directories: - > iroh get /ipfs/bafybeihjgu5w6wbbxqevdgccj5xm453dbzpkwmkyoepvs3vh6wft4uvf2q + > beetle get /ipfs/bafybeihjgu5w6wbbxqevdgccj5xm453dbzpkwmkyoepvs3vh6wft4uvf2q Saving file(s) to bafybeihjgu5w6wbbxqevdgccj5xm453dbzpkwmkyoepvs3vh6wft4uvf2q This will create a directory with our cat image inside. We can also make this a little nicer for humans by getting just the cat picture: - > iroh get /ipfs/bafybeihjgu5w6wbbxqevdgccj5xm453dbzpkwmkyoepvs3vh6wft4uvf2q/cat.jpg cat.jpg + > beetle get /ipfs/bafybeihjgu5w6wbbxqevdgccj5xm453dbzpkwmkyoepvs3vh6wft4uvf2q/cat.jpg cat.jpg The stored result of add is a 'MerkleDAG'. Merkle proofs (hashes) are a fast method of proving and checking data inclusion, and the tree formed by chunking @@ -43,7 +43,7 @@ can be provably checked for tamper resistance by anyone who fetches all blocks in the tree, which means MerkleDAGs can be provided by anyone, without concern for tampering. -By default all content added to iroh is available to the configured network, and +By default all content added to beetle is available to the configured network, and the default network is the public IPFS network. We can use a HTTPS gateway hosted at https://gateway.lol to fetch the content from our local node: @@ -58,14 +58,14 @@ value. pub const START_LONG_DESCRIPTION: &str = " Iroh start kicks off 'daemons' on your local machine: long-running processes -that make iroh work. Iroh requires a running daemon to do anything meaningful -like get or add content, and `iroh start` is the fastest way to get iroh up & +that make beetle work. Iroh requires a running daemon to do anything meaningful +like get or add content, and `beetle start` is the fastest way to get beetle up & running locally -Use the start, stop, and status commands to monitor iroh on your local machine, +Use the start, stop, and status commands to monitor beetle on your local machine, and control it's uptime. start runs daemons in the background, so there's no -need to keep your terminal open after running start. Once running, stop iroh -with `iroh stop`. +need to keep your terminal open after running start. Once running, stop beetle +with `beetle stop`. Daemons provide 'services'. Services work together to fullfill requests. There are three services: @@ -74,27 +74,27 @@ There are three services: p2p - peer-2-peer networking functionality gateway - bridge the IPFS network to HTTP -By default iroh start spins up storage & gateway services. Start the p2p service -with `iroh start p2p`. To learn more about each service, see: -https://iroh.computer/docs/services +By default beetle start spins up storage & gateway services. Start the p2p service +with `beetle start p2p`. To learn more about each service, see: +https://beetle.computer/docs/services -Iroh start is by no means the only way to get iroh up & running. Long running +Iroh start is by no means the only way to get beetle up & running. Long running local deployments should be scheduled by your operating systems daemon supervisior, and cloud deployments should invoke daemon binaries directly. -Regardless of how iroh is started, you can always use `iroh status` to monitor +Regardless of how beetle is started, you can always use `beetle status` to monitor service health. "; pub const STOP_LONG_DESCRIPTION: &str = " -stop turns local iroh services off by killing daemon processes. There are three -iroh services, each backed by a daemon: +stop turns local beetle services off by killing daemon processes. There are three +beetle services, each backed by a daemon: store - a database of IPFS content p2p - peer-2-peer networking functionality gateway - bridge the IPFS network to HTTP -By default `iroh stop` attempts to stop all three services. To stop specific -services, provide service names as arguments, eg: `iroh stop p2p`. +By default `beetle stop` attempts to stop all three services. To stop specific +services, provide service names as arguments, eg: `beetle stop p2p`. When a deamon starts it creates a lockfile and writes it's process identifier (PID) to the lock. Iroh stop uses this lock to lookup the process & send an @@ -107,8 +107,8 @@ services. "; pub const STATUS_LONG_DESCRIPTION: &str = " -status reports the current operational setup of iroh. Use status as a go-to -command for understanding where iroh commands are being processed. different +status reports the current operational setup of beetle. Use status as a go-to +command for understanding where beetle commands are being processed. different ops configurations utilize different network and service implementations under the hood, which can lead to varying performance characteristics. @@ -130,7 +130,7 @@ Status reports no metrics about the running system aside from current service health. Instead all metrics are emitted through uniform tracing collection & reporting, which is intended to be consumed by tools like prometheus and grafana. For more info on metrics collection, see -https://iroh.computer/docs/metrics"; +https://beetle.computer/docs/metrics"; pub const GET_LONG_DESCRIPTION: &str = " Download file or directory specified by from IPFS into [path]. If @@ -143,7 +143,7 @@ By default, the output will be written to the working directory. If no file or directory name can be derived from the , the output will be written to the given path's CID. -If is already present in the iroh store, no network call will +If is already present in the beetle store, no network call will be made."; pub const P2P_CONNECT_LONG_DESCRIPTION: &str = " @@ -156,9 +156,9 @@ with. The address format is in multiaddr format. For example: - > iroh p2p connect /ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ + > beetle p2p connect /ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ -for more info on multiaddrs see https://iroh.computer/docs/concepts#multiaddr +for more info on multiaddrs see https://beetle.computer/docs/concepts#multiaddr If a peer ID is provided, connect first perform a distribtued hash table (DHT) lookup to learn the address of the given peer ID before dialing."; @@ -194,8 +194,8 @@ The last element after the '/' is the Peer Identifier or 'PeerID'. Either the PeerID or the entire multiaddr can be given to the 'p2p lookup' command for additional details about the peer. For example: - > iroh p2p lookup QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ - > iroh p2p lookup /ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ + > beetle p2p lookup QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ + > beetle p2p lookup /ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ -For more info on multiaddrs see https://iroh.computer/docs/concepts#multiaddr. +For more info on multiaddrs see https://beetle.computer/docs/concepts#multiaddr. "; diff --git a/iroh/src/lib.rs b/beetle/src/lib.rs similarity index 100% rename from iroh/src/lib.rs rename to beetle/src/lib.rs diff --git a/iroh/src/main.rs b/beetle/src/main.rs similarity index 78% rename from iroh/src/main.rs rename to beetle/src/main.rs index 17fd979e5..3b8dae9cb 100644 --- a/iroh/src/main.rs +++ b/beetle/src/main.rs @@ -1,11 +1,11 @@ use anyhow::{anyhow, Result}; +use beetle_api::ApiError; use clap::Parser; use crossterm::style::Stylize; -use iroh_api::ApiError; #[tokio::main(flavor = "multi_thread")] async fn main() -> Result<()> { - let cli = iroh::run::Cli::parse(); + let cli = beetle::run::Cli::parse(); // the `run` method exists in two versions: // When using the `testing` feature, the // version of `run` designed for testing purposes using mocked test @@ -29,11 +29,11 @@ fn transform_error(r: Result<()>) -> Result<()> { Err(e) => { let rpc_error = e .root_cause() - .downcast_ref::(); - if let Some(iroh_rpc_client::ClientError::Open(_)) = rpc_error { + .downcast_ref::(); + if let Some(beetle_rpc_client::ClientError::Open(_)) = rpc_error { return Err(anyhow!( "Connection refused. Are services running?\n{}", - "hint: see 'iroh start' for more on starting services".yellow(), + "hint: see 'beetle start' for more on starting services".yellow(), )); } @@ -42,7 +42,7 @@ fn transform_error(r: Result<()>) -> Result<()> { return Err(anyhow!( "Connection refused. This command requires a running {} service.\n{}", service, - format!("hint: try 'iroh start {service}'").yellow(), + format!("hint: try 'beetle start {service}'").yellow(), )); } Err(e) diff --git a/iroh-bitswap/src/metrics.rs b/beetle/src/metrics.rs similarity index 89% rename from iroh-bitswap/src/metrics.rs rename to beetle/src/metrics.rs index 339f97d08..a6017b40a 100644 --- a/iroh-bitswap/src/metrics.rs +++ b/beetle/src/metrics.rs @@ -1,4 +1,4 @@ -use iroh_metrics::config::Config as MetricsConfig; +use beetle_metrics::config::Config as MetricsConfig; pub fn metrics_config_with_compile_time_info(cfg: MetricsConfig) -> MetricsConfig { // compile time configuration diff --git a/iroh/src/p2p.rs b/beetle/src/p2p.rs similarity index 98% rename from iroh/src/p2p.rs rename to beetle/src/p2p.rs index f466d7f32..771dfc19a 100644 --- a/iroh/src/p2p.rs +++ b/beetle/src/p2p.rs @@ -1,8 +1,8 @@ use crate::doc; use anyhow::{Error, Result}; +use beetle_api::{Lookup, Multiaddr, P2pApi, PeerId, PeerIdOrAddr}; use clap::{Args, Subcommand}; use crossterm::style::Stylize; -use iroh_api::{Lookup, Multiaddr, P2pApi, PeerId, PeerIdOrAddr}; use std::{collections::HashMap, fmt::Display, str::FromStr}; #[derive(Args, Debug, Clone)] diff --git a/iroh/src/run.rs b/beetle/src/run.rs similarity index 89% rename from iroh/src/run.rs rename to beetle/src/run.rs index a30b963c7..1f7bf318e 100644 --- a/iroh/src/run.rs +++ b/beetle/src/run.rs @@ -2,16 +2,16 @@ use std::collections::{BTreeSet, HashMap}; use std::path::{Path, PathBuf}; use anyhow::{Context, Result}; +use beetle_api::{ + Api, ChunkerConfig, IpfsPath, StatusType, UnixfsConfig, UnixfsEntry, DEFAULT_CHUNKS_SIZE, +}; +use beetle_metrics::config::Config as MetricsConfig; +use beetle_util::{beetle_config_path, human, make_config}; use clap::{Parser, Subcommand}; use console::style; use crossterm::style::Stylize; use futures::StreamExt; use indicatif::{ProgressBar, ProgressStyle}; -use iroh_api::{ - Api, ChunkerConfig, IpfsPath, StatusType, UnixfsConfig, UnixfsEntry, DEFAULT_CHUNKS_SIZE, -}; -use iroh_metrics::config::Config as MetricsConfig; -use iroh_util::{human, iroh_config_path, make_config}; use crate::config::{Config, CONFIG_FILE_NAME, ENV_PREFIX}; use crate::doc; @@ -23,8 +23,8 @@ use crate::size::size_stream; #[derive(Parser, Debug, Clone)] #[clap(version, long_about = None, propagate_version = true)] -#[clap(about = "A next generation IPFS implementation: https://iroh.computer")] -#[clap(after_help = doc::IROH_LONG_DESCRIPTION)] +#[clap(about = "A next generation IPFS implementation: https://beetle.computer")] +#[clap(after_help = doc::BEETLE_LONG_DESCRIPTION)] pub struct Cli { #[clap(long)] cfg: Option, @@ -38,7 +38,7 @@ pub struct Cli { #[derive(Subcommand, Debug, Clone)] enum Commands { P2p(P2p), - #[clap(about = "Add a file or directory to iroh & make it available on IPFS")] + #[clap(about = "Add a file or directory to beetle & make it available on IPFS")] #[clap(after_help = doc::ADD_LONG_DESCRIPTION )] Add { /// The path to a file or directory to be added @@ -64,7 +64,7 @@ enum Commands { /// filesystem path to write to. Optional and defaults to $CID output: Option, }, - #[clap(about = "Start local iroh services")] + #[clap(about = "Start local beetle services")] #[clap(after_help = doc::START_LONG_DESCRIPTION )] Start { service: Vec, @@ -73,14 +73,14 @@ enum Commands { all: bool, }, /// status checks the health of the different processes - #[clap(about = "Check the health of the different iroh services")] + #[clap(about = "Check the health of the different beetle services")] #[clap(after_help = doc::STATUS_LONG_DESCRIPTION)] Status { #[clap(short, long)] /// when true, updates the status table whenever a change in a process's status occurs watch: bool, }, - #[clap(about = "Stop local iroh services")] + #[clap(about = "Stop local beetle services")] #[clap(after_help = doc::STOP_LONG_DESCRIPTION )] Stop { service: Vec, @@ -89,7 +89,7 @@ enum Commands { impl Cli { pub async fn run(&self) -> Result<()> { - let config_path = iroh_config_path(CONFIG_FILE_NAME)?; + let config_path = beetle_config_path(CONFIG_FILE_NAME)?; let sources = [Some(config_path.as_path()), self.cfg.as_deref()]; let config = make_config( // default @@ -104,14 +104,14 @@ impl Cli { ) .unwrap(); - let metrics_handler = iroh_metrics::MetricsHandle::new(MetricsConfig::default()) + let metrics_handler = beetle_metrics::MetricsHandle::new(MetricsConfig::default()) .await .expect("failed to initialize metrics"); #[cfg(feature = "testing")] let api = get_fixture_api(); #[cfg(not(feature = "testing"))] - let api = iroh_api::Api::from_env(self.cfg.as_deref(), self.make_overrides_map()).await?; + let api = beetle_api::Api::from_env(self.cfg.as_deref(), self.make_overrides_map()).await?; self.cli_command(&config, &api).await?; @@ -144,7 +144,7 @@ impl Cli { } => { let blocks = api.get(path)?; let root_path = - iroh_api::fs::write_get_stream(path, blocks, output.as_deref()).await?; + beetle_api::fs::write_get_stream(path, blocks, output.as_deref()).await?; println!("Saving file(s) to {}", root_path.to_str().unwrap()); } Commands::P2p(p2p) => run_p2p_command(&api.p2p()?, p2p).await?, @@ -204,12 +204,12 @@ async fn add( match (provide, svc_status.p2p.status()) { (true, StatusType::Down) => { anyhow::bail!("Add provides content to the IPFS network by default, but the p2p service is not running.\n{}", - "hint: try using the --offline flag, or run 'iroh start p2p'".yellow() + "hint: try using the --offline flag, or run 'beetle start p2p'".yellow() ) } (true, StatusType::Unknown) | (true, StatusType::NotServing) => { anyhow::bail!("Add provides content to the IPFS network by default, but the p2p service is not running.\n{}", - "hint: try using the --offline flag, or run 'iroh start p2p'".yellow() + "hint: try using the --offline flag, or run 'beetle start p2p'".yellow() ) } (true, StatusType::Serving) => {} diff --git a/iroh/src/services.rs b/beetle/src/services.rs similarity index 88% rename from iroh/src/services.rs rename to beetle/src/services.rs index 28026c330..9de6f06b5 100644 --- a/iroh/src/services.rs +++ b/beetle/src/services.rs @@ -1,8 +1,8 @@ use anyhow::{anyhow, Result}; +use beetle_util::beetle_cache_path; use crossterm::terminal::{Clear, ClearType}; use crossterm::{cursor, style, style::Stylize, QueueableCommand}; use futures::StreamExt; -use iroh_util::iroh_cache_path; use std::collections::BTreeSet; use std::io::{stdout, Write}; use std::ops::Deref; @@ -10,8 +10,8 @@ use std::time::SystemTime; use sysinfo::PidExt; use tracing::info; -use iroh_api::{Api, ApiError, ClientStatus, ServiceStatus, StatusType}; -use iroh_util::lock::{LockError, ProgramLock}; +use beetle_api::{Api, ApiError, ClientStatus, ServiceStatus, StatusType}; +use beetle_util::lock::{LockError, ProgramLock}; const SERVICE_START_TIMEOUT_SECONDS: u64 = 15; @@ -30,10 +30,10 @@ pub async fn start(api: &Api, services: &Vec) -> Result<()> { start_services(api, services).await } -// TODO(b5) - should check for configuration mismatch between iroh CLI configuration +// TODO(b5) - should check for configuration mismatch between beetle CLI configuration // TODO(b5) - services BTreeSet should be an enum async fn start_services(api: &Api, services: BTreeSet<&str>) -> Result<()> { - // check for any running iroh services + // check for any running beetle services let table = api.check().await; let mut expected_services = BTreeSet::new(); @@ -61,14 +61,14 @@ async fn start_services(api: &Api, services: BTreeSet<&str>) -> Result<()> { .iter() .fold(&mut missing_services, |accum, status_row| { match status_row.status() { - iroh_api::StatusType::Serving => (), - iroh_api::StatusType::Unknown => { + beetle_api::StatusType::Serving => (), + beetle_api::StatusType::Unknown => { accum.insert(status_row.name()); } - iroh_api::StatusType::NotServing => { + beetle_api::StatusType::NotServing => { accum.insert(status_row.name()); } - iroh_api::StatusType::Down => { + beetle_api::StatusType::Down => { accum.insert(status_row.name()); // TODO(b5) - warn user that a service is down & exit } @@ -84,28 +84,28 @@ async fn start_services(api: &Api, services: BTreeSet<&str>) -> Result<()> { if missing_services.is_empty() { println!( "{}", - "All iroh daemons are already running. all systems normal.".green() + "All beetle daemons are already running. all systems normal.".green() ); return Ok(()); } for service in missing_services.iter() { - let daemon_name = format!("iroh-{service}"); - let log_path = iroh_cache_path(format!("iroh-{service}.log").as_str())?; + let daemon_name = format!("beetle-{service}"); + let log_path = beetle_cache_path(format!("beetle-{service}.log").as_str())?; // check if a binary by this name exists let bin_path = which::which(&daemon_name).map_err(|_| { anyhow!(format!( - "can't find {} daemon binary on your $PATH. please install {}.\n visit https://iroh.computer/docs/install for more info", + "can't find {} daemon binary on your $PATH. please install {}.\n visit https://beetle.computer/docs/install for more info", &daemon_name, &daemon_name )) })?; print!("starting {}... ", &daemon_name.bold()); - iroh_localops::process::daemonize(bin_path, log_path.clone())?; + beetle_localops::process::daemonize(bin_path, log_path.clone())?; - let is_up = poll_until_status(api, service, iroh_api::StatusType::Serving).await?; + let is_up = poll_until_status(api, service, beetle_api::StatusType::Serving).await?; if is_up { println!("{}", "success".green()); } else { @@ -142,21 +142,21 @@ pub async fn stop(api: &Api, services: &Vec) -> Result<()> { pub async fn stop_services(api: &Api, services: BTreeSet<&str>) -> Result<()> { for service in services { - let daemon_name = format!("iroh-{service}"); + let daemon_name = format!("beetle-{service}"); info!("checking daemon {} lock", daemon_name); let mut lock = ProgramLock::new(&daemon_name)?; match lock.active_pid() { Ok(pid) => { info!("stopping {} pid: {}", daemon_name, pid); print!("stopping {}... ", &daemon_name); - match iroh_localops::process::stop(pid.as_u32()) { + match beetle_localops::process::stop(pid.as_u32()) { Ok(_) => { let is_down = - poll_until_status(api, service, iroh_api::StatusType::Down).await?; + poll_until_status(api, service, beetle_api::StatusType::Down).await?; if is_down { println!("{}", "stopped".red()); } else { - eprintln!("{}", format!("{service} API is still running, but the lock is removed.\nYou may need to manually stop iroh via your operating system").red()); + eprintln!("{}", format!("{service} API is still running, but the lock is removed.\nYou may need to manually stop beetle via your operating system").red()); } } Err(error) => { @@ -259,10 +259,11 @@ where pub async fn require_services( api: &Api, services: BTreeSet<&str>, -) -> Result { +) -> Result { let table = api.check().await; for service in table.iter() { - if services.contains(service.name()) && service.status() != iroh_api::StatusType::Serving { + if services.contains(service.name()) && service.status() != beetle_api::StatusType::Serving + { return Err(anyhow!(ApiError::ConnectionRefused { service: service.name() })); @@ -273,7 +274,11 @@ pub async fn require_services( /// poll until a service matches the desired status. returns Ok(true) if status was matched, /// and Ok(false) if desired status isn't reported before SERVICE_START_TIMEOUT_SECONDS -async fn poll_until_status(api: &Api, service: &str, status: iroh_api::StatusType) -> Result { +async fn poll_until_status( + api: &Api, + service: &str, + status: beetle_api::StatusType, +) -> Result { let status_stream = api.watch().await; tokio::pin!(status_stream); let start = SystemTime::now(); @@ -299,7 +304,7 @@ async fn poll_until_status(api: &Api, service: &str, status: iroh_api::StatusTyp #[cfg(test)] mod tests { use super::*; - use iroh_api::ServiceType; + use beetle_api::ServiceType; #[test] fn status_table_queue() { diff --git a/iroh/src/size.rs b/beetle/src/size.rs similarity index 100% rename from iroh/src/size.rs rename to beetle/src/size.rs diff --git a/docker/Dockerfile.iroh-gateway b/docker/Dockerfile.beetle-gateway similarity index 85% rename from docker/Dockerfile.iroh-gateway rename to docker/Dockerfile.beetle-gateway index 20d7a972b..d9cbe0711 100644 --- a/docker/Dockerfile.iroh-gateway +++ b/docker/Dockerfile.beetle-gateway @@ -20,22 +20,22 @@ ENV RUST_BACKTRACE=1 \ # b/c empty-library is not a dependency, so we override with an exit code 0 RUN cargo install empty-library; exit 0 -WORKDIR /iroh +WORKDIR /beetle COPY ../ . -RUN cargo build --bin iroh-gateway --profile=docker +RUN cargo build --bin beetle-gateway --profile=docker ################################################################################ ## Final image ################################################################################ FROM gcr.io/distroless/cc -WORKDIR /iroh +WORKDIR /beetle # Copy our build, changing owndership to distroless-provided "nonroot" user, # (65532:65532) -COPY --from=builder --chown=65532:65532 /iroh/target/docker/iroh-gateway ./ +COPY --from=builder --chown=65532:65532 /beetle/target/docker/beetle-gateway ./ # Use nonroot (unprivileged) user USER nonroot @@ -43,4 +43,4 @@ USER nonroot # expose the default RPC port and default gateway HTTP port EXPOSE 4400 9050 -CMD ["/iroh/iroh-gateway"] \ No newline at end of file +CMD ["/beetle/beetle-gateway"] \ No newline at end of file diff --git a/docker/Dockerfile.iroh-one b/docker/Dockerfile.beetle-one similarity index 87% rename from docker/Dockerfile.iroh-one rename to docker/Dockerfile.beetle-one index a82aefc59..7072427fd 100644 --- a/docker/Dockerfile.iroh-one +++ b/docker/Dockerfile.beetle-one @@ -26,22 +26,22 @@ ENV RUST_BACKTRACE=1 \ # b/c empty-library is not a dependency, so we override with an exit code 0 RUN cargo install empty-library; exit 0 -WORKDIR /iroh +WORKDIR /beetle COPY ../ . -RUN cargo build --bin iroh-one --profile=docker +RUN cargo build --bin beetle-one --profile=docker ################################################################################ ## Final image ################################################################################ FROM gcr.io/distroless/cc -WORKDIR /iroh +WORKDIR /beetle # Copy our build, changing owndership to distroless-provided "nonroot" user, # (65532:65532) -COPY --from=builder --chown=65532:65532 /iroh/target/docker/iroh-one ./ +COPY --from=builder --chown=65532:65532 /beetle/target/docker/beetle-one ./ # Use nonroot (unprivileged) user USER nonroot @@ -49,4 +49,4 @@ USER nonroot # expose gateway, p2p & all default RPC ports EXPOSE 4400 4401 4402 4403 4444 9050 -CMD ["/iroh/iroh-one"] \ No newline at end of file +CMD ["/beetle/beetle-one"] \ No newline at end of file diff --git a/docker/Dockerfile.iroh-p2p b/docker/Dockerfile.beetle-p2p similarity index 88% rename from docker/Dockerfile.iroh-p2p rename to docker/Dockerfile.beetle-p2p index e04b31abb..890daacc8 100644 --- a/docker/Dockerfile.iroh-p2p +++ b/docker/Dockerfile.beetle-p2p @@ -20,22 +20,22 @@ ENV RUST_BACKTRACE=1 \ # b/c empty-library is not a dependency, so we override with an exit code 0 RUN cargo install empty-library; exit 0 -WORKDIR /iroh +WORKDIR /beetle COPY ../ . -RUN cargo build --bin iroh-p2p --profile=docker +RUN cargo build --bin beetle-p2p --profile=docker ################################################################################ ## Final image ################################################################################ FROM gcr.io/distroless/cc -WORKDIR /iroh +WORKDIR /beetle # Copy our build, changing owndership to distroless-provided "nonroot" user, # (65532:65532) -COPY --from=builder --chown=65532:65532 /iroh/target/docker/iroh-p2p ./ +COPY --from=builder --chown=65532:65532 /beetle/target/docker/beetle-p2p ./ # TODO (b5) - investigate max file descriptor limits within the container image # libp2p needs lots of FDs for open ports, and we should be maxing them out. @@ -50,4 +50,4 @@ USER nonroot EXPOSE 4401 4444 EXPOSE 4444/udp -CMD ["/iroh/iroh-p2p"] \ No newline at end of file +CMD ["/beetle/beetle-p2p"] \ No newline at end of file diff --git a/docker/Dockerfile.iroh-store b/docker/Dockerfile.beetle-store similarity index 86% rename from docker/Dockerfile.iroh-store rename to docker/Dockerfile.beetle-store index c8e81f19d..6bce72ffa 100644 --- a/docker/Dockerfile.iroh-store +++ b/docker/Dockerfile.beetle-store @@ -25,22 +25,22 @@ ENV RUST_BACKTRACE=1 \ # b/c empty-library is not a dependency, so we override with an exit code 0 RUN cargo install empty-library; exit 0 -WORKDIR /iroh +WORKDIR /beetle COPY ../ . -RUN cargo build --bin iroh-store --profile=docker +RUN cargo build --bin beetle-store --profile=docker ################################################################################ ## Final image ################################################################################ FROM gcr.io/distroless/cc -WORKDIR /iroh +WORKDIR /beetle # Copy our build, changing owndership to distroless-provided "nonroot" user, # (65532:65532) -COPY --from=builder --chown=65532:65532 /iroh/target/docker/iroh-store ./ +COPY --from=builder --chown=65532:65532 /beetle/target/docker/beetle-store ./ # Use nonroot (unprivileged) user USER nonroot @@ -48,4 +48,4 @@ USER nonroot # expose the default RPC port EXPOSE 4402 -CMD ["/iroh/iroh-store"] \ No newline at end of file +CMD ["/beetle/beetle-store"] \ No newline at end of file diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 8eb7035cc..87c8f83a7 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -1,42 +1,42 @@ -# this is a standard, bare bones iroh configuration. More sophisticated setups +# this is a standard, bare bones beetle configuration. More sophisticated setups # will take advantage of metrics, and provide custom configuration # # Usage: -# run 'docker-compose up' from the docker directory, use 'iroh status' from +# run 'docker-compose up' from the docker directory, use 'beetle status' from # another terminal to interact with services, or visit localhost:9050 on a # browser to utilize the gateway version: "3.9" services: - iroh-gateway: - container_name: "iroh-gateway" - image: "n0computer/iroh-gateway:latest" + beetle-gateway: + container_name: "beetle-gateway" + image: "n0computer/beetle-gateway:latest" environment: - - "IROH_GATEWAY__RPC_CLIENT__P2P_ADDR=grpc://iroh-p2p:4401" - - "IROH_GATEWAY__RPC_CLIENT__STORE_ADDR=grpc://iroh-store:4402" + - "BEETLE_GATEWAY__RPC_CLIENT__P2P_ADDR=grpc://beetle-p2p:4401" + - "BEETLE_GATEWAY__RPC_CLIENT__STORE_ADDR=grpc://beetle-store:4402" ports: # public HTTP gateway port. eg: http://localhost:9050/ipfs/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi - "9050:9050" - # RPC port, iroh CLI uses this to control your gateway service + # RPC port, beetle CLI uses this to control your gateway service # this shouldn't be publically accessible, so we explicitly wire it # to the local loopback address: 127.0.0.1 - "127.0.0.1:4400:4400" - iroh-p2p: - container_name: "iroh-p2p" - image: "n0computer/iroh-p2p:latest" + beetle-p2p: + container_name: "beetle-p2p" + image: "n0computer/beetle-p2p:latest" environment: - - "IROH_P2P__RPC_CLIENT__STORE_ADDR=grpc://iroh-store:4402" + - "BEETLE_P2P__RPC_CLIENT__STORE_ADDR=grpc://beetle-store:4402" ports: # libp2p connection port. peers will dial your node here - "4444:4444" - # RPC port, iroh CLI uses this to control your p2p service + # RPC port, beetle CLI uses this to control your p2p service # this shouldn't be publically accessible, so we explicitly wire it # to the local loopback address: 127.0.0.1 - "127.0.0.1:4401:4401" - iroh-store: - container_name: "iroh-store" - image: "n0computer/iroh-store:latest" + beetle-store: + container_name: "beetle-store" + image: "n0computer/beetle-store:latest" ports: - # RPC port, iroh CLI uses this to control your store service + # RPC port, beetle CLI uses this to control your store service # this shouldn't be publically accessible, so we explicitly wire it # to the local loopback address: 127.0.0.1 - "127.0.0.1:4402:4402" \ No newline at end of file diff --git a/examples/embed/Cargo.toml b/examples/embed/Cargo.toml index d3ec8245b..e4bbdb6d0 100644 --- a/examples/embed/Cargo.toml +++ b/examples/embed/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "iroh-example-embed" +name = "beetle-example-embed" authors = ["team@n0.computer"] -description = "Example of using iroh-embed" +description = "Example of using beetle-embed" publish = false version.workspace = true edition.workspace = true @@ -11,7 +11,7 @@ repository.workspace = true [dependencies] anyhow.workspace = true futures-util.workspace = true -iroh-api.workspace = true -iroh-embed.workspace = true +beetle-api.workspace = true +beetle-embed.workspace = true testdir.workspace = true tokio = { workspace = true, features = ["rt-multi-thread"] } diff --git a/examples/embed/src/main.rs b/examples/embed/src/main.rs index e00dc5d84..68533e67a 100644 --- a/examples/embed/src/main.rs +++ b/examples/embed/src/main.rs @@ -1,7 +1,7 @@ use anyhow::{bail, Result}; +use beetle_api::{IpfsPath, OutType}; +use beetle_embed::{IrohBuilder, Libp2pConfig, P2pService, RocksStoreService}; use futures_util::StreamExt; -use iroh_api::{IpfsPath, OutType}; -use iroh_embed::{IrohBuilder, Libp2pConfig, P2pService, RocksStoreService}; use testdir::testdir; #[tokio::main(flavor = "multi_thread")] @@ -9,7 +9,7 @@ async fn main() -> Result<()> { let dir = testdir!(); println!("Using directory: {}", dir.display()); - println!("Starting iroh system..."); + println!("Starting beetle system..."); let store = RocksStoreService::new(dir.join("store")).await?; let mut p2p_config = Libp2pConfig::default(); @@ -20,13 +20,13 @@ async fn main() -> Result<()> { let p2p = P2pService::new(p2p_config, dir, store.addr()).await?; // Note by default this is configured with an indexer, but not with http resolvers. - let iroh = IrohBuilder::new().store(store).p2p(p2p).build().await?; + let beetle = IrohBuilder::new().store(store).p2p(p2p).build().await?; println!("done"); let quick_start: IpfsPath = "/ipfs/QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc/quick-start".parse()?; println!("Fetching quick start: {quick_start}"); - let mut stream = iroh.api().get(&quick_start)?; + let mut stream = beetle.api().get(&quick_start)?; // We only expect a single item here. while let Some(item) = stream.next().await { @@ -44,7 +44,7 @@ async fn main() -> Result<()> { } // Stop the system gracefully. - iroh.stop().await?; + beetle.stop().await?; Ok(()) } diff --git a/examples/importer/Cargo.toml b/examples/importer/Cargo.toml index 99a0c4945..688485b6d 100644 --- a/examples/importer/Cargo.toml +++ b/examples/importer/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "iroh-example-importer" +name = "beetle-example-importer" authors = ["team@n0.computer"] publish = false version.workspace = true @@ -14,10 +14,10 @@ bytesize.workspace = true clap = { workspace = true, features = ["derive"] } futures.workspace = true indicatif.workspace = true -iroh-car.workspace = true -iroh-unixfs.workspace = true -iroh-resolver.workspace = true -iroh-rpc-client.workspace = true -iroh-util.workspace = true +beetle-car.workspace = true +beetle-unixfs.workspace = true +beetle-resolver.workspace = true +beetle-rpc-client.workspace = true +beetle-util.workspace = true par-stream = { workspace = true, features = ["runtime-tokio"]} tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } diff --git a/examples/importer/src/main.rs b/examples/importer/src/main.rs index 3a9612764..e88214f91 100644 --- a/examples/importer/src/main.rs +++ b/examples/importer/src/main.rs @@ -1,12 +1,12 @@ use std::{path::PathBuf, time::Instant}; use anyhow::{bail, Result}; +use beetle_car::CarReader; +use beetle_rpc_client::{Client, Config as RpcClientConfig}; use bytes::Bytes; use clap::Parser; use futures::{stream::TryStreamExt, StreamExt}; use indicatif::{ProgressBar, ProgressStyle}; -use iroh_car::CarReader; -use iroh_rpc_client::{Client, Config as RpcClientConfig}; use par_stream::prelude::*; #[derive(Parser, Debug, Clone)] @@ -52,10 +52,10 @@ async fn main() -> Result<()> { .try_par_map_unordered(None, move |(cid, data)| { move || { let data = Bytes::from(data); - if iroh_util::verify_hash(&cid, &data) == Some(false) { + if beetle_util::verify_hash(&cid, &data) == Some(false) { bail!("invalid hash {:?}", cid); } - let links = iroh_unixfs::parse_links(&cid, &data).unwrap_or_default(); + let links = beetle_unixfs::parse_links(&cid, &data).unwrap_or_default(); Ok((cid, data, links)) } }) diff --git a/iroh-api/README.md b/iroh-api/README.md deleted file mode 100644 index 12d8b608e..000000000 --- a/iroh-api/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# iroh-api - -[![crates.io](https://img.shields.io/crates/v/iroh-api.svg?style=flat-square)](https://crates.io/crates/iroh-api) -[![Released API docs](https://img.shields.io/docsrs/iroh-api?style=flat-square)](https://docs.rs/iroh-api) -[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/iroh-api?style=flat-square)](../LICENSE-MIT) -[![CI](https://img.shields.io/github/workflow/status/n0-computer/iroh/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/iroh/actions?query=workflow%3A%22Continuous+integration%22) - -This contains the API for controlling [iroh](https://github.com/n0-computer/iroh). - -## License - - -Licensed under either of Apache License, Version -2.0 or MIT license at your option. - - -
- - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in this crate by you, as defined in the Apache-2.0 license, shall -be dual licensed as above, without any additional terms or conditions. - diff --git a/iroh-metrics/README.md b/iroh-metrics/README.md deleted file mode 100644 index aa2a37bf3..000000000 --- a/iroh-metrics/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# iroh metrics - -[![crates.io](https://img.shields.io/crates/v/iroh-metrics.svg?style=flat-square)](https://crates.io/crates/iroh-metrics) -[![Released API docs](https://img.shields.io/docsrs/iroh-metrics?style=flat-square)](https://docs.rs/iroh-metrics) -[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/iroh-metrics?style=flat-square)](../LICENSE-MIT) -[![CI](https://img.shields.io/github/workflow/status/n0-computer/iroh/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/iroh/actions?query=workflow%3A%22Continuous+integration%22) - - -The metrics collection interface for [iroh](https://github.com/n0-computer/iroh) services. - -## ENV Variables - -- `IROH_METRICS_DEBUG` - redirects traces to stdout if the flag is set to `true` (default: ``) -- `IROH_METRICS_COLLECTOR_ENDPOINT` - endpoint where traces will be routed (default: `http://localhost:4317`) -- `IROH_METRICS_PROM_GATEWAY_ENDPOINT` - endpoint where prometheus metrics will be pushed (default: `http://localhost:9091`) - -## License - - -Licensed under either of Apache License, Version -2.0 or MIT license at your option. - - -
- - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in this crate by you, as defined in the Apache-2.0 license, shall -be dual licensed as above, without any additional terms or conditions. - diff --git a/iroh-resolver/README.md b/iroh-resolver/README.md deleted file mode 100644 index 8eb885d37..000000000 --- a/iroh-resolver/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# iroh resolver - -[![crates.io](https://img.shields.io/crates/v/iroh-resolver.svg?style=flat-square)](https://crates.io/crates/iroh-resolver) -[![Released API docs](https://img.shields.io/docsrs/iroh-resolver?style=flat-square)](https://docs.rs/iroh-resolver) -[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/iroh-resolver?style=flat-square)](../LICENSE-MIT) -[![CI](https://img.shields.io/github/workflow/status/n0-computer/iroh/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/iroh/actions?query=workflow%3A%22Continuous+integration%22) - -Resolver for [iroh](https://github.com/n0-computer/iroh). It retrieves data -associated with an IPFS CID from the [iroh -store](https://github.com/n0-computer/iroh/tree/main/iroh-store), or if not -available, uses [iroh -p2p](https://github.com/n0-computer/iroh/tree/main/iroh-p2p) to retrieve it -from the IPFS network. - -This crate also provides a way to take a directory of files, or a single file, -and chunk it into smaller parts that can be stored, and assemble them back -together again. - -## License - - -Licensed under either of Apache License, Version -2.0 or MIT license at your option. - - -
- - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in this crate by you, as defined in the Apache-2.0 license, shall -be dual licensed as above, without any additional terms or conditions. - - diff --git a/iroh-store/README.md b/iroh-store/README.md deleted file mode 100644 index e2c157389..000000000 --- a/iroh-store/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# iroh store - -[![crates.io](https://img.shields.io/crates/v/iroh-store.svg?style=flat-square)](https://crates.io/crates/iroh-store) -[![Released API docs](https://img.shields.io/docsrs/iroh-store?style=flat-square)](https://docs.rs/iroh-store) -[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/iroh-store?style=flat-square)](../LICENSE-MIT) -[![CI](https://img.shields.io/github/workflow/status/n0-computer/iroh/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/iroh/actions?query=workflow%3A%22Continuous+integration%22) - -Storage for [iroh](https://github.com/n0-computer/iroh). This provides an gRPC -API for storing IPFS data in a [RocksDB database](http://rocksdb.org/). - -## How to run - -```sh -# From the root of the workspace -> cargo run --release -p iroh-store -``` - -## License - - -Licensed under either of Apache License, Version -2.0 or MIT license at your option. - - -
- - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in this crate by you, as defined in the Apache-2.0 license, shall -be dual licensed as above, without any additional terms or conditions. - - diff --git a/iroh-util/README.md b/iroh-util/README.md deleted file mode 100644 index 297df1b7a..000000000 --- a/iroh-util/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# iroh util - -[![crates.io](https://img.shields.io/crates/v/iroh-util.svg?style=flat-square)](https://crates.io/crates/iroh-util) -[![Released API docs](https://img.shields.io/docsrs/iroh-util?style=flat-square)](https://docs.rs/iroh-util) -[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/iroh-util?style=flat-square)](../LICENSE-MIT) -[![CI](https://img.shields.io/github/workflow/status/n0-computer/iroh/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/iroh/actions?query=workflow%3A%22Continuous+integration%22) - -Utility functions for [iroh](https://github.com/n0-computer/iroh). This -provides shared functionality to be used in other iroh crates. - -## License - - -Licensed under either of Apache License, Version -2.0 or MIT license at your option. - - -
- - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in this crate by you, as defined in the Apache-2.0 license, shall -be dual licensed as above, without any additional terms or conditions. - - diff --git a/iroh/README.md b/iroh/README.md deleted file mode 100644 index d76dffe8d..000000000 --- a/iroh/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# iroh - -[![crates.io](https://img.shields.io/crates/v/iroh.svg?style=flat-square)](https://crates.io/crates/iroh) -[![Released API docs](https://img.shields.io/docsrs/iroh?style=flat-square)](https://docs.rs/iroh) -[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/iroh?style=flat-square)](../LICENSE-MIT) -[![CI](https://img.shields.io/github/workflow/status/n0-computer/iroh/Continuous%20integration?style=flat-square)](https://github.com/n0-computer/iroh/actions?query=workflow%3A%22Continuous+integration%22) - -This contains the implementation of a command-line tool for controlling -[iroh](https://github.com/n0-computer/iroh). - -## usage - -``` -// Track the status of your different iroh processes -$ iroh-ctl status --watch -``` - -## License - - -Licensed under either of Apache License, Version -2.0 or MIT license at your option. - - -
- - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in this crate by you, as defined in the Apache-2.0 license, shall -be dual licensed as above, without any additional terms or conditions. - diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 9cf341c16..ed394a78f 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -11,4 +11,4 @@ clap = { workspace = true, features = ["derive"] } clap_mangen.workspace = true dirs-next.workspace = true xtaskops.workspace = true -iroh.workspace = true +beetle.workspace = true diff --git a/xtask/README.md b/xtask/README.md index d0d7f1539..aa26f9836 100644 --- a/xtask/README.md +++ b/xtask/README.md @@ -1,4 +1,4 @@ -# iroh xtasks +# beetle xtasks This crate contains automation tasks similar to `make` or `npm run` commands in other languages, using the [cargo xtask pattern](https://github.com/matklad/cargo-xtask). diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 388ad3802..1c0adab20 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -9,7 +9,7 @@ use std::{ #[derive(Debug, Parser)] #[command(name = "xtasks")] -#[command(about = "iroh automation tasks", long_about = None)] +#[command(about = "beetle automation tasks", long_about = None)] #[command(arg_required_else_help = true)] struct Cli { #[command(subcommand)] @@ -43,7 +43,7 @@ enum Commands { /// Publish all images, overrides images args #[clap(short, long)] all: bool, - /// Set of services to publish. Any of {iroh-store,iroh-p2p,iroh-gateway,iroh-one} + /// Set of services to publish. Any of {beetle-store,beetle-p2p,beetle-gateway,beetle-one} images: Vec, }, #[command( @@ -53,7 +53,7 @@ enum Commands { /// Publish all images, overrides images args #[clap(short, long)] all: bool, - /// Set of services to publish. Any of {iroh-store,iroh-p2p,iroh-gateway,iroh-one} + /// Set of services to publish. Any of {beetle-store,beetle-p2p,beetle-gateway,beetle-one} images: Vec, #[clap(short, long, default_value_t = String::from("linux/arm64/v8,linux/amd64"))] platforms: String, @@ -108,7 +108,13 @@ fn dev_install(build: bool) -> Result<()> { if build { dist().unwrap(); } - let bins = ["iroh", "iroh-one", "iroh-gateway", "iroh-p2p", "iroh-store"]; + let bins = [ + "beetle", + "beetle-one", + "beetle-gateway", + "beetle-p2p", + "beetle-store", + ]; let home = dirs_next::home_dir().unwrap(); for bin in bins { let from = project_root().join(format!("target/release/{bin}")); @@ -141,18 +147,18 @@ fn dist_binaries() -> Result<()> { fn dist_manpage() -> Result<()> { let outdir = dist_dir(); - let f = fs::File::create(outdir.join("iroh.1"))?; + let f = fs::File::create(outdir.join("beetle.1"))?; let mut buf = io::BufWriter::new(f); - let cmd = iroh::run::Cli::command(); + let cmd = beetle::run::Cli::command(); let man = clap_mangen::Man::new(cmd.clone()); man.render(&mut buf)?; - write_subcommand_man_files("iroh", &cmd, &outdir) + write_subcommand_man_files("beetle", &cmd, &outdir) } fn write_subcommand_man_files(prefix: &str, cmd: &clap::Command, outdir: &PathBuf) -> Result<()> { for subcommand in cmd.get_subcommands() { - let subcommand_name = format!("iroh{}", subcommand.get_name()); + let subcommand_name = format!("beetle{}", subcommand.get_name()); let f = fs::File::create(outdir.join(format!("{}{}", &subcommand_name, ".1")))?; let mut buf = io::BufWriter::new(f); let man = clap_mangen::Man::new(subcommand.clone()); @@ -183,10 +189,10 @@ fn dist_dir() -> PathBuf { fn docker_images(all: bool, build_images: Vec) -> Vec { if all { return vec![ - String::from("iroh-one"), - String::from("iroh-store"), - String::from("iroh-p2p"), - String::from("iroh-gateway"), + String::from("beetle-one"), + String::from("beetle-store"), + String::from("beetle-p2p"), + String::from("beetle-gateway"), ]; } build_images