pub fn put(
        &mut self,
        signed_header: SignedHeaderHashed,
        maybe_entry: Option<EntryHashed>,
    ) -> DatabaseResult<()> {
        if let Some(entry) = maybe_entry {
            if let Some((_, entry_type)) = signed_header.header().entry_data() {
                match entry_type.visibility() {
                    EntryVisibility::Public => self.public_entries.put(entry),
                    EntryVisibility::Private => {
                        if let Some(db) = self.private_entries.as_mut() {
                            db.put(entry);
                        } else {
                            error!(
                                "Attempted ElementBuf::put on a private entry with a disabled private DB: {}",
                                entry.as_hash()
                            );
                        }
                    }
                }
            } else {
                unreachable!(
                    "Attempting to put an entry, but the header has no entry_type. Header hash: {}",
                    signed_header.header_address()
                );
            }
        }

        self.headers.put(signed_header.into());
        Ok(())
    }
/// Puts a signed header and optional entry into the Element store.
/// N.B. this code assumes that the header and entry have been validated
Puts a signed header and optional entry into the Element store.
Puts a signed header and optional entry into the Element store .
pub fn put(
        &mut self,
        signed_header: SignedHeaderHashed,
        maybe_entry: Option<EntryHashed>,
    ) -> DatabaseResult<()> {
        if let Some(entry) = maybe_entry {
            if let Some((_, entry_type)) = signed_header.header().entry_data() {
                match entry_type.visibility() {
                    EntryVisibility::Public => self.public_entries.put(entry),
                    EntryVisibility::Private => {
                        if let Some(db) = self.private_entries.as_mut() {
                            db.put(entry);
                        } else {
                            error!(
                                "Attempted ElementBuf::put on a private entry with a disabled private DB: {}",
                                entry.as_hash()
                            );
                        }
                    }
                }
            } else {
                unreachable!(
                    "Attempting to put an entry, but the header has no entry_type. Header hash: {}",
                    signed_header.header_address()
                );
            }
        }
        self.headers.put(signed_header.into());
        Ok(())
    }
pub fn put ( & mut self , signed_header : SignedHeaderHashed , maybe_entry : Option < EntryHashed > , ) -> DatabaseResult < ( ) > { if let Some ( entry ) = maybe_entry { if let Some ( ( _ , entry_type ) ) = signed_header . header ( ) . entry_data ( ) { match entry_type . visibility ( ) { EntryVisibility :: Public => self . public_entries . put ( entry ) , EntryVisibility :: Private => { if let Some ( db ) = self . private_entries . as_mut ( ) { db . put ( entry ) ; } else { error ! ( " " entry as_hash ( ) ) ; } } } } else { unreachable ! ( " " signed_header header_address ( ) ) ; } } self . headers . put ( signed_header . into ( ) ) ; Ok ( ( ) ) }
Puts a signed header and optional entry into the Element store.
Puts a signed header and optional entry into the Element store .
&mut self
signed_header
SignedHeaderHashed
maybe_entry
Option<EntryHashed>
&mut self
signed_header
SignedHeaderHashed
maybe_entry
Option<EntryHashed>