Module kitsune_p2p_types::tx2::tx2_utils
source · Expand description
Utilities to help with developing / testing tx2.
Structs
- Active tracking helper for related items. This facilitates e.g. an endpoint with sub connections. The endpoint can close, closing all connections. Or, individual connections can close, without closing the endpoint.
- A logic channel. Capture a handle to the logic_chan. Fill the LogicChan with async logic. Report events to the handle in the async logic. Treat the LogicChan as a stream, collecting the events.
- Handle to a logic_chan instance. A clone of a LogicChanHandle is
Eq
to its origin. A clone of a LogicChanHandle willHash
the same as its origin. - Many tasks can await on this notify struct. They will all be notified once notify is called.
- A buffer that will return to a pool after use.
- Control efficient access to shared resource pool.
- Synchronized droppable share-lock around internal state date.
- A version of Share which can never be closed, and thus every share is infallible (no Err possible).
- The receiver side of a t_chan.
- The sender side of a t_chan - this is cheaply clone-able.
- New-type for sync ref-counted Urls to make passing around tx2 more efficient.
Functions
- Construct a bound async read/write memory channel
- Fill a buffer with data that is readable as latency information. Note, the minimum message size to get the timing data across is 16 bytes.
- Return the duration since the time encoded in a latency info buffer. Returns a unit error if we could not parse the buffer into time data.
- tokio::sync::mpsc::Sender is cheaply clonable, futures::channel::mpsc::Sender can be closed from the sender side. We want both these things. Produce a TChan - a wrapper around a tokio::sync::mpsc::channel. Provides futures::stream::Stream impl on TReceive. Allows channel close from sender side.