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§
Source§impl LocalData
impl LocalData
pub fn get_default_file() -> PathBuf
Sourcepub fn initialized(&self) -> bool
pub fn initialized(&self) -> bool
Returns true if the local file exists
Sourcepub fn init(file: &Path, force: bool) -> Result<Self>
pub fn init(file: &Path, force: bool) -> Result<Self>
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.
Sourcepub fn refresh(self) -> Self
pub fn refresh(self) -> Self
Loops through each registry, each network/chain, each endpoint and update the endpoints lists.
Sourcepub fn add_registry(self, registry: Registry) -> Self
pub fn add_registry(self, registry: Registry) -> Self
Add a new registry. Registries are identitfied by their names, make sure the name is unique.
Sourcepub fn get_endpoints(&self, chain: Option<&str>) -> HashSet<Endpoint>
pub fn get_endpoints(&self, chain: Option<&str>) -> HashSet<Endpoint>
Get a list of endpoints matching an optional filter. If not
chain
filter is passed, all endpoints are returned.
Sourcepub fn print_registries(&self)
pub fn print_registries(&self)
Print the list of registries.
See also Self::print_summary.
Sourcepub fn print_summary(&self)
pub fn print_summary(&self)
Print a summary of your local db. It shows more information than Self::print_registries.