pub struct Service { /* private fields */ }Implementations§
Source§impl Service
impl Service
pub fn new(store: Store, broker: Arc<Broker>, config: Arc<ConfigState>) -> Self
pub fn store(&self) -> &Store
pub fn limits(&self) -> Limits
Sourcepub fn ingest(
self: &Arc<Self>,
req: CommandAttachmentsIngestData,
) -> AttachmentsIngestResult
pub fn ingest( self: &Arc<Self>, req: CommandAttachmentsIngestData, ) -> AttachmentsIngestResult
Classify paths, apply the limits, and (unless dry_run) start
processing the accepted images in the background. Returns at once.
pub fn cancel(&self, batch_id: &str) -> bool
Sourcepub async fn info(self: &Arc<Self>, ids: &[String]) -> Vec<AttachmentInfo>
pub async fn info(self: &Arc<Self>, ids: &[String]) -> Vec<AttachmentInfo>
Info for each id still in the store, in request order. May decode (after a send-edge change), so call it off the async workers.
Sourcepub async fn ensure_derived(self: &Arc<Self>, id: &str) -> Option<StoredMeta>
pub async fn ensure_derived(self: &Arc<Self>, id: &str) -> Option<StoredMeta>
Metadata under the current fingerprint. When the send edge or the pipeline changed since the attachment was processed, re-derive it from the stored original under the same CPU and memory limits as ingest, so a transcript full of old thumbnails can’t start an unbounded number of decodes at once.
A file stored unread (store_undecoded) is not derived here, so a pane
drawing its tile or a thumbnail request leaves it alone: that takes
Self::open_derived.
Sourcepub async fn open_derived(self: &Arc<Self>, id: &str) -> Option<StoredMeta>
pub async fn open_derived(self: &Arc<Self>, id: &str) -> Option<StoredMeta>
Self::ensure_derived for a file someone has chosen to open or use:
one stored unread is derived now.
Sourcepub fn refund_session_inline(&self, key: &str, bytes: u64)
pub fn refund_session_inline(&self, key: &str, bytes: u64)
Give back what Self::with_session_inline_budget recorded for a
message that then wasn’t delivered. Blocking.
Sourcepub fn with_session_inline_budget<T>(
&self,
key: &str,
carry_from: Option<&str>,
max: u64,
f: impl FnOnce(u64) -> (T, u64),
) -> T
pub fn with_session_inline_budget<T>( &self, key: &str, carry_from: Option<&str>, max: u64, f: impl FnOnce(u64) -> (T, u64), ) -> T
Run f with the inline budget left in Claude session key (out of
max), and record what it reports spending, as one step under a
lock. carry_from is a per-block key counted before the session had
an id; its count moves into key first. Blocking.
Sourcepub fn send_target(&self, id: &str, name: &str) -> Option<SendTarget>
pub fn send_target(&self, id: &str, name: &str) -> Option<SendTarget>
What the agent gets for attachment id sent under the user’s name,
marking it used: an image’s send-copy, or for any other file a
freshly made copy named name, with a note for the agent’s list.
Doesn’t decode: call Self::ensure_derived first so a stale
fingerprint is re-derived under the limits.
Sourcepub async fn store_undecoded(
self: &Arc<Self>,
tmp: PathBuf,
id: String,
name: String,
) -> Result<(), ProcessError>
pub async fn store_undecoded( self: &Arc<Self>, tmp: PathBuf, id: String, name: String, ) -> Result<(), ProcessError>
Store a file already sitting in incoming/ exactly as it came: placed
under its hash and nothing read from it (no type sniffing, decode,
preview or text). It is derived when something opens it
(Self::ensure_derived). For a file whose sender is not proven.
Sourcepub fn stored_len(&self, id: &str) -> Option<u64>
pub fn stored_len(&self, id: &str) -> Option<u64>
The size of the stored original of id, from the file system alone.
Sourcepub fn unread_target(&self, id: &str, name: &str) -> Option<SendTarget>
pub fn unread_target(&self, id: &str, name: &str) -> Option<SendTarget>
What the agent gets for id sent under name when nothing may be read
from the file: a named copy of the original and a note saying it was
not opened. A file that was derived before (the same bytes from a
sender that was proven, or the sender’s own upload) is given as
Self::send_target gives it.
Sourcepub async fn commit_upload(
self: &Arc<Self>,
tmp: PathBuf,
id: String,
name: String,
) -> Result<AttachmentInfo, ProcessError>
pub async fn commit_upload( self: &Arc<Self>, tmp: PathBuf, id: String, name: String, ) -> Result<AttachmentInfo, ProcessError>
Store a file already sitting in incoming/ (an upload): place it,
reserve decode memory, derive. Returns its info.
Auto Trait Implementations§
impl !Freeze for Service
impl !RefUnwindSafe for Service
impl !UnwindSafe for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl UnsafeUnpin for Service
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§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>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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