pub struct HoprEncoder<Chain, S, T> {
chain_api: Chain,
surb_store: S,
tracker: T,
chain_key: ChainKeypair,
channels_dst: Hash,
cfg: HoprCodecConfig,
}Expand description
Default encoder implementation for HOPR packets.
Fields§
§chain_api: Chain§surb_store: S§tracker: T§chain_key: ChainKeypair§channels_dst: Hash§cfg: HoprCodecConfigImplementations§
Source§impl<Chain, S, T> HoprEncoder<Chain, S, T>
impl<Chain, S, T> HoprEncoder<Chain, S, T>
Sourcepub fn new(
chain_key: ChainKeypair,
chain_api: Chain,
surb_store: S,
tracker: T,
channels_dst: Hash,
cfg: HoprCodecConfig,
) -> Self
pub fn new( chain_key: ChainKeypair, chain_api: Chain, surb_store: S, tracker: T, channels_dst: Hash, cfg: HoprCodecConfig, ) -> Self
Creates a new instance of the encoder.
Source§impl<Chain, S, T> HoprEncoder<Chain, S, T>where
Chain: ChainKeyOperations + ChainReadChannelOperations + ChainValues + Sync,
S: SurbStore,
T: TicketTracker + Sync,
impl<Chain, S, T> HoprEncoder<Chain, S, T>where
Chain: ChainKeyOperations + ChainReadChannelOperations + ChainValues + Sync,
S: SurbStore,
T: TicketTracker + Sync,
async fn encode_packet_internal<D: AsRef<[u8]> + Send + 'static, Sig: Into<PacketSignals> + Send + 'static>( &self, next_peer: OffchainPublicKey, data: D, num_hops: usize, signals: Sig, routing: PacketRouting<ValidatedPath>, pseudonym: HoprPseudonym, ) -> Result<OutgoingPacket, HoprProtocolError>
Trait Implementations§
Source§impl<Chain, S, T> PacketEncoder for HoprEncoder<Chain, S, T>
impl<Chain, S, T> PacketEncoder for HoprEncoder<Chain, S, T>
type Error = HoprProtocolError
Source§fn encode_packet<'life0, 'async_trait, D, Sig>(
&'life0 self,
data: D,
routing: ResolvedTransportRouting<HoprSurb>,
signals: Sig,
) -> Pin<Box<dyn Future<Output = Result<OutgoingPacket, Self::Error>> + Send + 'async_trait>>
fn encode_packet<'life0, 'async_trait, D, Sig>( &'life0 self, data: D, routing: ResolvedTransportRouting<HoprSurb>, signals: Sig, ) -> Pin<Box<dyn Future<Output = Result<OutgoingPacket, Self::Error>> + Send + 'async_trait>>
Source§fn encode_acknowledgements<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
acks: &'life1 [VerifiedAcknowledgement],
destination: &'life2 OffchainPublicKey,
) -> Pin<Box<dyn Future<Output = Result<OutgoingPacket, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn encode_acknowledgements<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
acks: &'life1 [VerifiedAcknowledgement],
destination: &'life2 OffchainPublicKey,
) -> Pin<Box<dyn Future<Output = Result<OutgoingPacket, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Encodes the given vector of
VerifiedAcknowledgements as an outgoing packet to be
sent to the given destination.Auto Trait Implementations§
impl<Chain, S, T> Freeze for HoprEncoder<Chain, S, T>
impl<Chain, S, T> RefUnwindSafe for HoprEncoder<Chain, S, T>
impl<Chain, S, T> Send for HoprEncoder<Chain, S, T>
impl<Chain, S, T> Sync for HoprEncoder<Chain, S, T>
impl<Chain, S, T> Unpin for HoprEncoder<Chain, S, T>
impl<Chain, S, T> UnwindSafe for HoprEncoder<Chain, S, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more