| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
| |
This commit adds FFI wrappers for the "poll" API, which lets the
user integrate with a poll(2)-style event loop.
|
| |
|
|
|
|
| |
This commit adds wrappers for the "submit/wait" methods on RpcConn
(which are used to submit tagged requests,
and then wait for responses to all tagged requests at once).
|
| | |
|
| |
|
|
| |
Closes #1588.
|
| |
|
|
|
|
|
|
|
|
| |
The two main causes of errors were:
- Since some of the lifetime rules have changed, we no longer need
to do as many "bind a variable and immediately return it"
patterns, and so clippy now warns about them.
- We needed to adjust the explicit captures (`use<...>`)
in a couple of our RPIT instances.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |\
| |
| |
| |
| |
| |
| | |
rpc: Document what is actually going on with stream optimism.
Closes #1583
See merge request tpo/core/arti!2753
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Our documentation had dated to an older version of our RPC stream
code, where all streams were automatically optimistic.
But as explained, our use of "optimistic"ness in RPC stream code is
now purely internal, to make it possible to get an DataStreamCtrl.
This isn't user-visible in our rpc_conn_open_stream code.
Closes #1583
|
| |/ |
|
| |
|
|
|
|
|
| |
I hope that this limitation is acceptable;
the alternative involves some significant refactoring to give
Request a Weak reference to RpcConn -- but RpcConn isn't currently
kept in an Arc<> at all, and so we'd need some fairly heavy hacking.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Expose ArtiRpcConnBuilder and appropriate C wrapper functions in
our FFI code, and wrap those functions in our python wrapper.
This breaks the old C API, but that's allowed since the API
is still experimental.
Some design decisions:
* I've wrapped the builder in a Mutex, so that we can continue
our FFI rule that we do not require non-Rust code to wrap `&mut`.
* I've removed the non-builder connect() function from the C API
as extraneous.
* I've made a single function to prepend elements to the search
path.
|
| |
|
|
|
|
|
|
|
| |
This commit covers the major points of the design:
Parsing the environment, parsing and resolving connect points,
connecting to Arti, and handling errors.
There are a few areas that need to be fixed,
all marked with XXXXs.
|
| |
|
|
|
|
|
|
|
|
|
| |
Now that prop351 is what Arti speaks, it's what the rpclib
needs to provide.
Note one change in particular: the `isolation` string
is no longer an optional argument when opening a stream.
(With prop351, there is no longer such a thing as an "absent"
isolation string, and we don't want to imply that there is a
difference between None and "".)
|
| | |
|
| |
|
|
|
| |
There's a blocking TODO here about exposing socks error codes that
I still need to solve.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Its underlying function previously took `&mut RpcHandle`,
which was an accident waiting to happen. Now it takes `&RpcHandle`
and includes a Mutex to prevent multiple threads from waiting for
updates on the same request ID at once.
As an alternative, we *could* try to update connimpl::Receiver to
allow multiple simultaneous listeners on the same request ID.
But that would (I think) require a lot more bookkeeping, and thus
would be a bit more error-prone.
Closes #1532.
|
| |
|
|
|
| |
This API allows the caller to launch a request and then watch for
updates on it.
|
| |
|
|
|
|
|
|
| |
Previously, we had out_ptr_opt for functions that wanted to return a
newly allocated `ArtiRpcFoo` via a `struct ArtiRpcFoo **` argument.
But we didn't have a way to return non-allocated `int` via an `int
*` argument. This code provides that.
|
| |
|
|
| |
(Without this, it isn't actually possible to use the RPC subsystem.)
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
Additionally, inline the related conversion functions.
This should reduce the total amount of unsafe code that somebody
would need to look at.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These macros do the only part of our FFI functions that needs to be
`unsafe`: converting input pointers into types that can be used in
safe rust. I've added documentation about what requirements each of
these conversions puts onto out inputs: both informally, and via a
reference to the relevant parts of the Rust library documentation.
While doing this I found a safety bug in `OutPtr::from_opt_ptr`:
it should have been using `MaybeUninit`.
These macros should allow us to build a "proof sketch" for the
safety of our FFI code. We need to show, for each input parameter:
- That the documented requirements for its conversion method
are also documented requirements for that kind of input, in our
header file.
- That the documented requirements for how it can be used
after conversion are in fact followed in the code.
|
| | |
|
| |
|
|
| |
In brief: Everything now starts with ARTI_RPC, arti_rpc, or ArtiRpc.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These documents are no longer called "safety". They are now mostly
collected as a big list of "correctness requirements" at the start
of the cbindgen header. Because of these requirements, most
functions no longer need their own "safety" sections.
I am explicitly using `#[allow(clippy::missing_safety_doc)]` on each
function, rather than adding a blanket exception:
- There are other unsafe functions in this code, to which we
wouldn't want an exception to apply.
- Documenting the safety^W correctness requirements of a function
is important enough to make sure that we aren't skipping out on
it unintentionally.
|
| | |
|
| |
|
|
|
|
|
|
| |
Per discussion, we'd rather have an optional output parameter for error
objects rather than mess with thread-local variables.
This is possibly less convenient for direct usage from C,
but likely more convenient for wrapper functions in other languages.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
In this API, borrowed strings are `const char *`, and owned strings
are `ArtiRpcStr *`. You can get the former from the latter with
`arti_rpc_str_get()`, which returns a `const char *` in hopes that
you will neither modify nor free() that `const char *`
(Note that there are no places where string ownership needs to be
passed into this library; and at present, there is only one case
where it is passed out. I do not anticipate that we will need to do
intake of owned strings. We will probably need to return these in a
few more cases as we add more API surface.)
|
| | |
|
|
|
This only covers the absolute minimal API in order to launch a
connection and run simple requests, and it doesn't document anything
nearly well enough. Nonetheless I think it's good enough for an
initial review, to make sure that we've got the basics right (as
well as a general consensus on the error handling API, naming, and
so forth).
|