pub(crate) struct Op {
pub run: for<'a> fn(&'a AppState, &'a RemoteCaller, Value) -> BoxFuture<'a, Result<Value, RemoteRefusal>>,
pub changes_state: bool,
pub needs_approved_install: bool,
pub max_params: usize,
}Expand description
One operation: its handler, and whether it changes anything on this machine.
Fields§
§run: for<'a> fn(&'a AppState, &'a RemoteCaller, Value) -> BoxFuture<'a, Result<Value, RemoteRefusal>>§changes_state: boolA state-changing operation needs a caller backed by a certificate from the install that
hosts the agent, an install this machine trusts (needs_certificate, install_not_trusted
otherwise). A read can go on the first-seen pin alone:
that pin comes from unauthenticated discovery, which is enough to read a version and too
thin to stop an agent or move an account.
needs_approved_install: boolA read of personal data (an account’s email) takes the same proof as a write: a certificate
from an install this machine has approved. A first-seen pin proves only that the peer stayed
the same, not that anyone approved it. Always true for a write.
max_params: usizeThe most bytes of params this operation takes. The default is the transport’s
MAX_PARAMS_BYTES; one that carries text raises it with Op::with_max_params. The sender
and the receiver both read it from here, the receiver before it verifies anything, so the
unsigned op name only bounds the work.
Implementations§
Source§impl Op
impl Op
pub(crate) const fn read( run: for<'a> fn(&'a AppState, &'a RemoteCaller, Value) -> BoxFuture<'a, Result<Value, RemoteRefusal>>, ) -> Self
Sourcepub(crate) const fn read_personal(
run: for<'a> fn(&'a AppState, &'a RemoteCaller, Value) -> BoxFuture<'a, Result<Value, RemoteRefusal>>,
) -> Self
pub(crate) const fn read_personal( run: for<'a> fn(&'a AppState, &'a RemoteCaller, Value) -> BoxFuture<'a, Result<Value, RemoteRefusal>>, ) -> Self
A read that returns personal data: refused (needs_certificate, install_not_trusted) to
a peer that is only first-seen, as a write is.
pub(crate) const fn write( run: for<'a> fn(&'a AppState, &'a RemoteCaller, Value) -> BoxFuture<'a, Result<Value, RemoteRefusal>>, ) -> Self
pub(crate) const fn with_max_params(self, max_params: usize) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Op
impl RefUnwindSafe for Op
impl Send for Op
impl Sync for Op
impl Unpin for Op
impl UnsafeUnpin for Op
impl UnwindSafe for Op
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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