pub struct RoomIndex { /* private fields */ }
Expand description
A struct that holds all data pertaining to a particular room’s message index.
Implementations§
Source§impl RoomIndex
impl RoomIndex
Sourcepub fn new(path: &Path, room_id: &RoomId) -> Result<RoomIndex, IndexError>
pub fn new(path: &Path, room_id: &RoomId) -> Result<RoomIndex, IndexError>
Create new RoomIndex
which stores the index in path/room_id
Sourcepub fn new_in_memory(room_id: &RoomId) -> Result<RoomIndex, IndexError>
pub fn new_in_memory(room_id: &RoomId) -> Result<RoomIndex, IndexError>
Create new RoomIndex
which stores the index in memory.
Intended for testing.
Sourcepub fn open_or_create(
path: &Path,
room_id: &RoomId,
) -> Result<RoomIndex, IndexError>
pub fn open_or_create( path: &Path, room_id: &RoomId, ) -> Result<RoomIndex, IndexError>
Open index at path/room_id if it exists else
create new RoomIndex
which stores the index in path/room_id
Sourcepub fn open(path: &Path, room_id: &RoomId) -> Result<RoomIndex, IndexError>
pub fn open(path: &Path, room_id: &RoomId) -> Result<RoomIndex, IndexError>
Open index at path/room_id. Fails if it doesn’t exist.
Sourcepub fn handle_event(
&mut self,
event: AnySyncMessageLikeEvent,
) -> Result<(), IndexError>
pub fn handle_event( &mut self, event: AnySyncMessageLikeEvent, ) -> Result<(), IndexError>
Handle [AnySyncMessageLikeEvent
]
This which will add/remove/edit an event in the index based on the event type.
Sourcepub fn commit_and_reload(&mut self) -> Result<OpStamp, IndexError>
pub fn commit_and_reload(&mut self) -> Result<OpStamp, IndexError>
Commit added events to RoomIndex
and
update searchers so that they reflect the state of the last
.commit()
.
Every commit should be rapidly reflected on your IndexReader
and you
should not need to call reload()
at all.
This automatic reload can take 10s of milliseconds to kick in however, and in unit tests it can be nice to deterministically force the reload of searchers.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RoomIndex
impl !RefUnwindSafe for RoomIndex
impl Send for RoomIndex
impl Sync for RoomIndex
impl Unpin for RoomIndex
impl !UnwindSafe for RoomIndex
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
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>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn 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>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which 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)
&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)
&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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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