[−][src]Struct seshat::Database
The Seshat database.
Methods
impl Database
[src]
pub fn new<P: AsRef<Path>>(path: P) -> Result<Database> where
PathBuf: From<P>,
[src]
PathBuf: From<P>,
Create a new Seshat database or open an existing one.
Arguments
path
- The directory where the database will be stored in. This should be an empty directory if a new database should be created.
pub fn new_with_config<P: AsRef<Path>>(
path: P,
config: &Config
) -> Result<Database> where
PathBuf: From<P>,
[src]
path: P,
config: &Config
) -> Result<Database> where
PathBuf: From<P>,
Create a new Seshat database or open an existing one with the given configuration.
Arguments
path
- The directory where the database will be stored in. This should be an empty directory if a new database should be created.config
- Configuration that changes the behaviour of the database.
pub fn change_passphrase(self, new_passphrase: &str) -> Result<()>
[src]
Change the passphrase of the Seshat database.
Note that this consumes the database object and any searcher objects can't be used anymore. A new database will have to be opened and new searcher objects as well.
Arguments
path
- The directory where the database will be stored in. This should be an empty directory if a new database should be created.new_passphrase
- The passphrase that should be used instead of the current one.
pub fn get_size(&self) -> Result<u64>
[src]
Get the size of the database. This returns the number of bytes the database is using on disk.
pub fn get_path(&self) -> &Path
[src]
Get the path of the directory where the Seshat database lives in.
pub fn add_event(&self, event: Event, profile: Profile)
[src]
Add an event with the given profile to the database.
Arguments
event
- The directory where the database will be stored in. Thisprofile
- The directory where the database will be stored in. This
This is a fast non-blocking operation, it only queues up the event to be
added to the database. The events will be committed to the database
only when the user calls the commit()
method.
pub fn delete_event(&self, event_id: &str) -> Receiver<Result<bool>>
[src]
Delete an event from the database.
Arguments
event_id
- The event id of the event that will be deleted.
Note for the event to be completely removed a commit needs to be done.
Returns a receiver that will receive an boolean once the event has been deleted. The boolean indicates if the event was deleted or if a commit will be needed.
pub fn commit(&mut self) -> Result<()>
[src]
Commit the currently queued up events. This method will block. A
non-blocking version of this method exists in the commit_no_wait()
method.
pub fn force_commit(&mut self) -> Result<()>
[src]
Commit the currently queued up events forcing the commit to the index.
Commits are usually rate limited. This gets around the limit and forces the documents to be added to the index.
This method will block. A non-blocking version of this method exists in
the force_commit_no_wait()
method.
This should only be used for testing purposes.
pub fn reload(&mut self) -> Result<()>
[src]
Reload the database so that a search reflects the state of the last commit. Note that this happens automatically and this method should be used only in unit tests.
pub fn commit_no_wait(&mut self) -> Receiver<Result<()>>
[src]
Commit the currently queued up events without waiting for confirmation that the operation is done.
Returns a receiver that will receive an empty message once the commit is done.
pub fn force_commit_no_wait(&mut self) -> Receiver<Result<()>>
[src]
Commit the currently queued up events forcing the commit to the index.
Commits are usually rate limited. This gets around the limit and forces the documents to be added to the index.
This should only be used for testing purposes.
Returns a receiver that will receive an empty message once the commit is done.
pub fn add_historic_events(
&self,
events: Vec<(Event, Profile)>,
new_checkpoint: Option<CrawlerCheckpoint>,
old_checkpoint: Option<CrawlerCheckpoint>
) -> Receiver<Result<bool>>
[src]
&self,
events: Vec<(Event, Profile)>,
new_checkpoint: Option<CrawlerCheckpoint>,
old_checkpoint: Option<CrawlerCheckpoint>
) -> Receiver<Result<bool>>
Add the given events from the room history to the database.
Arguments
events
- The events that will be added.new_checkpoint
- A checkpoint that states where we need to continue fetching events from the room history. This checkpoint will be persisted in the database.old_checkpoint
- The checkpoint that was used to fetch the given events. This checkpoint will be removed from the database.
pub fn search(
&self,
term: &str,
config: &SearchConfig
) -> Result<(usize, Vec<SearchResult>)>
[src]
&self,
term: &str,
config: &SearchConfig
) -> Result<(usize, Vec<SearchResult>)>
Search the index and return events matching a search term. This is just a helper function that gets a searcher and performs a search on it immediately.
Arguments
term
- The search term that should be used to search the index.
pub fn get_searcher(&self) -> Searcher
[src]
Get a searcher that can be used to perform a search.
pub fn get_connection(&self) -> Result<Connection>
[src]
Get a database connection. Note that this connection should only be used for reading.
pub fn shutdown(self) -> Receiver<Result<()>>
[src]
Shut the database down.
This will terminate the writer thread making sure that no writes will happen after this operation.
pub fn delete(self) -> Result<()>
[src]
Delete the database. Warning: This will delete the whole path that was provided at the database creation time.
Auto Trait Implementations
impl !RefUnwindSafe for Database
impl !Send for Database
impl !Sync for Database
impl Unpin for Database
impl !UnwindSafe for Database
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast for T where
T: Any,
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,