| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
Done using:
```
for crate in $(./maint/list_crates | rg '^(tor|arti-)'); do
cargo set-version -p $crate 0.37.0
done
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
This commit improves upon the work made in arti!3460, by establishing
the `database::Timestamp` type as a general purpose type for the
handling of timestamp throughout the code base.
It also replaces all previous occurrences of `SystemTime` within
`dirmirror::operation`, which leads to the reduction of code complexity
in one particular function, namely `calculate_sync_timeout`.
|
| | |
|
| |
|
|
|
|
|
| |
This commit replaces the custom implementation of `SaturatingSystemTime`
with the `saturating-time` crate, additionally adding a new type to the
`database` module called `Timestamp`, in order to have a convenient
wrapper around `ToSql` and `FromSql`.
|
| |
|
|
| |
Run maint/add_warning
|
| |\
| |
| |
| |
| | |
tor-dirserver: Apply database changes to http
See merge request tpo/core/arti!3426
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit applies the recent changes to the database module into the
http and http::cache module.
Notably, this includes the use of the database::sql! macro as well as
the use of database::read_tx and database::rw_tx for creation
transaction and saving, as well as retrying, although the latter one is
subject to SQLite's own busy handler
|
| |/
|
|
|
|
|
|
|
|
|
|
| |
This commit refactors `get_recent_consensus()` in `tor-dirserver` to use
a single SQL statement with the power of `INNER JOIN` instead of two SQL
statements querying the store after retrieving the SHA256 hash.
The primary motivation for this is to have cleaner code.
A single SQL statement is often-times easier to comprehend, as well more
performant in execution, although that can only be proven with a
profiler and is not of much concern, given that this function is only
executed roughly every 60-90min.
|
| |
|
|
|
|
| |
This commit changes various things in the dirmirror operation, namely
the use of a SystemTime wrapper type that provides saturation on both
ends.
|
| |
|
|
|
| |
This commit adds `CHECK` constraints to the database schema in order to
ensure all timestamps are positive.
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
| |
```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
```
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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]>
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
This commit renames the schema module to the database module in order
to perform better error handling while redesigning the API.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| | |
|
| |
|
|
| |
This feature has been removed from nightly, in favor of doc_cfg.
|
| |
|
|
|
|
|
| |
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.
|