Struct routing::messaging::MpidHeader
[−]
[src]
pub struct MpidHeader {
// some 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>
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
The name of the original creator of the message.
fn guid(&self) -> &[u8; 16]
A unique identifier generated randomly when calling new().
fn metadata(&self) -> &Vec<u8>
Arbitrary, user-supplied information.
fn signature(&self) -> &Signature
The signature of sender, guid and metadata, created when calling new().
fn name(&self) -> Result<XorName, Error>
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
Validates the header's signature against the provided PublicKey.
Trait Implementations
impl PartialEq for MpidHeader[src]
fn eq(&self, __arg_0: &MpidHeader) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &MpidHeader) -> bool
This method tests for !=.
impl Eq for MpidHeader[src]
impl Hash for MpidHeader[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher1.3.0
Feeds a slice of this type into the state provided.
impl Clone for MpidHeader[src]
fn clone(&self) -> MpidHeader
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more