Skip to main content

surrealdb_sql/
event_kind.rs

1/// Whether a DEFINE EVENT runs inline with the triggering write or is
2/// dispatched asynchronously, and the retry/nesting budget when async.
3
4#[derive(Clone, Debug, Eq, PartialEq, Hash)]
5#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
6pub enum EventKind {
7	Sync,
8	Async {
9		/// Maximum retry count for async events (0 disables retries; event still runs once).
10		retry: u16,
11		/// Maximum async event nesting depth for this event (0 allows top-level only).
12		max_depth: u16,
13	},
14}
15
16impl EventKind {
17	/// Retry budget applied to `ASYNC` events that do not name one.
18	pub const DEFAULT_RETRY: u16 = 1;
19	/// Nesting budget applied to `ASYNC` events that do not name one.
20	pub const DEFAULT_MAX_DEPTH: u16 = 3;
21}