summaryrefslogtreecommitdiff
path: root/crates/tor-dirserver
Commit message (Collapse)AuthorAgeFilesLines
...
* tor-dirserver: Implement read_tx and rw_txClara Engler2025-10-302-55/+352
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit does a large overhaul in the overall way on how we interact with SQLite. Although SQLite is a fairly straightforward tool, it has one large caveat, namely the handling of the infamous `SQLITE_BUSY` error. In WAL mode, the journaling mode we are using, the respective error may occur if there is an existing write transaction while another thread is trying to either upgrade an existing read transaction or create an exclusive transaction at the same time. In this case, SQLite will fail at the statement that either requires the write operation or at the creation of the transaction respectively. In order to tackle this problem, SQLite provides the `busy_timeout` pragma, which allows specifying a timeout in milliseconds during which SQLite will retry to obtain a write transaction or fail immediately. This only works in the latter case, that is, creating a write transaction from the beginning. To solve this issue, we introduce two new functions: 1. `database::read_tx` 2. `database::rw_tx` Both functions accept a database pool alongside a closure accepting a `Transaction` and returning an arbitrary return value. The first function creates a deferred transaction that gets rolled-back in the end, making it suitable for read-only connections. The latter function creates an exclusive transaction that gets committed in the end, making it suitable for read-write connections. This also honors the `busy_timeout`, i.e. the function retries for up to 1s to acquire a write transaction before failing ultimately.
* tor-dirmirror: Introduce the `sql!` macroClara Engler2025-10-303-2/+23
| | | | | | This commit introduces the no-op sql macro used to mark string literals as SQL statements. It is purely semantical and serves the purpose to quickly identify string literals as SQL statements.
* tor-dirserver: Outline the `mirror` APIClara Engler2025-10-302-1/+150
| | | | | | This commit introduces the `mirror` module which is fairly boilerplate at the moment. However, everything of it is very well documented using rustdoc, thereby more or less creating a design document.
* maint: remove all semver.md filesSteven Engler2025-10-301-3/+0
|
* maint: bump minor versions of all published cratesSteven Engler2025-10-291-2/+2
| | | | | | | ```bash readarray -t publish < <(cargo metadata --format-version 1 | jq -r '.packages[] | select((.id | startswith("path+file:///")) and (.rust_version != null) and (.publish == null or .publish == true or .publish != [])) | .name') for package in "${publish[@]}"; do echo "$package:"; cargo set-version --bump minor -p "$package"; done ```
* tor-dirserver: add missing semver breaking changesSteven Engler2025-10-281-0/+3
|
* tor-dirserver: bump MSRV from 1.83 to 1.86hashcatHitman2025-10-211-1/+1
| | | | | | | | | | | | I noticed that when doing `cargo generate-lockfile` in the workspace root, it was locking dependencies to 1.83 compatible versions. It turns out tor-dirserver started on MSRV 1.83 after we already bumped to 1.85, and has been missed in MSRV updates ever since. I've found no indication it is intentionally getting this special treatment and am assuming it is a mistake. Signed-off-by: hashcatHitman <[email protected]>
* tor-dirserver: Expose Arc of StoreCacheClara Engler2025-10-152-15/+15
|
* tor-dirserver: Do not lock during db queryClara Engler2025-10-151-7/+14
|
* tor-dirserver: Don't expose rusqlite::Error in PoolClara Engler2025-10-153-11/+28
|
* tor-dirserver: Fix rustdoc commentClara Engler2025-10-151-3/+3
|
* tor-dirserver: Some clippy fixesClara Engler2025-10-154-3/+19
|
* tor-dirserver: Remove unsafe unreachableClara Engler2025-10-151-3/+3
|
* tor-dirserver: Remove due TODOClara Engler2025-10-151-4/+0
|
* tor-dirserver: Improve the error situationClara Engler2025-10-153-140/+140
|
* tor-dirserver: Create database moduleClara Engler2025-10-153-88/+98
| | | | | This commit renames the schema module to the database module in order to perform better error handling while redesigning the API.
* tor-dirserver: Remove unused importsClara Engler2025-10-152-9/+0
|
* tor-dirserver: Store endpoint paths in `&str`Clara Engler2025-10-151-11/+34
|
* tor-dirserver: Get rid of the poor buildersClara Engler2025-10-153-138/+20
|
* tor-dirserver: Move StoreCache into own moduleClara Engler2025-10-152-151/+178
|
* release: Bump versions.Wesley Aptekar-Cassels2025-10-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because we've updated our MSRV, we must bump the minor version for every package. This was done as follows: cargo set-version -p arti 1.6.0 cargo set-version -p oneshot-fused-workaround 0.4.0 cargo set-version -p slotmap-careful 0.4.0 cargo set-version -p test-temp-dir 0.5.0 cargo set-version -p fslock-guard 0.4.0 cargo set-version -p hashx 0.5.0 cargo set-version -p equix 0.4.0 cargo set-version -p caret 0.7.0 cargo set-version -p fs-mistrust 0.12.0 cargo set-version -p safelog 0.6.0 cargo set-version -p retry-error 0.8.0 xargs -I P <<END cargo set-version -p P 0.35.0 tor-basic-utils tor-error tor-general-addr tor-geoip tor-rtcompat tor-rtmock tor-async-utils tor-config tor-config-path tor-rpc-connect tor-log-ratelim tor-rpcbase tor-memquota tor-units tor-llcrypto tor-bytes tor-protover tor-checkable tor-cert tor-key-forge tor-hscrypto tor-socksproto tor-linkspec tor-cell tor-proto tor-netdoc tor-consdiff tor-netdir tor-relay-selection tor-persist tor-keymgr tor-chanmgr tor-ptmgr tor-dircommon tor-guardmgr tor-circmgr tor-dirclient tor-dirmgr tor-dirserver tor-hsclient tor-hsservice tor-hsrproxy tor-relay-crypto arti-client arti-relay arti-rpcserver arti-ureq arti-rpc-client-core END
* release: Run fixup-features.Wesley Aptekar-Cassels2025-10-011-0/+3
|
* Remove "doc_auto_cfg" incantation from all crates.Nick Mathewson2025-09-291-1/+1
| | | | This feature has been removed from nightly, in favor of doc_cfg.
* tor-dirserver: Allow complexity in some fn'sClara Engler2025-09-041-0/+2
| | | | | | | This commit allows `#[allow(clippy::cognitive_complexity)]` in `HttpServer::serve` and `HttpServer::handler_tx`. Allowing this might be controversial but both functions, especially the latter one, are well documented.
* tor-dirserver: Set versions to 0.34.0Clara Engler2025-09-041-2/+2
|
* tor-dirserver: Add TODOs for unresolved discussionsClara Engler2025-09-041-0/+5
|
* tor-dirserver: Remove unused error membersClara Engler2025-09-041-12/+0
|
* tor-dirmirror: Schema x-ref for `unsigned_sha3_256`Clara Engler2025-09-041-0/+2
|
* tor-dirserver: Add missing sha1 length checkClara Engler2025-09-041-0/+1
|
* tor-dirserver: Better wording for "thread poisoned"Clara Engler2025-09-041-2/+2
|
* tor-dirserver: Ensure uppercase hex in schemaClara Engler2025-09-041-0/+8
|
* tor-dirserver: Use `internal!` macro for errorClara Engler2025-09-041-7/+3
|
* tor-dirserver Use `tor_error::Bug`Clara Engler2025-09-043-6/+11
| | | | This commit uses `tor_error::Bug` for indicating thread poisoning.
* tor-dirserver: Use `expect` instead of `unwrap`Clara Engler2025-09-041-11/+6
|
* tor-dirserver: TODO about endpoint error handlingClara Engler2025-09-041-0/+3
|
* tor-dirserver: Rename `cb` to `endpoint_fn`Clara Engler2025-09-041-6/+6
| | | | | This commit renames `cb` to `endpoint_fn` everywhere, including internal implementations.
* tor-dirmirror: Add several "TODO DIRMIRROR" linesClara Engler2025-09-044-1/+17
|
* tor-dirserver: Enable `PRAGMA foreign_keys=ON`Clara Engler2025-09-041-1/+5
| | | | | This commit enables `PRAGMA foreign_keys=ON;` for every connection by adding an appropriate statement to `schema::prepare_db`.
* tor-dirserver: Use strum for `ContentEncoding`Clara Engler2025-09-042-33/+43
|
* tor-dirserver: Document hex case in schemaClara Engler2025-09-041-1/+1
|
* tor-dirserver: Remove `ON DELETE CASCADE` for nowClara Engler2025-09-041-6/+6
|
* tor-dirserver: `Unrecognized` to `Incompatible`Clara Engler2025-09-042-2/+2
|
* tor-dirserver: Fix clippy warnings in testsClara Engler2025-09-042-3/+31
|
* tor-dirserver: Make more err fields `pub(crate)`Clara Engler2025-09-041-2/+2
|
* tor-dirserver: Use transactions in endpointsClara Engler2025-09-042-264/+258
| | | | | | | | | | | | | | | | | | This commit refactors a large part of the HTTP module, namely it refactors the `Callback` type to a new type called `EndpointFn` which now works in a transaction based approach and no longer gives access to the `StoreCache`. The type itself is also no longer a trait but a concrete type using `fn`. Another very notable change that became necessary during this commit was to make large parts of the codebase synchronous instead of async, namely because it is non-trivial to `Send` a `Transaction` created inside an async context to a synchronous function. Besides, this change has been deemed necessary for other reasons to. The refactoring to more synchronous code has lead to some interesting changes in `StoreCache` too, namely that in no longer uses async mutex, but a synchronous mutex instead.
* tor-dirserver: Add clippy checks and fix themClara Engler2025-09-045-18/+76
|
* tor-dirserver: Add http moduleClara Engler2025-09-044-3/+1188
| | | | | | | This commit implements the initial draft for the HTTP module. It is fairly complicated but well documented within the source code, please refer to that instead.
* tor-dirserver: Add schema moduleClara Engler2025-09-044-0/+284
| | | | | | This commit adds the `schema.rs` module, which implements the database schema alongside some functions for initializing the database and obtaining the database schema version.
* tor-dirserver: Initial commitClara Engler2025-09-045-0/+90
This commit lays the initial groundwork for the `tor-dirserver` crate, a crate that shall implement functionality for dirmirros and dirauths. For now, the current crate consists of three bare bone modules: * lib.rs * err.rs * mirror.rs All of which contain mostly boilerplate code for now