/// Stores an entry based on the configuration.
Stores an entry based on the configuration.
Stores an entry based on the configuration .
pub fn store_entry(&self, entry: Entry) -> Result<()> {
        let immutable = {
            let rules = self.rules.read();
            rules.lifecycle_rules.immutable
        };
        match (self.write_buffer.as_ref(), immutable) {
            (Some(write_buffer), true) => {
                // If only the write buffer is configured, this is passing the data through to
                // the write buffer, and it's not an error. We ignore the returned metadata; it
                // will get picked up when data is read from the write buffer.
                let _ = write_buffer.store_entry(&entry).context(WriteBufferError)?;
                Ok(())
            }
            (Some(write_buffer), false) => {
                // If using both write buffer and mutable buffer, we want to wait for the write
                // buffer to return success before adding the entry to the mutable buffer.
                let sequence = write_buffer.store_entry(&entry).context(WriteBufferError)?;
                let sequenced_entry = Arc::new(
                    SequencedEntry::new_from_sequence(sequence, entry)
                        .context(SequencedEntryError)?,
                );
                self.store_sequenced_entry(sequenced_entry)
            }
            (None, true) => {
                // If no write buffer is configured and the database is immutable, trying to
                // store an entry is an error and we don't need to build a `SequencedEntry`.
                DatabaseNotWriteable {}.fail()
            }
            (None, false) => {
                // If no write buffer is configured, use the process clock and send to the mutable
                // buffer.
                let sequenced_entry = Arc::new(
                    SequencedEntry::new_from_process_clock(
                        self.process_clock.next(),
                        self.server_id,
                        entry,
                    )
                    .context(SequencedEntryError)?,
                );
                self.store_sequenced_entry(sequenced_entry)
            }
        }
    }
pub fn store_entry ( & self , entry : Entry ) -> Result < ( ) > { let immutable = { let rules = self . rules . read ( ) ; rules . lifecycle_rules . immutable } ; match ( self . write_buffer . as_ref ( ) , immutable ) { ( Some ( write_buffer ) , true ) => { // If only the write buffer is configured, this is passing the data through to // the write buffer, and it's not an error. We ignore the returned metadata; it // will get picked up when data is read from the write buffer. let _ = write_buffer . store_entry ( & entry ) . context ( WriteBufferError ) ? ; Ok ( ( ) ) } ( Some ( write_buffer ) , false ) => { // If using both write buffer and mutable buffer, we want to wait for the write // buffer to return success before adding the entry to the mutable buffer. let sequence = write_buffer . store_entry ( & entry ) . context ( WriteBufferError ) ? ; let sequenced_entry = Arc :: new ( SequencedEntry :: new_from_sequence ( sequence , entry ) . context ( SequencedEntryError ) ? , ) ; self . store_sequenced_entry ( sequenced_entry ) } ( None , true ) => { // If no write buffer is configured and the database is immutable, trying to // store an entry is an error and we don't need to build a `SequencedEntry`. DatabaseNotWriteable { } . fail ( ) } ( None , false ) => { // If no write buffer is configured, use the process clock and send to the mutable // buffer. let sequenced_entry = Arc :: new ( SequencedEntry :: new_from_process_clock ( self . process_clock . next ( ) , self . server_id , entry , ) . context ( SequencedEntryError ) ? , ) ; self . store_sequenced_entry ( sequenced_entry ) } } }
Stores an entry based on the configuration.
Stores an entry based on the configuration .
&self
entry
Entry