summaryrefslogtreecommitdiff
path: root/crates/tor-rpcbase/src/method.rs
Commit message (Collapse)AuthorAgeFilesLines
* rpc: Suppress a clippy false positive that appears with current betaIan Jackson2025-09-301-1/+2
|
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-1/+1
| | | | | | | | | | | | | | 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.
* tor-rpcbase: Removed dependency on `once_cell`hashcatHitman2025-06-141-4/+5
| | | | | | - Replaced `once_cell::sync::Lazy` with `std::sync::LazyLock`. Signed-off-by: hashcatHitman <[email protected]>
* rpcbase: Make recognized namespace list optional.Nick Mathewson2025-01-271-1/+1
|
* rpcbase: Move is_valid_rpc_identifier to crate root.Nick Mathewson2025-01-271-88/+1
|
* rpc: Rename InvalidMethodName to InvalidRpcIdentifier.Nick Mathewson2025-01-271-13/+15
| | | | We're about to use this error type for other things too.
* Remove RPC TODO about bypass_method_dispatch method.Nick Mathewson2025-01-271-6/+1
| | | | | | There was formally a redundant method of this name, which could get out-of-sync with invoke_without_dispatch. But now that method is gone, and this TODO is wrong.
* rpc: Make cancel requests uncancellable.Nick Mathewson2025-01-221-1/+18
| | | | | | | | | The current cancel code is prone to deadlock, so the easiest way to solve it appears to be making cancel requests themselves uncancellable. I've included a test to verify the behavior; previously, this test caused a deadlock.
* rpc: Simplify method-dispatch-bypass logic a bitNick Mathewson2024-10-231-10/+10
| | | | | | | | | | | | | | | 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: Add a mechanism for method that bypass regular dispatchNick Mathewson2024-10-231-2/+34
| | | | | | | I'm about to use this for rpc:release, which is special because it doesn't actually look at the type of the object that it's invoked on. Later it might be useful for manipulating weakrefs, cloning referenes, detecting reference equality, etc.
* rpcbase: Facility for looking up RPC method informationNick Mathewson2024-08-121-2/+31
| | | | | We'll need this to refer to the names of RPC methods as visible to the caller, and to cross-reference them with their related types.
* rpc: Refactor errors part 1: a new RpcMethod trait.Nick Mathewson2024-07-251-11/+25
| | | | | It is no longer necessary to say, for every RPC method, that its error type is RpcError.
* rpcbase: Replace a TODO with a set of notes and caveatsNick Mathewson2024-07-251-7/+10
| | | | | | We have decided not to remove the "anybody can define methods" property. This commit documents the consequences, and warns extenders away from some really bad ideas.
* rpc: Tests for method name checking.Nick Mathewson2024-07-151-0/+38
|
* Change deftly syntax to post 0.12.1 versionIan Jackson2024-06-171-1/+1
| | | | | | | | | | | * Change `pub` to `export` * Change the `=` in define to `:` * Change `pub_template_semver_check` to `template_export_semver_check` Right now, 0.12.1 supports both syntaxes. I have verified this branch also compiles with https://gitlab.torproject.org/Diziet/rust-derive-deftly/-/merge_requests/402 ee171ffaf56d7dcb7d75584054921153fe19b222
* Add a few "TODO RPC" notesNick Mathewson2024-05-161-0/+3
|
* RPC: Fill in documentation about invoke_specialNick Mathewson2024-05-161-2/+5
|
* RPC: Require an Error type in methods.Nick Mathewson2024-05-161-0/+5
| | | | | | | | This is needed so that we can cast special methods' return types properly. I wish I could make this optional, but Rust doesn't allow defaulting an associated type.
* Relax Serialize requirement on method outputs.Nick Mathewson2024-05-161-3/+5
| | | | | Now Methods can return anything; and only if their outputs are Serialize will they implement RpcInvocable.
* rpc: Move typetag onto subtrait of DynMethodNick Mathewson2024-05-161-14/+33
| | | | | | 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-0/+71
| | | | | | | | | | | | 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.
* rpc: Remove a limitation on DynMethod macro.Nick Mathewson2024-05-061-6/+5
| | | | It no longer requires the user to have `typetag` in scope.
* rpc: Revise backend for dispatchable-object macro.Nick Mathewson2024-04-221-11/+0
| | | | | | | | | 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.
* rpc: Move deftly attributes into an `rpc` namespace.Nick Mathewson2024-04-111-3/+3
|
* Refactor: remove existence of HasConstTypeId_ as a traitNick Mathewson2024-04-081-1/+12
| | | | | | | | | We don't actually need this to be a trait; we just need methods and objects to have a `CONST_TYPE_ID_` if they want to participate in the inventory-based method registry. Removing this trait makes it much simpler to declare methods and objects.
* Port many of the macros in tor-rpcbase to use derive-deftly.Nick Mathewson2024-04-041-20/+20
| | | | | | This simplifies our implementation logic in a few places, and simplifies our invocation syntax greatly. There are a few infelicities, noted in `TODO RPC` comments.
* Arti: Add ability to remember the list of methods names.Nick Mathewson2023-04-191-0/+36
| | | | | | | | | | | | Right now, this lets us say whether the method was unrecognized or whether the parameter type was incorrect. We'll use this to enforce correct method names later on. (I have to add another `inventory` here, since the `typetag` maintainer does not want to expose this functionality: see https://github.com/dtolnay/typetag/issues/57#issuecomment-1506106290 )
* rpc: Split Method into DynMethod and MethodNick Mathewson2023-04-191-9/+39
| | | | | Now `Method` has an Output and Update associated type, and `decl_method` can do a little more.
* tor-rpcbase: Rename cmd.rs to method.rs.Nick Mathewson2023-04-121-0/+52