pub struct Journal { /* private fields */ }sqlite only.Expand description
The Journal is the audit log of all changes to a zone after initial creation.
Implementations§
Source§impl Journal
impl Journal
Sourcepub fn new(conn: Connection) -> Result<Self, PersistenceError>
pub fn new(conn: Connection) -> Result<Self, PersistenceError>
Constructs a new Journal, attaching to the specified Sqlite Connection
Sourcepub fn from_file(journal_file: &Path) -> Result<Self, PersistenceError>
pub fn from_file(journal_file: &Path) -> Result<Self, PersistenceError>
Constructs a new Journal opening a Sqlite connection to the file at the specified path
Sourcepub fn conn(&self) -> MutexGuard<'_, Connection>
pub fn conn(&self) -> MutexGuard<'_, Connection>
Returns a reference to the Sqlite Connection
Sourcepub fn schema_version(&self) -> i64
pub fn schema_version(&self) -> i64
Returns the current schema version of the journal
Sourcepub fn iter(&self) -> JournalIter<'_> ⓘ
pub fn iter(&self) -> JournalIter<'_> ⓘ
this returns an iterator from the beginning of time, to be used to recreate an authority
Sourcepub fn insert_record(
&self,
soa_serial: u32,
record: &Record,
) -> Result<(), PersistenceError>
pub fn insert_record( &self, soa_serial: u32, record: &Record, ) -> Result<(), PersistenceError>
Inserts a record, this is an append only operation.
Records should never be posthumously modified. The message will be serialized into the. the first message serialized to the journal, should be a single AXFR of the entire zone, this will be used as a starting point to reconstruct the zone.
§Argument
record- will be serialized into the journal
Sourcepub fn insert_records(
&self,
soa_serial: u32,
records: &[Record],
) -> Result<(), PersistenceError>
pub fn insert_records( &self, soa_serial: u32, records: &[Record], ) -> Result<(), PersistenceError>
Inserts a set of records into the Journal, a convenience method for insert_record
Sourcepub fn select_record(
&self,
row_id: i64,
) -> Result<Option<(i64, Record)>, PersistenceError>
pub fn select_record( &self, row_id: i64, ) -> Result<Option<(i64, Record)>, PersistenceError>
Selects a record from the given row_id.
This allows for the entire set of records to be iterated through, by starting at 0, and incrementing each subsequent row.
§Arguments
row_id- the row_id can either be exact, or start at 0 to get the earliest row in the list.
Sourcepub fn select_schema_version(conn: &Connection) -> Result<i64, PersistenceError>
pub fn select_schema_version(conn: &Connection) -> Result<i64, PersistenceError>
selects the current schema version of the journal DB, returns -1 if there is no schema
§Arguments
conn- db connection to use
Sourcepub fn schema_up(&mut self) -> Result<i64, PersistenceError>
pub fn schema_up(&mut self) -> Result<i64, PersistenceError>
initializes the schema for the Journal