pub struct MessagePolicy {
pub blanket: BlanketMessagePolicy,
pub restrict_chain_ids_to: Option<HashSet<ChainId>>,
pub ignore_chain_ids: HashSet<ChainId>,
pub reject_message_bundles_without_application_ids: Option<HashSet<GenericApplicationId>>,
pub reject_message_bundles_with_other_application_ids: Option<HashSet<GenericApplicationId>>,
pub process_events_from_application_ids: Option<HashSet<GenericApplicationId>>,
pub never_reject_application_ids: HashSet<GenericApplicationId>,
}Expand description
Policies for automatically handling incoming messages.
Fields§
§blanket: BlanketMessagePolicyThe blanket policy applied to all messages.
restrict_chain_ids_to: Option<HashSet<ChainId>>A collection of chains which restrict the origin of messages and events to be
accepted. Option::None means that messages and events from all chains are accepted. An
empty HashSet denotes that none are accepted. The admin chain’s event stream is always
followed regardless of this setting.
ignore_chain_ids: HashSet<ChainId>A collection of chains whose incoming messages should be ignored.
reject_message_bundles_without_application_ids: Option<HashSet<GenericApplicationId>>A collection of applications: If Some, only bundles with at least one message by any
of these applications will be accepted.
reject_message_bundles_with_other_application_ids: Option<HashSet<GenericApplicationId>>A collection of applications: If Some, only bundles all of whose messages are by these
applications will be accepted.
process_events_from_application_ids: Option<HashSet<GenericApplicationId>>A collection of applications: If Some, only event streams from those
applications are processed and followed. The admin chain’s event stream is always followed.
never_reject_application_ids: HashSet<GenericApplicationId>A collection of applications whose messages must never be rejected. Bundles whose
messages are all from one of these applications bypass the other rejection rules
(except restrict_chain_ids_to), and on execution failure they are discarded for
later retry instead of being rejected. A bundle that contains any message from an
application not on this list can be rejected. An empty set disables this feature.
Implementations§
Source§impl MessagePolicy
impl MessagePolicy
pub async fn blanket(&self, ctx: &Context<'_>) -> Result<&BlanketMessagePolicy>
pub async fn restrict_chain_ids_to( &self, ctx: &Context<'_>, ) -> Result<&Option<HashSet<ChainId>>>
pub async fn ignore_chain_ids( &self, ctx: &Context<'_>, ) -> Result<&HashSet<ChainId>>
pub async fn reject_message_bundles_without_application_ids( &self, ctx: &Context<'_>, ) -> Result<&Option<HashSet<GenericApplicationId>>>
pub async fn reject_message_bundles_with_other_application_ids( &self, ctx: &Context<'_>, ) -> Result<&Option<HashSet<GenericApplicationId>>>
pub async fn process_events_from_application_ids( &self, ctx: &Context<'_>, ) -> Result<&Option<HashSet<GenericApplicationId>>>
pub async fn never_reject_application_ids( &self, ctx: &Context<'_>, ) -> Result<&HashSet<GenericApplicationId>>
Source§impl MessagePolicy
impl MessagePolicy
Sourcepub fn ignores_origin(&self, origin: &ChainId) -> bool
pub fn ignores_origin(&self, origin: &ChainId) -> bool
Returns true if every message from origin would be unconditionally dropped:
blanket policy is Ignore, the origin is in ignore_chain_ids, or
restrict_chain_ids_to is Some and does not contain the origin.
Sourcepub fn accepts_event_stream(
&self,
chain_id: &ChainId,
stream_id: &StreamId,
) -> bool
pub fn accepts_event_stream( &self, chain_id: &ChainId, stream_id: &StreamId, ) -> bool
Returns true if events from stream_id, published by chain_id, should be followed
and processed: restrict_chain_ids_to (if set) must contain chain_id, and
process_events_from_application_ids (if set) must contain the stream’s application. The
admin chain is exempt; callers always follow it.
Trait Implementations§
Source§impl Clone for MessagePolicy
impl Clone for MessagePolicy
Source§fn clone(&self) -> MessagePolicy
fn clone(&self) -> MessagePolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ContainerType for MessagePolicy
impl ContainerType for MessagePolicy
Source§async fn resolve_field(&self, ctx: &Context<'_>) -> ServerResult<Option<Value>>
async fn resolve_field(&self, ctx: &Context<'_>) -> ServerResult<Option<Value>>
async_graphql::Value. Read moreSource§fn collect_all_fields<'a>(
&'a self,
ctx: &ContextBase<'a, &'a Positioned<SelectionSet>>,
fields: &mut Fields<'a>,
) -> Result<(), ServerError>
fn collect_all_fields<'a>( &'a self, ctx: &ContextBase<'a, &'a Positioned<SelectionSet>>, fields: &mut Fields<'a>, ) -> Result<(), ServerError>
Source§fn find_entity(
&self,
_: &ContextBase<'_, &Positioned<Field>>,
_params: &ConstValue,
) -> impl Future<Output = Result<Option<ConstValue>, ServerError>> + Send
fn find_entity( &self, _: &ContextBase<'_, &Positioned<Field>>, _params: &ConstValue, ) -> impl Future<Output = Result<Option<ConstValue>, ServerError>> + Send
Source§impl Debug for MessagePolicy
impl Debug for MessagePolicy
Source§impl Default for MessagePolicy
impl Default for MessagePolicy
Source§fn default() -> MessagePolicy
fn default() -> MessagePolicy
Source§impl<'de> Deserialize<'de> for MessagePolicy
impl<'de> Deserialize<'de> for MessagePolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl ObjectType for MessagePolicy
Source§impl OutputType for MessagePolicy
impl OutputType for MessagePolicy
Source§fn create_type_info(registry: &mut Registry) -> String
fn create_type_info(registry: &mut Registry) -> String
Source§async fn resolve(
&self,
ctx: &ContextSelectionSet<'_>,
_field: &Positioned<Field>,
) -> ServerResult<Value>
async fn resolve( &self, ctx: &ContextSelectionSet<'_>, _field: &Positioned<Field>, ) -> ServerResult<Value>
async_graphql::Value.Source§fn qualified_type_name() -> String
fn qualified_type_name() -> String
Auto Trait Implementations§
impl Freeze for MessagePolicy
impl RefUnwindSafe for MessagePolicy
impl Send for MessagePolicy
impl Sync for MessagePolicy
impl Unpin for MessagePolicy
impl UnsafeUnpin for MessagePolicy
impl UnwindSafe for MessagePolicy
Blanket Implementations§
impl<_INNER> AutoTraits for _INNER
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,
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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 moreimpl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSync for Twhere
T: Sync,
Source§impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
Source§fn read<'instance>(
&self,
instance: &'instance &mut I,
location: GuestPointer,
length: u32,
) -> Result<Cow<'instance, [u8]>, RuntimeError>
fn read<'instance>( &self, instance: &'instance &mut I, location: GuestPointer, length: u32, ) -> Result<Cow<'instance, [u8]>, RuntimeError>
Reads length bytes from memory from the provided location.
Source§fn write(
&mut self,
instance: &mut &mut I,
location: GuestPointer,
bytes: &[u8],
) -> Result<(), RuntimeError>
fn write( &mut self, instance: &mut &mut I, location: GuestPointer, bytes: &[u8], ) -> Result<(), RuntimeError>
Writes the bytes to memory at the provided location.