Struct EventContentV0

Source
pub struct EventContentV0 {
    pub topic: TopicId,
    pub publisher: PeerId,
    pub seq: u64,
    pub blocks: Vec<Block>,
    pub file_ids: Vec<BlockId>,
    pub key: Vec<u8>,
}
Expand description

Content of EventV0

Contains the objects of newly published Commit, its optional blocks, and optional FILES and their blocks. If a block is not present in the Event, its ID should be present in file_ids and the block should be put on the emitting broker beforehand with BlocksPut.

Fields§

§topic: TopicId

Pub/sub topic

§publisher: PeerId§seq: u64

Commit sequence number of publisher

§blocks: Vec<Block>

Blocks with encrypted content. First in the list is always the commit block followed by its children, then its optional header and body blocks (and eventual children), blocks of the FILES are optional (only sent here if user specifically want to push them to the pub/sub). the first in the list MUST contain a commit_header_key When saved locally (the broker keeps the associated event, until the topic is refreshed(the last heads retain their events) ), so, this blocks list is emptied (as the blocked are saved in the overlay storage anyway) and their IDs are kept on the side. then when the event needs to be send in reply to a *TopicSyncReq, the blocks list is regenerated from the IDs, so that a valid EventContent can be sent (and so that its signature can be verified successfully)

§file_ids: Vec<BlockId>

Ids of additional Blocks (FILES or Objects) with encrypted content that are not to be pushed in the pub/sub they will be retrieved later by interested users

§key: Vec<u8>

can be :

  • Encrypted key for the Commit object (the first Block in blocks vec) The ObjectKey is encrypted using ChaCha20:
    • key: BLAKE3 derive_key (“NextGraph Event Commit ObjectKey ChaCha20 key”, RepoId + BranchId + branch_secret(ReadCapSecret of the branch) + publisher)
    • nonce: commit_seq
  • If it is a CertificateRefresh, both the blocks and file_ids vectors are empty. the key here contains an encrypted ObjectRef to the new Certificate. The whole ObjectRef is encrypted (including the ID) to avoid correlation of topics who will have the same Certificate ID (belong to the same repo) Encrypted using ChaCha20, with :
    • key: BLAKE3 derive_key (“NextGraph Event Certificate ObjectRef ChaCha20 key”, RepoId + BranchId + branch_secret(ReadCapSecret of the branch) + publisher) it is the same key as above, because the commit_seq will be different (incremented anyway)
    • nonce: commit_seq

Trait Implementations§

Source§

impl Clone for EventContentV0

Source§

fn clone(&self) -> EventContentV0

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EventContentV0

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for EventContentV0

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for EventContentV0

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Serialize for EventContentV0

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,