From 6f49a22fcecc5649fddabe028a44f50fc458d581 Mon Sep 17 00:00:00 2001 From: Jose Celano Date: Thu, 21 May 2026 16:29:36 +0100 Subject: [PATCH 1/5] docs(issues): open SI-09 #1821 rename torrust-tracker-clock to torrust-clock - Move spec from drafts/ to open/ with issue number prefix 1821 - Update spec: issue number, branch, defer crates.io tasks to SI-13 - Update EPIC #1669 SI-09 row with issue #1821 link and open spec path --- .../open/1669-overhaul-packages/EPIC.md | 4 +- ...torrust-tracker-clock-to-torrust-clock.md} | 86 +++++++++---------- 2 files changed, 42 insertions(+), 48 deletions(-) rename docs/issues/{drafts/1669-09-rename-torrust-tracker-clock-to-torrust-clock.md => open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md} (61%) diff --git a/docs/issues/open/1669-overhaul-packages/EPIC.md b/docs/issues/open/1669-overhaul-packages/EPIC.md index 450675f55..6324344d7 100644 --- a/docs/issues/open/1669-overhaul-packages/EPIC.md +++ b/docs/issues/open/1669-overhaul-packages/EPIC.md @@ -215,7 +215,7 @@ Status: TODO unless noted. `SI-XX` = recommended implementation sequence number. - [x] SI-06 — [#1813](https://github.com/torrust/torrust-tracker/issues/1813) Resolve `bittorrent-tracker-core` ↔ `torrust-tracker-rest-api-client` layer violation _(Rule M; prerequisite for `bittorrent-tracker-core` extraction)_ - [x] SI-07 — [#1816](https://github.com/torrust/torrust-tracker/issues/1816) Align `torrust-` prefix: rename 7 tracker-specific packages to `torrust-tracker-` _(Rule U; no blockers)_ - [x] SI-08 — [#1819](https://github.com/torrust/torrust-tracker/issues/1819) Rename `torrust-tracker-metrics` to `torrust-metrics` _(Rule U; no blockers)_ -- [ ] SI-09 — Rename `torrust-tracker-clock` to `torrust-clock` _(Rule P; no blockers)_ +- [ ] SI-09 — [#1821](https://github.com/torrust/torrust-tracker/issues/1821) Rename `torrust-tracker-clock` to `torrust-clock` _(Rule P; no blockers)_ - [ ] SI-10 — Rename `torrust-tracker-located-error` to `torrust-located-error` _(Rule P; no blockers)_ - [ ] SI-11 — Update all package READMEs _(documentation; after SI-07–SI-10; before SI-12)_ - [ ] SI-12 — Extract and rename `torrust-tracker-contrib-bencode` to `torrust-bencode` _(Rule E; no blockers within this EPIC)_ @@ -235,7 +235,7 @@ Details: | SI-06 | [#1813](https://github.com/torrust/torrust-tracker/issues/1813) — Resolve `bittorrent-tracker-core` ↔ `torrust-tracker-rest-api-client` layer violation | [docs/issues/closed/1813-1669-06-resolve-bittorrent-tracker-core-rest-api-layer-violation.md](../../closed/1813-1669-06-resolve-bittorrent-tracker-core-rest-api-layer-violation.md) | DONE | Rule M; stale unused dev dep removed in PR #1804; unblocks `bittorrent-tracker-core` extraction | | SI-07 | [#1816](https://github.com/torrust/torrust-tracker/issues/1816) — Align `torrust-` prefix: rename 7 tracker-specific packages to `torrust-tracker-` | [docs/issues/open/1816-1669-07-align-torrust-prefix-rename-tracker-specific-packages.md](../../open/1816-1669-07-align-torrust-prefix-rename-tracker-specific-packages.md) | DONE | Rule U; none of the 7 are published; pure workspace rename; no blockers | | SI-08 | [#1819](https://github.com/torrust/torrust-tracker/issues/1819) — Rename `torrust-tracker-metrics` to `torrust-metrics` | [docs/issues/open/1819-1669-08-rename-torrust-tracker-metrics-to-torrust-metrics.md](../../open/1819-1669-08-rename-torrust-tracker-metrics-to-torrust-metrics.md) | DONE | Rule U; not yet published; no blockers; prerequisite for SI-14 | -| SI-09 | #TBD — Rename `torrust-tracker-clock` to `torrust-clock` | [docs/issues/drafts/1669-09-rename-torrust-tracker-clock-to-torrust-clock.md](../../drafts/1669-09-rename-torrust-tracker-clock-to-torrust-clock.md) | TODO | Rule P; published on crates.io; no blockers; prerequisite for SI-13 | +| SI-09 | [#1821](https://github.com/torrust/torrust-tracker/issues/1821) — Rename `torrust-tracker-clock` to `torrust-clock` | [docs/issues/open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md](../../open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md) | TODO | Rule P; published on crates.io; no blockers; prerequisite for SI-13 | | SI-10 | #TBD — Rename `torrust-tracker-located-error` to `torrust-located-error` | [docs/issues/drafts/1669-10-rename-torrust-tracker-located-error-to-torrust-located-error.md](../../drafts/1669-10-rename-torrust-tracker-located-error-to-torrust-located-error.md) | TODO | Rule P; published on crates.io; no blockers | | SI-11 | #TBD — Update all package READMEs | [docs/issues/drafts/1669-11-update-all-package-readmes.md](../../drafts/1669-11-update-all-package-readmes.md) | TODO | Documentation; requires SI-07–SI-10; before SI-12 | | SI-12 | #TBD — Extract and rename `torrust-tracker-contrib-bencode` to `torrust-bencode` | [docs/issues/drafts/1669-12-extract-torrust-tracker-contrib-bencode-to-torrust-bencode.md](../../drafts/1669-12-extract-torrust-tracker-contrib-bencode-to-torrust-bencode.md) | TODO | Rule E; no workspace-dep blockers; Apache-2.0; one internal consumer | diff --git a/docs/issues/drafts/1669-09-rename-torrust-tracker-clock-to-torrust-clock.md b/docs/issues/open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md similarity index 61% rename from docs/issues/drafts/1669-09-rename-torrust-tracker-clock-to-torrust-clock.md rename to docs/issues/open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md index 82dd4dd10..f919fe324 100644 --- a/docs/issues/drafts/1669-09-rename-torrust-tracker-clock-to-torrust-clock.md +++ b/docs/issues/open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md @@ -1,13 +1,13 @@ --- doc-type: issue issue-type: task -status: draft +status: open priority: p2 -github-issue: null -spec-path: docs/issues/drafts/1669-09-rename-torrust-tracker-clock-to-torrust-clock.md -branch: null +github-issue: 1821 +spec-path: docs/issues/open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md +branch: 1821-rename-torrust-tracker-clock-to-torrust-clock related-pr: null -last-updated-utc: 2026-05-15 12:00 +last-updated-utc: 2026-05-21 12:00 semantic-links: skill-links: - create-issue @@ -21,7 +21,7 @@ semantic-links: -# Issue #[To be assigned] - Rename `torrust-tracker-clock` to `torrust-clock` +# Issue #1821 - Rename `torrust-tracker-clock` to `torrust-clock` ## Goal @@ -45,8 +45,9 @@ crate's actual purpose. The rename: (see [1669-13-extract-torrust-clock-to-standalone-repo.md](1669-13-extract-torrust-clock-to-standalone-repo.md)). The current crate name `torrust-tracker-clock` is **published on crates.io** (as of -May 2026). The rename requires publishing the new name `torrust-clock` and handling the -old published name (yank or deprecation notice). +May 2026). Publishing the new name `torrust-clock` and handling the old published name +(yank or deprecation notice) are **deferred to SI-13** (extract `torrust-clock` to +standalone repository). This issue covers only the in-workspace rename. **This issue has a prerequisite**: the `DEFAULT_TIMEOUT` constant must be moved from `torrust-tracker-configuration` to `torrust-tracker-clock` before this rename is started, @@ -80,43 +81,35 @@ This issue is a subissue of EPIC #1669 (Overhaul: Packages). - Update prose references in `packages/AGENTS.md`, `AGENTS.md`, `docs/packages.md`, and the `clock` package `README.md`. - Verify the workspace builds and all tests pass. -- Publish `torrust-clock` on crates.io. -- Handle the old crates.io name `torrust-tracker-clock`: first add a deprecation notice / - README update pointing to `torrust-clock`; yank all versions only after `torrust-index` - migration is merged (see Companion work). ### Out of Scope +- Publishing `torrust-clock` on crates.io — deferred to SI-13. +- Deprecating or yanking `torrust-tracker-clock` on crates.io — deferred to SI-13. +- Updating `torrust-index` to use `torrust-clock` — deferred to SI-13; an issue will be + opened on `torrust/torrust-index` once the crate is published under the new name. - Moving the crate to a separate repository — see - [1669-13-extract-torrust-clock-to-standalone-repo.md](1669-13-extract-torrust-clock-to-standalone-repo.md). + [1669-13-extract-torrust-clock-to-standalone-repo.md](../drafts/1669-13-extract-torrust-clock-to-standalone-repo.md). - Changes to the crate's API or behaviour. -### Companion work (other repositories) - -`torrust-index` currently contains a copy of the clock code rather than a proper dependency -(see Background). After `torrust-clock` is published, `torrust-index` must be updated to -depend on `torrust-clock` and delete its local copy. This work happens in the -`torrust/torrust-index` repository and must be completed **before** the old crates.io name -`torrust-tracker-clock` is yanked. See T10. - ## Implementation Plan Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`. -| ID | Status | Task | Notes / Expected Output | -| --- | ------ | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | -| T1 | TODO | Rename `name` in `packages/clock/Cargo.toml` | `name = "torrust-clock"` | -| T2 | TODO | Update root `Cargo.toml` workspace dependency key | `torrust-clock = { version = ..., path = "packages/clock" }` | -| T3 | TODO | Update all dependent package `Cargo.toml` files (10 packages, excluding root — see T2) | Replace `torrust-tracker-clock` key with `torrust-clock` in each | -| T4 | TODO | Update Rust source `use` / path references (`torrust_tracker_clock::` → `torrust_clock::`) | Affects `src/`, package sources, and integration tests | -| T5 | TODO | Update prose in `packages/AGENTS.md`, `AGENTS.md`, `docs/packages.md`, `packages/clock/README.md` | Crate name and any inline code snippets | -| T6 | TODO | Run `cargo build --workspace` and `cargo test --workspace` | Clean build and all tests pass | -| T7 | TODO | Run `linter all` | Exit code `0` | -| T8 | TODO | Publish `torrust-clock` on crates.io | Successful `cargo publish -p torrust-clock` | -| T9 | TODO | Add deprecation notice to `torrust-tracker-clock` on crates.io | README / description points to `torrust-clock`; do **not** yank yet | -| T10 | TODO | Update `torrust-index`: replace copied clock code with `torrust-clock` dep | Companion PR in `torrust/torrust-index`; must be merged before T11 | -| T11 | TODO | Yank all versions of `torrust-tracker-clock` on crates.io | All versions yanked; downstream migration (T10) must be complete first | -| T12 | TODO | Update EPIC #1669 `Package Inventory` and `Desired Package State` tables | Move `torrust-clock` from `torrust-tracker-` to `torrust-`; drop `Renamed from` note | +| ID | Status | Task | Notes / Expected Output | +| --- | -------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | +| T1 | TODO | Rename `name` in `packages/clock/Cargo.toml` | `name = "torrust-clock"` | +| T2 | TODO | Update root `Cargo.toml` workspace dependency key | `torrust-clock = { version = ..., path = "packages/clock" }` | +| T3 | TODO | Update all dependent package `Cargo.toml` files (10 packages, excluding root — see T2) | Replace `torrust-tracker-clock` key with `torrust-clock` in each | +| T4 | TODO | Update Rust source `use` / path references (`torrust_tracker_clock::` → `torrust_clock::`) | Affects `src/`, package sources, and integration tests | +| T5 | TODO | Update prose in `packages/AGENTS.md`, `AGENTS.md`, `docs/packages.md`, `packages/clock/README.md` | Crate name and any inline code snippets | +| T6 | TODO | Run `cargo build --workspace` and `cargo test --workspace` | Clean build and all tests pass | +| T7 | TODO | Run `linter all` | Exit code `0` | +| T8 | DEFERRED | Publish `torrust-clock` on crates.io | Deferred to SI-13 | +| T9 | DEFERRED | Add deprecation notice to `torrust-tracker-clock` on crates.io | Deferred to SI-13 | +| T10 | DEFERRED | Update `torrust-index`: replace copied clock code with `torrust-clock` dep | Deferred to SI-13; open issue on `torrust/torrust-index` after crate is published | +| T11 | DEFERRED | Yank all versions of `torrust-tracker-clock` on crates.io | Deferred to SI-13 | +| T12 | TODO | Update EPIC #1669 `Package Inventory` and `Desired Package State` tables | Move `torrust-clock` from `torrust-tracker-` to `torrust-`; drop `Renamed from` note | **Dependent packages to update in T3** (10 files; root `Cargo.toml` is handled in T2): @@ -135,23 +128,24 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`. ### Workflow Checkpoints -- [ ] Spec drafted in `docs/issues/drafts/` -- [ ] Spec reviewed and approved by user/maintainer -- [ ] GitHub issue created and issue number added to this spec -- [ ] Spec moved to `docs/issues/open/` with issue number prefix +- [x] Spec drafted in `docs/issues/drafts/` +- [x] Spec reviewed and approved by user/maintainer +- [x] GitHub issue created and issue number added to this spec +- [x] Spec moved to `docs/issues/open/` with issue number prefix - [ ] Implementation completed - [ ] Automatic verification completed (`linter all`, `cargo test --workspace`) - [ ] Manual verification scenarios executed and recorded - [ ] Acceptance criteria reviewed after implementation and updated with evidence -- [ ] `torrust-clock` published on crates.io; deprecation notice added to old name -- [ ] `torrust-index` migrated to `torrust-clock` (companion PR merged) -- [ ] `torrust-tracker-clock` yanked on crates.io +- [ ] `torrust-clock` published on crates.io; deprecation notice added to old name (deferred to SI-13) +- [ ] `torrust-index` migrated to `torrust-clock` (companion PR merged) (deferred to SI-13) +- [ ] `torrust-tracker-clock` yanked on crates.io (deferred to SI-13) - [ ] EPIC #1669 Active Subissues table updated to `DONE` - [ ] Issue closed and spec moved to `docs/issues/closed/` ### Progress Log - 2026-05-15 12:00 UTC - josecelano - Spec drafted as subissue of EPIC #1669 +- 2026-05-21 12:00 UTC - josecelano - GitHub issue #1821 created; spec moved to `docs/issues/open/`; branch `1821-rename-torrust-tracker-clock-to-torrust-clock` created; crates.io tasks deferred to SI-13 ## Acceptance Criteria @@ -161,10 +155,10 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`. - [ ] `cargo build --workspace` succeeds with zero errors. - [ ] `cargo test --workspace` passes with zero failures. - [ ] `linter all` exits with code `0`. -- [ ] `torrust-clock` is published and visible on crates.io. -- [ ] `torrust-tracker-clock` has a deprecation notice pointing to `torrust-clock`. -- [ ] `torrust-index` no longer contains a local copy of clock code; it depends on `torrust-clock`. -- [ ] `torrust-tracker-clock` is yanked on crates.io (only after `torrust-index` migration is merged). +- [ ] `torrust-clock` is published and visible on crates.io (deferred to SI-13). +- [ ] `torrust-tracker-clock` has a deprecation notice pointing to `torrust-clock` (deferred to SI-13). +- [ ] `torrust-index` no longer contains a local copy of clock code; it depends on `torrust-clock` (deferred to SI-13). +- [ ] `torrust-tracker-clock` is yanked on crates.io (only after `torrust-index` migration is merged) (deferred to SI-13). - [ ] `packages/AGENTS.md`, `AGENTS.md`, `docs/packages.md`, and `packages/clock/README.md` reflect the new crate name. - [ ] EPIC #1669 `Desired Package State` table lists `torrust-clock` in the `torrust-` section. From 660c01d4bf7ce935264fb9213da94e3b5c30c8b4 Mon Sep 17 00:00:00 2001 From: Jose Celano Date: Thu, 21 May 2026 16:57:01 +0100 Subject: [PATCH 2/5] feat(clock): rename crate torrust-tracker-clock to torrust-clock #1821 Rename the `torrust-tracker-clock` crate to `torrust-clock` as specified in issue #1821 (sub-issue SI-09 of EPIC #1669). - Rename `name` in `packages/clock/Cargo.toml` - Update root workspace dependency key - Update all 12 dependent package `Cargo.toml` files - Replace all `torrust_tracker_clock::` references in Rust source files - Update prose in README, AGENTS.md, docs/release_process.md, skills Crates.io publish/deprecation/yank steps are deferred to SI-13. All CI checks pass: `cargo build --workspace`, `cargo test --workspace`, `linter all`. --- .../git-workflow/release-new-version/SKILL.md | 2 +- .../dev/testing/write-unit-test/SKILL.md | 10 ++--- AGENTS.md | 2 +- Cargo.lock | 42 +++++++++---------- Cargo.toml | 2 +- .../analysis/workspace-coupling/src/main.rs | 4 +- .../open/1669-overhaul-packages/EPIC.md | 18 ++++---- ...-torrust-tracker-clock-to-torrust-clock.md | 23 +++++----- docs/release_process.md | 2 +- .../axum-health-check-api-server/Cargo.toml | 2 +- .../tests/integration.rs | 2 +- packages/axum-http-tracker-server/Cargo.toml | 4 +- .../src/environment.rs | 2 +- .../axum-http-tracker-server/src/server.rs | 2 +- .../tests/integration.rs | 2 +- .../axum-rest-tracker-api-server/Cargo.toml | 2 +- .../src/environment.rs | 2 +- .../axum-rest-tracker-api-server/src/lib.rs | 2 +- .../src/server.rs | 2 +- .../src/v1/context/auth_key/resources.rs | 6 +-- .../v1/context/torrent/resources/torrent.rs | 2 +- .../tests/integration.rs | 2 +- packages/clock/Cargo.toml | 6 +-- packages/clock/README.md | 6 +-- packages/clock/src/lib.rs | 2 +- packages/clock/tests/clock/mod.rs | 2 +- packages/clock/tests/integration.rs | 4 +- packages/http-protocol/Cargo.toml | 2 +- packages/http-protocol/src/lib.rs | 2 +- .../http-protocol/src/v1/requests/announce.rs | 2 +- packages/http-tracker-core/Cargo.toml | 2 +- .../http-tracker-core/benches/helpers/util.rs | 2 +- packages/http-tracker-core/src/lib.rs | 4 +- .../http-tracker-core/src/services/scrape.rs | 2 +- .../src/statistics/event/handler.rs | 4 +- .../src/statistics/event/listener.rs | 2 +- .../src/statistics/metrics.rs | 2 +- .../src/statistics/repository.rs | 2 +- packages/metrics/Cargo.toml | 2 +- packages/metrics/src/metric/aggregate/avg.rs | 2 +- packages/metrics/src/metric/aggregate/sum.rs | 2 +- packages/metrics/src/metric/mod.rs | 2 +- .../src/metric_collection/aggregate/avg.rs | 2 +- .../src/metric_collection/aggregate/sum.rs | 2 +- .../src/metric_collection/kind_collection.rs | 2 +- packages/metrics/src/metric_collection/mod.rs | 2 +- .../src/metric_collection/prometheus.rs | 8 ++-- .../metrics/src/metric_collection/serde.rs | 2 +- packages/metrics/src/prometheus.rs | 2 +- packages/metrics/src/sample.rs | 10 ++--- packages/metrics/src/sample_collection.rs | 4 +- packages/primitives/Cargo.toml | 2 +- packages/primitives/src/lib.rs | 6 +-- packages/primitives/src/peer.rs | 8 ++-- .../swarm-coordination-registry/Cargo.toml | 2 +- .../swarm-coordination-registry/src/lib.rs | 4 +- .../statistics/activity_metrics_updater.rs | 4 +- .../src/statistics/event/handler.rs | 18 ++++---- .../src/statistics/event/listener.rs | 2 +- .../src/statistics/metrics.rs | 2 +- .../src/statistics/repository.rs | 2 +- .../src/swarm/coordinator.rs | 6 +-- .../src/swarm/registry.rs | 14 +++---- .../Cargo.toml | 2 +- .../benches/helpers/utils.rs | 2 +- .../src/entry/mod.rs | 2 +- .../src/entry/mutex_parking_lot.rs | 2 +- .../src/entry/mutex_std.rs | 2 +- .../src/entry/mutex_tokio.rs | 2 +- .../src/entry/peer_list.rs | 4 +- .../src/entry/rw_lock_parking_lot.rs | 2 +- .../src/entry/single.rs | 2 +- .../src/lib.rs | 2 +- .../src/repository/dash_map_mutex_std.rs | 2 +- .../src/repository/mod.rs | 2 +- .../src/repository/rw_lock_std.rs | 2 +- .../src/repository/rw_lock_std_mutex_std.rs | 2 +- .../src/repository/rw_lock_std_mutex_tokio.rs | 2 +- .../src/repository/rw_lock_tokio.rs | 2 +- .../src/repository/rw_lock_tokio_mutex_std.rs | 2 +- .../repository/rw_lock_tokio_mutex_tokio.rs | 2 +- .../src/repository/skip_map_mutex_std.rs | 2 +- .../tests/common/repo.rs | 2 +- .../tests/common/torrent.rs | 2 +- .../tests/entry/mod.rs | 4 +- .../tests/integration.rs | 2 +- .../tests/repository/mod.rs | 4 +- packages/tracker-core/Cargo.toml | 2 +- packages/tracker-core/src/announce_handler.rs | 4 +- .../src/authentication/handler.rs | 14 +++---- .../src/authentication/key/mod.rs | 14 +++---- .../src/authentication/key/peer_key.rs | 4 +- .../databases/driver/mysql/auth_key_store.rs | 2 +- .../driver/postgres/auth_key_store.rs | 2 +- .../databases/driver/sqlite/auth_key_store.rs | 2 +- packages/tracker-core/src/lib.rs | 2 +- packages/tracker-core/src/peer_tests.rs | 4 +- .../src/statistics/event/handler.rs | 2 +- .../src/statistics/event/listener.rs | 2 +- .../tracker-core/src/statistics/metrics.rs | 2 +- .../src/statistics/persisted/mod.rs | 2 +- .../tracker-core/src/statistics/repository.rs | 2 +- packages/tracker-core/src/test_helpers.rs | 2 +- packages/tracker-core/src/torrent/manager.rs | 10 ++--- packages/tracker-core/src/torrent/mod.rs | 2 +- .../src/torrent/repository/in_memory.rs | 2 +- packages/tracker-core/src/torrent/services.rs | 2 +- .../tracker-core/tests/common/fixtures.rs | 2 +- .../tracker-core/tests/common/test_env.rs | 2 +- packages/udp-tracker-core/Cargo.toml | 2 +- packages/udp-tracker-core/src/lib.rs | 2 +- packages/udp-tracker-core/src/peer_builder.rs | 2 +- .../src/statistics/event/handler.rs | 4 +- .../src/statistics/event/listener.rs | 2 +- .../src/statistics/metrics.rs | 2 +- .../src/statistics/repository.rs | 2 +- packages/udp-tracker-server/Cargo.toml | 2 +- .../src/banning/event/handler.rs | 2 +- .../src/banning/event/listener.rs | 2 +- .../udp-tracker-server/src/environment.rs | 2 +- .../udp-tracker-server/src/handlers/mod.rs | 2 +- packages/udp-tracker-server/src/lib.rs | 4 +- packages/udp-tracker-server/src/server/mod.rs | 2 +- .../src/statistics/event/handler/error.rs | 4 +- .../src/statistics/event/handler/mod.rs | 2 +- .../event/handler/request_aborted.rs | 4 +- .../event/handler/request_accepted.rs | 4 +- .../event/handler/request_banned.rs | 4 +- .../event/handler/request_received.rs | 4 +- .../statistics/event/handler/response_sent.rs | 4 +- .../src/statistics/event/listener.rs | 2 +- .../src/statistics/metrics.rs | 4 +- .../src/statistics/repository.rs | 6 +-- .../udp-tracker-server/tests/integration.rs | 2 +- src/app.rs | 2 +- src/bootstrap/app.rs | 2 +- .../jobs/activity_metrics_updater.rs | 2 +- src/lib.rs | 2 +- tests/integration.rs | 2 +- 139 files changed, 257 insertions(+), 256 deletions(-) diff --git a/.github/skills/dev/git-workflow/release-new-version/SKILL.md b/.github/skills/dev/git-workflow/release-new-version/SKILL.md index f30898511..bb696bd6f 100644 --- a/.github/skills/dev/git-workflow/release-new-version/SKILL.md +++ b/.github/skills/dev/git-workflow/release-new-version/SKILL.md @@ -103,7 +103,7 @@ ran successfully and the following crates were published: - `torrust-tracker-contrib-bencode` - `torrust-tracker-located-error` - `torrust-tracker-primitives` -- `torrust-tracker-clock` +- `torrust-clock` - `torrust-tracker-configuration` - `torrust-tracker-torrent-repository` - `torrust-tracker-test-helpers` diff --git a/.github/skills/dev/testing/write-unit-test/SKILL.md b/.github/skills/dev/testing/write-unit-test/SKILL.md index ccc007999..816df6280 100644 --- a/.github/skills/dev/testing/write-unit-test/SKILL.md +++ b/.github/skills/dev/testing/write-unit-test/SKILL.md @@ -141,17 +141,17 @@ automatically selects `Working` in production and `Stopped` in tests: ```rust /// Working version, for production. #[cfg(not(test))] -pub(crate) type CurrentClock = torrust_tracker_clock::clock::Working; +pub(crate) type CurrentClock = torrust_clock::clock::Working; /// Stopped version, for testing. #[cfg(test)] -pub(crate) type CurrentClock = torrust_tracker_clock::clock::Stopped; +pub(crate) type CurrentClock = torrust_clock::clock::Stopped; ``` In production code, obtain the current time via the `Time` trait: ```rust -use torrust_tracker_clock::clock::Time as _; +use torrust_clock::clock::Time as _; pub fn is_peer_expired(last_seen: std::time::Duration, ttl: u32) -> bool { let now = CurrentClock::now(); // returns DurationSinceUnixEpoch (= std::time::Duration) @@ -169,8 +169,8 @@ thread-local, so tests are isolated from each other by default. mod tests { use std::time::Duration; - use torrust_tracker_clock::clock::{stopped::Stopped as _, Time as _}; - use torrust_tracker_clock::clock::Stopped; + use torrust_clock::clock::{stopped::Stopped as _, Time as _}; + use torrust_clock::clock::Stopped; use super::*; diff --git a/AGENTS.md b/AGENTS.md index fb7d43c54..19dc32848 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -64,7 +64,7 @@ All packages live under `packages/`. The workspace version is `3.0.0-develop`. | `axum-http-tracker-server` | `torrust-tracker-axum-http-server` | `axum-*` | BitTorrent HTTP tracker server (BEP 3/23) | | `axum-rest-tracker-api-server` | `torrust-tracker-axum-rest-api-server` | `axum-*` | Management REST API server | | `axum-server` | `torrust-tracker-axum-server` | `axum-*` | Base Axum HTTP server infrastructure | -| `clock` | `torrust-tracker-clock` | utilities | Mockable time source for deterministic testing | +| `clock` | `torrust-clock` | utilities | Mockable time source for deterministic testing | | `configuration` | `torrust-tracker-configuration` | domain | Config file parsing, environment variables | | `events` | `torrust-tracker-events` | domain | Domain event definitions | | `http-protocol` | `bittorrent-http-tracker-protocol` | `*-protocol` | HTTP tracker protocol (BEP 3/23) parsing | diff --git a/Cargo.lock b/Cargo.lock index 46ca0a018..fd913ad1d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -471,9 +471,9 @@ dependencies = [ "thiserror 2.0.18", "tokio", "tokio-util", + "torrust-clock", "torrust-metrics", "torrust-net-primitives", - "torrust-tracker-clock", "torrust-tracker-configuration", "torrust-tracker-events", "torrust-tracker-primitives", @@ -495,7 +495,7 @@ dependencies = [ "serde", "serde_bencode", "thiserror 2.0.18", - "torrust-tracker-clock", + "torrust-clock", "torrust-tracker-contrib-bencode", "torrust-tracker-located-error", "torrust-tracker-primitives", @@ -567,8 +567,8 @@ dependencies = [ "thiserror 2.0.18", "tokio", "tokio-util", + "torrust-clock", "torrust-metrics", - "torrust-tracker-clock", "torrust-tracker-configuration", "torrust-tracker-events", "torrust-tracker-located-error", @@ -597,9 +597,9 @@ dependencies = [ "thiserror 2.0.18", "tokio", "tokio-util", + "torrust-clock", "torrust-metrics", "torrust-net-primitives", - "torrust-tracker-clock", "torrust-tracker-configuration", "torrust-tracker-events", "torrust-tracker-primitives", @@ -5102,6 +5102,14 @@ dependencies = [ "tonic", ] +[[package]] +name = "torrust-clock" +version = "3.0.0-develop" +dependencies = [ + "chrono", + "tracing", +] + [[package]] name = "torrust-metrics" version = "3.0.0-develop" @@ -5117,7 +5125,7 @@ dependencies = [ "serde", "serde_json", "thiserror 2.0.18", - "torrust-tracker-clock", + "torrust-clock", "tracing", ] @@ -5169,12 +5177,12 @@ dependencies = [ "tokio", "tokio-util", "toml 1.1.2+spec-1.1.0", + "torrust-clock", "torrust-server-lib", "torrust-tracker-axum-health-check-api-server", "torrust-tracker-axum-http-server", "torrust-tracker-axum-rest-api-server", "torrust-tracker-axum-server", - "torrust-tracker-clock", "torrust-tracker-configuration", "torrust-tracker-rest-api-client", "torrust-tracker-rest-api-core", @@ -5197,13 +5205,13 @@ dependencies = [ "serde", "serde_json", "tokio", + "torrust-clock", "torrust-net-primitives", "torrust-server-lib", "torrust-tracker-axum-health-check-api-server", "torrust-tracker-axum-http-server", "torrust-tracker-axum-rest-api-server", "torrust-tracker-axum-server", - "torrust-tracker-clock", "torrust-tracker-configuration", "torrust-tracker-test-helpers", "torrust-tracker-udp-server", @@ -5237,10 +5245,10 @@ dependencies = [ "serde_repr", "tokio", "tokio-util", + "torrust-clock", "torrust-net-primitives", "torrust-server-lib", "torrust-tracker-axum-server", - "torrust-tracker-clock", "torrust-tracker-configuration", "torrust-tracker-primitives", "torrust-tracker-swarm-coordination-registry", @@ -5271,11 +5279,11 @@ dependencies = [ "serde_with", "thiserror 2.0.18", "tokio", + "torrust-clock", "torrust-metrics", "torrust-net-primitives", "torrust-server-lib", "torrust-tracker-axum-server", - "torrust-tracker-clock", "torrust-tracker-configuration", "torrust-tracker-primitives", "torrust-tracker-rest-api-client", @@ -5335,14 +5343,6 @@ dependencies = [ "url", ] -[[package]] -name = "torrust-tracker-clock" -version = "3.0.0-develop" -dependencies = [ - "chrono", - "tracing", -] - [[package]] name = "torrust-tracker-configuration" version = "3.0.0-develop" @@ -5400,8 +5400,8 @@ dependencies = [ "tdyne-peer-id", "tdyne-peer-id-registry", "thiserror 2.0.18", + "torrust-clock", "torrust-net-primitives", - "torrust-tracker-clock", ] [[package]] @@ -5448,8 +5448,8 @@ dependencies = [ "thiserror 2.0.18", "tokio", "tokio-util", + "torrust-clock", "torrust-metrics", - "torrust-tracker-clock", "torrust-tracker-configuration", "torrust-tracker-events", "torrust-tracker-primitives", @@ -5478,7 +5478,7 @@ dependencies = [ "parking_lot", "rstest 0.26.1", "tokio", - "torrust-tracker-clock", + "torrust-clock", "torrust-tracker-configuration", "torrust-tracker-primitives", ] @@ -5502,10 +5502,10 @@ dependencies = [ "thiserror 2.0.18", "tokio", "tokio-util", + "torrust-clock", "torrust-metrics", "torrust-net-primitives", "torrust-server-lib", - "torrust-tracker-clock", "torrust-tracker-configuration", "torrust-tracker-events", "torrust-tracker-primitives", diff --git a/Cargo.toml b/Cargo.toml index 11738fd44..9444f2bab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,7 +61,7 @@ torrust-tracker-axum-server = { version = "3.0.0-develop", path = "packages/axum torrust-tracker-rest-api-client = { version = "3.0.0-develop", path = "packages/rest-tracker-api-client" } torrust-tracker-rest-api-core = { version = "3.0.0-develop", path = "packages/rest-tracker-api-core" } torrust-server-lib = { version = "3.0.0-develop", path = "packages/server-lib" } -torrust-tracker-clock = { version = "3.0.0-develop", path = "packages/clock" } +torrust-clock = { version = "3.0.0-develop", path = "packages/clock" } torrust-tracker-configuration = { version = "3.0.0-develop", path = "packages/configuration" } torrust-tracker-swarm-coordination-registry = { version = "3.0.0-develop", path = "packages/swarm-coordination-registry" } torrust-tracker-udp-server = { version = "3.0.0-develop", path = "packages/udp-tracker-server" } diff --git a/contrib/dev-tools/analysis/workspace-coupling/src/main.rs b/contrib/dev-tools/analysis/workspace-coupling/src/main.rs index c631708f0..6aa8a839c 100644 --- a/contrib/dev-tools/analysis/workspace-coupling/src/main.rs +++ b/contrib/dev-tools/analysis/workspace-coupling/src/main.rs @@ -289,9 +289,9 @@ fn write_observations(out: &mut String) { writeln!(out).unwrap(); writeln!(out, "### Known thin dependencies (pre-existing)").unwrap(); writeln!(out).unwrap(); - writeln!(out, "- `torrust-tracker-clock` → `torrust-tracker-primitives`: only").unwrap(); + writeln!(out, "- `torrust-clock` → `torrust-tracker-primitives`: only").unwrap(); writeln!(out, " `DurationSinceUnixEpoch` imported. Addressed by SI-02.").unwrap(); - writeln!(out, "- `torrust-tracker-configuration` → `torrust-tracker-clock`: only").unwrap(); + writeln!(out, "- `torrust-tracker-configuration` → `torrust-clock`: only").unwrap(); writeln!(out, " `DEFAULT_TIMEOUT` imported. Addressed by SI-03.").unwrap(); writeln!(out).unwrap(); writeln!(out, "### New findings").unwrap(); diff --git a/docs/issues/open/1669-overhaul-packages/EPIC.md b/docs/issues/open/1669-overhaul-packages/EPIC.md index 6324344d7..1ea9a9734 100644 --- a/docs/issues/open/1669-overhaul-packages/EPIC.md +++ b/docs/issues/open/1669-overhaul-packages/EPIC.md @@ -60,6 +60,7 @@ The workspace currently contains **27 packages** (including the root `torrust-tr | Published on crates.io | Crate Name | Folder | | ---------------------- | ------------------------ | ---------------- | +| Yes | `torrust-clock` | `clock` | | No | `torrust-metrics` | `metrics` | | No | `torrust-net-primitives` | `net-primitives` | | No | `torrust-server-lib` | `server-lib` | @@ -73,7 +74,6 @@ The workspace currently contains **27 packages** (including the root `torrust-tr | No | `torrust-tracker-axum-rest-api-server` | `axum-rest-tracker-api-server` | | No | `torrust-tracker-axum-server` | `axum-server` | | No | `torrust-tracker-client` | `console/tracker-client` | -| Yes | `torrust-tracker-clock` | `clock` | | Yes | `torrust-tracker-configuration` | `configuration` | | Yes | `torrust-tracker-contrib-bencode` | `contrib/bencode` | | No | `torrust-tracker-events` | `events` | @@ -115,12 +115,12 @@ destination group with a "Renamed from …" note. ### `torrust-` prefix (non-`torrust-tracker-`) -| Published on crates.io | Crate Name | Folder | Change | -| ---------------------- | ------------------------ | ---------------- | -------------------------------------------- | -| Yes | `torrust-clock` | `clock` | Renamed from `torrust-tracker-clock` | -| Yes | `torrust-located-error` | `located-error` | Renamed from `torrust-tracker-located-error` | -| Yes | `torrust-net-primitives` | `net-primitives` | New package (created by SI-05) | -| No | `torrust-metrics` | `metrics` | — | +| Published on crates.io | Crate Name | Folder | Change | +| ---------------------- | ------------------------ | ---------------- | ---------------------------------------------------- | +| Yes | `torrust-clock` | `clock` | Renamed from `torrust-tracker-clock` ✓ (SI-09 #1821) | +| Yes | `torrust-located-error` | `located-error` | Renamed from `torrust-tracker-located-error` | +| Yes | `torrust-net-primitives` | `net-primitives` | New package (created by SI-05) | +| No | `torrust-metrics` | `metrics` | — | ### `torrust-tracker-` prefix @@ -215,7 +215,7 @@ Status: TODO unless noted. `SI-XX` = recommended implementation sequence number. - [x] SI-06 — [#1813](https://github.com/torrust/torrust-tracker/issues/1813) Resolve `bittorrent-tracker-core` ↔ `torrust-tracker-rest-api-client` layer violation _(Rule M; prerequisite for `bittorrent-tracker-core` extraction)_ - [x] SI-07 — [#1816](https://github.com/torrust/torrust-tracker/issues/1816) Align `torrust-` prefix: rename 7 tracker-specific packages to `torrust-tracker-` _(Rule U; no blockers)_ - [x] SI-08 — [#1819](https://github.com/torrust/torrust-tracker/issues/1819) Rename `torrust-tracker-metrics` to `torrust-metrics` _(Rule U; no blockers)_ -- [ ] SI-09 — [#1821](https://github.com/torrust/torrust-tracker/issues/1821) Rename `torrust-tracker-clock` to `torrust-clock` _(Rule P; no blockers)_ +- [x] SI-09 — [#1821](https://github.com/torrust/torrust-tracker/issues/1821) Rename `torrust-tracker-clock` to `torrust-clock` _(Rule P; no blockers)_ - [ ] SI-10 — Rename `torrust-tracker-located-error` to `torrust-located-error` _(Rule P; no blockers)_ - [ ] SI-11 — Update all package READMEs _(documentation; after SI-07–SI-10; before SI-12)_ - [ ] SI-12 — Extract and rename `torrust-tracker-contrib-bencode` to `torrust-bencode` _(Rule E; no blockers within this EPIC)_ @@ -235,7 +235,7 @@ Details: | SI-06 | [#1813](https://github.com/torrust/torrust-tracker/issues/1813) — Resolve `bittorrent-tracker-core` ↔ `torrust-tracker-rest-api-client` layer violation | [docs/issues/closed/1813-1669-06-resolve-bittorrent-tracker-core-rest-api-layer-violation.md](../../closed/1813-1669-06-resolve-bittorrent-tracker-core-rest-api-layer-violation.md) | DONE | Rule M; stale unused dev dep removed in PR #1804; unblocks `bittorrent-tracker-core` extraction | | SI-07 | [#1816](https://github.com/torrust/torrust-tracker/issues/1816) — Align `torrust-` prefix: rename 7 tracker-specific packages to `torrust-tracker-` | [docs/issues/open/1816-1669-07-align-torrust-prefix-rename-tracker-specific-packages.md](../../open/1816-1669-07-align-torrust-prefix-rename-tracker-specific-packages.md) | DONE | Rule U; none of the 7 are published; pure workspace rename; no blockers | | SI-08 | [#1819](https://github.com/torrust/torrust-tracker/issues/1819) — Rename `torrust-tracker-metrics` to `torrust-metrics` | [docs/issues/open/1819-1669-08-rename-torrust-tracker-metrics-to-torrust-metrics.md](../../open/1819-1669-08-rename-torrust-tracker-metrics-to-torrust-metrics.md) | DONE | Rule U; not yet published; no blockers; prerequisite for SI-14 | -| SI-09 | [#1821](https://github.com/torrust/torrust-tracker/issues/1821) — Rename `torrust-tracker-clock` to `torrust-clock` | [docs/issues/open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md](../../open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md) | TODO | Rule P; published on crates.io; no blockers; prerequisite for SI-13 | +| SI-09 | [#1821](https://github.com/torrust/torrust-tracker/issues/1821) — Rename `torrust-tracker-clock` to `torrust-clock` | [docs/issues/open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md](../../open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md) | DONE | Rule P; published on crates.io; no blockers; prerequisite for SI-13 | | SI-10 | #TBD — Rename `torrust-tracker-located-error` to `torrust-located-error` | [docs/issues/drafts/1669-10-rename-torrust-tracker-located-error-to-torrust-located-error.md](../../drafts/1669-10-rename-torrust-tracker-located-error-to-torrust-located-error.md) | TODO | Rule P; published on crates.io; no blockers | | SI-11 | #TBD — Update all package READMEs | [docs/issues/drafts/1669-11-update-all-package-readmes.md](../../drafts/1669-11-update-all-package-readmes.md) | TODO | Documentation; requires SI-07–SI-10; before SI-12 | | SI-12 | #TBD — Extract and rename `torrust-tracker-contrib-bencode` to `torrust-bencode` | [docs/issues/drafts/1669-12-extract-torrust-tracker-contrib-bencode-to-torrust-bencode.md](../../drafts/1669-12-extract-torrust-tracker-contrib-bencode-to-torrust-bencode.md) | TODO | Rule E; no workspace-dep blockers; Apache-2.0; one internal consumer | diff --git a/docs/issues/open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md b/docs/issues/open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md index f919fe324..1840d3f9b 100644 --- a/docs/issues/open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md +++ b/docs/issues/open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md @@ -98,18 +98,18 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`. | ID | Status | Task | Notes / Expected Output | | --- | -------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | -| T1 | TODO | Rename `name` in `packages/clock/Cargo.toml` | `name = "torrust-clock"` | -| T2 | TODO | Update root `Cargo.toml` workspace dependency key | `torrust-clock = { version = ..., path = "packages/clock" }` | -| T3 | TODO | Update all dependent package `Cargo.toml` files (10 packages, excluding root — see T2) | Replace `torrust-tracker-clock` key with `torrust-clock` in each | -| T4 | TODO | Update Rust source `use` / path references (`torrust_tracker_clock::` → `torrust_clock::`) | Affects `src/`, package sources, and integration tests | -| T5 | TODO | Update prose in `packages/AGENTS.md`, `AGENTS.md`, `docs/packages.md`, `packages/clock/README.md` | Crate name and any inline code snippets | -| T6 | TODO | Run `cargo build --workspace` and `cargo test --workspace` | Clean build and all tests pass | -| T7 | TODO | Run `linter all` | Exit code `0` | +| T1 | DONE | Rename `name` in `packages/clock/Cargo.toml` | `name = "torrust-clock"` | +| T2 | DONE | Update root `Cargo.toml` workspace dependency key | `torrust-clock = { version = ..., path = "packages/clock" }` | +| T3 | DONE | Update all dependent package `Cargo.toml` files (10 packages, excluding root — see T2) | Replace `torrust-tracker-clock` key with `torrust-clock` in each | +| T4 | DONE | Update Rust source `use` / path references (`torrust_tracker_clock::` → `torrust_clock::`) | Affects `src/`, package sources, and integration tests | +| T5 | DONE | Update prose in `packages/AGENTS.md`, `AGENTS.md`, `docs/packages.md`, `packages/clock/README.md` | Crate name and any inline code snippets | +| T6 | DONE | Run `cargo build --workspace` and `cargo test --workspace` | Clean build and all tests pass | +| T7 | DONE | Run `linter all` | Exit code `0` | | T8 | DEFERRED | Publish `torrust-clock` on crates.io | Deferred to SI-13 | | T9 | DEFERRED | Add deprecation notice to `torrust-tracker-clock` on crates.io | Deferred to SI-13 | | T10 | DEFERRED | Update `torrust-index`: replace copied clock code with `torrust-clock` dep | Deferred to SI-13; open issue on `torrust/torrust-index` after crate is published | | T11 | DEFERRED | Yank all versions of `torrust-tracker-clock` on crates.io | Deferred to SI-13 | -| T12 | TODO | Update EPIC #1669 `Package Inventory` and `Desired Package State` tables | Move `torrust-clock` from `torrust-tracker-` to `torrust-`; drop `Renamed from` note | +| T12 | DONE | Update EPIC #1669 `Package Inventory` and `Desired Package State` tables | Move `torrust-clock` from `torrust-tracker-` to `torrust-`; drop `Renamed from` note | **Dependent packages to update in T3** (10 files; root `Cargo.toml` is handled in T2): @@ -132,20 +132,21 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`. - [x] Spec reviewed and approved by user/maintainer - [x] GitHub issue created and issue number added to this spec - [x] Spec moved to `docs/issues/open/` with issue number prefix -- [ ] Implementation completed -- [ ] Automatic verification completed (`linter all`, `cargo test --workspace`) +- [x] Implementation completed +- [x] Automatic verification completed (`linter all`, `cargo test --workspace`) - [ ] Manual verification scenarios executed and recorded - [ ] Acceptance criteria reviewed after implementation and updated with evidence - [ ] `torrust-clock` published on crates.io; deprecation notice added to old name (deferred to SI-13) - [ ] `torrust-index` migrated to `torrust-clock` (companion PR merged) (deferred to SI-13) - [ ] `torrust-tracker-clock` yanked on crates.io (deferred to SI-13) -- [ ] EPIC #1669 Active Subissues table updated to `DONE` +- [x] EPIC #1669 Active Subissues table updated to `DONE` - [ ] Issue closed and spec moved to `docs/issues/closed/` ### Progress Log - 2026-05-15 12:00 UTC - josecelano - Spec drafted as subissue of EPIC #1669 - 2026-05-21 12:00 UTC - josecelano - GitHub issue #1821 created; spec moved to `docs/issues/open/`; branch `1821-rename-torrust-tracker-clock-to-torrust-clock` created; crates.io tasks deferred to SI-13 +- 2026-05-21 15:50 UTC - josecelano - Implementation complete: T1–T7 + T12 done; `cargo build --workspace`, `cargo test --workspace`, `linter all` all pass; EPIC updated ## Acceptance Criteria diff --git a/docs/release_process.md b/docs/release_process.md index 03c8fef4b..5e96d453c 100644 --- a/docs/release_process.md +++ b/docs/release_process.md @@ -82,7 +82,7 @@ Make sure the [deployment](https://github.com/torrust/torrust-tracker/actions/wo - [torrust-tracker-contrib-bencode](https://crates.io/crates/torrust-tracker-contrib-bencode) - [torrust-tracker-located-error](https://crates.io/crates/torrust-tracker-located-error) - [torrust-tracker-primitives](https://crates.io/crates/torrust-tracker-primitives) -- [torrust-tracker-clock](https://crates.io/crates/torrust-tracker-clock) +- [torrust-clock](https://crates.io/crates/torrust-clock) - [torrust-tracker-configuration](https://crates.io/crates/torrust-tracker-configuration) - [torrust-tracker-torrent-repository](https://crates.io/crates/torrust-tracker-torrent-repository) - [torrust-tracker-test-helpers](https://crates.io/crates/torrust-tracker-test-helpers) diff --git a/packages/axum-health-check-api-server/Cargo.toml b/packages/axum-health-check-api-server/Cargo.toml index c1c7cb608..fe7c518a9 100644 --- a/packages/axum-health-check-api-server/Cargo.toml +++ b/packages/axum-health-check-api-server/Cargo.toml @@ -34,6 +34,6 @@ reqwest = { version = "0", features = [ "json" ] } torrust-tracker-axum-health-check-api-server = { version = "3.0.0-develop", path = "../axum-health-check-api-server" } torrust-tracker-axum-http-server = { version = "3.0.0-develop", path = "../axum-http-tracker-server" } torrust-tracker-axum-rest-api-server = { version = "3.0.0-develop", path = "../axum-rest-tracker-api-server" } -torrust-tracker-clock = { version = "3.0.0-develop", path = "../clock" } +torrust-clock = { version = "3.0.0-develop", path = "../clock" } torrust-tracker-test-helpers = { version = "3.0.0-develop", path = "../test-helpers" } torrust-tracker-udp-server = { version = "3.0.0-develop", path = "../udp-tracker-server" } diff --git a/packages/axum-health-check-api-server/tests/integration.rs b/packages/axum-health-check-api-server/tests/integration.rs index 13ca963a3..ebf1bf968 100644 --- a/packages/axum-health-check-api-server/tests/integration.rs +++ b/packages/axum-health-check-api-server/tests/integration.rs @@ -5,7 +5,7 @@ //! ``` mod server; -use torrust_tracker_clock::clock; +use torrust_clock::clock; /// This code needs to be copied into each crate. /// Working version, for production. diff --git a/packages/axum-http-tracker-server/Cargo.toml b/packages/axum-http-tracker-server/Cargo.toml index 7679f21db..fcb3cc179 100644 --- a/packages/axum-http-tracker-server/Cargo.toml +++ b/packages/axum-http-tracker-server/Cargo.toml @@ -31,7 +31,7 @@ tokio = { version = "1", features = [ "macros", "net", "rt-multi-thread", "signa tokio-util = "0.7.15" torrust-tracker-axum-server = { version = "3.0.0-develop", path = "../axum-server" } torrust-server-lib = { version = "3.0.0-develop", path = "../server-lib" } -torrust-tracker-clock = { version = "3.0.0-develop", path = "../clock" } +torrust-clock = { version = "3.0.0-develop", path = "../clock" } torrust-tracker-configuration = { version = "3.0.0-develop", path = "../configuration" } torrust-net-primitives = { version = "3.0.0-develop", path = "../net-primitives" } torrust-tracker-primitives = { version = "3.0.0-develop", path = "../primitives" } @@ -47,7 +47,7 @@ rand = "0.9" serde_bencode = "0" serde_bytes = "0" serde_repr = "0" -torrust-tracker-clock = { version = "3.0.0-develop", path = "../clock" } +torrust-clock = { version = "3.0.0-develop", path = "../clock" } torrust-tracker-test-helpers = { version = "3.0.0-develop", path = "../test-helpers" } uuid = { version = "1", features = [ "v4" ] } diff --git a/packages/axum-http-tracker-server/src/environment.rs b/packages/axum-http-tracker-server/src/environment.rs index a8d4a288e..6d72ba53c 100644 --- a/packages/axum-http-tracker-server/src/environment.rs +++ b/packages/axum-http-tracker-server/src/environment.rs @@ -173,5 +173,5 @@ fn initialize_global_services(configuration: &Configuration) { } fn initialize_static() { - torrust_tracker_clock::initialize_static(); + torrust_clock::initialize_static(); } diff --git a/packages/axum-http-tracker-server/src/server.rs b/packages/axum-http-tracker-server/src/server.rs index 56cf00389..8684f3d51 100644 --- a/packages/axum-http-tracker-server/src/server.rs +++ b/packages/axum-http-tracker-server/src/server.rs @@ -337,7 +337,7 @@ mod tests { } fn initialize_static() { - torrust_tracker_clock::initialize_static(); + torrust_clock::initialize_static(); } #[tokio::test] diff --git a/packages/axum-http-tracker-server/tests/integration.rs b/packages/axum-http-tracker-server/tests/integration.rs index 70b3aeb89..9d05c95c1 100644 --- a/packages/axum-http-tracker-server/tests/integration.rs +++ b/packages/axum-http-tracker-server/tests/integration.rs @@ -6,7 +6,7 @@ mod common; mod server; -use torrust_tracker_clock::clock; +use torrust_clock::clock; /// This code needs to be copied into each crate. /// Working version, for production. diff --git a/packages/axum-rest-tracker-api-server/Cargo.toml b/packages/axum-rest-tracker-api-server/Cargo.toml index ce5410362..1a997b6ed 100644 --- a/packages/axum-rest-tracker-api-server/Cargo.toml +++ b/packages/axum-rest-tracker-api-server/Cargo.toml @@ -34,7 +34,7 @@ torrust-tracker-axum-server = { version = "3.0.0-develop", path = "../axum-serve torrust-tracker-rest-api-client = { version = "3.0.0-develop", path = "../rest-tracker-api-client" } torrust-tracker-rest-api-core = { version = "3.0.0-develop", path = "../rest-tracker-api-core" } torrust-server-lib = { version = "3.0.0-develop", path = "../server-lib" } -torrust-tracker-clock = { version = "3.0.0-develop", path = "../clock" } +torrust-clock = { version = "3.0.0-develop", path = "../clock" } torrust-tracker-configuration = { version = "3.0.0-develop", path = "../configuration" } torrust-metrics = { version = "3.0.0-develop", path = "../metrics" } torrust-net-primitives = { version = "3.0.0-develop", path = "../net-primitives" } diff --git a/packages/axum-rest-tracker-api-server/src/environment.rs b/packages/axum-rest-tracker-api-server/src/environment.rs index 81d1b9882..48488e49f 100644 --- a/packages/axum-rest-tracker-api-server/src/environment.rs +++ b/packages/axum-rest-tracker-api-server/src/environment.rs @@ -210,6 +210,6 @@ fn initialize_global_services(configuration: &Configuration) { } fn initialize_static() { - torrust_tracker_clock::initialize_static(); + torrust_clock::initialize_static(); bittorrent_udp_tracker_core::initialize_static(); } diff --git a/packages/axum-rest-tracker-api-server/src/lib.rs b/packages/axum-rest-tracker-api-server/src/lib.rs index 0ed026654..ed8bb7581 100644 --- a/packages/axum-rest-tracker-api-server/src/lib.rs +++ b/packages/axum-rest-tracker-api-server/src/lib.rs @@ -159,7 +159,7 @@ pub mod server; pub mod v1; use serde::{Deserialize, Serialize}; -use torrust_tracker_clock::clock; +use torrust_clock::clock; /// This code needs to be copied into each crate. /// Working version, for production. diff --git a/packages/axum-rest-tracker-api-server/src/server.rs b/packages/axum-rest-tracker-api-server/src/server.rs index 21235decd..305d62731 100644 --- a/packages/axum-rest-tracker-api-server/src/server.rs +++ b/packages/axum-rest-tracker-api-server/src/server.rs @@ -321,7 +321,7 @@ mod tests { } fn initialize_static() { - torrust_tracker_clock::initialize_static(); + torrust_clock::initialize_static(); bittorrent_udp_tracker_core::initialize_static(); } diff --git a/packages/axum-rest-tracker-api-server/src/v1/context/auth_key/resources.rs b/packages/axum-rest-tracker-api-server/src/v1/context/auth_key/resources.rs index 357f1c365..0b3c69f1a 100644 --- a/packages/axum-rest-tracker-api-server/src/v1/context/auth_key/resources.rs +++ b/packages/axum-rest-tracker-api-server/src/v1/context/auth_key/resources.rs @@ -2,7 +2,7 @@ use bittorrent_tracker_core::authentication::{self, Key}; use serde::{Deserialize, Serialize}; -use torrust_tracker_clock::conv::convert_from_iso_8601_to_timestamp; +use torrust_clock::conv::convert_from_iso_8601_to_timestamp; /// A resource that represents an authentication key. #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] @@ -50,8 +50,8 @@ mod tests { use std::time::Duration; use bittorrent_tracker_core::authentication::{self, Key}; - use torrust_tracker_clock::clock::stopped::Stopped as _; - use torrust_tracker_clock::clock::{self, Time}; + use torrust_clock::clock::stopped::Stopped as _; + use torrust_clock::clock::{self, Time}; use super::AuthKey; use crate::CurrentClock; diff --git a/packages/axum-rest-tracker-api-server/src/v1/context/torrent/resources/torrent.rs b/packages/axum-rest-tracker-api-server/src/v1/context/torrent/resources/torrent.rs index c5e5a721e..8b5d53b83 100644 --- a/packages/axum-rest-tracker-api-server/src/v1/context/torrent/resources/torrent.rs +++ b/packages/axum-rest-tracker-api-server/src/v1/context/torrent/resources/torrent.rs @@ -98,7 +98,7 @@ mod tests { use bittorrent_primitives::info_hash::InfoHash; use bittorrent_tracker_core::torrent::services::{BasicInfo, Info}; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_primitives::{AnnounceEvent, NumberOfBytes, PeerId, peer}; use super::Torrent; diff --git a/packages/axum-rest-tracker-api-server/tests/integration.rs b/packages/axum-rest-tracker-api-server/tests/integration.rs index 878ac203d..e8be161f2 100644 --- a/packages/axum-rest-tracker-api-server/tests/integration.rs +++ b/packages/axum-rest-tracker-api-server/tests/integration.rs @@ -4,7 +4,7 @@ //! cargo test --test integration //! ``` -use torrust_tracker_clock::clock; +use torrust_clock::clock; mod common; mod server; diff --git a/packages/clock/Cargo.toml b/packages/clock/Cargo.toml index 3e96b4243..04d450820 100644 --- a/packages/clock/Cargo.toml +++ b/packages/clock/Cargo.toml @@ -1,7 +1,7 @@ [package] -description = "A library to a clock for the torrust tracker." -keywords = [ "clock", "library", "torrents" ] -name = "torrust-tracker-clock" +description = "A library providing a working and mockable clock for deterministic testing." +keywords = [ "clock", "library", "time" ] +name = "torrust-clock" readme = "README.md" authors.workspace = true diff --git a/packages/clock/README.md b/packages/clock/README.md index bfdd7808f..4e769fdb9 100644 --- a/packages/clock/README.md +++ b/packages/clock/README.md @@ -1,10 +1,10 @@ -# Torrust Tracker Clock +# Torrust Clock -A library to provide a working and mockable clock for the [Torrust Tracker](https://github.com/torrust/torrust-tracker). +A library to provide a working and mockable clock. It is a generic utility with no tracker-specific logic, reusable in any Rust project. ## Documentation -[Crate documentation](https://docs.rs/torrust-tracker-torrent-clock). +[Crate documentation](https://docs.rs/torrust-clock). ## License diff --git a/packages/clock/src/lib.rs b/packages/clock/src/lib.rs index 2c2195d8a..68d65a1e4 100644 --- a/packages/clock/src/lib.rs +++ b/packages/clock/src/lib.rs @@ -31,7 +31,7 @@ use tracing::instrument; /// A duration measured from the Unix Epoch (1970-01-01 00:00:00 UTC). /// /// This is a type alias for [`std::time::Duration`]. It carries no -/// tracker-specific logic and lives here so that `torrust-tracker-clock` +/// tracker-specific logic and lives here so that `torrust-clock` /// has no dependency on `torrust-tracker-primitives`. pub type DurationSinceUnixEpoch = std::time::Duration; diff --git a/packages/clock/tests/clock/mod.rs b/packages/clock/tests/clock/mod.rs index 5d94bb83d..62c549312 100644 --- a/packages/clock/tests/clock/mod.rs +++ b/packages/clock/tests/clock/mod.rs @@ -1,6 +1,6 @@ use std::time::Duration; -use torrust_tracker_clock::clock::Time; +use torrust_clock::clock::Time; use crate::CurrentClock; diff --git a/packages/clock/tests/integration.rs b/packages/clock/tests/integration.rs index fa500227a..ffa7fc36e 100644 --- a/packages/clock/tests/integration.rs +++ b/packages/clock/tests/integration.rs @@ -11,9 +11,9 @@ mod clock; /// Working version, for production. #[cfg(not(test))] #[allow(dead_code)] -pub(crate) type CurrentClock = torrust_tracker_clock::clock::Working; +pub(crate) type CurrentClock = torrust_clock::clock::Working; /// Stopped version, for testing. #[cfg(test)] #[allow(dead_code)] -pub(crate) type CurrentClock = torrust_tracker_clock::clock::Stopped; +pub(crate) type CurrentClock = torrust_clock::clock::Stopped; diff --git a/packages/http-protocol/Cargo.toml b/packages/http-protocol/Cargo.toml index 94d9162e2..3bb5b2a12 100644 --- a/packages/http-protocol/Cargo.toml +++ b/packages/http-protocol/Cargo.toml @@ -24,7 +24,7 @@ percent-encoding = "2" serde = { version = "1", features = [ "derive" ] } serde_bencode = "0" thiserror = "2" -torrust-tracker-clock = { version = "3.0.0-develop", path = "../clock" } +torrust-clock = { version = "3.0.0-develop", path = "../clock" } torrust-tracker-contrib-bencode = { version = "3.0.0-develop", path = "../../contrib/bencode" } torrust-tracker-located-error = { version = "3.0.0-develop", path = "../located-error" } torrust-tracker-primitives = { version = "3.0.0-develop", path = "../primitives" } diff --git a/packages/http-protocol/src/lib.rs b/packages/http-protocol/src/lib.rs index 326a5b182..2851ba8cd 100644 --- a/packages/http-protocol/src/lib.rs +++ b/packages/http-protocol/src/lib.rs @@ -2,7 +2,7 @@ pub mod percent_encoding; pub mod v1; -use torrust_tracker_clock::clock; +use torrust_clock::clock; /// This code needs to be copied into each crate. /// Working version, for production. diff --git a/packages/http-protocol/src/v1/requests/announce.rs b/packages/http-protocol/src/v1/requests/announce.rs index 2f4752535..74ac5d80c 100644 --- a/packages/http-protocol/src/v1/requests/announce.rs +++ b/packages/http-protocol/src/v1/requests/announce.rs @@ -8,7 +8,7 @@ use std::str::FromStr; use bittorrent_primitives::info_hash::{self, InfoHash}; use thiserror::Error; -use torrust_tracker_clock::clock::Time; +use torrust_clock::clock::Time; use torrust_tracker_located_error::{Located, LocatedError}; use torrust_tracker_primitives::{AnnounceEvent, NumberOfBytes, PeerId, peer}; diff --git a/packages/http-tracker-core/Cargo.toml b/packages/http-tracker-core/Cargo.toml index b38853b3e..37b1eb86b 100644 --- a/packages/http-tracker-core/Cargo.toml +++ b/packages/http-tracker-core/Cargo.toml @@ -23,7 +23,7 @@ serde = "1.0.219" thiserror = "2" tokio = { version = "1", features = [ "macros", "net", "rt-multi-thread", "signal", "sync" ] } tokio-util = "0.7.15" -torrust-tracker-clock = { version = "3.0.0-develop", path = "../clock" } +torrust-clock = { version = "3.0.0-develop", path = "../clock" } torrust-tracker-configuration = { version = "3.0.0-develop", path = "../configuration" } torrust-tracker-events = { version = "3.0.0-develop", path = "../events" } torrust-metrics = { version = "3.0.0-develop", path = "../metrics" } diff --git a/packages/http-tracker-core/benches/helpers/util.rs b/packages/http-tracker-core/benches/helpers/util.rs index 899c8bc4a..10628537a 100644 --- a/packages/http-tracker-core/benches/helpers/util.rs +++ b/packages/http-tracker-core/benches/helpers/util.rs @@ -20,7 +20,7 @@ use bittorrent_tracker_core::whitelist::repository::in_memory::InMemoryWhitelist use futures::future::BoxFuture; use mockall::mock; use tokio_util::sync::CancellationToken; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::{Configuration, Core}; use torrust_tracker_events::sender::SendError; use torrust_tracker_primitives::peer::Peer; diff --git a/packages/http-tracker-core/src/lib.rs b/packages/http-tracker-core/src/lib.rs index a9943c93e..974229a11 100644 --- a/packages/http-tracker-core/src/lib.rs +++ b/packages/http-tracker-core/src/lib.rs @@ -3,7 +3,7 @@ pub mod event; pub mod services; pub mod statistics; -use torrust_tracker_clock::clock; +use torrust_clock::clock; /// This code needs to be copied into each crate. /// Working version, for production. @@ -23,7 +23,7 @@ pub(crate) mod tests { use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; use bittorrent_primitives::info_hash::InfoHash; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_primitives::{AnnounceEvent, NumberOfBytes, PeerId, peer}; /// # Panics diff --git a/packages/http-tracker-core/src/services/scrape.rs b/packages/http-tracker-core/src/services/scrape.rs index 962912a9a..2bfaa4c3b 100644 --- a/packages/http-tracker-core/src/services/scrape.rs +++ b/packages/http-tracker-core/src/services/scrape.rs @@ -181,7 +181,7 @@ mod tests { use bittorrent_tracker_core::whitelist::repository::in_memory::InMemoryWhitelist; use futures::future::BoxFuture; use mockall::mock; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::Configuration; use torrust_tracker_events::sender::SendError; use torrust_tracker_primitives::{AnnounceEvent, NumberOfBytes, PeerId, peer}; diff --git a/packages/http-tracker-core/src/statistics/event/handler.rs b/packages/http-tracker-core/src/statistics/event/handler.rs index 5f98923c1..2046d69da 100644 --- a/packages/http-tracker-core/src/statistics/event/handler.rs +++ b/packages/http-tracker-core/src/statistics/event/handler.rs @@ -1,8 +1,8 @@ use std::sync::Arc; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::{LabelSet, LabelValue}; use torrust_metrics::{label_name, metric_name}; -use torrust_tracker_clock::DurationSinceUnixEpoch; use crate::event::Event; use crate::statistics::HTTP_TRACKER_CORE_REQUESTS_RECEIVED_TOTAL; @@ -55,8 +55,8 @@ mod tests { use std::sync::Arc; use bittorrent_http_tracker_protocol::v1::services::peer_ip_resolver::{RemoteClientAddr, ResolvedIp}; + use torrust_clock::clock::Time; use torrust_net_primitives::service_binding::{Protocol, ServiceBinding}; - use torrust_tracker_clock::clock::Time; use crate::CurrentClock; use crate::event::{ConnectionContext, Event}; diff --git a/packages/http-tracker-core/src/statistics/event/listener.rs b/packages/http-tracker-core/src/statistics/event/listener.rs index ff2937a59..e84442fe1 100644 --- a/packages/http-tracker-core/src/statistics/event/listener.rs +++ b/packages/http-tracker-core/src/statistics/event/listener.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use tokio::task::JoinHandle; use tokio_util::sync::CancellationToken; -use torrust_tracker_clock::clock::Time; +use torrust_clock::clock::Time; use torrust_tracker_events::receiver::RecvError; use super::handler::handle_event; diff --git a/packages/http-tracker-core/src/statistics/metrics.rs b/packages/http-tracker-core/src/statistics/metrics.rs index a4ca67342..acb67d4bf 100644 --- a/packages/http-tracker-core/src/statistics/metrics.rs +++ b/packages/http-tracker-core/src/statistics/metrics.rs @@ -1,10 +1,10 @@ use serde::Serialize; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::metric::MetricName; use torrust_metrics::metric_collection::aggregate::sum::Sum; use torrust_metrics::metric_collection::{Error, MetricCollection}; use torrust_metrics::metric_name; -use torrust_tracker_clock::DurationSinceUnixEpoch; use crate::statistics::HTTP_TRACKER_CORE_REQUESTS_RECEIVED_TOTAL; diff --git a/packages/http-tracker-core/src/statistics/repository.rs b/packages/http-tracker-core/src/statistics/repository.rs index f6bad024d..b4e9f8d29 100644 --- a/packages/http-tracker-core/src/statistics/repository.rs +++ b/packages/http-tracker-core/src/statistics/repository.rs @@ -1,10 +1,10 @@ use std::sync::Arc; use tokio::sync::{RwLock, RwLockReadGuard}; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::metric::MetricName; use torrust_metrics::metric_collection::Error; -use torrust_tracker_clock::DurationSinceUnixEpoch; use super::describe_metrics; use super::metrics::Metrics; diff --git a/packages/metrics/Cargo.toml b/packages/metrics/Cargo.toml index ecc079d47..bb46577d4 100644 --- a/packages/metrics/Cargo.toml +++ b/packages/metrics/Cargo.toml @@ -21,7 +21,7 @@ openmetrics-parser = "0.4.4" serde = { version = "1", features = [ "derive" ] } serde_json = "1.0.140" thiserror = "2" -torrust-tracker-clock = { version = "3.0.0-develop", path = "../clock" } +torrust-clock = { version = "3.0.0-develop", path = "../clock" } tracing = "0.1.41" [dev-dependencies] diff --git a/packages/metrics/src/metric/aggregate/avg.rs b/packages/metrics/src/metric/aggregate/avg.rs index 595ecbee0..dbbcf3bba 100644 --- a/packages/metrics/src/metric/aggregate/avg.rs +++ b/packages/metrics/src/metric/aggregate/avg.rs @@ -46,7 +46,7 @@ impl Avg for Metric { #[cfg(test)] mod tests { - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use crate::counter::Counter; use crate::gauge::Gauge; diff --git a/packages/metrics/src/metric/aggregate/sum.rs b/packages/metrics/src/metric/aggregate/sum.rs index 578babd6e..7622833bf 100644 --- a/packages/metrics/src/metric/aggregate/sum.rs +++ b/packages/metrics/src/metric/aggregate/sum.rs @@ -35,7 +35,7 @@ impl Sum for Metric { #[cfg(test)] mod tests { - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use crate::counter::Counter; use crate::gauge::Gauge; diff --git a/packages/metrics/src/metric/mod.rs b/packages/metrics/src/metric/mod.rs index 19b9bb22d..8b6f521f2 100644 --- a/packages/metrics/src/metric/mod.rs +++ b/packages/metrics/src/metric/mod.rs @@ -3,7 +3,7 @@ pub mod description; pub mod name; use serde::{Deserialize, Serialize}; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use super::counter::Counter; use super::label::LabelSet; diff --git a/packages/metrics/src/metric_collection/aggregate/avg.rs b/packages/metrics/src/metric_collection/aggregate/avg.rs index ba8ca173b..64589dd21 100644 --- a/packages/metrics/src/metric_collection/aggregate/avg.rs +++ b/packages/metrics/src/metric_collection/aggregate/avg.rs @@ -40,7 +40,7 @@ mod tests { mod it_should_allow_averaging_all_metric_samples_containing_some_given_labels { - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use crate::label::LabelValue; use crate::label_name; diff --git a/packages/metrics/src/metric_collection/aggregate/sum.rs b/packages/metrics/src/metric_collection/aggregate/sum.rs index b041672c1..b677e9e68 100644 --- a/packages/metrics/src/metric_collection/aggregate/sum.rs +++ b/packages/metrics/src/metric_collection/aggregate/sum.rs @@ -43,7 +43,7 @@ mod tests { mod it_should_allow_summing_all_metric_samples_containing_some_given_labels { - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use crate::label::LabelValue; use crate::label_name; diff --git a/packages/metrics/src/metric_collection/kind_collection.rs b/packages/metrics/src/metric_collection/kind_collection.rs index 2a9c24770..e625a1be6 100644 --- a/packages/metrics/src/metric_collection/kind_collection.rs +++ b/packages/metrics/src/metric_collection/kind_collection.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use crate::counter::Counter; use crate::gauge::Gauge; diff --git a/packages/metrics/src/metric_collection/mod.rs b/packages/metrics/src/metric_collection/mod.rs index 5a58d419c..9606c60d4 100644 --- a/packages/metrics/src/metric_collection/mod.rs +++ b/packages/metrics/src/metric_collection/mod.rs @@ -8,7 +8,7 @@ use std::collections::HashSet; pub use error::Error; pub use kind_collection::MetricKindCollection; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use super::counter::Counter; use super::gauge::Gauge; diff --git a/packages/metrics/src/metric_collection/prometheus.rs b/packages/metrics/src/metric_collection/prometheus.rs index ce7b19d25..8f7736929 100644 --- a/packages/metrics/src/metric_collection/prometheus.rs +++ b/packages/metrics/src/metric_collection/prometheus.rs @@ -1,7 +1,7 @@ use std::borrow::Cow; use std::sync::Arc; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use crate::counter::Counter; use crate::gauge::Gauge; @@ -299,7 +299,7 @@ mod tests { } mod stage3_conversion { - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use super::super::ParsedExposition; use crate::counter::Counter; @@ -354,7 +354,7 @@ mod tests { } mod prometheus_timestamp { - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use super::super::parse_prometheus_timestamp; @@ -418,7 +418,7 @@ mod tests { } mod prometheus_deserialization { - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use super::super::build_metric_collection; use crate::counter::Counter; diff --git a/packages/metrics/src/metric_collection/serde.rs b/packages/metrics/src/metric_collection/serde.rs index d6669da1c..23e445937 100644 --- a/packages/metrics/src/metric_collection/serde.rs +++ b/packages/metrics/src/metric_collection/serde.rs @@ -73,7 +73,7 @@ mod tests { use pretty_assertions::assert_eq; use serde::Serialize; use serde::ser::{self, Impossible, SerializeSeq}; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use crate::counter::Counter; use crate::gauge::Gauge; diff --git a/packages/metrics/src/prometheus.rs b/packages/metrics/src/prometheus.rs index 32ac37651..4cc2d59f5 100644 --- a/packages/metrics/src/prometheus.rs +++ b/packages/metrics/src/prometheus.rs @@ -1,4 +1,4 @@ -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use crate::metric_collection::Error as MetricCollectionError; use crate::sample_collection::Error as SampleCollectionError; diff --git a/packages/metrics/src/sample.rs b/packages/metrics/src/sample.rs index 8fc4f56b1..a34dbfc0d 100644 --- a/packages/metrics/src/sample.rs +++ b/packages/metrics/src/sample.rs @@ -1,6 +1,6 @@ use chrono::{DateTime, Utc}; use serde::{Deserialize, Deserializer, Serialize, Serializer, de}; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use super::counter::Counter; use super::gauge::Gauge; @@ -188,7 +188,7 @@ where #[cfg(test)] mod tests { - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use super::*; @@ -264,7 +264,7 @@ mod tests { } mod for_counter_type_sample { - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use crate::label::LabelSet; use crate::prometheus::PrometheusSerializable; @@ -323,7 +323,7 @@ mod tests { } } mod for_gauge_type_sample { - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use crate::label::LabelSet; use crate::prometheus::PrometheusSerializable; @@ -403,7 +403,7 @@ mod tests { mod serialization_to_json { use pretty_assertions::assert_eq; use serde_json::json; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use crate::label::LabelSet; use crate::sample::Sample; diff --git a/packages/metrics/src/sample_collection.rs b/packages/metrics/src/sample_collection.rs index bab4cf5ad..9f6841335 100644 --- a/packages/metrics/src/sample_collection.rs +++ b/packages/metrics/src/sample_collection.rs @@ -3,7 +3,7 @@ use std::collections::hash_map::Iter; use std::fmt::Write as _; use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use super::counter::Counter; use super::gauge::Gauge; @@ -168,7 +168,7 @@ impl PrometheusSerializable for SampleCollection { #[cfg(test)] mod tests { - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use crate::counter::Counter; use crate::label::LabelSet; diff --git a/packages/primitives/Cargo.toml b/packages/primitives/Cargo.toml index e6d261951..c1402b25b 100644 --- a/packages/primitives/Cargo.toml +++ b/packages/primitives/Cargo.toml @@ -24,4 +24,4 @@ tdyne-peer-id = "1" tdyne-peer-id-registry = "0" thiserror = "2" torrust-net-primitives = { version = "3.0.0-develop", path = "../net-primitives" } -torrust-tracker-clock = { version = "3.0.0-develop", path = "../clock" } +torrust-clock = { version = "3.0.0-develop", path = "../clock" } diff --git a/packages/primitives/src/lib.rs b/packages/primitives/src/lib.rs index 1e8eae2cc..fd35d99a0 100644 --- a/packages/primitives/src/lib.rs +++ b/packages/primitives/src/lib.rs @@ -21,16 +21,16 @@ pub use peer_id::{PeerClient, PeerId}; pub use scrape::ScrapeData; /// Duration since the Unix Epoch. /// -/// **Deprecated**: import from [`torrust_tracker_clock::DurationSinceUnixEpoch`] instead. +/// **Deprecated**: import from [`torrust_clock::DurationSinceUnixEpoch`] instead. /// This re-export is kept for backwards compatibility and will be removed in a /// future release. Removal is tracked as a follow-up cleanup subissue of EPIC /// [#1669](https://github.com/torrust/torrust-tracker/issues/1669). #[deprecated( since = "3.0.0-develop", - note = "import `DurationSinceUnixEpoch` from `torrust_tracker_clock` instead; \ + note = "import `DurationSinceUnixEpoch` from `torrust_clock` instead; \ this re-export will be removed in a future release (see EPIC #1669)" )] -pub use torrust_tracker_clock::DurationSinceUnixEpoch; +pub use torrust_clock::DurationSinceUnixEpoch; /// Network service binding types. /// diff --git a/packages/primitives/src/peer.rs b/packages/primitives/src/peer.rs index 1b85ca5eb..1e3678e78 100644 --- a/packages/primitives/src/peer.rs +++ b/packages/primitives/src/peer.rs @@ -8,7 +8,7 @@ //! use std::net::SocketAddr; //! use std::net::IpAddr; //! use std::net::Ipv4Addr; -//! use torrust_tracker_clock::DurationSinceUnixEpoch; +//! use torrust_clock::DurationSinceUnixEpoch; //! //! //! peer::Peer { @@ -29,7 +29,7 @@ use std::str::FromStr; use std::sync::Arc; use serde::Serialize; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use crate::{AnnounceEvent, NumberOfBytes, PeerId}; @@ -96,7 +96,7 @@ pub enum ParsePeerRoleError { /// use std::net::SocketAddr; /// use std::net::IpAddr; /// use std::net::Ipv4Addr; -/// use torrust_tracker_clock::DurationSinceUnixEpoch; +/// use torrust_clock::DurationSinceUnixEpoch; /// /// /// peer::Peer { @@ -494,7 +494,7 @@ impl FromIterator for Vec

{ pub mod fixture { use std::net::{IpAddr, Ipv4Addr, SocketAddr}; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use super::{Id, Peer, PeerId}; use crate::{AnnounceEvent, NumberOfBytes}; diff --git a/packages/swarm-coordination-registry/Cargo.toml b/packages/swarm-coordination-registry/Cargo.toml index 52afa5201..9c3e4834a 100644 --- a/packages/swarm-coordination-registry/Cargo.toml +++ b/packages/swarm-coordination-registry/Cargo.toml @@ -24,7 +24,7 @@ serde = { version = "1.0.219", features = [ "derive" ] } thiserror = "2.0.12" tokio = { version = "1", features = [ "macros", "net", "rt-multi-thread", "signal", "sync" ] } tokio-util = "0.7.15" -torrust-tracker-clock = { version = "3.0.0-develop", path = "../clock" } +torrust-clock = { version = "3.0.0-develop", path = "../clock" } torrust-tracker-configuration = { version = "3.0.0-develop", path = "../configuration" } torrust-tracker-events = { version = "3.0.0-develop", path = "../events" } torrust-metrics = { version = "3.0.0-develop", path = "../metrics" } diff --git a/packages/swarm-coordination-registry/src/lib.rs b/packages/swarm-coordination-registry/src/lib.rs index 6a313ec43..34f34f7ca 100644 --- a/packages/swarm-coordination-registry/src/lib.rs +++ b/packages/swarm-coordination-registry/src/lib.rs @@ -6,7 +6,7 @@ pub mod swarm; use std::sync::Arc; use tokio::sync::Mutex; -use torrust_tracker_clock::clock; +use torrust_clock::clock; pub type Registry = swarm::registry::Registry; pub type CoordinatorHandle = Arc>; @@ -29,7 +29,7 @@ pub(crate) mod tests { use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use bittorrent_primitives::info_hash::InfoHash; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_primitives::peer::Peer; use torrust_tracker_primitives::{AnnounceEvent, NumberOfBytes, PeerId}; diff --git a/packages/swarm-coordination-registry/src/statistics/activity_metrics_updater.rs b/packages/swarm-coordination-registry/src/statistics/activity_metrics_updater.rs index 27961e080..5f5b40d12 100644 --- a/packages/swarm-coordination-registry/src/statistics/activity_metrics_updater.rs +++ b/packages/swarm-coordination-registry/src/statistics/activity_metrics_updater.rs @@ -3,10 +3,10 @@ use std::sync::Arc; use chrono::Utc; use tokio::task::JoinHandle; +use torrust_clock::DurationSinceUnixEpoch; +use torrust_clock::clock::Time; use torrust_metrics::label::LabelSet; use torrust_metrics::metric_name; -use torrust_tracker_clock::DurationSinceUnixEpoch; -use torrust_tracker_clock::clock::Time; use tracing::instrument; use super::repository::Repository; diff --git a/packages/swarm-coordination-registry/src/statistics/event/handler.rs b/packages/swarm-coordination-registry/src/statistics/event/handler.rs index ccc549d8a..03952e137 100644 --- a/packages/swarm-coordination-registry/src/statistics/event/handler.rs +++ b/packages/swarm-coordination-registry/src/statistics/event/handler.rs @@ -1,8 +1,8 @@ use std::sync::Arc; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::{LabelSet, LabelValue}; use torrust_metrics::{label_name, metric_name}; -use torrust_tracker_clock::DurationSinceUnixEpoch; use torrust_tracker_primitives::peer::Peer; use crate::event::Event; @@ -250,10 +250,10 @@ mod tests { use std::sync::Arc; + use torrust_clock::clock::stopped::Stopped; + use torrust_clock::clock::{self, Time}; use torrust_metrics::label::LabelSet; use torrust_metrics::metric_name; - use torrust_tracker_clock::clock::stopped::Stopped; - use torrust_tracker_clock::clock::{self, Time}; use crate::CurrentClock; use crate::event::Event; @@ -370,9 +370,9 @@ mod tests { mod for_peer_metrics { use std::sync::Arc; + use torrust_clock::clock::stopped::Stopped; + use torrust_clock::clock::{self, Time}; use torrust_metrics::metric_name; - use torrust_tracker_clock::clock::stopped::Stopped; - use torrust_tracker_clock::clock::{self, Time}; use crate::CurrentClock; use crate::event::Event; @@ -390,10 +390,10 @@ mod tests { use std::sync::Arc; use rstest::rstest; + use torrust_clock::clock::stopped::Stopped; + use torrust_clock::clock::{self, Time}; use torrust_metrics::label::LabelValue; use torrust_metrics::{label_name, metric_name}; - use torrust_tracker_clock::clock::stopped::Stopped; - use torrust_tracker_clock::clock::{self, Time}; use torrust_tracker_primitives::peer::PeerRole; use crate::CurrentClock; @@ -609,10 +609,10 @@ mod tests { use std::sync::Arc; use rstest::rstest; + use torrust_clock::clock::stopped::Stopped; + use torrust_clock::clock::{self, Time}; use torrust_metrics::label::LabelValue; use torrust_metrics::{label_name, metric_name}; - use torrust_tracker_clock::clock::stopped::Stopped; - use torrust_tracker_clock::clock::{self, Time}; use torrust_tracker_primitives::peer::PeerRole; use crate::CurrentClock; diff --git a/packages/swarm-coordination-registry/src/statistics/event/listener.rs b/packages/swarm-coordination-registry/src/statistics/event/listener.rs index b578d1284..207aa5f23 100644 --- a/packages/swarm-coordination-registry/src/statistics/event/listener.rs +++ b/packages/swarm-coordination-registry/src/statistics/event/listener.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use tokio::task::JoinHandle; use tokio_util::sync::CancellationToken; -use torrust_tracker_clock::clock::Time; +use torrust_clock::clock::Time; use torrust_tracker_events::receiver::RecvError; use super::handler::handle_event; diff --git a/packages/swarm-coordination-registry/src/statistics/metrics.rs b/packages/swarm-coordination-registry/src/statistics/metrics.rs index 77e4fb8bf..b82ebe3d1 100644 --- a/packages/swarm-coordination-registry/src/statistics/metrics.rs +++ b/packages/swarm-coordination-registry/src/statistics/metrics.rs @@ -1,8 +1,8 @@ use serde::Serialize; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::metric::MetricName; use torrust_metrics::metric_collection::{Error, MetricCollection}; -use torrust_tracker_clock::DurationSinceUnixEpoch; /// Metrics collected by the torrent repository. #[derive(Debug, Clone, PartialEq, Default, Serialize)] diff --git a/packages/swarm-coordination-registry/src/statistics/repository.rs b/packages/swarm-coordination-registry/src/statistics/repository.rs index d5e625fce..af0f4e37d 100644 --- a/packages/swarm-coordination-registry/src/statistics/repository.rs +++ b/packages/swarm-coordination-registry/src/statistics/repository.rs @@ -1,10 +1,10 @@ use std::sync::Arc; use tokio::sync::{RwLock, RwLockReadGuard}; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::metric::MetricName; use torrust_metrics::metric_collection::Error; -use torrust_tracker_clock::DurationSinceUnixEpoch; use super::describe_metrics; use super::metrics::Metrics; diff --git a/packages/swarm-coordination-registry/src/swarm/coordinator.rs b/packages/swarm-coordination-registry/src/swarm/coordinator.rs index a2be882d8..76ba8f9ba 100644 --- a/packages/swarm-coordination-registry/src/swarm/coordinator.rs +++ b/packages/swarm-coordination-registry/src/swarm/coordinator.rs @@ -5,7 +5,7 @@ use std::net::SocketAddr; use std::sync::Arc; use bittorrent_primitives::info_hash::InfoHash; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::AnnounceEvent; use torrust_tracker_primitives::peer::{self, Peer, PeerAnnouncement}; @@ -321,7 +321,7 @@ mod tests { use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::sync::Arc; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_primitives::PeerId; use torrust_tracker_primitives::peer::fixture::PeerBuilder; use torrust_tracker_primitives::swarm_metadata::SwarmMetadata; @@ -909,7 +909,7 @@ mod tests { use std::sync::Arc; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_primitives::AnnounceEvent::Started; use torrust_tracker_primitives::peer::fixture::PeerBuilder; diff --git a/packages/swarm-coordination-registry/src/swarm/registry.rs b/packages/swarm-coordination-registry/src/swarm/registry.rs index 2c1e3b471..dd1a0bfce 100644 --- a/packages/swarm-coordination-registry/src/swarm/registry.rs +++ b/packages/swarm-coordination-registry/src/swarm/registry.rs @@ -3,8 +3,8 @@ use std::sync::Arc; use bittorrent_primitives::info_hash::InfoHash; use crossbeam_skiplist::SkipMap; use tokio::sync::Mutex; -use torrust_tracker_clock::DurationSinceUnixEpoch; -use torrust_tracker_clock::conv::convert_from_timestamp_to_datetime_utc; +use torrust_clock::DurationSinceUnixEpoch; +use torrust_clock::conv::convert_from_timestamp_to_datetime_utc; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::pagination::Pagination; use torrust_tracker_primitives::swarm_metadata::{AggregateActiveSwarmMetadata, SwarmMetadata}; @@ -614,7 +614,7 @@ mod tests { use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::sync::Arc; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_primitives::peer::Peer; use torrust_tracker_primitives::{AnnounceEvent, NumberOfBytes}; @@ -675,7 +675,7 @@ mod tests { use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::sync::Arc; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TORRENT_PEERS_LIMIT; use torrust_tracker_primitives::peer::Peer; use torrust_tracker_primitives::{AnnounceEvent, NumberOfBytes}; @@ -755,7 +755,7 @@ mod tests { use std::time::Duration; use bittorrent_primitives::info_hash::InfoHash; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use crate::swarm::registry::Registry; @@ -1183,7 +1183,7 @@ mod tests { mod it_should_count_peerless_torrents { use std::sync::Arc; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use crate::swarm::registry::Registry; use crate::tests::{sample_info_hash, sample_peer}; @@ -1350,7 +1350,7 @@ mod tests { use std::sync::Arc; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_primitives::peer::fixture::PeerBuilder; use crate::event::Event; diff --git a/packages/torrent-repository-benchmarking/Cargo.toml b/packages/torrent-repository-benchmarking/Cargo.toml index 83e21d5ff..0c2ecb3df 100644 --- a/packages/torrent-repository-benchmarking/Cargo.toml +++ b/packages/torrent-repository-benchmarking/Cargo.toml @@ -22,7 +22,7 @@ dashmap = "6" futures = "0" parking_lot = "0" tokio = { version = "1", features = [ "macros", "net", "rt-multi-thread", "signal", "sync" ] } -torrust-tracker-clock = { version = "3.0.0-develop", path = "../clock" } +torrust-clock = { version = "3.0.0-develop", path = "../clock" } torrust-tracker-configuration = { version = "3.0.0-develop", path = "../configuration" } torrust-tracker-primitives = { version = "3.0.0-develop", path = "../primitives" } diff --git a/packages/torrent-repository-benchmarking/benches/helpers/utils.rs b/packages/torrent-repository-benchmarking/benches/helpers/utils.rs index 2452fe554..80e89bc19 100644 --- a/packages/torrent-repository-benchmarking/benches/helpers/utils.rs +++ b/packages/torrent-repository-benchmarking/benches/helpers/utils.rs @@ -2,7 +2,7 @@ use std::collections::HashSet; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use bittorrent_primitives::info_hash::InfoHash; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_primitives::peer::Peer; use torrust_tracker_primitives::{AnnounceEvent, NumberOfBytes, PeerId}; diff --git a/packages/torrent-repository-benchmarking/src/entry/mod.rs b/packages/torrent-repository-benchmarking/src/entry/mod.rs index 2ff07377c..14e4cf1d5 100644 --- a/packages/torrent-repository-benchmarking/src/entry/mod.rs +++ b/packages/torrent-repository-benchmarking/src/entry/mod.rs @@ -2,7 +2,7 @@ use std::fmt::Debug; use std::net::SocketAddr; use std::sync::Arc; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::peer; use torrust_tracker_primitives::swarm_metadata::SwarmMetadata; diff --git a/packages/torrent-repository-benchmarking/src/entry/mutex_parking_lot.rs b/packages/torrent-repository-benchmarking/src/entry/mutex_parking_lot.rs index e48ac3e9f..77da4597e 100644 --- a/packages/torrent-repository-benchmarking/src/entry/mutex_parking_lot.rs +++ b/packages/torrent-repository-benchmarking/src/entry/mutex_parking_lot.rs @@ -1,7 +1,7 @@ use std::net::SocketAddr; use std::sync::Arc; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::peer; use torrust_tracker_primitives::swarm_metadata::SwarmMetadata; diff --git a/packages/torrent-repository-benchmarking/src/entry/mutex_std.rs b/packages/torrent-repository-benchmarking/src/entry/mutex_std.rs index ffe24cb72..2312c0969 100644 --- a/packages/torrent-repository-benchmarking/src/entry/mutex_std.rs +++ b/packages/torrent-repository-benchmarking/src/entry/mutex_std.rs @@ -1,7 +1,7 @@ use std::net::SocketAddr; use std::sync::Arc; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::peer; use torrust_tracker_primitives::swarm_metadata::SwarmMetadata; diff --git a/packages/torrent-repository-benchmarking/src/entry/mutex_tokio.rs b/packages/torrent-repository-benchmarking/src/entry/mutex_tokio.rs index e86b4552d..3bc029042 100644 --- a/packages/torrent-repository-benchmarking/src/entry/mutex_tokio.rs +++ b/packages/torrent-repository-benchmarking/src/entry/mutex_tokio.rs @@ -1,7 +1,7 @@ use std::net::SocketAddr; use std::sync::Arc; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::peer; use torrust_tracker_primitives::swarm_metadata::SwarmMetadata; diff --git a/packages/torrent-repository-benchmarking/src/entry/peer_list.rs b/packages/torrent-repository-benchmarking/src/entry/peer_list.rs index f2f5a22a3..31f0c55d5 100644 --- a/packages/torrent-repository-benchmarking/src/entry/peer_list.rs +++ b/packages/torrent-repository-benchmarking/src/entry/peer_list.rs @@ -2,7 +2,7 @@ use std::net::SocketAddr; use std::sync::Arc; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_primitives::{PeerId, peer}; // code-review: the current implementation uses the peer Id as the ``BTreeMap`` @@ -90,7 +90,7 @@ mod tests { use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::sync::Arc; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_primitives::PeerId; use torrust_tracker_primitives::peer::fixture::PeerBuilder; diff --git a/packages/torrent-repository-benchmarking/src/entry/rw_lock_parking_lot.rs b/packages/torrent-repository-benchmarking/src/entry/rw_lock_parking_lot.rs index 663a8bd56..ceb88aca8 100644 --- a/packages/torrent-repository-benchmarking/src/entry/rw_lock_parking_lot.rs +++ b/packages/torrent-repository-benchmarking/src/entry/rw_lock_parking_lot.rs @@ -1,7 +1,7 @@ use std::net::SocketAddr; use std::sync::Arc; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::peer; use torrust_tracker_primitives::swarm_metadata::SwarmMetadata; diff --git a/packages/torrent-repository-benchmarking/src/entry/single.rs b/packages/torrent-repository-benchmarking/src/entry/single.rs index abf5d12c4..b57dc2e26 100644 --- a/packages/torrent-repository-benchmarking/src/entry/single.rs +++ b/packages/torrent-repository-benchmarking/src/entry/single.rs @@ -1,7 +1,7 @@ use std::net::SocketAddr; use std::sync::Arc; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::AnnounceEvent; use torrust_tracker_primitives::peer::{self}; diff --git a/packages/torrent-repository-benchmarking/src/lib.rs b/packages/torrent-repository-benchmarking/src/lib.rs index a8955808e..491f087b5 100644 --- a/packages/torrent-repository-benchmarking/src/lib.rs +++ b/packages/torrent-repository-benchmarking/src/lib.rs @@ -4,7 +4,7 @@ use repository::dash_map_mutex_std::XacrimonDashMap; use repository::rw_lock_std::RwLockStd; use repository::rw_lock_tokio::RwLockTokio; use repository::skip_map_mutex_std::CrossbeamSkipList; -use torrust_tracker_clock::clock; +use torrust_clock::clock; pub mod entry; pub mod repository; diff --git a/packages/torrent-repository-benchmarking/src/repository/dash_map_mutex_std.rs b/packages/torrent-repository-benchmarking/src/repository/dash_map_mutex_std.rs index be0e9fa30..81cc46470 100644 --- a/packages/torrent-repository-benchmarking/src/repository/dash_map_mutex_std.rs +++ b/packages/torrent-repository-benchmarking/src/repository/dash_map_mutex_std.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use bittorrent_primitives::info_hash::InfoHash; use dashmap::DashMap; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::pagination::Pagination; use torrust_tracker_primitives::swarm_metadata::{AggregateActiveSwarmMetadata, SwarmMetadata}; diff --git a/packages/torrent-repository-benchmarking/src/repository/mod.rs b/packages/torrent-repository-benchmarking/src/repository/mod.rs index 08d06e4e9..1b7e031a1 100644 --- a/packages/torrent-repository-benchmarking/src/repository/mod.rs +++ b/packages/torrent-repository-benchmarking/src/repository/mod.rs @@ -1,5 +1,5 @@ use bittorrent_primitives::info_hash::InfoHash; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::pagination::Pagination; use torrust_tracker_primitives::swarm_metadata::{AggregateActiveSwarmMetadata, SwarmMetadata}; diff --git a/packages/torrent-repository-benchmarking/src/repository/rw_lock_std.rs b/packages/torrent-repository-benchmarking/src/repository/rw_lock_std.rs index 950011fd3..ea73c5361 100644 --- a/packages/torrent-repository-benchmarking/src/repository/rw_lock_std.rs +++ b/packages/torrent-repository-benchmarking/src/repository/rw_lock_std.rs @@ -1,5 +1,5 @@ use bittorrent_primitives::info_hash::InfoHash; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::pagination::Pagination; use torrust_tracker_primitives::swarm_metadata::{AggregateActiveSwarmMetadata, SwarmMetadata}; diff --git a/packages/torrent-repository-benchmarking/src/repository/rw_lock_std_mutex_std.rs b/packages/torrent-repository-benchmarking/src/repository/rw_lock_std_mutex_std.rs index e9a7f1ce8..139ffb484 100644 --- a/packages/torrent-repository-benchmarking/src/repository/rw_lock_std_mutex_std.rs +++ b/packages/torrent-repository-benchmarking/src/repository/rw_lock_std_mutex_std.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use bittorrent_primitives::info_hash::InfoHash; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::pagination::Pagination; use torrust_tracker_primitives::swarm_metadata::{AggregateActiveSwarmMetadata, SwarmMetadata}; diff --git a/packages/torrent-repository-benchmarking/src/repository/rw_lock_std_mutex_tokio.rs b/packages/torrent-repository-benchmarking/src/repository/rw_lock_std_mutex_tokio.rs index 2203c088f..3c5663729 100644 --- a/packages/torrent-repository-benchmarking/src/repository/rw_lock_std_mutex_tokio.rs +++ b/packages/torrent-repository-benchmarking/src/repository/rw_lock_std_mutex_tokio.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use bittorrent_primitives::info_hash::InfoHash; use futures::future::join_all; use futures::{Future, FutureExt}; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::pagination::Pagination; use torrust_tracker_primitives::swarm_metadata::{AggregateActiveSwarmMetadata, SwarmMetadata}; diff --git a/packages/torrent-repository-benchmarking/src/repository/rw_lock_tokio.rs b/packages/torrent-repository-benchmarking/src/repository/rw_lock_tokio.rs index 5cf5e0a56..8fa904f09 100644 --- a/packages/torrent-repository-benchmarking/src/repository/rw_lock_tokio.rs +++ b/packages/torrent-repository-benchmarking/src/repository/rw_lock_tokio.rs @@ -1,5 +1,5 @@ use bittorrent_primitives::info_hash::InfoHash; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::pagination::Pagination; use torrust_tracker_primitives::swarm_metadata::{AggregateActiveSwarmMetadata, SwarmMetadata}; diff --git a/packages/torrent-repository-benchmarking/src/repository/rw_lock_tokio_mutex_std.rs b/packages/torrent-repository-benchmarking/src/repository/rw_lock_tokio_mutex_std.rs index be667cd8e..22b750b07 100644 --- a/packages/torrent-repository-benchmarking/src/repository/rw_lock_tokio_mutex_std.rs +++ b/packages/torrent-repository-benchmarking/src/repository/rw_lock_tokio_mutex_std.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use bittorrent_primitives::info_hash::InfoHash; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::pagination::Pagination; use torrust_tracker_primitives::swarm_metadata::{AggregateActiveSwarmMetadata, SwarmMetadata}; diff --git a/packages/torrent-repository-benchmarking/src/repository/rw_lock_tokio_mutex_tokio.rs b/packages/torrent-repository-benchmarking/src/repository/rw_lock_tokio_mutex_tokio.rs index b8fac3810..4b00bb1eb 100644 --- a/packages/torrent-repository-benchmarking/src/repository/rw_lock_tokio_mutex_tokio.rs +++ b/packages/torrent-repository-benchmarking/src/repository/rw_lock_tokio_mutex_tokio.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use bittorrent_primitives::info_hash::InfoHash; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::pagination::Pagination; use torrust_tracker_primitives::swarm_metadata::{AggregateActiveSwarmMetadata, SwarmMetadata}; diff --git a/packages/torrent-repository-benchmarking/src/repository/skip_map_mutex_std.rs b/packages/torrent-repository-benchmarking/src/repository/skip_map_mutex_std.rs index 8851b4c49..aa5153b53 100644 --- a/packages/torrent-repository-benchmarking/src/repository/skip_map_mutex_std.rs +++ b/packages/torrent-repository-benchmarking/src/repository/skip_map_mutex_std.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use bittorrent_primitives::info_hash::InfoHash; use crossbeam_skiplist::SkipMap; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::pagination::Pagination; use torrust_tracker_primitives::swarm_metadata::{AggregateActiveSwarmMetadata, SwarmMetadata}; diff --git a/packages/torrent-repository-benchmarking/tests/common/repo.rs b/packages/torrent-repository-benchmarking/tests/common/repo.rs index 6fa7c0ddc..f66bbcfc6 100644 --- a/packages/torrent-repository-benchmarking/tests/common/repo.rs +++ b/packages/torrent-repository-benchmarking/tests/common/repo.rs @@ -1,5 +1,5 @@ use bittorrent_primitives::info_hash::InfoHash; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::pagination::Pagination; use torrust_tracker_primitives::swarm_metadata::{AggregateActiveSwarmMetadata, SwarmMetadata}; diff --git a/packages/torrent-repository-benchmarking/tests/common/torrent.rs b/packages/torrent-repository-benchmarking/tests/common/torrent.rs index 8bed54ff1..ecda864a4 100644 --- a/packages/torrent-repository-benchmarking/tests/common/torrent.rs +++ b/packages/torrent-repository-benchmarking/tests/common/torrent.rs @@ -1,7 +1,7 @@ use std::net::SocketAddr; use std::sync::Arc; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::TrackerPolicy; use torrust_tracker_primitives::peer; use torrust_tracker_primitives::swarm_metadata::SwarmMetadata; diff --git a/packages/torrent-repository-benchmarking/tests/entry/mod.rs b/packages/torrent-repository-benchmarking/tests/entry/mod.rs index 6acc34399..fa58cf11c 100644 --- a/packages/torrent-repository-benchmarking/tests/entry/mod.rs +++ b/packages/torrent-repository-benchmarking/tests/entry/mod.rs @@ -2,8 +2,8 @@ use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::time::Duration; use rstest::{fixture, rstest}; -use torrust_tracker_clock::clock::stopped::Stopped as _; -use torrust_tracker_clock::clock::{self, Time as _}; +use torrust_clock::clock::stopped::Stopped as _; +use torrust_clock::clock::{self, Time as _}; use torrust_tracker_configuration::{TORRENT_PEERS_LIMIT, TrackerPolicy}; use torrust_tracker_primitives::peer::Peer; use torrust_tracker_primitives::{AnnounceEvent, NumberOfBytes, peer}; diff --git a/packages/torrent-repository-benchmarking/tests/integration.rs b/packages/torrent-repository-benchmarking/tests/integration.rs index 5aab67b03..f45895412 100644 --- a/packages/torrent-repository-benchmarking/tests/integration.rs +++ b/packages/torrent-repository-benchmarking/tests/integration.rs @@ -4,7 +4,7 @@ //! cargo test --test integration //! ``` -use torrust_tracker_clock::clock; +use torrust_clock::clock; pub mod common; mod entry; diff --git a/packages/torrent-repository-benchmarking/tests/repository/mod.rs b/packages/torrent-repository-benchmarking/tests/repository/mod.rs index 1bd73c3e6..2cca580a5 100644 --- a/packages/torrent-repository-benchmarking/tests/repository/mod.rs +++ b/packages/torrent-repository-benchmarking/tests/repository/mod.rs @@ -527,8 +527,8 @@ async fn it_should_remove_inactive_peers( ) { use std::time::Duration; - use torrust_tracker_clock::clock::stopped::Stopped as _; - use torrust_tracker_clock::clock::{self, Time as _}; + use torrust_clock::clock::stopped::Stopped as _; + use torrust_clock::clock::{self, Time as _}; use torrust_tracker_primitives::peer; use crate::CurrentClock; diff --git a/packages/tracker-core/Cargo.toml b/packages/tracker-core/Cargo.toml index f96b873df..482cc0469 100644 --- a/packages/tracker-core/Cargo.toml +++ b/packages/tracker-core/Cargo.toml @@ -32,7 +32,7 @@ sqlx = { version = "0.8", features = [ "macros", "mysql", "postgres", "runtime-t thiserror = "2" tokio = { version = "1", features = [ "macros", "net", "rt-multi-thread", "signal", "sync" ] } tokio-util = "0.7.15" -torrust-tracker-clock = { version = "3.0.0-develop", path = "../clock" } +torrust-clock = { version = "3.0.0-develop", path = "../clock" } torrust-tracker-configuration = { version = "3.0.0-develop", path = "../configuration" } torrust-tracker-events = { version = "3.0.0-develop", path = "../events" } torrust-tracker-located-error = { version = "3.0.0-develop", path = "../located-error" } diff --git a/packages/tracker-core/src/announce_handler.rs b/packages/tracker-core/src/announce_handler.rs index f1d4f2427..220d79eb6 100644 --- a/packages/tracker-core/src/announce_handler.rs +++ b/packages/tracker-core/src/announce_handler.rs @@ -19,7 +19,7 @@ //! use std::str::FromStr; //! //! use torrust_tracker_primitives::{AnnounceEvent, NumberOfBytes, PeerId}; -//! use torrust_tracker_clock::DurationSinceUnixEpoch; +//! use torrust_clock::DurationSinceUnixEpoch; //! use torrust_tracker_primitives::peer; //! use bittorrent_primitives::info_hash::InfoHash; //! @@ -282,7 +282,7 @@ mod tests { use std::str::FromStr; use std::sync::Arc; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_primitives::peer::Peer; use torrust_tracker_primitives::{AnnounceEvent, NumberOfBytes, PeerId}; use torrust_tracker_test_helpers::configuration; diff --git a/packages/tracker-core/src/authentication/handler.rs b/packages/tracker-core/src/authentication/handler.rs index b8fc2cfd0..15c8802f9 100644 --- a/packages/tracker-core/src/authentication/handler.rs +++ b/packages/tracker-core/src/authentication/handler.rs @@ -9,8 +9,8 @@ use std::sync::Arc; use std::time::Duration; -use torrust_tracker_clock::DurationSinceUnixEpoch; -use torrust_tracker_clock::clock::Time; +use torrust_clock::DurationSinceUnixEpoch; +use torrust_clock::clock::Time; use torrust_tracker_located_error::Located; use super::key::repository::in_memory::InMemoryKeyRepository; @@ -331,7 +331,7 @@ mod tests { mod handling_expiring_peer_keys { use std::time::Duration; - use torrust_tracker_clock::clock::Time; + use torrust_clock::clock::Time; use crate::CurrentClock; use crate::authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::instantiate_keys_handler; @@ -357,8 +357,8 @@ mod tests { use std::time::Duration; use mockall::predicate::function; - use torrust_tracker_clock::clock::stopped::Stopped; - use torrust_tracker_clock::clock::{self, Time}; + use torrust_clock::clock::stopped::Stopped; + use torrust_clock::clock::{self, Time}; use crate::CurrentClock; use crate::authentication::PeerKey; @@ -431,8 +431,8 @@ mod tests { use std::time::Duration; use mockall::predicate; - use torrust_tracker_clock::clock::stopped::Stopped; - use torrust_tracker_clock::clock::{self, Time}; + use torrust_clock::clock::stopped::Stopped; + use torrust_clock::clock::{self, Time}; use crate::CurrentClock; use crate::authentication::handler::AddKeyRequest; diff --git a/packages/tracker-core/src/authentication/key/mod.rs b/packages/tracker-core/src/authentication/key/mod.rs index ff30f2b6f..c5a1f7bd9 100644 --- a/packages/tracker-core/src/authentication/key/mod.rs +++ b/packages/tracker-core/src/authentication/key/mod.rs @@ -30,7 +30,7 @@ //! //! ```rust //! use bittorrent_tracker_core::authentication::Key; -//! use torrust_tracker_clock::DurationSinceUnixEpoch; +//! use torrust_clock::DurationSinceUnixEpoch; //! //! pub struct PeerKey { //! /// A random 32-character authentication token (e.g., `YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ`) @@ -48,8 +48,8 @@ use std::sync::Arc; use std::time::Duration; use thiserror::Error; -use torrust_tracker_clock::DurationSinceUnixEpoch; -use torrust_tracker_clock::clock::Time; +use torrust_clock::DurationSinceUnixEpoch; +use torrust_clock::clock::Time; use torrust_tracker_located_error::{DynError, LocatedError}; use crate::CurrentClock; @@ -206,8 +206,8 @@ mod tests { use std::time::Duration; - use torrust_tracker_clock::clock; - use torrust_tracker_clock::clock::stopped::Stopped as _; + use torrust_clock::clock; + use torrust_clock::clock::stopped::Stopped as _; use crate::authentication; @@ -255,8 +255,8 @@ mod tests { use std::time::Duration; - use torrust_tracker_clock::clock; - use torrust_tracker_clock::clock::stopped::Stopped as _; + use torrust_clock::clock; + use torrust_clock::clock::stopped::Stopped as _; use crate::authentication; diff --git a/packages/tracker-core/src/authentication/key/peer_key.rs b/packages/tracker-core/src/authentication/key/peer_key.rs index 6fe0eebd1..9f91bc4cf 100644 --- a/packages/tracker-core/src/authentication/key/peer_key.rs +++ b/packages/tracker-core/src/authentication/key/peer_key.rs @@ -16,8 +16,8 @@ use rand::distr::Alphanumeric; use rand::{RngExt, rng}; use serde::{Deserialize, Serialize}; use thiserror::Error; -use torrust_tracker_clock::DurationSinceUnixEpoch; -use torrust_tracker_clock::conv::convert_from_timestamp_to_datetime_utc; +use torrust_clock::DurationSinceUnixEpoch; +use torrust_clock::conv::convert_from_timestamp_to_datetime_utc; use super::AUTH_KEY_LENGTH; diff --git a/packages/tracker-core/src/databases/driver/mysql/auth_key_store.rs b/packages/tracker-core/src/databases/driver/mysql/auth_key_store.rs index 682d75075..e9150d21a 100644 --- a/packages/tracker-core/src/databases/driver/mysql/auth_key_store.rs +++ b/packages/tracker-core/src/databases/driver/mysql/auth_key_store.rs @@ -1,6 +1,6 @@ use ::sqlx::Row; use async_trait::async_trait; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use super::{DRIVER, Mysql}; use crate::authentication::{self, Key}; diff --git a/packages/tracker-core/src/databases/driver/postgres/auth_key_store.rs b/packages/tracker-core/src/databases/driver/postgres/auth_key_store.rs index ff94a91b0..273971f58 100644 --- a/packages/tracker-core/src/databases/driver/postgres/auth_key_store.rs +++ b/packages/tracker-core/src/databases/driver/postgres/auth_key_store.rs @@ -1,6 +1,6 @@ use ::sqlx::Row; use async_trait::async_trait; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use super::{DRIVER, Postgres}; use crate::authentication::{self, Key}; diff --git a/packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs b/packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs index d0147f3b0..fa8edfc23 100644 --- a/packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs +++ b/packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs @@ -2,7 +2,7 @@ use std::panic::Location; use ::sqlx::Row; use async_trait::async_trait; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use super::{DRIVER, Sqlite}; use crate::authentication::{self, Key}; diff --git a/packages/tracker-core/src/lib.rs b/packages/tracker-core/src/lib.rs index 745745427..b6d3fc71d 100644 --- a/packages/tracker-core/src/lib.rs +++ b/packages/tracker-core/src/lib.rs @@ -131,7 +131,7 @@ pub mod whitelist; pub mod peer_tests; pub mod test_helpers; -use torrust_tracker_clock::clock; +use torrust_clock::clock; /// The maximum number of torrents that can be returned in an `scrape` response. /// diff --git a/packages/tracker-core/src/peer_tests.rs b/packages/tracker-core/src/peer_tests.rs index 5ca37cb86..6dcf08f14 100644 --- a/packages/tracker-core/src/peer_tests.rs +++ b/packages/tracker-core/src/peer_tests.rs @@ -2,8 +2,8 @@ use std::net::{IpAddr, Ipv4Addr, SocketAddr}; -use torrust_tracker_clock::clock::stopped::Stopped as _; -use torrust_tracker_clock::clock::{self, Time}; +use torrust_clock::clock::stopped::Stopped as _; +use torrust_clock::clock::{self, Time}; use torrust_tracker_primitives::{AnnounceEvent, NumberOfBytes, PeerId, peer}; use crate::CurrentClock; diff --git a/packages/tracker-core/src/statistics/event/handler.rs b/packages/tracker-core/src/statistics/event/handler.rs index cac931360..efa8b7762 100644 --- a/packages/tracker-core/src/statistics/event/handler.rs +++ b/packages/tracker-core/src/statistics/event/handler.rs @@ -1,8 +1,8 @@ use std::sync::Arc; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::metric_name; -use torrust_tracker_clock::DurationSinceUnixEpoch; use torrust_tracker_swarm_coordination_registry::event::Event; use crate::statistics::TRACKER_CORE_PERSISTENT_TORRENTS_DOWNLOADS_TOTAL; diff --git a/packages/tracker-core/src/statistics/event/listener.rs b/packages/tracker-core/src/statistics/event/listener.rs index 8d2d74c71..7cc71515c 100644 --- a/packages/tracker-core/src/statistics/event/listener.rs +++ b/packages/tracker-core/src/statistics/event/listener.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use tokio::task::JoinHandle; use tokio_util::sync::CancellationToken; -use torrust_tracker_clock::clock::Time; +use torrust_clock::clock::Time; use torrust_tracker_events::receiver::RecvError; use torrust_tracker_swarm_coordination_registry::event::receiver::Receiver; diff --git a/packages/tracker-core/src/statistics/metrics.rs b/packages/tracker-core/src/statistics/metrics.rs index fd08fe55a..da20075a5 100644 --- a/packages/tracker-core/src/statistics/metrics.rs +++ b/packages/tracker-core/src/statistics/metrics.rs @@ -1,8 +1,8 @@ use serde::Serialize; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::metric::MetricName; use torrust_metrics::metric_collection::{Error, MetricCollection}; -use torrust_tracker_clock::DurationSinceUnixEpoch; /// Metrics collected by the torrent repository. #[derive(Debug, Clone, PartialEq, Default, Serialize)] diff --git a/packages/tracker-core/src/statistics/persisted/mod.rs b/packages/tracker-core/src/statistics/persisted/mod.rs index 313d32e7f..5c309d32f 100644 --- a/packages/tracker-core/src/statistics/persisted/mod.rs +++ b/packages/tracker-core/src/statistics/persisted/mod.rs @@ -3,9 +3,9 @@ pub mod downloads; use std::sync::Arc; use thiserror::Error; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::{metric_collection, metric_name}; -use torrust_tracker_clock::DurationSinceUnixEpoch; use super::TRACKER_CORE_PERSISTENT_TORRENTS_DOWNLOADS_TOTAL; use super::repository::Repository; diff --git a/packages/tracker-core/src/statistics/repository.rs b/packages/tracker-core/src/statistics/repository.rs index ddc5c642e..eaa5aace7 100644 --- a/packages/tracker-core/src/statistics/repository.rs +++ b/packages/tracker-core/src/statistics/repository.rs @@ -1,11 +1,11 @@ use std::sync::Arc; use tokio::sync::{RwLock, RwLockReadGuard}; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::metric::MetricName; use torrust_metrics::metric_collection::Error; use torrust_metrics::metric_name; -use torrust_tracker_clock::DurationSinceUnixEpoch; use super::metrics::Metrics; use super::{TRACKER_CORE_PERSISTENT_TORRENTS_DOWNLOADS_TOTAL, describe_metrics}; diff --git a/packages/tracker-core/src/test_helpers.rs b/packages/tracker-core/src/test_helpers.rs index 74bc8c027..9ad9078d3 100644 --- a/packages/tracker-core/src/test_helpers.rs +++ b/packages/tracker-core/src/test_helpers.rs @@ -7,7 +7,7 @@ pub(crate) mod tests { use bittorrent_primitives::info_hash::InfoHash; use rand::RngExt; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::Configuration; #[cfg(test)] use torrust_tracker_configuration::Core; diff --git a/packages/tracker-core/src/torrent/manager.rs b/packages/tracker-core/src/torrent/manager.rs index fc4bf314d..8e9bcd412 100644 --- a/packages/tracker-core/src/torrent/manager.rs +++ b/packages/tracker-core/src/torrent/manager.rs @@ -2,8 +2,8 @@ use std::sync::Arc; use std::time::Duration; -use torrust_tracker_clock::DurationSinceUnixEpoch; -use torrust_tracker_clock::clock::Time; +use torrust_clock::DurationSinceUnixEpoch; +use torrust_clock::clock::Time; use torrust_tracker_configuration::Core; use super::repository::in_memory::InMemoryTorrentRepository; @@ -222,9 +222,9 @@ mod tests { use std::time::Duration; use bittorrent_primitives::info_hash::InfoHash; - use torrust_tracker_clock::DurationSinceUnixEpoch; - use torrust_tracker_clock::clock::stopped::Stopped; - use torrust_tracker_clock::clock::{self}; + use torrust_clock::DurationSinceUnixEpoch; + use torrust_clock::clock::stopped::Stopped; + use torrust_clock::clock::{self}; use crate::test_helpers::tests::{ephemeral_configuration, sample_info_hash, sample_peer}; use crate::torrent::manager::tests::{initialize_torrents_manager, initialize_torrents_manager_with}; diff --git a/packages/tracker-core/src/torrent/mod.rs b/packages/tracker-core/src/torrent/mod.rs index 143e93586..af2964fe5 100644 --- a/packages/tracker-core/src/torrent/mod.rs +++ b/packages/tracker-core/src/torrent/mod.rs @@ -105,7 +105,7 @@ //! ```rust,no_run //! use std::net::SocketAddr; //! use torrust_tracker_primitives::PeerId; -//! use torrust_tracker_clock::DurationSinceUnixEpoch; +//! use torrust_clock::DurationSinceUnixEpoch; //! use torrust_tracker_primitives::NumberOfBytes; //! use torrust_tracker_primitives::AnnounceEvent; //! diff --git a/packages/tracker-core/src/torrent/repository/in_memory.rs b/packages/tracker-core/src/torrent/repository/in_memory.rs index 356330399..22c09902a 100644 --- a/packages/tracker-core/src/torrent/repository/in_memory.rs +++ b/packages/tracker-core/src/torrent/repository/in_memory.rs @@ -3,7 +3,7 @@ use std::cmp::max; use std::sync::Arc; use bittorrent_primitives::info_hash::InfoHash; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::{TORRENT_PEERS_LIMIT, TrackerPolicy}; use torrust_tracker_primitives::pagination::Pagination; use torrust_tracker_primitives::swarm_metadata::{AggregateActiveSwarmMetadata, SwarmMetadata}; diff --git a/packages/tracker-core/src/torrent/services.rs b/packages/tracker-core/src/torrent/services.rs index 1c33ad9d7..d1cef5c3c 100644 --- a/packages/tracker-core/src/torrent/services.rs +++ b/packages/tracker-core/src/torrent/services.rs @@ -206,7 +206,7 @@ pub async fn get_torrents( mod tests { use std::net::{IpAddr, Ipv4Addr, SocketAddr}; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_primitives::{AnnounceEvent, NumberOfBytes, PeerId, peer}; fn sample_peer() -> peer::Peer { diff --git a/packages/tracker-core/tests/common/fixtures.rs b/packages/tracker-core/tests/common/fixtures.rs index a2bf609f6..bf040eff3 100644 --- a/packages/tracker-core/tests/common/fixtures.rs +++ b/packages/tracker-core/tests/common/fixtures.rs @@ -2,7 +2,7 @@ use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::str::FromStr; use bittorrent_primitives::info_hash::InfoHash; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::Core; use torrust_tracker_primitives::peer::Peer; use torrust_tracker_primitives::{AnnounceEvent, NumberOfBytes, PeerId}; diff --git a/packages/tracker-core/tests/common/test_env.rs b/packages/tracker-core/tests/common/test_env.rs index c0e3e6698..678d00242 100644 --- a/packages/tracker-core/tests/common/test_env.rs +++ b/packages/tracker-core/tests/common/test_env.rs @@ -7,9 +7,9 @@ use bittorrent_tracker_core::container::TrackerCoreContainer; use bittorrent_tracker_core::statistics::persisted::load_persisted_metrics; use tokio::task::yield_now; use tokio_util::sync::CancellationToken; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::metric::MetricName; -use torrust_tracker_clock::DurationSinceUnixEpoch; use torrust_tracker_configuration::Core; use torrust_tracker_primitives::peer::Peer; use torrust_tracker_primitives::swarm_metadata::SwarmMetadata; diff --git a/packages/udp-tracker-core/Cargo.toml b/packages/udp-tracker-core/Cargo.toml index 84c5f5183..5f5352273 100644 --- a/packages/udp-tracker-core/Cargo.toml +++ b/packages/udp-tracker-core/Cargo.toml @@ -27,7 +27,7 @@ serde = "1.0.219" thiserror = "2" tokio = { version = "1", features = [ "macros", "net", "rt-multi-thread", "signal", "sync", "time" ] } tokio-util = "0.7.15" -torrust-tracker-clock = { version = "3.0.0-develop", path = "../clock" } +torrust-clock = { version = "3.0.0-develop", path = "../clock" } torrust-tracker-configuration = { version = "3.0.0-develop", path = "../configuration" } torrust-tracker-events = { version = "3.0.0-develop", path = "../events" } torrust-metrics = { version = "3.0.0-develop", path = "../metrics" } diff --git a/packages/udp-tracker-core/src/lib.rs b/packages/udp-tracker-core/src/lib.rs index 5e2577e6d..32d38eed1 100644 --- a/packages/udp-tracker-core/src/lib.rs +++ b/packages/udp-tracker-core/src/lib.rs @@ -6,7 +6,7 @@ pub mod peer_builder; pub mod services; pub mod statistics; -use torrust_tracker_clock::clock; +use torrust_clock::clock; /// This code needs to be copied into each crate. /// Working version, for production. diff --git a/packages/udp-tracker-core/src/peer_builder.rs b/packages/udp-tracker-core/src/peer_builder.rs index 40cc516bf..20b7e09c2 100644 --- a/packages/udp-tracker-core/src/peer_builder.rs +++ b/packages/udp-tracker-core/src/peer_builder.rs @@ -1,7 +1,7 @@ //! Logic to extract the peer info from the announce request. use std::net::{IpAddr, SocketAddr}; -use torrust_tracker_clock::clock::Time; +use torrust_clock::clock::Time; use torrust_tracker_primitives::peer; use crate::CurrentClock; diff --git a/packages/udp-tracker-core/src/statistics/event/handler.rs b/packages/udp-tracker-core/src/statistics/event/handler.rs index 3c0666c6b..dd252a05f 100644 --- a/packages/udp-tracker-core/src/statistics/event/handler.rs +++ b/packages/udp-tracker-core/src/statistics/event/handler.rs @@ -1,6 +1,6 @@ +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::{LabelSet, LabelValue}; use torrust_metrics::{label_name, metric_name}; -use torrust_tracker_clock::DurationSinceUnixEpoch; use crate::event::Event; use crate::statistics::UDP_TRACKER_CORE_REQUESTS_RECEIVED_TOTAL; @@ -56,8 +56,8 @@ pub async fn handle_event(event: Event, stats_repository: &Repository, now: Dura mod tests { use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; + use torrust_clock::clock::Time; use torrust_net_primitives::service_binding::{Protocol, ServiceBinding}; - use torrust_tracker_clock::clock::Time; use torrust_tracker_primitives::peer::PeerAnnouncement; use crate::CurrentClock; diff --git a/packages/udp-tracker-core/src/statistics/event/listener.rs b/packages/udp-tracker-core/src/statistics/event/listener.rs index b11bcce85..46b959f53 100644 --- a/packages/udp-tracker-core/src/statistics/event/listener.rs +++ b/packages/udp-tracker-core/src/statistics/event/listener.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use tokio::task::JoinHandle; use tokio_util::sync::CancellationToken; -use torrust_tracker_clock::clock::Time; +use torrust_clock::clock::Time; use torrust_tracker_events::receiver::RecvError; use super::handler::handle_event; diff --git a/packages/udp-tracker-core/src/statistics/metrics.rs b/packages/udp-tracker-core/src/statistics/metrics.rs index 85041a15c..25f5d53ad 100644 --- a/packages/udp-tracker-core/src/statistics/metrics.rs +++ b/packages/udp-tracker-core/src/statistics/metrics.rs @@ -1,10 +1,10 @@ use serde::Serialize; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::metric::MetricName; use torrust_metrics::metric_collection::aggregate::sum::Sum; use torrust_metrics::metric_collection::{Error, MetricCollection}; use torrust_metrics::metric_name; -use torrust_tracker_clock::DurationSinceUnixEpoch; use crate::statistics::UDP_TRACKER_CORE_REQUESTS_RECEIVED_TOTAL; diff --git a/packages/udp-tracker-core/src/statistics/repository.rs b/packages/udp-tracker-core/src/statistics/repository.rs index f0debc179..94af1371d 100644 --- a/packages/udp-tracker-core/src/statistics/repository.rs +++ b/packages/udp-tracker-core/src/statistics/repository.rs @@ -1,10 +1,10 @@ use std::sync::Arc; use tokio::sync::{RwLock, RwLockReadGuard}; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::metric::MetricName; use torrust_metrics::metric_collection::Error; -use torrust_tracker_clock::DurationSinceUnixEpoch; use super::describe_metrics; use super::metrics::Metrics; diff --git a/packages/udp-tracker-server/Cargo.toml b/packages/udp-tracker-server/Cargo.toml index 697b6d831..b325ea6a5 100644 --- a/packages/udp-tracker-server/Cargo.toml +++ b/packages/udp-tracker-server/Cargo.toml @@ -28,7 +28,7 @@ thiserror = "2" tokio = { version = "1", features = [ "macros", "net", "rt-multi-thread", "signal", "sync" ] } tokio-util = "0.7.15" torrust-server-lib = { version = "3.0.0-develop", path = "../server-lib" } -torrust-tracker-clock = { version = "3.0.0-develop", path = "../clock" } +torrust-clock = { version = "3.0.0-develop", path = "../clock" } torrust-tracker-configuration = { version = "3.0.0-develop", path = "../configuration" } torrust-tracker-events = { version = "3.0.0-develop", path = "../events" } torrust-metrics = { version = "3.0.0-develop", path = "../metrics" } diff --git a/packages/udp-tracker-server/src/banning/event/handler.rs b/packages/udp-tracker-server/src/banning/event/handler.rs index 77c143b6b..f98488942 100644 --- a/packages/udp-tracker-server/src/banning/event/handler.rs +++ b/packages/udp-tracker-server/src/banning/event/handler.rs @@ -2,9 +2,9 @@ use std::sync::Arc; use bittorrent_udp_tracker_core::services::banning::BanService; use tokio::sync::RwLock; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::metric_name; -use torrust_tracker_clock::DurationSinceUnixEpoch; use crate::event::{ErrorKind, Event}; use crate::statistics::UDP_TRACKER_SERVER_IPS_BANNED_TOTAL; diff --git a/packages/udp-tracker-server/src/banning/event/listener.rs b/packages/udp-tracker-server/src/banning/event/listener.rs index 9b9261962..a60ba412f 100644 --- a/packages/udp-tracker-server/src/banning/event/listener.rs +++ b/packages/udp-tracker-server/src/banning/event/listener.rs @@ -5,7 +5,7 @@ use bittorrent_udp_tracker_core::services::banning::BanService; use tokio::sync::RwLock; use tokio::task::JoinHandle; use tokio_util::sync::CancellationToken; -use torrust_tracker_clock::clock::Time; +use torrust_clock::clock::Time; use torrust_tracker_events::receiver::RecvError; use super::handler::handle_event; diff --git a/packages/udp-tracker-server/src/environment.rs b/packages/udp-tracker-server/src/environment.rs index 04c1d0824..380c80183 100644 --- a/packages/udp-tracker-server/src/environment.rs +++ b/packages/udp-tracker-server/src/environment.rs @@ -216,7 +216,7 @@ fn initialize_global_services(configuration: &Configuration) { } fn initialize_static() { - torrust_tracker_clock::initialize_static(); + torrust_clock::initialize_static(); bittorrent_udp_tracker_core::initialize_static(); } diff --git a/packages/udp-tracker-server/src/handlers/mod.rs b/packages/udp-tracker-server/src/handlers/mod.rs index 8c06b0621..cff4fdbe5 100644 --- a/packages/udp-tracker-server/src/handlers/mod.rs +++ b/packages/udp-tracker-server/src/handlers/mod.rs @@ -16,8 +16,8 @@ use bittorrent_udp_tracker_protocol::{Request, Response, TransactionId}; use connect::handle_connect; use error::handle_error; use scrape::handle_scrape; +use torrust_clock::clock::Time; use torrust_net_primitives::service_binding::ServiceBinding; -use torrust_tracker_clock::clock::Time; use tracing::{Level, instrument}; use uuid::Uuid; diff --git a/packages/udp-tracker-server/src/lib.rs b/packages/udp-tracker-server/src/lib.rs index c200192a8..0564680e5 100644 --- a/packages/udp-tracker-server/src/lib.rs +++ b/packages/udp-tracker-server/src/lib.rs @@ -645,7 +645,7 @@ pub mod statistics; use std::net::SocketAddr; -use torrust_tracker_clock::clock; +use torrust_clock::clock; /// The maximum number of bytes in a UDP packet. pub const MAX_PACKET_SIZE: usize = 1496; @@ -680,7 +680,7 @@ pub(crate) mod tests { use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use bittorrent_udp_tracker_core::event::Event; - use torrust_tracker_clock::DurationSinceUnixEpoch; + use torrust_clock::DurationSinceUnixEpoch; use torrust_tracker_primitives::{AnnounceEvent, NumberOfBytes, PeerId, peer}; pub fn sample_peer() -> peer::Peer { diff --git a/packages/udp-tracker-server/src/server/mod.rs b/packages/udp-tracker-server/src/server/mod.rs index 59a4ca385..c7254a0da 100644 --- a/packages/udp-tracker-server/src/server/mod.rs +++ b/packages/udp-tracker-server/src/server/mod.rs @@ -72,7 +72,7 @@ mod tests { } fn initialize_static() { - torrust_tracker_clock::initialize_static(); + torrust_clock::initialize_static(); bittorrent_udp_tracker_core::initialize_static(); } diff --git a/packages/udp-tracker-server/src/statistics/event/handler/error.rs b/packages/udp-tracker-server/src/statistics/event/handler/error.rs index 3553ebffe..ed5dcf6e8 100644 --- a/packages/udp-tracker-server/src/statistics/event/handler/error.rs +++ b/packages/udp-tracker-server/src/statistics/event/handler/error.rs @@ -1,7 +1,7 @@ use bittorrent_udp_tracker_protocol::PeerClient; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::{label_name, metric_name}; -use torrust_tracker_clock::DurationSinceUnixEpoch; use crate::event::{ConnectionContext, ErrorKind, UdpRequestKind}; use crate::statistics::repository::Repository; @@ -104,8 +104,8 @@ fn extract_name_and_version(peer_client: &PeerClient) -> (String, String) { mod tests { use std::net::{IpAddr, Ipv4Addr, SocketAddr}; + use torrust_clock::clock::Time; use torrust_net_primitives::service_binding::{Protocol, ServiceBinding}; - use torrust_tracker_clock::clock::Time; use crate::CurrentClock; use crate::event::{ConnectionContext, Event}; diff --git a/packages/udp-tracker-server/src/statistics/event/handler/mod.rs b/packages/udp-tracker-server/src/statistics/event/handler/mod.rs index 24f272445..34f1ddc60 100644 --- a/packages/udp-tracker-server/src/statistics/event/handler/mod.rs +++ b/packages/udp-tracker-server/src/statistics/event/handler/mod.rs @@ -5,7 +5,7 @@ mod request_banned; mod request_received; mod response_sent; -use torrust_tracker_clock::DurationSinceUnixEpoch; +use torrust_clock::DurationSinceUnixEpoch; use crate::event::Event; use crate::statistics::repository::Repository; diff --git a/packages/udp-tracker-server/src/statistics/event/handler/request_aborted.rs b/packages/udp-tracker-server/src/statistics/event/handler/request_aborted.rs index e17eddc00..60c4b1f90 100644 --- a/packages/udp-tracker-server/src/statistics/event/handler/request_aborted.rs +++ b/packages/udp-tracker-server/src/statistics/event/handler/request_aborted.rs @@ -1,6 +1,6 @@ +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::metric_name; -use torrust_tracker_clock::DurationSinceUnixEpoch; use crate::event::ConnectionContext; use crate::statistics::UDP_TRACKER_SERVER_REQUESTS_ABORTED_TOTAL; @@ -24,8 +24,8 @@ pub async fn handle_event(context: ConnectionContext, stats_repository: &Reposit mod tests { use std::net::{IpAddr, Ipv4Addr, SocketAddr}; + use torrust_clock::clock::Time; use torrust_net_primitives::service_binding::{Protocol, ServiceBinding}; - use torrust_tracker_clock::clock::Time; use crate::CurrentClock; use crate::event::{ConnectionContext, Event}; diff --git a/packages/udp-tracker-server/src/statistics/event/handler/request_accepted.rs b/packages/udp-tracker-server/src/statistics/event/handler/request_accepted.rs index f7c97c616..a7b54acff 100644 --- a/packages/udp-tracker-server/src/statistics/event/handler/request_accepted.rs +++ b/packages/udp-tracker-server/src/statistics/event/handler/request_accepted.rs @@ -1,6 +1,6 @@ +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::{LabelSet, LabelValue}; use torrust_metrics::{label_name, metric_name}; -use torrust_tracker_clock::DurationSinceUnixEpoch; use crate::event::{ConnectionContext, UdpRequestKind}; use crate::statistics::UDP_TRACKER_SERVER_REQUESTS_ACCEPTED_TOTAL; @@ -29,8 +29,8 @@ pub async fn handle_event( mod tests { use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; + use torrust_clock::clock::Time; use torrust_net_primitives::service_binding::{Protocol, ServiceBinding}; - use torrust_tracker_clock::clock::Time; use crate::CurrentClock; use crate::event::{ConnectionContext, Event}; diff --git a/packages/udp-tracker-server/src/statistics/event/handler/request_banned.rs b/packages/udp-tracker-server/src/statistics/event/handler/request_banned.rs index 87f780bb8..724ca184c 100644 --- a/packages/udp-tracker-server/src/statistics/event/handler/request_banned.rs +++ b/packages/udp-tracker-server/src/statistics/event/handler/request_banned.rs @@ -1,6 +1,6 @@ +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::metric_name; -use torrust_tracker_clock::DurationSinceUnixEpoch; use crate::event::ConnectionContext; use crate::statistics::UDP_TRACKER_SERVER_REQUESTS_BANNED_TOTAL; @@ -24,8 +24,8 @@ pub async fn handle_event(context: ConnectionContext, stats_repository: &Reposit mod tests { use std::net::{IpAddr, Ipv4Addr, SocketAddr}; + use torrust_clock::clock::Time; use torrust_net_primitives::service_binding::{Protocol, ServiceBinding}; - use torrust_tracker_clock::clock::Time; use crate::CurrentClock; use crate::event::{ConnectionContext, Event}; diff --git a/packages/udp-tracker-server/src/statistics/event/handler/request_received.rs b/packages/udp-tracker-server/src/statistics/event/handler/request_received.rs index f946c6a7d..07056f788 100644 --- a/packages/udp-tracker-server/src/statistics/event/handler/request_received.rs +++ b/packages/udp-tracker-server/src/statistics/event/handler/request_received.rs @@ -1,6 +1,6 @@ +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::metric_name; -use torrust_tracker_clock::DurationSinceUnixEpoch; use crate::event::ConnectionContext; use crate::statistics::UDP_TRACKER_SERVER_REQUESTS_RECEIVED_TOTAL; @@ -24,8 +24,8 @@ pub async fn handle_event(context: ConnectionContext, stats_repository: &Reposit mod tests { use std::net::{IpAddr, Ipv4Addr, SocketAddr}; + use torrust_clock::clock::Time; use torrust_net_primitives::service_binding::{Protocol, ServiceBinding}; - use torrust_tracker_clock::clock::Time; use crate::CurrentClock; use crate::event::{ConnectionContext, Event}; diff --git a/packages/udp-tracker-server/src/statistics/event/handler/response_sent.rs b/packages/udp-tracker-server/src/statistics/event/handler/response_sent.rs index 67bb4bcc7..6fd7cf213 100644 --- a/packages/udp-tracker-server/src/statistics/event/handler/response_sent.rs +++ b/packages/udp-tracker-server/src/statistics/event/handler/response_sent.rs @@ -1,6 +1,6 @@ +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::{LabelSet, LabelValue}; use torrust_metrics::{label_name, metric_name}; -use torrust_tracker_clock::DurationSinceUnixEpoch; use crate::event::{ConnectionContext, UdpRequestKind, UdpResponseKind}; use crate::statistics::UDP_TRACKER_SERVER_RESPONSES_SENT_TOTAL; @@ -68,8 +68,8 @@ pub async fn handle_event( mod tests { use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; + use torrust_clock::clock::Time; use torrust_net_primitives::service_binding::{Protocol, ServiceBinding}; - use torrust_tracker_clock::clock::Time; use crate::CurrentClock; use crate::event::{ConnectionContext, Event}; diff --git a/packages/udp-tracker-server/src/statistics/event/listener.rs b/packages/udp-tracker-server/src/statistics/event/listener.rs index 7366957e4..369be27c6 100644 --- a/packages/udp-tracker-server/src/statistics/event/listener.rs +++ b/packages/udp-tracker-server/src/statistics/event/listener.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use bittorrent_udp_tracker_core::UDP_TRACKER_LOG_TARGET; use tokio::task::JoinHandle; use tokio_util::sync::CancellationToken; -use torrust_tracker_clock::clock::Time; +use torrust_clock::clock::Time; use torrust_tracker_events::receiver::RecvError; use super::handler::handle_event; diff --git a/packages/udp-tracker-server/src/statistics/metrics.rs b/packages/udp-tracker-server/src/statistics/metrics.rs index 01ddad28b..ab674cc40 100644 --- a/packages/udp-tracker-server/src/statistics/metrics.rs +++ b/packages/udp-tracker-server/src/statistics/metrics.rs @@ -1,13 +1,13 @@ use std::time::Duration; use serde::Serialize; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::metric::MetricName; use torrust_metrics::metric_collection::aggregate::avg::Avg; use torrust_metrics::metric_collection::aggregate::sum::Sum; use torrust_metrics::metric_collection::{Error, MetricCollection}; use torrust_metrics::metric_name; -use torrust_tracker_clock::DurationSinceUnixEpoch; use crate::statistics::{ UDP_TRACKER_SERVER_ERRORS_TOTAL, UDP_TRACKER_SERVER_IPS_BANNED_TOTAL, @@ -380,8 +380,8 @@ impl Metrics { #[cfg(test)] mod tests { + use torrust_clock::clock::Time; use torrust_metrics::metric_name; - use torrust_tracker_clock::clock::Time; use super::*; use crate::CurrentClock; diff --git a/packages/udp-tracker-server/src/statistics/repository.rs b/packages/udp-tracker-server/src/statistics/repository.rs index beac24fd6..6bfacad20 100644 --- a/packages/udp-tracker-server/src/statistics/repository.rs +++ b/packages/udp-tracker-server/src/statistics/repository.rs @@ -2,10 +2,10 @@ use std::sync::Arc; use std::time::Duration; use tokio::sync::{RwLock, RwLockReadGuard}; +use torrust_clock::DurationSinceUnixEpoch; use torrust_metrics::label::LabelSet; use torrust_metrics::metric::MetricName; use torrust_metrics::metric_collection::Error; -use torrust_tracker_clock::DurationSinceUnixEpoch; use super::describe_metrics; use super::metrics::Metrics; @@ -94,9 +94,9 @@ mod tests { use core::f64; use std::time::Duration; + use torrust_clock::clock::Time; use torrust_metrics::metric_collection::aggregate::sum::Sum; use torrust_metrics::metric_name; - use torrust_tracker_clock::clock::Time; use super::*; use crate::CurrentClock; @@ -590,8 +590,8 @@ mod tests { use std::time::Duration; use tokio::task::JoinHandle; + use torrust_clock::clock::Time; use torrust_metrics::metric_name; - use torrust_tracker_clock::clock::Time; use super::*; use crate::CurrentClock; diff --git a/packages/udp-tracker-server/tests/integration.rs b/packages/udp-tracker-server/tests/integration.rs index 70b3aeb89..9d05c95c1 100644 --- a/packages/udp-tracker-server/tests/integration.rs +++ b/packages/udp-tracker-server/tests/integration.rs @@ -6,7 +6,7 @@ mod common; mod server; -use torrust_tracker_clock::clock; +use torrust_clock::clock; /// This code needs to be copied into each crate. /// Working version, for production. diff --git a/src/app.rs b/src/app.rs index de7e64a7b..7981d9c22 100644 --- a/src/app.rs +++ b/src/app.rs @@ -23,7 +23,7 @@ //! - Tracker REST API: the tracker API can be enabled/disabled. use std::sync::Arc; -use torrust_tracker_clock::clock::Time; +use torrust_clock::clock::Time; use torrust_tracker_configuration::{Configuration, HttpTracker, UdpTracker}; use tracing::instrument; diff --git a/src/bootstrap/app.rs b/src/bootstrap/app.rs index eb01ca439..7541fbcd8 100644 --- a/src/bootstrap/app.rs +++ b/src/bootstrap/app.rs @@ -73,6 +73,6 @@ pub fn initialize_global_services(configuration: &Configuration) { /// it's changed when the main application process is restarted. #[instrument(skip())] pub fn initialize_static() { - torrust_tracker_clock::initialize_static(); + torrust_clock::initialize_static(); bittorrent_udp_tracker_core::initialize_static(); } diff --git a/src/bootstrap/jobs/activity_metrics_updater.rs b/src/bootstrap/jobs/activity_metrics_updater.rs index 08bc83317..2a430a8b2 100644 --- a/src/bootstrap/jobs/activity_metrics_updater.rs +++ b/src/bootstrap/jobs/activity_metrics_updater.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use std::time::Duration; use tokio::task::JoinHandle; -use torrust_tracker_clock::clock::Time; +use torrust_clock::clock::Time; use torrust_tracker_configuration::Configuration; use crate::CurrentClock; diff --git a/src/lib.rs b/src/lib.rs index cb137631f..a57114d47 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -487,7 +487,7 @@ //! In addition to the production code documentation you can find a lot of //! examples on the integration and unit tests. -use torrust_tracker_clock::clock; +use torrust_clock::clock; pub mod app; pub mod bootstrap; diff --git a/tests/integration.rs b/tests/integration.rs index 92289c415..c0af43b87 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -9,7 +9,7 @@ //! ``` mod servers; -use torrust_tracker_clock::clock; +use torrust_clock::clock; /// This code needs to be copied into each crate. /// Working version, for production. From 8c4ad90c276bbf7a28751982f8f3a7460af00569 Mon Sep 17 00:00:00 2001 From: Jose Celano Date: Thu, 21 May 2026 17:36:24 +0100 Subject: [PATCH 3/5] docs(issues): add PR #1822 to spec for SI-09 #1821 --- ...1-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/issues/open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md b/docs/issues/open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md index 1840d3f9b..cb03f72d4 100644 --- a/docs/issues/open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md +++ b/docs/issues/open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md @@ -6,8 +6,8 @@ priority: p2 github-issue: 1821 spec-path: docs/issues/open/1821-1669-09-rename-torrust-tracker-clock-to-torrust-clock.md branch: 1821-rename-torrust-tracker-clock-to-torrust-clock -related-pr: null -last-updated-utc: 2026-05-21 12:00 +related-pr: 1822 +last-updated-utc: 2026-05-21 16:00 semantic-links: skill-links: - create-issue From 588d6fe844680a9517c86c637bd9f31ef8ca635c Mon Sep 17 00:00:00 2001 From: Jose Celano Date: Thu, 21 May 2026 17:53:59 +0100 Subject: [PATCH 4/5] fix(clock): address Copilot review comments on PR #1822 - EPIC Package Inventory: mark torrust-clock as unpublished (No) since the new crate name is not yet on crates.io; publishing is deferred to SI-13 - workspace-coupling: replace stale thin-dep bullets with a note that both were resolved (SI-02 and SI-03 respectively) --- contrib/dev-tools/analysis/workspace-coupling/src/main.rs | 7 +++---- docs/issues/open/1669-overhaul-packages/EPIC.md | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/contrib/dev-tools/analysis/workspace-coupling/src/main.rs b/contrib/dev-tools/analysis/workspace-coupling/src/main.rs index 6aa8a839c..6a334f849 100644 --- a/contrib/dev-tools/analysis/workspace-coupling/src/main.rs +++ b/contrib/dev-tools/analysis/workspace-coupling/src/main.rs @@ -289,10 +289,9 @@ fn write_observations(out: &mut String) { writeln!(out).unwrap(); writeln!(out, "### Known thin dependencies (pre-existing)").unwrap(); writeln!(out).unwrap(); - writeln!(out, "- `torrust-clock` → `torrust-tracker-primitives`: only").unwrap(); - writeln!(out, " `DurationSinceUnixEpoch` imported. Addressed by SI-02.").unwrap(); - writeln!(out, "- `torrust-tracker-configuration` → `torrust-clock`: only").unwrap(); - writeln!(out, " `DEFAULT_TIMEOUT` imported. Addressed by SI-03.").unwrap(); + writeln!(out, "None — previously known thin dependencies have been resolved:").unwrap(); + writeln!(out, "- `torrust-clock` → `torrust-tracker-primitives` (resolved by SI-02)").unwrap(); + writeln!(out, "- `torrust-tracker-configuration` → `torrust-clock` (resolved by SI-03)").unwrap(); writeln!(out).unwrap(); writeln!(out, "### New findings").unwrap(); writeln!(out).unwrap(); diff --git a/docs/issues/open/1669-overhaul-packages/EPIC.md b/docs/issues/open/1669-overhaul-packages/EPIC.md index 1ea9a9734..986022e17 100644 --- a/docs/issues/open/1669-overhaul-packages/EPIC.md +++ b/docs/issues/open/1669-overhaul-packages/EPIC.md @@ -60,7 +60,7 @@ The workspace currently contains **27 packages** (including the root `torrust-tr | Published on crates.io | Crate Name | Folder | | ---------------------- | ------------------------ | ---------------- | -| Yes | `torrust-clock` | `clock` | +| No | `torrust-clock` | `clock` | | No | `torrust-metrics` | `metrics` | | No | `torrust-net-primitives` | `net-primitives` | | No | `torrust-server-lib` | `server-lib` | From d956c7e4cd295cfc452fd9264d8921d360d3c635 Mon Sep 17 00:00:00 2001 From: Jose Celano Date: Thu, 21 May 2026 18:03:01 +0100 Subject: [PATCH 5/5] docs(skills): document VS Code fork-based PR limitation in review skills The VS Code `currentActivePullRequest` and `pullRequestInViewport` tools do not detect fork-based PRs. Since all contributor PRs in this repository are fork-based, clarify that GitHub CLI GraphQL is the primary path for fetching and resolving review threads in both the fetch-review-threads and resolve-review-threads skills. --- .../dev/pr-reviews/fetch-review-threads/SKILL.md | 13 ++++++++----- .../dev/pr-reviews/resolve-review-threads/SKILL.md | 11 ++++++++--- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/skills/dev/pr-reviews/fetch-review-threads/SKILL.md b/.github/skills/dev/pr-reviews/fetch-review-threads/SKILL.md index e6c505b78..19cd67533 100644 --- a/.github/skills/dev/pr-reviews/fetch-review-threads/SKILL.md +++ b/.github/skills/dev/pr-reviews/fetch-review-threads/SKILL.md @@ -23,11 +23,14 @@ review thread IDs and enough context to decide whether each thread should stay o Use one of these approaches: -1. Active pull request tools when they are available in the environment. -2. GitHub CLI GraphQL when you need a terminal-based fallback. - -Prefer the active PR tools first because they provide thread metadata together with file paths, -resolution state, and comments. +1. GitHub CLI GraphQL — reliable for all PRs, including fork-based PRs (see note below). +2. Active pull request tools when they are available in the environment and the PR is not fork-based. + +> **Fork-based PR limitation**: The VS Code `currentActivePullRequest` and `pullRequestInViewport` +> tools do **not** detect PRs opened from a fork (e.g. `contributor:branch` → `upstream/repo`). +> In this repository all contributor PRs are fork-based, so the GitHub CLI GraphQL approach +> is the reliable primary path. Use the VS Code tools only when you know the branch lives in +> the same repository as the target. ## What to Collect diff --git a/.github/skills/dev/pr-reviews/resolve-review-threads/SKILL.md b/.github/skills/dev/pr-reviews/resolve-review-threads/SKILL.md index 048acdbea..766cdfb78 100644 --- a/.github/skills/dev/pr-reviews/resolve-review-threads/SKILL.md +++ b/.github/skills/dev/pr-reviews/resolve-review-threads/SKILL.md @@ -36,10 +36,15 @@ concern is fixed or intentionally declined with a clear reason. ## Preferred Resolution Path -If PR tools are available, first gather thread IDs from the active pull request metadata. +Use GitHub CLI GraphQL to gather thread IDs and resolve threads directly from the terminal. +This is reliable for all PRs, including fork-based PRs. -- Use the active PR tools to identify unresolved `reviewThreads`. -- Resolve only threads where `isResolved == false` and the fix is already on the branch. +> **Fork-based PR limitation**: The VS Code `currentActivePullRequest` and `pullRequestInViewport` +> tools do **not** detect PRs opened from a fork (e.g. `contributor:branch` → `upstream/repo`). +> In this repository all contributor PRs are fork-based, so the GitHub CLI GraphQL approach +> is the reliable primary path. Do not rely on the VS Code active PR tools for thread IDs. + +Resolve only threads where `isResolved == false` and the fix is already on the branch. ## GitHub CLI GraphQL Command