pub struct HoprEncoder<Chain, S, T> {
chain_api: Chain,
surb_store: S,
ticket_factory: T,
chain_key: ChainKeypair,
channels_dst: Hash,
cfg: HoprCodecConfig,
}Expand description
Default encoder implementation for HOPR packets.
Fields§
§chain_api: Chain§surb_store: S§ticket_factory: 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,
ticket_factory: T,
channels_dst: Hash,
cfg: HoprCodecConfig,
) -> Self
pub fn new( chain_key: ChainKeypair, chain_api: Chain, surb_store: S, ticket_factory: T, channels_dst: Hash, cfg: HoprCodecConfig, ) -> Self
Creates a new instance of the encoder.
Source§impl<Chain, S, T> HoprEncoder<Chain, S, T>
impl<Chain, S, T> HoprEncoder<Chain, S, T>
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<D: AsRef<[u8]> + Send + 'static, Sig: Into<PacketSignals> + Send + 'static>(
&self,
data: D,
routing: ResolvedTransportRouting<HoprSurb>,
signals: Sig,
) -> Result<OutgoingPacket, Self::Error>
fn encode_packet<D: AsRef<[u8]> + Send + 'static, Sig: Into<PacketSignals> + Send + 'static>( &self, data: D, routing: ResolvedTransportRouting<HoprSurb>, signals: Sig, ) -> Result<OutgoingPacket, Self::Error>
Source§fn encode_acknowledgements(
&self,
acks: &[VerifiedAcknowledgement],
destination: &OffchainPublicKey,
) -> Result<OutgoingPacket, Self::Error>
fn encode_acknowledgements( &self, acks: &[VerifiedAcknowledgement], destination: &OffchainPublicKey, ) -> Result<OutgoingPacket, Self::Error>
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> 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