aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-rpcbase
Commit message (Collapse)AuthorAgeFilesLines
* Bump patchlevel (not dependents) on crates with trivial changesNick Mathewson2023-09-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This includes: ``` tor-basic-utils caret fs-mistrust safelog retry-error tor-events tor-units tor-geoip tor-rtcompat tor-rpcbase tor-protover tor-socksproto tor-checkable tor-congestion tor-persist tor-circmgr arti-rpcserver arti-config arti-hyper arti-bench arti-testing tor-consdiff ```
* Update patchlevel for crates with nontrivial changes.Nick Mathewson2023-09-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are: ``` hashx equix tor-async-utils tor-error tor-config tor-rtmock tor-llcrypto tor-bytes tor-hscrypto tor-hspow tor-cert tor-linkspec tor-cell tor-proto tor-netdoc tor-netdir tor-chanmgr tor-guardmgr tor-dirmgr tor-keymgr tor-hsclient tor-hsservice arti-client arti ```
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-235-0/+5
|
* Run add_warnings on all files.Nick Mathewson2023-08-041-2/+2
|
* Bump patchlevel versions of crates with trivial changesNick Mathewson2023-08-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These crates have had trivial changes only: typically, changes to documentation or to clippy warnings. There's no good reason to update which version of them other crates depend on, so we only bump _their_ patchlevels. ``` tor-async-utils caret safelog tor-events tor-units tor-rtcompat tor-rpcbase tor-llcrypto tor-protover tor-bytes tor-hscrypto tor-socksproto tor-cert tor-cell tor-consdiff tor-congestion arti-rpcserver arti-testing arti-bench arti-config arti-hyper ```
* Increment patchlevel versions of crates with minor changesNick Mathewson2023-08-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These crates are at version 0.x.y, so we don't need to distinguish new-feature changes from other changes: ``` tor-basic-utils fs-mistrust tor-error tor-geoip tor-checkable tor-linkspec tor-netdoc tor-netdir tor-persist tor-ptmgr tor-hsservice ``` This crate has a breaking change, but only when the semver-breaking feature `experimental-api` is enabled: ``` tor-config ``` This crate is at version 1.x.y, but has no new public APIs, and therefore does not need a minor version bump: ``` arti ```
* Fix typosDimitris Apostolou2023-07-221-1/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-106-0/+6
|
* Run add_warning to remove `missing_panics_doc` deny.Nick Mathewson2023-07-061-1/+0
| | | | Closes #950.
* Bump patchlevel versions on crates with smaller changesNick Mathewson2023-06-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Done with the commands below. The following crates have had various changes, and should get a patchlevel bump. Since they are pre-1.0, we do not need to distinguish new APIs from other changes. ``` cargo set-version --bump patch -p arti-client cargo set-version --bump patch -p safelog cargo set-version --bump patch -p tor-bytes cargo set-version --bump patch -p tor-cert cargo set-version --bump patch -p tor-circmgr cargo set-version --bump patch -p tor-config cargo set-version --bump patch -p tor-consdiff cargo set-version --bump patch -p tor-dirclient cargo set-version --bump patch -p tor-dirmgr cargo set-version --bump patch -p tor-error cargo set-version --bump patch -p tor-hsservice cargo set-version --bump patch -p tor-linkspec cargo set-version --bump patch -p tor-llcrypto cargo set-version --bump patch -p tor-netdir cargo set-version --bump patch -p tor-netdoc cargo set-version --bump patch -p tor-proto cargo set-version --bump patch -p tor-rpcbase cargo set-version --bump patch -p tor-socksproto ``` This crate has new features, but no new non-experimental Rust APIs. So even though it is post-1.0, it gets a patchlevel bump. ``` cargo set-version --bump patch -p arti ```
* lints: Run maint/add_warning to actually apply new lintsIan Jackson2023-06-211-0/+2
|
* Merge branch 'rpcdoc' into 'main'Ian Jackson2023-06-201-0/+2
|\ | | | | | | | | rpc: Minor docs improvements See merge request tpo/core/arti!1260
| * rpc: Cross-reference up from tor-rpcbase re where DispatchTable livesIan Jackson2023-06-161-0/+2
| |
* | rpc: Remove some verbiage about 'static, and demo that it's OK withoutIan Jackson2023-06-151-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It's now not actually possible to write code that doesn't work, even if `Tr` *isn't* 'static, because of the bounds on `CastTable::insert`. I tried to produce a non-working setup with a non-static `Simple`, but you can't implement `Object` for such a thing. Removing 'static from Object would stop the downcasts from Any to Object working. Prior to the new typesafe insert, this change - let f: fn(&dyn $crate::Object) -> &(dyn $traitname + 'static) = |self_| { + let f: fn(&dyn $crate::Object) -> &(dyn $traitname) = |self_| { would result in a runtime crash. Now it results in a compiler error.
* | rpc: Give the name `O` to "the type associated with this CastTable"Ian Jackson2023-06-151-8/+12
| | | | | | | | | | | | | | This was locally bound to `S` in one place. Bind and use it throughout. Since this is an RPC object, `O` is a better name. In each item, use the description once and thereafter just the name.
* | rpc: Add Simple test case for CastTableIan Jackson2023-06-151-3/+20
| |
* | rpc: Move boxing from macro to CastTable::insert (formatting)Ian Jackson2023-06-151-3/+1
| |
* | rpc: Move boxing from macro to CastTable::insertIan Jackson2023-06-151-4/+4
| |
* | rpc: Make CastTable::insert be more type-safeIan Jackson2023-06-151-6/+21
|/ | | | This checks the Requirements.
* RPC: Functionality to downcast dyn Object to a dyn Trait.Nick Mathewson2023-06-124-14/+510
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a rather tricky piece of functionality. It works as follows. We introduce a `CastTable` type. Each `CastTable` tells us how to downcast `dyn Object` for objects of a single concrete type. The `Object` type now has a `get_casttable` method that returns an empty `CastTable` by default. `CastTable` is, internally, a map from the `TypeId` of the target dyn Trait reference type to a function `fn(&dyn Object) -> &dyn Trait`. These functions are stored as `Box<dyn Any + ...>`. (They are Boxed because they may refer to generic functions, which you can't get a static reference to, and they're Any because the functions have different types.) The `decl_object!` macro now implements `get_casttable` as appropriate. (The syntax is a bit janky, but that's what we get for not using derive_adhoc.) For non-generic types, `get_casttable` uses a Lazy<CastTable>`. to initialize a CastTable exactly once. For generic types, it use a `Lazy<RwLock<HashMap<..>>` to build one CastTable per instantiation of the generic type. This could probably be optimized a bit more, the yaks could be shaved in a more scintillating hairstyle, and the syntax for generic `decl_object` could definitely be improved.
* rpc: make decl_object! responsible for writing impl Object {} blocks.Nick Mathewson2023-06-072-4/+1
|
* RPC: Let objects declare that they need a GlobalId.Nick Mathewson2023-06-051-1/+17
|
* Bump crate versions in preparation for v1.1.5 release.Nick Mathewson2023-06-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generated with the following commands: ``` cargo set-version --bump minor -p tor-cell cargo set-version --bump minor -p tor-linkspec cargo set-version --bump minor -p tor-proto cargo set-version --bump minor -p tor-netdoc cargo set-version --bump minor -p tor-circmgr cargo set-version --bump patch -p tor-cert cargo set-version --bump patch -p tor-basic-utils cargo set-version --bump patch -p tor-rpcbase cargo set-version --bump patch -p tor-llcrypto cargo set-version --bump patch -p tor-hscrypto cargo set-version --bump patch -p tor-checkable cargo set-version --bump patch -p tor-async-utils cargo set-version --bump patch -p caret cargo set-version --bump patch -p fs-mistrust cargo set-version --bump patch -p safelog cargo set-version --bump patch -p retry-error cargo set-version --bump patch -p tor-error cargo set-version --bump patch -p tor-config cargo set-version --bump patch -p tor-events cargo set-version --bump patch -p tor-units cargo set-version --bump patch -p tor-rtcompat cargo set-version --bump patch -p tor-rtmock cargo set-version --bump patch -p tor-protover cargo set-version --bump patch -p tor-bytes cargo set-version --bump patch -p tor-socksproto cargo set-version --bump patch -p tor-consdiff cargo set-version --bump patch -p tor-netdir cargo set-version --bump patch -p tor-congestion cargo set-version --bump patch -p tor-persist cargo set-version --bump patch -p tor-chanmgr cargo set-version --bump patch -p tor-ptmgr cargo set-version --bump patch -p tor-guardmgr cargo set-version --bump patch -p tor-dirclient cargo set-version --bump patch -p tor-dirmgr cargo set-version --bump patch -p tor-hsclient cargo set-version --bump patch -p tor-hsservice cargo set-version --bump patch -p arti-client cargo set-version --bump patch -p arti-rpcserver cargo set-version --bump patch -p arti-config cargo set-version --bump patch -p arti-hyper cargo set-version --bump patch -p arti cargo set-version --bump patch -p arti-bench cargo set-version --bump patch -p arti-testing ```
* rpc: Remove downgrade_owned for nowNick Mathewson2023-05-242-15/+0
| | | | | | | Rationale: Our weak-vs-strong design is a bit confused at the moment due to concerns about deduplication and capability semantics. It's not clear that a general "change strong to weak" method is compatible with what we want to provide.
* rpc: Implement functionality to remove objects from a sessionNick Mathewson2023-05-242-0/+36
| | | | | | | | | | | I've made doing some design choices here: * Reserving "rpc" as a prefix for post-authentication functionality that is not arti-specific. * Declaring these to be methods on the session rather than methods on the objects themselves. There's a problem with defining an API to drop a weak reference; see comment in code.
* rpc: fix documentation for methods in Context.Nick Mathewson2023-05-241-6/+4
|
* Run fixup-features --no-annotate for initial Cargo.toml fixes.Nick Mathewson2023-05-151-0/+3
| | | | | | | | | This does the following: - Gives every crate a `full`. - Cause every `full` to depend on `full` from the lower-level crates. - Makes every feature listed _directly_ in `experimental` depend on `__is_experimental`.
* RPC: Add "register" methods to RequestContext.Nick Mathewson2023-05-042-0/+30
|
* Increment crate versions.Nick Mathewson2023-05-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because of the errorkind bumps, we're calling this a breaking change in everything lower-level than `arti`. Generated with: ``` cargo set-version -p tor-basic-utils --bump minor cargo set-version -p tor-async-utils --bump minor cargo set-version -p caret --bump minor cargo set-version -p fs-mistrust --bump minor cargo set-version -p safelog --bump minor cargo set-version -p retry-error --bump minor cargo set-version -p tor-error --bump minor cargo set-version -p tor-config --bump minor cargo set-version -p tor-events --bump minor cargo set-version -p tor-units --bump minor cargo set-version -p tor-rtcompat --bump minor cargo set-version -p tor-rtmock --bump minor cargo set-version -p tor-rpcbase --bump minor cargo set-version -p tor-llcrypto --bump minor cargo set-version -p tor-protover --bump minor cargo set-version -p tor-bytes --bump minor cargo set-version -p tor-hscrypto --bump minor cargo set-version -p tor-socksproto --bump minor cargo set-version -p tor-checkable --bump minor cargo set-version -p tor-cert --bump minor cargo set-version -p tor-linkspec --bump minor cargo set-version -p tor-cell --bump minor cargo set-version -p tor-proto --bump minor cargo set-version -p tor-netdoc --bump minor cargo set-version -p tor-consdiff --bump minor cargo set-version -p tor-netdir --bump minor cargo set-version -p tor-congestion --bump minor cargo set-version -p tor-persist --bump minor cargo set-version -p tor-chanmgr --bump minor cargo set-version -p tor-ptmgr --bump minor cargo set-version -p tor-guardmgr --bump minor cargo set-version -p tor-circmgr --bump minor cargo set-version -p tor-dirclient --bump minor cargo set-version -p tor-dirmgr --bump minor cargo set-version -p tor-hsclient --bump minor cargo set-version -p tor-hsservice --bump minor cargo set-version -p arti-client --bump minor cargo set-version -p arti-rpcserver --bump minor cargo set-version -p arti-config --bump minor cargo set-version -p arti-hyper --bump minor cargo set-version -p arti --bump patch cargo set-version -p arti-bench --bump patch cargo set-version -p arti-testing --bump patch ```
* RPC: Log all internal errors.Nick Mathewson2023-04-191-3/+7
|
* rpc: Simplify and clarify SendUpdateError.Nick Mathewson2023-04-191-7/+13
|
* Arti: Add ability to remember the list of methods names.Nick Mathewson2023-04-192-2/+39
| | | | | | | | | | | | 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: New syntax for method declarationNick Mathewson2023-04-191-9/+46
| | | | | Now you just declare your function `my_func` with the right types, and invoke `rpc_invoke_fn!{ my_func(ObjType, MethodType); }`
* rpc: impl From<SendUpdateError> for RpcError.Nick Mathewson2023-04-191-0/+14
|
* rpcbase: Use with_fn.Nick Mathewson2023-04-193-8/+14
|
* rpc: Minor tweaks to get a sink to compile.Nick Mathewson2023-04-191-4/+5
|
* rpc: Use Method types to determine type of method outputs, updates.Nick Mathewson2023-04-191-64/+103
| | | | This lets us do much less in our rpc_invoke_fn functions.
* rpc: Split Method into DynMethod and MethodNick Mathewson2023-04-193-23/+60
| | | | | Now `Method` has an Output and Update associated type, and `decl_method` can do a little more.
* rpc: simplify API by always providing a sink.Nick Mathewson2023-04-161-19/+12
| | | | | Previously we have two places where we had to do "make a `Drain` sink if updates aren't wanted"; now there's only one.
* rpc: Wire updates into rpc invoke functions again.Nick Mathewson2023-04-161-12/+43
| | | | | | | | Now that the sink is not part of the context, RPC functions that are able to send an update have to declare an `impl Sink` as their fourth argument. This syntax is not final. Part of #824.
* rpc: Move update sink out of context.Nick Mathewson2023-04-162-46/+26
| | | | | Now the update sink is its own boxed object. It is not yet passed to the invoke functions that want it.
* rpc, spec: Document current ObjectError, RequestError behavior as correct.Nick Mathewson2023-04-131-10/+2
|
* rpcbase: Use correct error codes, and add tests.Nick Mathewson2023-04-122-7/+183
| | | | | | | | | | | Well, mostly correct. Our current serde implementation doesn't tell us much about what went wrong with the object, so we can't tell why we couldn't convert it into a Request. Also, our output for the data field is not as the spec says: we should bring them into conformance. Part of #825.
* tor-rpcbase: Create error kinds properly.Nick Mathewson2023-04-121-14/+16
| | | | | The field is called "kinds", it is a list, and it holds strings beginning with "arti:".
* tor-rpcbase: rename cmd to method everywhere.Nick Mathewson2023-04-121-31/+31
|
* tor-rpcbase: Rename cmd.rs to method.rs.Nick Mathewson2023-04-122-2/+2
|
* tor-rpcbase: Rename and rephrase "command" to "method"Nick Mathewson2023-04-125-47/+47
|
* rpc: Try to fix rustdoc errors.Nick Mathewson2023-04-122-2/+2
|
* rpc: Use empty structs in test code.Nick Mathewson2023-04-121-12/+12
|
* Rename tor-rpccmd to tor-rpcbase.Nick Mathewson2023-04-128-0/+840