pub struct Connection { /* private fields */ }Expand description
A Seshat database connection that can be used for reading.
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn load_checkpoints(&self) -> Result<Vec<CrawlerCheckpoint>>
pub fn load_checkpoints(&self) -> Result<Vec<CrawlerCheckpoint>>
Load all the previously stored crawler checkpoints from the database.
§Arguments
Sourcepub fn is_empty(&self) -> Result<bool>
pub fn is_empty(&self) -> Result<bool>
Is the database empty. Returns true if the database is empty, false otherwise.
Sourcepub fn is_room_indexed(&self, room_id: &str) -> Result<bool>
pub fn is_room_indexed(&self, room_id: &str) -> Result<bool>
Is a room already indexed.
Returns true if the database contains events from a room, false otherwise.
Sourcepub fn get_stats(&self) -> Result<DatabaseStats>
pub fn get_stats(&self) -> Result<DatabaseStats>
Get statistical information of the database.
Sourcepub fn load_file_events(
&self,
load_config: &LoadConfig,
) -> Result<Vec<(String, Profile)>>
pub fn load_file_events( &self, load_config: &LoadConfig, ) -> Result<Vec<(String, Profile)>>
Load events that contain an mxc URL to a file.
§Arguments
load_config- Configuration deciding which events and how many of them should be loaded.
§Examples
let config = LoadConfig::new("!testroom:localhost").limit(10);
let result = connection.load_file_events(&config);Returns a list of tuples containing the serialized events and the profile of the sender at the time when the event was sent.
Sourcepub fn get_user_version(&self) -> Result<i64>
pub fn get_user_version(&self) -> Result<i64>
Get the user version stored in the database.
This version isn’t used anywhere internally and can be set by the user to signal changes between the JSON that gets stored inside of Seshat.
Trait Implementations§
Source§impl Deref for Connection
impl Deref for Connection
Source§type Target = PooledConnection<SqliteConnectionManager>
type Target = PooledConnection<SqliteConnectionManager>
The resulting type after dereferencing.
Auto Trait Implementations§
impl !Freeze for Connection
impl !RefUnwindSafe for Connection
impl Send for Connection
impl !Sync for Connection
impl Unpin for Connection
impl !UnwindSafe for Connection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more