pub struct Options {Show 32 fields
pub embedded_db: bool,
pub(crate) postgres_options: PostgresOptions,
pub(crate) sqlite_options: SqliteOptions,
pub(crate) uri: Option<String>,
pub(crate) prune: bool,
pub(crate) pruning: PruningOptions,
pub(crate) consensus_pruning: ConsensusPruningOptions,
pub(crate) serializable_retry: SerializableRetryOptions,
pub(crate) fetch_rate_limit: Option<usize>,
pub(crate) active_fetch_delay: Option<Duration>,
pub(crate) chunk_fetch_delay: Option<Duration>,
pub(crate) ranges_concurrency: Option<NonZeroUsize>,
pub(crate) sync_status_chunk_size: Option<usize>,
pub(crate) sync_status_ttl: Option<Duration>,
pub(crate) proactive_scan_chunk_size: Option<usize>,
pub(crate) proactive_scan_interval: Option<Duration>,
pub(crate) proactive_fetch_timeout: Option<Duration>,
pub(crate) disable_proactive_fetching: bool,
pub(crate) archive: bool,
pub(crate) archive_state_min_retention: u64,
pub(crate) archive_full_state: 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) pool: Option<SqlPool>,
pub(crate) consensus_only: bool,
}Expand description
Options for database-backed persistence, supporting both Postgres and SQLite.
Fields§
§embedded_db: boolStore data in an embedded SQLite database instead of Postgres.
The database lives under ESPRESSO_NODE_STORAGE_PATH, and the Postgres options are ignored.
postgres_options: PostgresOptions§sqlite_options: SqliteOptions§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: 100
- max_usage: 80%
- interval: 1 hour
A pruned node with no merklized state starts it from a recent epoch boundary. Its trees then
lack block proofs below that boundary, and fee accounts that no block after it touched. They
stay incomplete after a switch to --archive: complete trees need a replay from genesis,
which runs only on a database with no merklized state.
A pruned node keeps no transaction or payload totals, which count from genesis: it does not run the aggregator, and the routes that serve the totals return 404.
pruning: PruningOptionsPruning parameters.
consensus_pruning: ConsensusPruningOptionsPruning parameters for ephemeral consensus storage.
serializable_retry: SerializableRetryOptionsRetry/backoff parameters for PostgreSQL serialization conflicts.
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.
ranges_concurrency: Option<NonZeroUsize>How many of a request’s height ranges to serve at once.
sync_status_chunk_size: Option<usize>The number of items to process in a single transaction when scanning the database for missing objects.
sync_status_ttl: Option<Duration>Duration to cache sync status results for.
proactive_scan_chunk_size: Option<usize>The number of items to process at a time when scanning for proactive fetching.
proactive_scan_interval: Option<Duration>The time interval between proactive fetching scans.
proactive_fetch_timeout: Option<Duration>How long a proactive scan waits for one request of missing ranges before fetching its chunks one at a time instead.
disable_proactive_fetching: boolDisable the proactive scanner task.
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.
Historical merklized state older than the light client contract history is garbage collected, but never less than ESPRESSO_NODE_ARCHIVE_STATE_MIN_RETENTION heights behind the head. Use ESPRESSO_NODE_ARCHIVE_FULL_STATE to retain all of it.
archive_state_min_retention: u64Block heights of merklized state an archive node retains regardless of the light client.
Collection stops at whichever reaches further back, this floor or the light client contract’s history. Set it to zero to follow the contract alone.
archive_full_state: boolRetain all historical merklized state on an archive node.
Disables the state garbage collector that archive nodes run by default.
lightweight: boolTurns on leaf only data storage
A lightweight node keeps no transaction or payload totals: it does not run the aggregator, and the routes that serve the totals return 404.
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. Postgres only.
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. Postgres only.
pool: Option<SqlPool>§consensus_only: boolImplementations§
Source§impl Options
impl Options
Sourcepub fn into_backend(self) -> SqlBackendOptions
pub fn into_backend(self) -> SqlBackendOptions
These options for the backend embedded_db selects.
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 From<&Options> for SqlStorageConfig
impl From<&Options> for SqlStorageConfig
Source§impl From<PostgresOptions> for Options
impl From<PostgresOptions> for Options
Source§fn from(opt: PostgresOptions) -> Self
fn from(opt: PostgresOptions) -> Self
Source§impl From<SqliteOptions> for Options
impl From<SqliteOptions> for Options
Source§fn from(opt: SqliteOptions) -> Self
fn from(opt: SqliteOptions) -> 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>
Auto Trait Implementations§
impl !RefUnwindSafe for Options
impl !UnwindSafe for Options
impl Freeze for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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<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> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Requestimpl<T> JsonSchemaMaybe for T
§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§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> Read<Exclusive, BecauseExclusive> 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.