Commit graph

35 commits

Author SHA1 Message Date
networkException 47a470b281
everywhere: support unix sockets
Some checks failed
continuous-integration/drone/pr Build is failing
This patch adds support for listening on and connecting to unix sockets.

This requires having wrapper types for various tokio specific network
abstractions while also supporting things like serialization and
deserialization.

Unfortionately i was unable to find a published crate fulfilling these
requirements.

For this reason I've published a crate myself. Called `tokio-unix-tcp`,
it serves as a drop in replacement for Tokio's TCP and Unix network
types.

I plan to maintain this library outside the scope of this project as
well, in general the code should be simple and stable enough however
to not require maintainance going forward.

As i said this crate aims to support the requirement mentioned above.
In addition to this it also strives to be more correct about handling
the different types of unix sockets, which the libraries i reviewed
were weak at. A list of these crates can be found in the crate README
under "Related work".

---

The changes to netapp can be summarized as the following:

- `std::net::SocketAddr` has been replaced by
  `tokio_unix_tcp::NamedSocketAddr` in most places. This enum encapsulates
  a IP address and port as well as a path in its variants and describes
  a concrete socket address netapp can bind or connect to.

- In some places `tokio_unix_tcp::SocketAddr` is used instead of
  `tokio_unix_tcp::NamedSocketAddr` as mentioned above. This is due to
  the way unix sockets work:

  The remote peer of a client from the perspective of a server is not
  a concrete path but `unnamed`. They just share a file descriptor
  for the actual communication channel. The local address of the server
  is the actual file system path the server is listening on.

  In some cases netapp might be configured to connect to another peer
  using a unix socket and to not send a reachable IP address and port
  or unix socket path using the `HelloMessage`.

  As per the above (the client's remote address will be `unnamed`),
  we have no way of connecting back to that peer. This will currently
  cause the connection to be aborted by the server.

- Listening on Unix sockets requires some additional handling like
  removing a previous file at the bind path and setting a correct
  mode (defaulting to `0o222` currently). This is handled by
  `tokio_unix_tcp`.

---

I've tested these changes by including them in garage and running basic
administration commands against a node and by running the unit tests here.

Basalt peering is currently lacking a proper cost calculation for unix
sockets - I'm sadly not familiar with this code.
2023-11-05 22:29:12 +01:00
Alex 6df6411b72 fix clippy
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-31 23:57:33 +01:00
Alex f6ad1d0fab
less verbosity
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 16:13:43 +02:00
Alex b931d0d1cf
try debug
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 16:01:56 +02:00
Alex 522f420e2b
Implement request cancellation
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 15:54:11 +02:00
Alex 22d96929d5
Merge branch 'fix-ping' into stream-body
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 14:23:10 +02:00
Alex 4a59b73d7b
Add actual support for order tag
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 12:46:33 +02:00
Alex cd203f5708
Add OrderTag to Req and Resp, refactor errors
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 12:15:50 +02:00
Alex 7909a95d3c
Stream errors are now std::io::Error
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 11:21:24 +02:00
Alex 01db3c4319
add debug_name in proto to differenciate messages
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-08-31 15:58:05 +02:00
Alex 74e57016f6
Add some debugging
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2022-07-25 15:04:52 +02:00
Alex 9cb28c21b4
Use bounded channels on receive side for backpressure
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2022-07-22 13:01:52 +02:00
Alex 0b71ca12f9
Clean up framing protocol
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2022-07-22 12:45:38 +02:00
Alex 4934ed726d
Propose alternative API
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2022-07-21 20:22:56 +02:00
Alex 7d148c7e76
One possibility, but I don't like it 2022-07-21 19:25:07 +02:00
Alex 44bbc1c00c
Rename AutoSerialize into SimpleMessage and refactor a bit 2022-07-21 19:05:51 +02:00
Alex f35fa7d18d
Move things around 2022-07-21 17:37:52 +02:00
trinity-1686a cdff8ae1be add detection of premature eos 2022-07-18 15:21:13 +02:00
trinity-1686a d3d18b8e8b use a framing protocol instead of even/odd channel 2022-06-20 23:40:31 +02:00
trinity-1686a 4745e7c4ba further work on streams
most changes still required are related to error handling
2022-06-08 09:54:38 +02:00
trinity-1686a 368ba90879 initial work on associated stream
still require testing, and fixing a few kinks:
- sending packets > 16k truncate them
- send one more packet than it could at eos
- probably update documentation

/!\ contains breaking changes
2022-06-05 15:33:43 +02:00
Alex faecefc7a8
Fix span kind for RPC client side
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2022-04-07 10:31:37 +02:00
Alex 96d1f14966
Avoid logging full node IDs
Some checks failed
continuous-integration/drone/push Build is failing
2022-02-21 16:57:07 +01:00
Alex 8858c94289
Implement version tag for application as well
Some checks failed
continuous-integration/drone/push Build is failing
2022-02-21 16:43:17 +01:00
Alex 96a3cc1e1f
Implement version check & transmit more error info
All checks were successful
continuous-integration/drone/push Build is passing
2022-02-21 13:45:41 +01:00
Alex 706a3b4ac4
Formatting & clippy 2022-02-21 12:04:09 +01:00
Alex 3b8bff6341
Refactoring
Some checks failed
continuous-integration/drone/push Build is failing
2022-02-21 12:01:04 +01:00
Alex 109d6c143d Add length of query to span
All checks were successful
continuous-integration/drone/push Build is passing
2022-02-18 20:23:10 +01:00
Alex fb6b4dc9a9 Correct implementation of distributed tracing
All checks were successful
continuous-integration/drone/push Build is passing
2022-02-18 20:10:46 +01:00
Alex ab0f7785ae Add telemetry 2022-02-18 19:01:59 +01:00
Alex 8a0bfa0ff6
Change call() to take a ref to the message to be sent
All checks were successful
continuous-integration/drone/push Build is passing
Handlers also receive a ref
2021-10-14 16:11:07 +02:00
Alex bc86bd3986
improve comment
All checks were successful
continuous-integration/drone/push Build is passing
2021-10-13 17:14:26 +02:00
Alex 70839d70d8
Try to handle termination and closing of stuff properly
All checks were successful
continuous-integration/drone/push Build is passing
2021-10-13 17:12:13 +02:00
Alex 8dede69dee
Fix netapp protocol & adapt basalt to new api
Some checks failed
continuous-integration/drone/push Build is failing
2021-10-13 12:33:14 +02:00
Alex d9bd1182f7
Move out things from conn.rs into two separate files
Some checks failed
continuous-integration/drone/push Build is failing
2021-10-12 18:13:07 +02:00
Renamed from src/conn.rs (Browse further)