Commit Graph

465 Commits

Author SHA1 Message Date
Ian Jackson 1c085cf401 bridge desc mgr: Add dormancy comment to effective_parallelism
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/861#note_2856922
2022-11-23 18:20:58 +00:00
Ian Jackson 68acedccfd bridge desc mgr: Test dormancy 2022-11-23 18:20:58 +00:00
Ian Jackson e0c4eed549 bridge desc mgr: Honour specified dormancy
Fixes #630
2022-11-23 18:20:58 +00:00
Ian Jackson a33df9a5f5 bridge desc mgr: Introduce effective_parallelism helper 2022-11-23 18:20:58 +00:00
Ian Jackson 2c98351e2d bridge desc mgr: Move set_dormancy to impl that is for mock too 2022-11-23 18:20:58 +00:00
Ian Jackson ee87097dc1 BridgeConfig: Replace all Arc<BridgeConfig> with BridgeConfig
BridgeConfig is itself an Arc now, so these are redundant.
2022-11-22 15:33:21 +00:00
Ian Jackson 285a7988bb Merge branch 'fix_nightly_20221118' into 'main'
Fix warnings and breakage in nightly (2022-11-18 edition)

See merge request tpo/core/arti!872
2022-11-18 16:43:16 +00:00
Nick Mathewson 829cb708e2 Fix a couple of rustdoc issues.
These slipped in while nightly was broken.
2022-11-18 10:19:54 -05:00
Nick Mathewson d51162e55b Fix a bunch of "needless borrow" warnings on nightly
It looks like, despite a few false starts, they've got this warning
right; there weren't any false positives.
2022-11-18 10:12:05 -05:00
Nick Mathewson 9f661e264f dirmgr: make "bridge-client" non-experimental. 2022-11-18 08:53:47 -05:00
Ian Jackson 58fc19dc8d Merge branch 'store3' into 'main'
dirmgr: Expopse DirMgrStore

See merge request tpo/core/arti!851
2022-11-14 17:01:10 +00:00
Ian Jackson 7efbc600c0 Merge branch 'bdm-dormant' into 'main'
bridge descriptor dormancy: Define an enum and semantics

See merge request tpo/core/arti!845
2022-11-14 17:00:40 +00:00
Ian Jackson 92939439a6 dirmgr Store: Have constructors take DirMgrStore
Now the Store is constructed by arti_client, solving the problem
described here
  https://gitlab.torproject.org/tpo/core/arti/-/issues/631#note_2853665
but in a different way.
2022-11-14 15:48:17 +00:00
Ian Jackson 5e16c55f9e dirmgr Store: Introduce DirMgrStore and use for BridgeDescMgr (fmt)
rustfmt only, broken out to ease review.
2022-11-14 15:48:17 +00:00
Ian Jackson cf362f9806 dirmgr Store: Introduce DirMgrStore and use for BridgeDescMgr
We are going to change DirMgr's constructors to also take a DirMgrStore.
2022-11-14 15:48:17 +00:00
Ian Jackson d9f231e099 dirmgr Store: Abolish redundant trait impl 2022-11-14 15:47:04 +00:00
Ian Jackson 527ab06376 dirmgr Store: Use `**` syntax and deref to trait objects
This will allow us to get rid of a needless trait impl.
2022-11-14 15:47:04 +00:00
Ian Jackson bf7d45b7b9 dirmgr Store: Move Send and 'static bounds to Store trait
This seems tidier to me.

(It saved a lot of typing when I was trying to make some complicated
pub supertrait with sealed private supertrait, but apparently not
now.)
2022-11-14 15:33:58 +00:00
Ian Jackson c6234428e3 bridge descriptor dormancy: Accept the dormancy value
But right now, don't do anything with it.  That will come in a future MR.
2022-11-11 15:34:35 +00:00
Ian Jackson eeb6d52678 bridge descriptor dormancy: Add a TODO for this enum 2022-11-11 15:26:42 +00:00
Nick Mathewson 936920b26e bump rust-version to 1.60 in every crate. 2022-11-10 10:57:33 -05:00
Ian Jackson eacb5dc2e3 bridge descriptor dormancy: Define an enum and semantics
This is part of #630.
2022-11-10 15:17:36 +00:00
Nick Mathewson d9788c16b3 Merge branch 'bridge-error' into 'main'
Use ErrorKind::TorAccessFailed for misbehaving bridges

See merge request tpo/core/arti!842
2022-11-10 13:50:47 +00:00
Nick Mathewson 3c29dfd99d Merge branch 'bdm-process-doc-test' into 'main'
bridge descs: Add tests for process_document

See merge request tpo/core/arti!841
2022-11-10 13:50:23 +00:00
Nick Mathewson 6454896d95 Merge branch 'bdm-params' into 'main'
Remove TODO re BridgeDescDownloadConfig defaults

See merge request tpo/core/arti!839
2022-11-10 13:49:54 +00:00
trinity-1686a 614cf34284 Check more targets 2022-11-10 13:34:17 +00:00
Ian Jackson 42dd5d7746 bridge desc: Drop a done TODO
We have a separate BridgeDescMgr, rather than reusing DirMgr, so we
will not be implementing BridgeDescProvider for DirMgr.
2022-11-08 18:54:31 +00:00
Ian Jackson 8fbff3a27f Use ErrorKind::TorAccessFailed for misbehaving bridges
(Use semantic linefeed for the doc comment.)
2022-11-08 18:52:57 +00:00
Ian Jackson d808f70a13 bridge descs: Add tests for process_document 2022-11-08 18:42:34 +00:00
Ian Jackson f1f4ca56a8 Remove TODO re BridgeDescDownloadConfig defaults 2022-11-08 17:34:25 +00:00
Ian Jackson 05cad7c0eb bridge desc: todo re config: weaken and reference a new ticket 2022-11-08 17:34:13 +00:00
Nick Mathewson ec9e9c86e7 Merge branch 'store' into 'main'
Persistently cache bridge descriptors

Closes #619

See merge request tpo/core/arti!831
2022-11-08 15:10:21 +00:00
Ian Jackson ea369e8385 bridge descs: Rename BridgeDescMgr from BridgeDescManager
This is more consistent with our naming elsewhere.

Suggested-by: Nick Mathewson <nickm@torproject.org>
2022-11-08 14:40:28 +00:00
eta 53f62eb8be Merge branch 'store-yak-misc' into 'main'
Small misc yaks for bridge descriptor persistence

See merge request tpo/core/arti!828
2022-11-08 14:28:14 +00:00
Ian Jackson d9d9cdeac9 bridge descs: Apply sensitive() to bridge identity in error log msg 2022-11-08 13:19:42 +00:00
Ian Jackson 93a150229a sqlite cache: Document reasoning about timestamps
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/831#note_2851764
2022-11-08 13:00:51 +00:00
Dimitris Apostolou 9c7d1802f5
Fix typos 2022-11-06 06:51:58 +02:00
Ian Jackson 5b66a5e199 bridge desc tests: Test caching and if-modified-since 2022-11-04 19:08:32 +00:00
Ian Jackson 78f7916a88 bridge desc tests: Break out queues_are_empty helper 2022-11-04 19:08:32 +00:00
Ian Jackson 40c21b7d19 bridge desc tests: Provide a sqlite connection
The current test case doesn't use this.
2022-11-04 19:08:32 +00:00
Ian Jackson 636bff3193 bridge desc: Implement storage functions at the DB layer 2022-11-04 19:08:32 +00:00
Ian Jackson 6bb2eb9902 bridge desc: Make Downloaded be Debug 2022-11-04 19:08:32 +00:00
Ian Jackson 5bc1d40a2b bridge desc: Implement cache reuse logic and if-modified-since
This introduces the new API functions to Store.
But currently they are all no-ops.
So all this machinery doesn't actually do anything.

Also, it changes the API to the mockable downloader, to allow it to
support if-modified-since.  So this isn't used either.  But it is more
convenient to do this all at once in BridgeDescManager, since care
needs to be taken about the intraction between if-modified-since and
the persistent cache.
2022-11-04 19:08:32 +00:00
Ian Jackson 279a169031 bridge desc: Rename one more variable to text 2022-11-04 19:02:23 +00:00
Ian Jackson eaaa61a8e2 bridge desc: Catch panics in the download functionality 2022-11-04 19:02:23 +00:00
Ian Jackson 3f3f27193c bridge desc: Provide a Store to the bridge desc manager
We use the one in the dirmgr.  That means that our constructor now has
to take a dirmgr.  And, the dirmgr must have a circmgr.

This is all rather odd, TBH.

Add .. to the binding of the return values from setup, as
future-proofing.

The tests now need to provide a Store too.  Make the sqlite::new_empty
function pub(crate) so we can use it.

We must retain the _db_tmp_dir, since when it goes away the tmp
directory is deleted and the db goes readonly.
2022-11-04 19:02:23 +00:00
Ian Jackson 1fa9dd62b3 bridge desc tests: Apply tracing_test::traced_test
This lets us see the log messages.  They look fine, as it happens.
2022-11-04 19:02:23 +00:00
Ian Jackson 9424b0970d tor-dirmgr: impl AsRef<dyn Error> for Error
This allows use with tor_error::Report.
2022-11-04 19:01:24 +00:00
Ian Jackson dcdd8053b4 dirmgr: Make store be in an Arc
This will let us share it with the bridge descriptor manager.
(As discussed with Nick.)
2022-11-04 19:01:24 +00:00
Ian Jackson 9a285ec4ad dirmgr sqlite store: Improve schema updates
* Centralise applying the schema updates, in a closure
 * Make the schema update SQL texts be in an array so we can loop
 * Make the version update statement generic, not cloned-and-hacked

This will make it possible to add another schema version without
error-prone conditions etc.
2022-11-04 19:01:24 +00:00