47a470b281
everywhere: support unix sockets
...
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
e6976dea5a
cargo: add tokio-unix-tcp as a dependency
2023-11-05 22:29:11 +01:00
170ddbfac4
Merge pull request 'netapp 0.10' ( #12 ) from next-0.10 into main
...
continuous-integration/drone/push Build was killed
Reviewed-on: #12
2023-10-23 09:24:40 +00:00
2484d7654a
update rmp-serde to v1.1, bump to 0.10.0
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2023-09-27 12:32:54 +02:00
b7beb15492
bump to v0.5.4
continuous-integration/drone/tag Build was killed
continuous-integration/drone/push Build was killed
2023-09-21 15:54:35 +02:00
34aade6ce9
update .drone.yml
continuous-integration/drone/push Build was killed
2023-02-01 00:09:13 +01:00
6df6411b72
fix clippy
continuous-integration/drone/push Build is passing
2023-01-31 23:57:33 +01:00
e4c0be848d
Ability to configure ping timeout interval
continuous-integration/drone/push Build was killed
continuous-integration/drone/tag Build was killed
continuous-integration/drone Build is failing
2022-09-19 19:46:41 +02:00
1a413eef97
Add async version of parse_and_resolve_peer_addr
continuous-integration/drone/push Build was killed
continuous-integration/drone/tag Build was killed
2022-09-14 15:45:05 +02:00
8ac109e3a8
Merge pull request 'add streaming body to requests and responses' ( #3 ) from stream-body into main
...
continuous-integration/drone/push Build was killed
Reviewed-on: #3
2022-09-13 12:56:53 +02:00
298e956a19
undo needless change
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-13 12:48:54 +02:00
395f942fc7
Fix potential memory leak
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-13 12:37:55 +02:00
b509e6057f
Missing cleanup
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-13 12:28:01 +02:00
c00676feba
Uniformize flag naming
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-13 12:25:37 +02:00
18d5abc981
add precision to protocol description
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-13 12:20:49 +02:00
8ab6256c3b
No longer need to derive Clone on message types
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-13 12:12:55 +02:00
9362d26890
fill_buffer do something only if buf is empty
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-13 12:08:33 +02:00
db96af2609
Add comment on cancellation
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-13 12:05:42 +02:00
add2b54743
fix comment
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-13 11:52:35 +02:00
bf0e82047f
try make more like before
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-13 11:51:03 +02:00
2305c2cf03
Use BytesMut instead of Vec<u8> in bytes_buf (extend is probably faster)
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-13 11:31:19 +02:00
f022a77f97
Add documentation
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-12 17:43:10 +02:00
8a7aca9837
reword doc comment
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-12 17:20:45 +02:00
f0326607ee
slightly change example
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-12 17:19:26 +02:00
0f799a7768
Implement Least Attained First scheduling of streams
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-06 19:42:49 +02:00
5af23955af
Merge branch 'main' into stream-body
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-02 14:24:45 +02:00
a82700c5a2
Merge pull request 'Fix ping timeout and interval' ( #4 ) from fix-ping into main
...
continuous-integration/drone/push Build was killed
Reviewed-on: #4
2022-09-02 14:22:57 +02:00
ca25331d73
Bump to v0.4.5
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
continuous-integration/drone/tag Build was killed
2022-09-02 14:21:42 +02:00
9bf29a7a18
Merge branch 'fix-ping' into stream-body
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-02 14:15:02 +02:00
c865cc9f9c
Merge branch 'main' into fix-ping
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-02 14:02:08 +02:00
8c73b27655
Update dependencies
continuous-integration/drone/push Build was killed
2022-09-02 14:00:52 +02:00
f6ad1d0fab
less verbosity
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 16:13:43 +02:00
b82ad70dd5
Correctly defuse cancellation on simple requests
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 16:11:42 +02:00
b931d0d1cf
try debug
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 16:01:56 +02:00
522f420e2b
Implement request cancellation
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 15:54:11 +02:00
3292566738
fix trace message
2022-09-01 14:43:27 +02:00
22d96929d5
Merge branch 'fix-ping' into stream-body
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 14:23:10 +02:00
4a59b73d7b
Add actual support for order tag
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 12:46:33 +02:00
cd203f5708
Add OrderTag to Req and Resp, refactor errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 12:15:50 +02:00
745c786184
Also encode errorkind in stream
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 11:34:53 +02:00
7909a95d3c
Stream errors are now std::io::Error
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 11:21:24 +02:00
263db66fce
Refactor: create a BytesBuf utility crate (will also be usefull in Garage)
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 10:29:26 +02:00
3fd30c6e28
recv side: use unbounded channel to remove deadlock
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-09-01 09:45:24 +02:00
2c9d595da0
Remove useless phantom and pub(crate)
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-08-31 22:19:40 +02:00
d75146fb81
SVR -> SRV
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-08-31 17:04:45 +02:00
7703659742
Be more lenient on pings
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build was killed
2022-08-31 16:25:36 +02:00
984ba65e65
Better messages in proto.rs
continuous-integration/drone/push Build was killed
2022-08-31 16:10:14 +02:00
01db3c4319
add debug_name in proto to differenciate messages
continuous-integration/drone/push Build was killed
2022-08-31 15:58:05 +02:00
700f783956
Add dump of sending queue
continuous-integration/drone/push Build was killed
2022-08-31 15:08:51 +02:00
81b2ff3a4e
Ping less frequently
2022-08-31 15:06:21 +02:00