Struct subrpc_core::LocalData

source ·
pub struct LocalData {
    pub file: PathBuf,
    pub registries: HashMap<String, Registry>,
    pub last_update: Option<DateTime<Local>>,
}
Expand description

Local user data collected from the various regitries.

It contains the list of registries. Some may be disabled. The data for each registry can be updated in order to keep a fresh list of endpoints.

Fields§

§file: PathBuf

File where the local data are stored

§registries: HashMap<String, Registry>

List of the registries where the RPC endpoints are pulled from

§last_update: Option<DateTime<Local>>

DateTime of the last update of the data

Implementations§

Returns true if the local file exists

Initialize a DB based on a given file. After initializing a DB, you should ensure it contains at least one registry and call the Self::refresh function.

Load LocalData and deserialize data from file.

Loops through each registry, each network/chain, each endpoint and update the endpoints lists.

Add a new registry. Registries are identitfied by their names, make sure the name is unique.

Save the current state to file

Get a list of endpoints matching an optional filter. If not chain filter is passed, all endpoints are returned.

Print the list of registries.

See also Self::print_summary.

Print a summary of your local db. It shows more information than Self::print_registries.

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more