pub struct Vars {Show 20 fields
application_name: SessionVar<str>,
client_encoding: ServerVar<str>,
client_min_messages: SessionVar<ClientSeverity>,
cluster: SessionVar<str>,
cluster_replica: SessionVar<Option<String>>,
database: SessionVar<str>,
date_style: ServerVar<str>,
extra_float_digits: SessionVar<i32>,
failpoints: ServerVar<str>,
integer_datetimes: ServerVar<bool>,
interval_style: ServerVar<str>,
qgm_optimizations: SessionVar<bool>,
search_path: SessionVar<[String]>,
server_version: ServerVar<str>,
server_version_num: ServerVar<i32>,
sql_safe_updates: SessionVar<bool>,
standard_conforming_strings: ServerVar<bool>,
statement_timeout: SessionVar<Duration>,
timezone: SessionVar<TimeZone>,
transaction_isolation: ServerVar<str>,
}
Expand description
Session variables.
Materialize roughly follows the PostgreSQL configuration model, which works
as follows. There is a global set of named configuration parameters, like
DateStyle
and client_encoding
. These parameters can be set in several
places: in an on-disk configuration file (in Postgres, named
postgresql.conf), in command line arguments when the server is started, or
at runtime via the ALTER SYSTEM
or SET
statements. Parameters that are
set in a session take precedence over database defaults, which in turn take
precedence over command line arguments, which in turn take precedence over
settings in the on-disk configuration. Note that changing the value of
parameters obeys transaction semantics: if a transaction fails to commit,
any parameters that were changed in that transaction (i.e., via SET
)
will be rolled back to their previous value.
The Materialize configuration hierarchy at the moment is much simpler. Global defaults are hardcoded into the binary, and a select few parameters can be overridden per session. The infrastructure has been designed with an eye towards supporting additional layers to the hierarchy, however, should the need arise.
The configuration parameters that exist are driven by compatibility with PostgreSQL drivers that expect them, not because they are particularly important.
Fields
application_name: SessionVar<str>
client_encoding: ServerVar<str>
client_min_messages: SessionVar<ClientSeverity>
cluster: SessionVar<str>
cluster_replica: SessionVar<Option<String>>
database: SessionVar<str>
date_style: ServerVar<str>
extra_float_digits: SessionVar<i32>
failpoints: ServerVar<str>
integer_datetimes: ServerVar<bool>
interval_style: ServerVar<str>
qgm_optimizations: SessionVar<bool>
search_path: SessionVar<[String]>
server_version: ServerVar<str>
server_version_num: ServerVar<i32>
sql_safe_updates: SessionVar<bool>
standard_conforming_strings: ServerVar<bool>
statement_timeout: SessionVar<Duration>
timezone: SessionVar<TimeZone>
transaction_isolation: ServerVar<str>
Implementations
sourceimpl Vars
impl Vars
sourcepub fn iter(&self) -> impl Iterator<Item = &dyn Var>
pub fn iter(&self) -> impl Iterator<Item = &dyn Var>
Returns an iterator over the configuration parameters and their current values for this session.
sourcepub fn notify_set(&self) -> impl Iterator<Item = &dyn Var>
pub fn notify_set(&self) -> impl Iterator<Item = &dyn Var>
Returns an iterator over configuration parameters (and their current values for this session) that are expected to be sent to the client when a new connection is established or when their value changes.
sourcepub fn get(&self, name: &str) -> Result<&dyn Var, CoordError>
pub fn get(&self, name: &str) -> Result<&dyn Var, CoordError>
Returns a Var
representing the configuration parameter with the
specified name.
Configuration parameters are matched case insensitively. If no such
configuration parameter exists, get
returns an error.
Note that if name
is known at compile time, you should instead use the
named accessor to access the variable with its true Rust type. For
example, self.get("sql_safe_updates").value()
returns the string
"true"
or "false"
, while self.sql_safe_updates()
returns a bool.
sourcepub fn set(
&mut self,
name: &str,
value: &str,
local: bool
) -> Result<(), CoordError>
pub fn set(
&mut self,
name: &str,
value: &str,
local: bool
) -> Result<(), CoordError>
Sets the configuration parameter named name
to the value represented
by value
.
The new value may be either committed or rolled back by the next call to
Vars::end_transaction
. If local
is true, the new value is always
discarded by the next call to Vars::end_transaction
, even if the
transaction is marked to commit.
Like with Vars::get
, configuration parameters are matched case
insensitively. If value
is not valid, as determined by the underlying
configuration parameter, or if the named configuration parameter does
not exist, an error is returned.
sourcepub fn reset(&mut self, name: &str, local: bool) -> Result<(), CoordError>
pub fn reset(&mut self, name: &str, local: bool) -> Result<(), CoordError>
Sets the configuration parameter named name
to its default value.
The new value may be either committed or rolled back by the next call to
Vars::end_transaction
. If local
is true, the new value is always
discarded by the next call to Vars::end_transaction
, even if the
transaction is marked to commit.
Like with Vars::get
, configuration parameters are matched case
insensitively. If the named configuration parameter does not exist, an
error is returned.
sourcepub fn end_transaction(&mut self, action: EndTransactionAction)
pub fn end_transaction(&mut self, action: EndTransactionAction)
Commits or rolls back configuration parameter updates made via
Vars::set
since the last call to end_transaction
.
sourcepub fn application_name(&self) -> &str
pub fn application_name(&self) -> &str
Returns the value of the application_name
configuration parameter.
sourcepub fn client_encoding(&self) -> &'static str
pub fn client_encoding(&self) -> &'static str
Returns the value of the client_encoding
configuration parameter.
sourcepub fn client_min_messages(&self) -> &ClientSeverity
pub fn client_min_messages(&self) -> &ClientSeverity
Returns the value of the client_min_messages
configuration parameter.
sourcepub fn cluster_replica(&self) -> Option<&str>
pub fn cluster_replica(&self) -> Option<&str>
Returns the value of the cluster_replica
configuration parameter.
sourcepub fn date_style(&self) -> &'static str
pub fn date_style(&self) -> &'static str
Returns the value of the DateStyle
configuration parameter.
sourcepub fn extra_float_digits(&self) -> i32
pub fn extra_float_digits(&self) -> i32
Returns the value of the extra_float_digits
configuration parameter.
sourcepub fn integer_datetimes(&self) -> bool
pub fn integer_datetimes(&self) -> bool
Returns the value of the integer_datetimes
configuration parameter.
sourcepub fn intervalstyle(&self) -> &'static str
pub fn intervalstyle(&self) -> &'static str
Returns the value of the intervalstyle
configuration parameter.
sourcepub fn qgm_optimizations(&self) -> bool
pub fn qgm_optimizations(&self) -> bool
Returns the value of the qgm_optimizations
configuration parameter.
sourcepub fn search_path(&self) -> Vec<&str>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn search_path(&self) -> Vec<&str>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Returns the value of the search_path
configuration parameter.
sourcepub fn server_version(&self) -> &'static str
pub fn server_version(&self) -> &'static str
Returns the value of the server_version
configuration parameter.
sourcepub fn server_version_num(&self) -> i32
pub fn server_version_num(&self) -> i32
Returns the value of the server_version_num
configuration parameter.
sourcepub fn sql_safe_updates(&self) -> bool
pub fn sql_safe_updates(&self) -> bool
Returns the value of the sql_safe_updates
configuration parameter.
sourcepub fn standard_conforming_strings(&self) -> bool
pub fn standard_conforming_strings(&self) -> bool
Returns the value of the standard_conforming_strings
configuration
parameter.
sourcepub fn statement_timeout(&self) -> &Duration
pub fn statement_timeout(&self) -> &Duration
Returns the value of the statement_timeout
configuration parameter.
sourcepub fn transaction_isolation(&self) -> &'static str
pub fn transaction_isolation(&self) -> &'static str
Returns the value of the transaction_isolation
configuration
parameter.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Vars
impl Send for Vars
impl Sync for Vars
impl Unpin for Vars
impl UnwindSafe for Vars
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FutureExt for T
impl<T> FutureExt for T
sourcefn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
sourcefn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T
in a tonic::Request
sourceimpl<P, R> ProtoType<R> for P where
R: RustType<P>,
impl<P, R> ProtoType<R> for P where
R: RustType<P>,
sourcefn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
See RustType::from_proto
.
sourcefn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
See RustType::into_proto
.
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more