Struct libqaul::api::Services [−][src]
Manage service sessions and related metadata
Services are external applications using libqaul as a basis to communicate on a distributed network. For a service to start using all libqaul functions it should register itself via this API. This will unlock internal storage and better subscription support.
Some applications might be quite security critical, and so, there needs to be a way to store data in a safe way for future sessions, without offering metadata sidechannels from captured devices. This API is a solution to this problem.
In libqaul, all data is stored to disk encrypted, meaning that conversations, keys and logs are safe from inspection. To allow services to hook into the same storage mechanism for their own metadata, this API provides a view into a per-user, per-service metadata map. This way your service doesn’t have to re-implemented secure disk storage, or rely on easier non-secure storage.
Implementations
impl<'qaul> Services<'qaul>
[src]
pub fn god_mode(&self) -> bool
[src]
Check if “god mode” is supported by this instance
pub async fn register<S: Into<String>, F: 'static>(
&self,
name: S,
cb: F
) -> Result<()> where
F: Fn(ServiceEvent) + Send + Sync,
[src]
&self,
name: S,
cb: F
) -> Result<()> where
F: Fn(ServiceEvent) + Send + Sync,
Add an external service to the qaul service registry
Registering a service means that future Message
listeners
can be allocated for this service, as well as enabling polling.
Names of services need to be unique, so it’s advised to
namespace them on some other key, for example the application
package name (such as com.example.myapp
)
pub async fn unregister<S: Into<String>>(&self, name: S) -> Result<()>
[src]
Remove an external service from the qaul service registry
Calling this function will disable the ability to poll for messages, as well as deleting all already registered message listeners already existing for this service.
Will return Error::NoService
if no such service name could
be found.
pub async fn save<S, T>(
&self,
user: UserAuth,
service: S,
data: MetadataMap,
tags: T
) -> Result<()> where
S: Into<String>,
T: Into<TagSet>,
[src]
&self,
user: UserAuth,
service: S,
data: MetadataMap,
tags: T
) -> Result<()> where
S: Into<String>,
T: Into<TagSet>,
Save some piece of metadata, for a particular user and service
This function can be used to save a piece of metadata with a set of tags. The name of a MetadataMap needs to be unique and will be overridden by this call. The search tags can be used to identity different classes of data, but can also be left empty.
pub async fn delete<S, K>(
&self,
user: UserAuth,
service: S,
key: K
) -> Result<()> where
S: Into<String>,
K: Into<String>,
[src]
&self,
user: UserAuth,
service: S,
key: K
) -> Result<()> where
S: Into<String>,
K: Into<String>,
Delete a particular key from the service metadata store
Will only error on access failure, not if the key didn’t previously exist.
pub async fn query<S, T>(
&self,
user: UserAuth,
service: S,
tags: T
) -> Result<Vec<MetadataMap>> where
S: Into<String>,
T: Into<TagSet>,
[src]
&self,
user: UserAuth,
service: S,
tags: T
) -> Result<Vec<MetadataMap>> where
S: Into<String>,
T: Into<TagSet>,
Make a query into the service metadata store via a set of tags
Each entry in the store can further be associated with a name. If your query doesn’t provide a tag filter all entries for the service/user combination will be returned.
Auto Trait Implementations
impl<'chain> !RefUnwindSafe for Services<'chain>
impl<'chain> Send for Services<'chain>
impl<'chain> Sync for Services<'chain>
impl<'chain> Unpin for Services<'chain>
impl<'chain> !UnwindSafe for Services<'chain>
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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[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.
pub 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.
pub 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>,
pub fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,