pub struct Options {Show 20 fields
pub(crate) postgres_options: PostgresOptions,
pub(crate) uri: Option<String>,
pub(crate) prune: bool,
pub(crate) pruning: PruningOptions,
pub(crate) consensus_pruning: ConsensusPruningOptions,
pub(crate) fetch_rate_limit: Option<usize>,
pub(crate) active_fetch_delay: Option<Duration>,
pub(crate) chunk_fetch_delay: Option<Duration>,
pub(crate) archive: bool,
pub(crate) lightweight: bool,
pub(crate) idle_connection_timeout: Duration,
pub(crate) connection_timeout: Duration,
pub(crate) slow_statement_threshold: Duration,
pub(crate) statement_timeout: Duration,
pub(crate) min_connections: u32,
pub(crate) query_min_connections: Option<u32>,
pub(crate) max_connections: u32,
pub(crate) query_max_connections: Option<u32>,
pub(crate) types_migration_batch_size: Option<u64>,
pub(crate) pool: Option<Pool<Db>>,
}Expand description
Options for database-backed persistence, supporting both Postgres and SQLite.
Fields§
§postgres_options: PostgresOptions§uri: Option<String>Database URI for Postgres or SQLite.
This is a shorthand for setting a number of other options all at once. The URI has the following format ([brackets] indicate optional segments):
- Postgres:
postgres[ql]://[username[:password]@][host[:port],]/database[?parameter_list] - SQLite:
sqlite://path/to/db.sqlite
Options set explicitly via other env vars or flags will take precedence, so you can use this URI to set a baseline and then use other parameters to override or add configuration. In addition, there are some parameters which cannot be set via the URI, such as TLS.
prune: boolThis will enable the pruner and set the default pruning parameters unless provided. Default parameters:
- pruning_threshold: 3 TB
- minimum_retention: 1 day
- target_retention: 7 days
- batch_size: 1000
- max_usage: 80%
- interval: 1 hour
pruning: PruningOptionsPruning parameters.
consensus_pruning: ConsensusPruningOptionsPruning parameters for ephemeral consensus storage.
fetch_rate_limit: Option<usize>Specifies the maximum number of concurrent fetch requests allowed from peers.
active_fetch_delay: Option<Duration>The minimum delay between active fetches in a stream.
chunk_fetch_delay: Option<Duration>The minimum delay between loading chunks in a stream.
archive: boolDisable pruning and reconstruct previously pruned data.
While running without pruning is the default behavior, the default will not try to reconstruct data that was pruned in a previous run where pruning was enabled. This option instructs the service to run without pruning and reconstruct all previously pruned data by fetching from peers.
lightweight: boolTurns on leaf only data storage
idle_connection_timeout: DurationThe maximum idle time of a database connection.
Any connection which has been open and unused longer than this duration will be automatically closed to reduce load on the server.
connection_timeout: DurationThe maximum lifetime of a database connection.
Any connection which has been open longer than this duration will be automatically closed (and, if needed, replaced), even if it is otherwise healthy. It is good practice to refresh even healthy connections once in a while (e.g. daily) in case of resource leaks in the server implementation.
slow_statement_threshold: Duration§statement_timeout: DurationThe maximum time a single SQL statement is allowed to run before being canceled.
This helps prevent queries from running indefinitely and consuming resources. Set to 10 minutes by default
min_connections: u32The minimum number of database connections to maintain at any time.
The database client will, to the best of its ability, maintain at least min open
connections at all times. This can be used to reduce the latency hit of opening new
connections when at least this many simultaneous connections are frequently needed.
query_min_connections: Option<u32>Allows setting a different maximum number of connections for query operations. Default value of None implies using the min_connections value.
max_connections: u32The maximum number of database connections to maintain at any time.
Once max connections are in use simultaneously, further attempts to acquire a connection
(or begin a transaction) will block until one of the existing connections is released.
query_max_connections: Option<u32>Allows setting a different maximum number of connections for query operations. Default value of None implies using the max_connections value.
types_migration_batch_size: Option<u64>Sets the batch size for the types migration.
Determines how many (leaf, vid) rows are selected from the old types table
and migrated at once.
Default is `10000`` if not set
pool: Option<Pool<Db>>Trait Implementations§
Source§impl Args for Options
impl Args for Options
Source§fn group_id() -> Option<Id>
fn group_id() -> Option<Id>
ArgGroup::id][crate::ArgGroup::id] for this set of argumentsSource§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command] so it can instantiate self via
[FromArgMatches::update_from_arg_matches_mut] Read moreSource§impl DataSourceOptions for Options
impl DataSourceOptions for Options
type DataSource = FetchingDataSource<SeqTypes, SqlStorage, AnyProvider<SeqTypes>>
fn enable_query_module(&self, opt: Options, query: Query) -> Options
Source§impl From<(PostgresOptions, Option<String>, bool, PruningOptions, ConsensusPruningOptions, Option<usize>, Option<Duration>, Option<Duration>, bool, bool, Duration, Duration, Duration, Duration, u32, Option<u32>, u32, Option<u32>, Option<u64>, Option<Pool<Postgres>>)> for Options
impl From<(PostgresOptions, Option<String>, bool, PruningOptions, ConsensusPruningOptions, Option<usize>, Option<Duration>, Option<Duration>, bool, bool, Duration, Duration, Duration, Duration, u32, Option<u32>, u32, Option<u32>, Option<u64>, Option<Pool<Postgres>>)> for Options
Source§fn from(
value: (PostgresOptions, Option<String>, bool, PruningOptions, ConsensusPruningOptions, Option<usize>, Option<Duration>, Option<Duration>, bool, bool, Duration, Duration, Duration, Duration, u32, Option<u32>, u32, Option<u32>, Option<u64>, Option<Pool<Db>>),
) -> Self
fn from( value: (PostgresOptions, Option<String>, bool, PruningOptions, ConsensusPruningOptions, Option<usize>, Option<Duration>, Option<Duration>, bool, bool, Duration, Duration, Duration, Duration, u32, Option<u32>, u32, Option<u32>, Option<u64>, Option<Pool<Db>>), ) -> Self
Source§impl From<Options> for (PostgresOptions, Option<String>, bool, PruningOptions, ConsensusPruningOptions, Option<usize>, Option<Duration>, Option<Duration>, bool, bool, Duration, Duration, Duration, Duration, u32, Option<u32>, u32, Option<u32>, Option<u64>, Option<Pool<Db>>)
impl From<Options> for (PostgresOptions, Option<String>, bool, PruningOptions, ConsensusPruningOptions, Option<usize>, Option<Duration>, Option<Duration>, bool, bool, Duration, Duration, Duration, Duration, u32, Option<u32>, u32, Option<u32>, Option<u64>, Option<Pool<Db>>)
Source§impl From<PostgresOptions> for Options
Available on non-crate feature embedded-db only.
impl From<PostgresOptions> for Options
embedded-db only.Source§fn from(opt: PostgresOptions) -> Self
fn from(opt: PostgresOptions) -> Self
Source§impl FromArgMatches for Options
impl FromArgMatches for Options
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§impl ModuleInfo for Options
impl ModuleInfo for Options
Source§impl Parser for Options
impl Parser for Options
§fn parse_from<I, T>(itr: I) -> Self
fn parse_from<I, T>(itr: I) -> Self
§fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
§fn update_from<I, T>(&mut self, itr: I)
fn update_from<I, T>(&mut self, itr: I)
§fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
Source§impl PersistenceOptions for Options
impl PersistenceOptions for Options
type Persistence = Persistence
fn set_view_retention(&mut self, view_retention: u64)
fn create<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Self::Persistence>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn reset<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
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§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> Conv for T
impl<T> Conv for T
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
§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<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<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 more§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.