pub struct LabelService { /* private fields */ }Expand description
The main label service that creates, signs, and stores labels.
Implementations§
Source§impl LabelService
impl LabelService
Sourcepub fn new(db: SqlitePool, signer: LabelSigner, labeler_did: String) -> Self
pub fn new(db: SqlitePool, signer: LabelSigner, labeler_did: String) -> Self
Create a new label service.
Sourcepub async fn create_label(
&self,
subject_uri: &str,
value: LabelValue,
subject_cid: Option<&str>,
) -> Result<SignedLabel>
pub async fn create_label( &self, subject_uri: &str, value: LabelValue, subject_cid: Option<&str>, ) -> Result<SignedLabel>
Create and store a label for a subject.
The label is signed and persisted to the store before being returned.
Sourcepub async fn negate_label(
&self,
subject_uri: &str,
value: LabelValue,
subject_cid: Option<&str>,
) -> Result<SignedLabel>
pub async fn negate_label( &self, subject_uri: &str, value: LabelValue, subject_cid: Option<&str>, ) -> Result<SignedLabel>
Negate (remove) a previously issued label.
Creates a new label entry with neg: true, indicating that the
specified label value no longer applies to the subject.
Sourcepub async fn query_labels(&self, uri: &str) -> Result<Vec<SignedLabel>>
pub async fn query_labels(&self, uri: &str) -> Result<Vec<SignedLabel>>
Query labels for a subject URI.
Sourcepub async fn query_since(
&self,
cursor: i64,
limit: i64,
) -> Result<Vec<(i64, SignedLabel)>>
pub async fn query_since( &self, cursor: i64, limit: i64, ) -> Result<Vec<(i64, SignedLabel)>>
Query labels since a cursor for subscription streaming.
Returns (row_id, signed_label) pairs so callers can track the cursor
position for subsequent requests.
Auto Trait Implementations§
impl Freeze for LabelService
impl !RefUnwindSafe for LabelService
impl Send for LabelService
impl Sync for LabelService
impl Unpin for LabelService
impl UnsafeUnpin for LabelService
impl !UnwindSafe for LabelService
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
§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>
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