pub struct MetadataQuery {
pub status: Option<NodeStatus>,
pub statuses: Option<Vec<NodeStatus>>,
pub continent: Option<String>,
pub region: Option<Region>,
pub min_tier: Option<NetworkTier>,
pub tags: Option<Vec<String>>,
pub roles: Option<Vec<String>>,
pub owner: Option<String>,
pub max_age: Option<Duration>,
pub accepts_work: Option<bool>,
pub can_relay: Option<bool>,
pub limit: Option<usize>,
}Expand description
Query filter for metadata store
Fields§
§status: Option<NodeStatus>Filter by status
statuses: Option<Vec<NodeStatus>>Filter by statuses (any match)
continent: Option<String>Filter by region continent
region: Option<Region>Filter by region
min_tier: Option<NetworkTier>Filter by minimum tier
Filter by tag (all must match)
roles: Option<Vec<String>>Filter by role (all must match)
owner: Option<String>Filter by owner
max_age: Option<Duration>Maximum age since last update
accepts_work: Option<bool>Must accept new work
can_relay: Option<bool>Must be able to relay
limit: Option<usize>Maximum results
Implementations§
Source§impl MetadataQuery
impl MetadataQuery
Sourcepub fn with_status(self, status: NodeStatus) -> Self
pub fn with_status(self, status: NodeStatus) -> Self
Filter by status
Sourcepub fn with_statuses(self, statuses: Vec<NodeStatus>) -> Self
pub fn with_statuses(self, statuses: Vec<NodeStatus>) -> Self
Filter by multiple statuses
Sourcepub fn with_continent(self, continent: impl Into<String>) -> Self
pub fn with_continent(self, continent: impl Into<String>) -> Self
Filter by continent
Sourcepub fn with_region(self, region: Region) -> Self
pub fn with_region(self, region: Region) -> Self
Filter by region
Sourcepub fn with_min_tier(self, tier: NetworkTier) -> Self
pub fn with_min_tier(self, tier: NetworkTier) -> Self
Filter by minimum tier
Filter by tags
Sourcepub fn with_roles(self, roles: Vec<String>) -> Self
pub fn with_roles(self, roles: Vec<String>) -> Self
Filter by roles
Sourcepub fn with_owner(self, owner: impl Into<String>) -> Self
pub fn with_owner(self, owner: impl Into<String>) -> Self
Filter by owner
Sourcepub fn with_max_age(self, max_age: Duration) -> Self
pub fn with_max_age(self, max_age: Duration) -> Self
Filter by max age
Sourcepub fn accepting_work(self) -> Self
pub fn accepting_work(self) -> Self
Filter nodes that accept work
Sourcepub fn with_limit(self, limit: usize) -> Self
pub fn with_limit(self, limit: usize) -> Self
Limit results
Sourcepub fn matches(&self, meta: &NodeMetadata) -> bool
pub fn matches(&self, meta: &NodeMetadata) -> bool
Check if metadata matches query
Trait Implementations§
Source§impl Clone for MetadataQuery
impl Clone for MetadataQuery
Source§fn clone(&self) -> MetadataQuery
fn clone(&self) -> MetadataQuery
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MetadataQuery
impl Debug for MetadataQuery
Source§impl Default for MetadataQuery
impl Default for MetadataQuery
Source§fn default() -> MetadataQuery
fn default() -> MetadataQuery
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MetadataQuery
impl RefUnwindSafe for MetadataQuery
impl Send for MetadataQuery
impl Sync for MetadataQuery
impl Unpin for MetadataQuery
impl UnsafeUnpin for MetadataQuery
impl UnwindSafe for MetadataQuery
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
Mutably borrows from an owned value. Read more