Struct routing::messaging::MpidHeader
[−]
[src]
pub struct MpidHeader { /* fields omitted */ }
Minimal information about a given message which can be used as a notification to the receiver.
Methods
impl MpidHeader
[src]
fn new(
sender: XorName,
metadata: Vec<u8>,
secret_key: &SecretKey
) -> Result<MpidHeader, Error>
[src]
sender: XorName,
metadata: Vec<u8>,
secret_key: &SecretKey
) -> Result<MpidHeader, Error>
Constructor.
Each new MpidHeader
will have a random unique identifier assigned to it, accessed via the
guid()
getter.
sender
represents the name of the original creator of the message.
metadata
is arbitrary, user-supplied information which must not exceed
MAX_HEADER_METADATA_SIZE
. It can be empty if
desired.
secret_key
will be used to generate a signature of sender
, guid
and metadata
.
An error will be returned if metadata
exceeds MAX_HEADER_METADATA_SIZE
or if
serialisation during the signing process fails.
fn sender(&self) -> &XorName
[src]
The name of the original creator of the message.
fn guid(&self) -> &[u8; 16]
[src]
A unique identifier generated randomly when calling new()
.
fn metadata(&self) -> &Vec<u8>
[src]
Arbitrary, user-supplied information.
fn signature(&self) -> &Signature
[src]
The signature of sender
, guid
and metadata
, created when calling new()
.
fn name(&self) -> Result<XorName, Error>
[src]
The name of the header. This is a relatively expensive getter - the name is the SHA512 hash of the serialised header, so its use should be minimised.
fn verify(&self, public_key: &PublicKey) -> bool
[src]
Validates the header's signature against the provided PublicKey
.
Trait Implementations
impl PartialEq for MpidHeader
[src]
fn eq(&self, __arg_0: &MpidHeader) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &MpidHeader) -> bool
[src]
This method tests for !=
.
impl Eq for MpidHeader
[src]
impl Hash for MpidHeader
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Clone for MpidHeader
[src]
fn clone(&self) -> MpidHeader
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more