summaryrefslogtreecommitdiff
path: root/crates/tor-rpcbase
Commit message (Collapse)AuthorAgeFilesLines
...
* Write a README for tor-rpcbaseNick Mathewson2024-06-241-0/+156
|
* Change deftly syntax to post 0.12.1 versionIan Jackson2024-06-172-2/+2
| | | | | | | | | | | * 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
* Update to derive-deftly 0.12.1Ian Jackson2024-06-172-2/+6
| | | | | | * Bump in Cargo.toml * Deal with `${Xmeta as ...}` incompatible change, by always specifying an `as`, and changing `as tokens`.
* rpc: Missing rpc_invoker is a Bug.Nick Mathewson2024-06-101-1/+6
| | | | | Every method is either "special" or not; therefore, it is always a Bug if we look for an rpc_invoker and don't find one.
* Add more explanation of InvokerEnt fields.Nick Mathewson2024-06-101-0/+8
|
* rpc: Add RPC method invocation based on Context, not dispatch table.Nick Mathewson2024-06-102-1/+58
| | | | | | | | 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-102-26/+26
| | | | | | | | 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: refactor DispatchTable invoker lookup into new functionsNick Mathewson2024-06-101-15/+36
|
* rpc: Implement Clone and HasKind on InvokeError.Nick Mathewson2024-06-101-1/+11
|
* Bump all the unstable tor- and arti- crates to 0.19.Gabriela Moldovan2024-06-051-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The unstable crates are: - tor-error - tor-config - tor-units - tor-geoip - tor-rtcompat - tor-rtmock - tor-log-ratelim - tor-rpcbase - tor-memquota - tor-llcrypto - tor-protover - tor-bytes - tor-hscrypto - tor-socksproto - tor-checkable - tor-cert - tor-linkspec - tor-cell - tor-proto - tor-netdoc - tor-consdiff - tor-netdir - tor-relay-selection - tor-persist - tor-chanmgr - tor-ptmgr - tor-guardmgr - tor-circmgr - tor-dirclient - tor-dirmgr - tor-keymgr - tor-hsclient - tor-hsservice - tor-hsrproxy - arti-client - arti-rpcserver - arti-hyper - tor-basic-utils - tor-async-utils Done using ``` for p in "${unstable[@]}"; do cargo set-version -p $p 0.19; done ``` where `unstable` contains the list above
* Add a few "TODO RPC" notesNick Mathewson2024-05-162-0/+8
|
* RPC: Expose dispatch table from ContextNick Mathewson2024-05-162-0/+7
| | | | | We need to do this so that we can actually invoke RPC functions from one another.
* RPC: Fill in documentation about invoke_specialNick Mathewson2024-05-162-6/+27
|
* Tests for invoke_specialNick Mathewson2024-05-161-0/+42
|
* RPC: Fix types for DispatchTable::invoke_specialNick Mathewson2024-05-161-11/+14
| | | | | Now that Method::Error exists, we can downcast Any to the actual function's return type.
* RPC: Require an Error type in methods.Nick Mathewson2024-05-162-0/+8
| | | | | | | | 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.
* Rpc: Allow invoker_ents to be marked as @specialNick Mathewson2024-05-161-7/+21
| | | | A @special invoker does not get an RPC entry.
* Relax Serialize requirement on method outputs.Nick Mathewson2024-05-162-11/+13
| | | | | Now Methods can return anything; and only if their outputs are Serialize will they implement RpcInvocable.
* Split Invocable into RpcInvocable.Nick Mathewson2024-05-161-50/+77
| | | | | RpcInvocable will only be implemented on types whose output can be serialized.
* RPC: Add an "invoke special" mechanismNick Mathewson2024-05-161-1/+62
| | | | This is part of work on #1403.
* rpc: Move typetag onto subtrait of DynMethodNick Mathewson2024-05-162-16/+35
| | | | | | 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-142-1/+75
| | | | | | | | | | | | 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.
* Fix rustdoc errors from !2140.Nick Mathewson2024-05-091-2/+2
|
* RPC: Use one cast table entry per type.Nick Mathewson2024-05-091-29/+47
|
* tor-rpcbase: Add facility to downcast to Arc<dyn Trait>.Nick Mathewson2024-05-093-9/+84
| | | | | Previously we could only downcast to &dyn Trait, which is not adequate.
* Make cast_to_trait inherent on dyn Object.Nick Mathewson2024-05-091-4/+10
| | | | | This makes `ObjectRefExt` less necessary, and will let us make it Arc-only.
* rpc::invoker_ent_list: allow trailing comma.Nick Mathewson2024-05-091-1/+1
|
* rpc: Add helper type for methods that return a single id.Nick Mathewson2024-05-092-0/+9
|
* Merge branch 'void' into 'main'Nick Mathewson2024-05-072-7/+11
|\ | | | | | | | | tor-rpcbase: Use Void to eliminate a panic, as statically unreachable See merge request tpo/core/arti!2124
| * tor-rpcbase: Use Void to eliminate a panic, as statically unreachableIan Jackson2024-05-022-7/+11
| |
* | 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.
* | | Lightly simplify the syntax for installing multiple InvokerEntsNick Mathewson2024-05-061-0/+38
| | |
* | | Add a const instance of rpc::Nil.Nick Mathewson2024-05-061-0/+2
| | |
* | | rpc: Remove a limitation on DynMethod macro.Nick Mathewson2024-05-061-6/+5
|/ / | | | | | | It no longer requires the user to have `typetag` in scope.
* / tor-rpcbase: Require downcast_rs 1.2.1Nick Mathewson2024-05-051-1/+1
|/ | | | This resolves a clippy warning about redundant bounds.
* Bump versions of 0.x tor-* and arti-* cratesIan Jackson2024-04-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for p in `cat ../u`; do cargo set-version --locked --offline -p $p; done where u contains tor-basic-utils tor-async-utils tor-error tor-config tor-units tor-geoip tor-rtcompat tor-rtmock tor-log-ratelim tor-rpcbase tor-memquota tor-llcrypto tor-protover tor-bytes tor-hscrypto tor-socksproto tor-checkable tor-cert tor-linkspec tor-cell tor-proto tor-netdoc tor-consdiff tor-netdir tor-relay-selection tor-persist tor-chanmgr tor-ptmgr tor-guardmgr tor-circmgr tor-dirclient tor-dirmgr tor-keymgr tor-hsclient tor-hsservice tor-hsrproxy arti-client arti-rpcserver arti-hyper
* tor-rpcbase: Add a missing `#[doc(hidden)]`Ian Jackson2024-04-291-0/+1
| | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2103#note_3024372 I overlooked this.
* tor-rpcbase: invoker_ent!: simplify argument parsingIan Jackson2024-04-251-12/+15
| | | | | | Previously, one of the macros was documented to accept `(function_expr)`, but in fact it would only accept an identifier. Now we *do* accept any expression.
* tor-rpcbase: invoker_ent!: abolish flags argumentIan Jackson2024-04-251-19/+9
| | | | | | | | IMO if we want flags again in the future, we should probably pick a syntax that doesn't involve such awkward patterns. Perhaps `$expr $( , $( $flag )* )?`. But I think we probably won't need that feature.
* tor-rpcbase: invoker_ent: Infer the correct fn type for castIan Jackson2024-04-251-7/+69
| | | | | This renders the Update flag redundant. Indeed, in this commit we mow ignore the flags.
* tor-rpcbase: invoker_ent!: remove buggy unuseable armIan Jackson2024-04-251-3/+0
| | | | | | | | | This arm puts parens around its argument. But the other arm insists on $func:ident, and also would capture any reasonable input. This was probably something to do with the (func_expr) syntax. We don't need to *fix* this macrology, because in a moment the whole macro can be made to take $func:expr.
* rpc: add a comment from diziet to explain why we need same_declNick Mathewson2024-04-221-0/+6
|
* rpc: reformat macro slightly.Nick Mathewson2024-04-221-2/+5
|
* Rename Invoker trait to Invocable.Nick Mathewson2024-04-221-15/+15
|
* Fix rustdoc links.Nick Mathewson2024-04-221-2/+2
|
* Adjust an allow.Nick Mathewson2024-04-221-1/+1
|
* rpc:Sketch out the syntax of our remaining tricky macrosNick Mathewson2024-04-221-2/+8
|
* RPC: Remove installable_rpc_invoke_fnNick Mathewson2024-04-221-128/+68
| | | | | | | | | | | | | | | Now that we've done more refactoring, it's no longer necessary to have this machinery, since: * We can support statically registering instantiated methods, if we know them ahead of time. * Writing an installer function is pretty simple, and the syntax is much nicer than the special-purpose junk we had before. I've added examples of both approaches. While we're at it, I've simplified the syntax for `invoker_ent!` a little, since the parentheses I had before aren't necessary.
* RPC: Remove method and object type from macros.Nick Mathewson2024-04-221-20/+18
| | | | | These are no longer needed, since they are inferred from the types of the functions.