pub struct Options {Show 14 fields
pub auth: Arc<Auth>,
pub auth_enabled: bool,
pub live: bool,
pub force: bool,
pub perms: bool,
pub strict: bool,
pub fields: bool,
pub events: bool,
pub tables: bool,
pub indexes: bool,
pub futures: bool,
pub projections: bool,
pub sender: Option<Sender<Notification>>,
pub capabilities: Arc<Capabilities>,
/* private fields */
}
Expand description
An Options is passed around when processing a set of query statements. An Options contains specific information for how to process each particular statement, including the record version to retrieve, whether futures should be processed, and whether field/event/table queries should be processed (useful when importing data, where these queries might fail).
Fields§
§auth: Arc<Auth>
Connection authentication data
auth_enabled: bool
Is authentication enabled?
live: bool
Whether live queries are allowed?
force: bool
Should we force tables/events to re-run?
perms: bool
Should we run permissions checks?
strict: bool
Should we error if tables don’t exist?
fields: bool
Should we process field queries?
events: bool
Should we process event queries?
tables: bool
Should we process table queries?
indexes: bool
Should we process index queries?
futures: bool
Should we process function futures?
projections: bool
Should we process variable field projections?
sender: Option<Sender<Notification>>
The channel over which we send notifications
capabilities: Arc<Capabilities>
Datastore capabilities
Implementations§
Source§impl Options
impl Options
Sourcepub fn set_ns(&mut self, ns: Option<Arc<str>>)
pub fn set_ns(&mut self, ns: Option<Arc<str>>)
Specify which Namespace should be used for
code which uses this Options
object.
Sourcepub fn set_db(&mut self, db: Option<Arc<str>>)
pub fn set_db(&mut self, db: Option<Arc<str>>)
Specify which Database should be used for
code which uses this Options
object.
Sourcepub fn with_required(
self,
node_id: Uuid,
ns: Option<Arc<str>>,
db: Option<Arc<str>>,
auth: Arc<Auth>,
) -> Self
pub fn with_required( self, node_id: Uuid, ns: Option<Arc<str>>, db: Option<Arc<str>>, auth: Arc<Auth>, ) -> Self
Set all the required options from a single point. The system expects these values to always be set, so this should be called for all instances when there is doubt.
Sourcepub fn with_id(self, id: Uuid) -> Self
pub fn with_id(self, id: Uuid) -> Self
Set the Node ID for subsequent code which uses
this Options
, with support for chaining.
Sourcepub fn with_ns(self, ns: Option<Arc<str>>) -> Self
pub fn with_ns(self, ns: Option<Arc<str>>) -> Self
Specify which Namespace should be used for code which
uses this Options
, with support for chaining.
Sourcepub fn with_db(self, db: Option<Arc<str>>) -> Self
pub fn with_db(self, db: Option<Arc<str>>) -> Self
Specify which Database should be used for code which
uses this Options
, with support for chaining.
Sourcepub fn with_auth(self, auth: Arc<Auth>) -> Self
pub fn with_auth(self, auth: Arc<Auth>) -> Self
Specify the authentication options for subsequent
code which uses this Options
, with chaining.
Sourcepub fn with_live(self, live: bool) -> Self
pub fn with_live(self, live: bool) -> Self
Specify whether live queries are supported for
code which uses this Options
, with chaining.
Sourcepub fn with_perms(self, perms: bool) -> Self
pub fn with_perms(self, perms: bool) -> Self
Specify whether permissions should be run for
code which uses this Options
, with chaining.
Sourcepub fn with_force(self, force: bool) -> Self
pub fn with_force(self, force: bool) -> Self
Sourcepub fn with_strict(self, strict: bool) -> Self
pub fn with_strict(self, strict: bool) -> Self
Sourcepub fn with_fields(self, fields: bool) -> Self
pub fn with_fields(self, fields: bool) -> Self
Sourcepub fn with_events(self, events: bool) -> Self
pub fn with_events(self, events: bool) -> Self
Sourcepub fn with_tables(self, tables: bool) -> Self
pub fn with_tables(self, tables: bool) -> Self
Sourcepub fn with_indexes(self, indexes: bool) -> Self
pub fn with_indexes(self, indexes: bool) -> Self
Sourcepub fn with_futures(self, futures: bool) -> Self
pub fn with_futures(self, futures: bool) -> Self
Sourcepub fn with_projections(self, projections: bool) -> Self
pub fn with_projections(self, projections: bool) -> Self
Sourcepub fn with_import(self, import: bool) -> Self
pub fn with_import(self, import: bool) -> Self
Create a new Options object for a subquery
Sourcepub fn with_auth_enabled(self, auth_enabled: bool) -> Self
pub fn with_auth_enabled(self, auth_enabled: bool) -> Self
Create a new Options object with auth enabled
Sourcepub fn with_capabilities(self, capabilities: Arc<Capabilities>) -> Self
pub fn with_capabilities(self, capabilities: Arc<Capabilities>) -> Self
Create a new Options object with the given Capabilities
Sourcepub fn new_with_perms(&self, perms: bool) -> Self
pub fn new_with_perms(&self, perms: bool) -> Self
Create a new Options object for a subquery
Sourcepub fn new_with_force(&self, force: bool) -> Self
pub fn new_with_force(&self, force: bool) -> Self
Create a new Options object for a subquery
Sourcepub fn new_with_strict(&self, strict: bool) -> Self
pub fn new_with_strict(&self, strict: bool) -> Self
Create a new Options object for a subquery
Sourcepub fn new_with_fields(&self, fields: bool) -> Self
pub fn new_with_fields(&self, fields: bool) -> Self
Create a new Options object for a subquery
Sourcepub fn new_with_events(&self, events: bool) -> Self
pub fn new_with_events(&self, events: bool) -> Self
Create a new Options object for a subquery
Sourcepub fn new_with_tables(&self, tables: bool) -> Self
pub fn new_with_tables(&self, tables: bool) -> Self
Create a new Options object for a subquery
Sourcepub fn new_with_indexes(&self, indexes: bool) -> Self
pub fn new_with_indexes(&self, indexes: bool) -> Self
Create a new Options object for a subquery
Sourcepub fn new_with_futures(&self, futures: bool) -> Self
pub fn new_with_futures(&self, futures: bool) -> Self
Create a new Options object for a subquery
Sourcepub fn new_with_projections(&self, projections: bool) -> Self
pub fn new_with_projections(&self, projections: bool) -> Self
Create a new Options object for a subquery
Sourcepub fn new_with_import(&self, import: bool) -> Self
pub fn new_with_import(&self, import: bool) -> Self
Create a new Options object for a subquery
Sourcepub fn new_with_sender(&self, sender: Sender<Notification>) -> Self
pub fn new_with_sender(&self, sender: Sender<Notification>) -> Self
Create a new Options object for a subquery
pub fn selected_base(&self) -> Result<Base, Error>
Sourcepub fn dive(&self, cost: u8) -> Result<Self, Error>
pub fn dive(&self, cost: u8) -> Result<Self, Error>
Create a new Options object for a function/subquery/future/etc.
The parameter is the approximate cost of the operation (more concretely, the size of the stack frame it uses relative to a simple function call). When in doubt, use a value of 1.
Sourcepub fn realtime(&self) -> Result<(), Error>
pub fn realtime(&self) -> Result<(), Error>
Check whether this request supports realtime queries
pub fn valid_for_ns(&self) -> Result<(), Error>
pub fn valid_for_db(&self) -> Result<(), Error>
Sourcepub fn is_allowed(
&self,
action: Action,
res: ResourceKind,
base: &Base,
) -> Result<(), Error>
pub fn is_allowed( &self, action: Action, res: ResourceKind, base: &Base, ) -> Result<(), Error>
Check if the current auth is allowed to perform an action on a given resource
Sourcepub fn check_perms(&self, action: Action) -> bool
pub fn check_perms(&self, action: Action) -> bool
Whether or not to check table permissions
TODO: This method is called a lot during data operations, so we decided to bypass the system’s authorization mechanism. This is a temporary solution, until we optimize the new authorization system.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Options
impl RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnwindSafe for Options
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,
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 more