summaryrefslogtreecommitdiff
path: root/crates/tor-dirserver/src/err.rs
Commit message (Collapse)AuthorAgeFilesLines
* Fix typosTobias Stoeckmann2026-03-241-2/+2
| | | | Typos found with codespell
* tor-dirserver: Add `StaticEngine::send_request()`Clara Engler2026-03-091-0/+7
| | | | | | | | | | | | | This commit adds a new method to static engine that serves as a convenience wrapper around `tor_dirclient::send_request`. The reason for that is, that fetch_consensus is not the only method that requires performing download requests, so it makes sense to generalize it. Besides, it also adds support for parsing multiple netdocs alongside storing their raw variant, which is required for inserting them into the database at one point eventually.
* tor-dirserver: Add IsFatal traitClara Engler2026-03-091-17/+22
| | | | | This commit adds the IsFatal trait to the err module for having a generic signature for the fatality of certain error variants.
* tor-dirservert: Implement FetchConsensus stateClara Engler2026-03-091-0/+52
| | | | | | | | | | | | This commit implements the `FetchConsensus` state by adding a method to `StaticEngine` called `fetch_consensus`, which retrieves the consensus from an upstream directory authority. Likewise, it also implements a new error type called `AuthorityRequestError`. The retry logic is handled externally which will be done in later commits.
* tor-dirserver: Remove unused error variantsClara Engler2026-03-091-62/+0
|
* tor-dirserver: Remove serve functionClara Engler2026-03-091-17/+0
| | | | | This commit removes the operation serve function because it no longer fits into the new model of operation using a FSM.
* tor-dirserver: Scratch out the FSMClara Engler2026-03-091-0/+36
| | | | | | | This commit scratches out the FSM for the dirmirror operation. Right now, there are still lots of TODO, lots of code warnigns, and such. It should model the rough concept.
* tor-dirserver: Make compression failures a bugClara Engler2026-01-221-4/+0
| | | | | | | | | | | | | | This commit removes `DatabaseError::Compression` because it does not fit in. Right now, this single variant makes the error to be call-site oriented which is not nice for error handling. Instead, this error should indicate that something was truly wrong with the database in itself, such as an invalid schema, a low-level SQLite bug, etc. Instead, we now map a compression error to `DatabaseError::Bug` because there is no good reason on why it should fail, given that we compress memory data to memory data. Probably because it uses the `std::io::Writer` interface which itself demands use of `std::io::Result`.
* tor-dirserver: Implement authcert retrieval logicClara Engler2026-01-151-1/+19
| | | | | | | | | | | This commit implements the logic necessary to retrieve the (missing) directory authority certificates from an upstream directory authority. In order to do so, this commit implements three new functions: 1. `download_authority_certificates()` 2. `parse_authority_certificates()` 3. `verify_authority_certificates()` 4. `insert_authority_certificates()`
* tor-dirserver: Support for inserting into storeClara Engler2026-01-151-0/+4
| | | | | | | | This commit implements support for adding arbitrary documents into the store table. It is non-trivial because the relevant data has to be compressed into various formats, so it can be retrieved without delays.
* tor-dirserver: Add doc for TcpConnect errorClara Engler2025-12-101-0/+4
|
* tor-dirserver: Replace IO with TcpConnect errorClara Engler2025-12-101-3/+11
| | | | | | | | This commit replaces `AuthorityCommunicationError::IO` with `AuthorityCommunicationError::TcpConnect` while removing the respective `From<std::io::Error>` implementation, mostly because an IO error is way too generic and in our case, it would only occurr with a failed TCP connection.
* tor-dirserver: Implement DownloadManagerClara Engler2025-12-101-0/+27
| | | | | | | | | This commit implements the DownloadManager in its own module, an object responsible for downloading network documents from an upstream directory authority. Further motivation for this can be found in the rustdoc comment of the respectively introduced type.
* tor-dirserver: Add SaturatingSystemTimeClara Engler2025-10-301-27/+0
| | | | | | This commit changes various things in the dirmirror operation, namely the use of a SystemTime wrapper type that provides saturation on both ends.
* tor-dirserver: Make database full syncClara Engler2025-10-301-20/+7
| | | | | | | | | | This commit makes the entire database operations synchronous, thereby replacing deadpool with r2d2. The full motivation is outlined in a rustdoc comment at the top of the `database` module, but it can be summarized to the fact that SQLite is by design inherently synchronous due to directly interfacing with the file system.
* tor-dirserver: Outline the dirmirror operationClara Engler2025-10-301-0/+16
| | | | | | | | | | This commit creates a function named `mirror::operation::serve`, that will serve as the primary entry point for the dirmirror operation. While the function itself already contains some logic, such as querying the timeout to wait for the next consensus, it is largely a rustdoc design document that adds lots of comment to the `mirror::operation` module.
* tor-dirserver: Implement download timeoutClara Engler2025-10-301-0/+27
| | | | | | | | | | This commit starts work in the `mirror::operation` module by implementing the functions for calculating the `Duration` to wait from a given `SystemTime` until the point in time when the dirmirror should download new documents from the authorities again. Also, this commit introduces new error types and internal helper functions in order to fulfill this purpose better.
* tor-dirserver: Don't expose rusqlite::Error in PoolClara Engler2025-10-151-9/+16
|
* tor-dirserver: Some clippy fixesClara Engler2025-10-151-1/+4
|
* tor-dirserver: Improve the error situationClara Engler2025-10-151-28/+27
|
* tor-dirserver: Remove unused importsClara Engler2025-10-151-5/+0
|
* tor-dirserver: Get rid of the poor buildersClara Engler2025-10-151-10/+0
|
* tor-dirserver: Remove unused error membersClara Engler2025-09-041-12/+0
|
* tor-dirserver Use `tor_error::Bug`Clara Engler2025-09-041-4/+3
| | | | This commit uses `tor_error::Bug` for indicating thread poisoning.
* tor-dirmirror: Add several "TODO DIRMIRROR" linesClara Engler2025-09-041-0/+2
|
* tor-dirserver: `Unrecognized` to `Incompatible`Clara Engler2025-09-041-1/+1
|
* tor-dirserver: Make more err fields `pub(crate)`Clara Engler2025-09-041-2/+2
|
* tor-dirserver: Use transactions in endpointsClara Engler2025-09-041-0/+15
| | | | | | | | | | | | | | | | | | 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-041-0/+3
|
* tor-dirserver: Add http moduleClara Engler2025-09-041-0/+24
| | | | | | | 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-041-0/+21
| | | | | | 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-041-0/+12
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