pub struct Connector {
pub config: ConnectorConfig,
/* private fields */
}Expand description
A connector that can fetch entities from a remote Haystack server.
Fields§
§config: ConnectorConfigImplementations§
Source§impl Connector
impl Connector
Sourcepub fn new(config: ConnectorConfig) -> Self
pub fn new(config: ConnectorConfig) -> Self
Create a new connector with an empty cache.
Sourcepub async fn sync(&self) -> Result<usize, String>
pub async fn sync(&self) -> Result<usize, String>
Connect to the remote server, fetch all entities, apply id prefixing, and store them in the cache. Returns the count of entities synced.
Sourcepub fn cached_entities(&self) -> Vec<HDict>
pub fn cached_entities(&self) -> Vec<HDict>
Returns a clone of all cached entities.
Sourcepub fn entity_count(&self) -> usize
pub fn entity_count(&self) -> usize
Returns the number of cached entities.
Auto Trait Implementations§
impl !Freeze for Connector
impl !RefUnwindSafe for Connector
impl Send for Connector
impl Sync for Connector
impl Unpin for Connector
impl UnsafeUnpin for Connector
impl UnwindSafe for Connector
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