aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-rpcbase/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* add_warning: add reference to arti#2556Jim Newsome2026-07-151-1/+1
|
* Removed unnecessary lintpryty262026-07-151-1/+1
| | | | Removed unnecessary lint
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+2
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* rpc: Adjust invoke_rpc_method API and related lookups.Nick Mathewson2026-04-131-20/+29
| | | | | | | | | | | | The important thing here is that we need to look up the object _after_ we invoke any non-dispatched methods, since the object might be an expired weak reference. This required some related changes to tests and error types. Additionally, it required us to change the return value of Context::remove, since we can remove objects that are not completely present.
* rpc: Add context support for adding and removing weak refsNick Mathewson2026-04-131-2/+5
|
* Allow clippy::collapsible_if to triggerGabriela Moldovan2026-02-161-0/+1
| | | | | | | | | `clippy::collapsible_if` started triggering after bumping the MSRV to 1.88. Since this triggers from a lot of places, and since there even are a couple of instances where we explicitly allow `clippy::collapsible_ifs`, I've opened #2342 for deciding what to do about it.
* maint/add_warning: Run script to add new warningGabriela Moldovan2026-01-271-0/+1
| | | | This adds the lint to all our crates.
* Remove unnecessary `doc(cfg(...))` attributesNeel Chauhan2025-12-041-2/+0
| | | | | | | | | Fixes part of #2193. (Edits from nickm: I selected the cases here that I could verify were correct from immediate context.) Edited-by: Nick Mathewson <[email protected]>
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-2/+2
| | | | Run maint/add_warning
* 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.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-2/+2
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* Temporarily suppress mismatched_lifetime_syntaxes.Gabriela Moldovan2025-07-071-0/+1
| | | | See #2060.
* tor-rpcbase: Removed dependency on `once_cell`hashcatHitman2025-06-141-1/+1
| | | | | | - Replaced `once_cell::sync::Lazy` with `std::sync::LazyLock`. Signed-off-by: hashcatHitman <[email protected]>
* Merge branch 'rpc-references-cleanup' into 'main'Nick Mathewson2025-01-281-12/+1
|\ | | | | | | | | rpc: Move support for weak references behind an experimental feature See merge request tpo/core/arti!2742
| * rpc: Move support for weak references behind an experimental featureNick Mathewson2025-01-271-12/+1
| | | | | | | | | | We haven't decided how these should work (see #868), so having them present by default is a bad idea.
* | Merge branch 'strongrefs_are_not_deduped' into 'main'Nick Mathewson2025-01-281-6/+2
|\ \ | | | | | | | | | | | | rpc: Clean up comments surrounding strong references See merge request tpo/core/arti!2741
| * | rpc: Clean up comments surrounding strong referencesNick Mathewson2025-01-271-6/+2
| |/ | | | | | | They used to be deduplicated, but they haven't been for a while.
* | rpcbase: Make recognized namespace list optional.Nick Mathewson2025-01-271-7/+10
| |
* | rpcbase: Move is_valid_rpc_identifier to crate root.Nick Mathewson2025-01-271-3/+88
| |
* | rpc: Rename InvalidMethodName to InvalidRpcIdentifier.Nick Mathewson2025-01-271-1/+1
|/ | | | We're about to use this error type for other things too.
* clippy: deny `mod_module_files`Steven Engler2025-01-061-0/+1
| | | | | | Denies 'mod.rs' files for consistency. https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
* add_warnings, *: Allow clippy::needless_lifetimesNick Mathewson2024-12-031-0/+1
| | | | | | | | In 1.83, this warning triggers on many of our crates. We're thinking of fixing them all, but for now, we're going to disable the warning. This is part of #1765.
* rpc: Simplify method-dispatch-bypass logic a bitNick Mathewson2024-10-231-14/+16
| | | | | | | | | | | | | | | This commit removes the separate function for asking whether to bypass the dispatch code. Instead, it gives the "invoke with bypass" function an error to return when no dispatch is warranted, and moves the whole responsibility for method dispatch or non-dispatch back into tor-rpcbase. I had to add an ObjectId argument to `invoke_rpc_method` to make this work, but that's probably a good thing. Additionally, this commit tweaks the derive-deftly macro to prevent you from asking for dispatch bypass on special methods, where it isn't implemented (and doesn't really make sense).
* rpc: do not attempt to dispatch methods with bypassed dispatch.Nick Mathewson2024-10-231-0/+12
|
* Remove Rpc* variants from tor_error::ErrorKindNick Mathewson2024-10-171-7/+8
| | | | | | | | | | | | | These are not regular ErrorKinds, since they can never occur in an error that's meant to be returned from a Rust API like `arti-client`. Instead, they only exist for errors returned from RpcError. (I can't find the place where we discussed this previously, but the rationale is that if an ErrorKind never makes sense in response to something that the user does from Rust, we should never have that be an ErrorKind. The fact that the removed kinds do not actually appear outside the RPC system suggests that this is reasonable.)
* rpc: Make RpcErrorKind public.Nick Mathewson2024-10-171-1/+1
|
* Merge branch 'rename_singleton_id' into 'main'Jim Newsome2024-09-251-1/+1
|\ | | | | | | | | | | | | rpc: Rename SingletonId to SingleIdResponse Closes #1585 See merge request tpo/core/arti!2448
| * rpc: Rename SingletonId to SingleIdResponseNick Mathewson2024-09-241-1/+1
| | | | | | | | | | | | | | | | | | | | Calling it "singleton" might have suggested that it was using the [singleton pattern](https://en.wikipedia.org/wiki/Singleton_pattern), which it isn't. (Renaming done with rust-analyzer and double-checked with `git grep`.) Closes #1585.
* | rpc: Expose a delegation table in arti:x_list_all_rpc_methodsNick Mathewson2024-09-241-0/+5
|/ | | | Closes #1624.
* rpcbase: Implement RPC method delegation support.Nick Mathewson2024-08-141-4/+4
| | | | | | | | (Couldn't use Deref here, since we needed to get an Arc.) Only one delegation target per object is permitted for now. This will help with #1523.
* Add a missing incantation to fix doc(cfg=...).Nick Mathewson2024-08-131-0/+1
| | | | Without this, we get a warning when we run `cargo doc`.
* rpcbase: Feature to list the RPC methods and what they apply to.Nick Mathewson2024-08-121-0/+4
|
* rpc: Remove special conversion for SendUpdateError.Nick Mathewson2024-07-251-0/+6
|
* rpc: Remove RpcError data field and use ReportNick Mathewson2024-07-251-3/+11
| | | | | | | | | | | | Per discussion, this field isn't really specified in a way that lets us fill it sensibly at the moment. So for now, we're going to just omit it. Additionally, we said that we'd Report on our errors; this branch changes the implementation of RpcError to do that. Question: Will the blanket implementation for Into<RpcError> make it harder to re-add a Data field later on if we want to do so?
* rpc: Refactor errors part 1: a new RpcMethod trait.Nick Mathewson2024-07-251-2/+2
| | | | | It is no longer necessary to say, for every RPC method, that its error type is RpcError.
* rpcbase: remove now-unused invoke methodsNick Mathewson2024-07-251-1/+1
| | | | | | | These methods were defined on DispatchTable, and then replaced by top-level functions in the crate. (The reason for using top-level functions instead is so that we get the locking on the dispatch table correct.)
* rpc: remove TODO about adding an extension traitNick Mathewson2024-07-251-4/+0
| | | | | These functions are called rarely enough that it is probably okay for the ergonomics to be a bit verbose.
* rpcbase: remove "Nil" TODO.Nick Mathewson2024-07-251-3/+0
| | | | This change would take some serde magic that is probably not worth it.
* rpcbase: tests for crate-level invoke functions.Nick Mathewson2024-07-151-0/+40
|
* rpc: Add RPC method invocation based on Context, not dispatch table.Nick Mathewson2024-06-101-0/+53
| | | | | | | | Doing it this way will allow us to invoke methods without holding the read lock on the table, implicitly or via the future. I am not yet removing the methods on DispatchTable, since the tests need them; I've added TODOs to revisit and remove later.
* rpc: Pass around our rpc::Context in an Arc.Nick Mathewson2024-06-101-1/+1
| | | | | | | | Formerly we used a Box. That was okay at first, but now that we want RPC methods to be able to invoke other RPC methods, we don't want the Invocable methods to have to consume the Context. This requires that Context become Sync.
* RPC: Expose dispatch table from ContextNick Mathewson2024-05-161-0/+3
| | | | | We need to do this so that we can actually invoke RPC functions from one another.
* rpc: Move typetag onto subtrait of DynMethodNick Mathewson2024-05-161-2/+2
| | | | | | This will allow us to create dispatchable methods that are only invoked from inside the arti code, and are not themselves serializable.
* RPC: Enforce method name format.Nick Mathewson2024-05-141-1/+4
| | | | | | | | | | | | We need to do this carefully, since we want our system to be extensible with new namespaces. First, when we are constructing an RpcMgr, we _warn_ about any method names that are misformed. Second, we add a test in the `arti` crate to fail if any method names are invalid. This will only catch method names in crates that `arti` depends on.
* tor-rpcbase: Add facility to downcast to Arc<dyn Trait>.Nick Mathewson2024-05-091-1/+1
| | | | | Previously we could only downcast to &dyn Trait, which is not adequate.
* rpc: Add helper type for methods that return a single id.Nick Mathewson2024-05-091-0/+8
|
* Merge branch 'new_ci_cfg_strategy' into 'main'Nick Mathewson2024-05-071-2/+2
|\ | | | | | | | | | | | | add_warning/CI: New strategy to avoid "unexpected-cfgs" warning Closes #1395 See merge request tpo/core/arti!2129
| * Re-run maint/add_warning.Nick Mathewson2024-05-061-2/+2
| | | | | | | | This commit is automatically generated.
* | Add a const instance of rpc::Nil.Nick Mathewson2024-05-061-0/+2
|/
* rpc: Revise backend for dispatchable-object macro.Nick Mathewson2024-04-221-4/+2
| | | | | | | | | The trick here is to provide an `Invoker` trait, with blanket implementations for appropriate `fn(_,_,_,_?) -> _`. With this trick, we no longer need to have a `decl_rpc_invoke_fn`. This lets us discard HasConstTypeId entirely, and will let us simplify some other syntax moving forward.