pub struct QueryParams {
pub ts_start: Option<String>,
pub ts_end: Option<String>,
pub collector_id: Option<String>,
pub project: Option<String>,
pub data_type: Option<String>,
pub page: i64,
pub page_size: i64,
pub peers_ip: Option<IpAddr>,
pub peers_asn: Option<u32>,
pub peers_only_full_feed: bool,
}Expand description
QueryParams represents the query parameters to the backend API.
Example for constructing a QueryParams:
use bgpkit_broker::QueryParams;
let mut params = QueryParams::new();
params = params.ts_start("1633046400");
params = params.ts_end("1633132800");
params = params.collector_id("rrc00");
params = params.project("riperis");
params = params.data_type("rib");
params = params.page(2);
params = params.page_size(20);The above example constructs a query that searches for BGP archive files that are:
- after 2021-10-01T00:00:00 UTC
- before 2021-10-02T00:00:00 UTC
- from collector
rrc00 - from
riperiscollectors (already implied by collector=rrc00though) - rib table dump files
- second page
- each page contains 20 items
Fields§
§ts_start: Option<String>start unix timestamp: files with time after or equals to ts_start will match
ts_end: Option<String>end unix timestamp: files with time before or equals to ts_end will match
collector_id: Option<String>collector identifier, e.g. rrc00 or route-views2
project: Option<String>archive project name: riperis or routeviews
data_type: Option<String>archive data type: rib or updates
page: i64page number to seek to, starting from 1, default to 1
page_size: i64number of items each page contains, default to 10, max to 100000
peers_ip: Option<IpAddr>collector peer IP address (for listing peers info)
peers_asn: Option<u32>collector peer ASN (for listing peers info)
peers_only_full_feed: boolcollector peer full feed status (for listing peers info)
Implementations§
Source§impl QueryParams
impl QueryParams
pub fn new() -> QueryParams
Sourcepub fn ts_start(self, ts_start: &str) -> Self
pub fn ts_start(self, ts_start: &str) -> Self
set starting timestamp for the search and returns a new QueryParams object.
use bgpkit_broker::QueryParams;
let mut params = QueryParams::new();
params = params.ts_start("1633046400");Sourcepub fn ts_end(self, ts_end: &str) -> Self
pub fn ts_end(self, ts_end: &str) -> Self
set ending timestamp for the search and returns a new QueryParams object.
use bgpkit_broker::QueryParams;
let mut params = QueryParams::new();
params = params.ts_end("1633046400");Sourcepub fn page(self, page: i64) -> Self
pub fn page(self, page: i64) -> Self
set page number for the each for pagination. the page number starts from 1.
use bgpkit_broker::QueryParams;
let mut params = QueryParams::new();
params = params.page(3);Sourcepub fn page_size(self, page_size: i64) -> Self
pub fn page_size(self, page_size: i64) -> Self
set each page’s size (number of items per page).
use bgpkit_broker::QueryParams;
let mut params = QueryParams::new();
params = params.page_size(20);Sourcepub fn data_type(self, data_type: &str) -> Self
pub fn data_type(self, data_type: &str) -> Self
set the type of data to search for:
rib: table dump filesupdates: BGP updates files
Without specifying a data type, it defaults to search for all types.
use bgpkit_broker::QueryParams;
let mut params = QueryParams::new();
params = params.data_type("rib");Sourcepub fn project(self, project: &str) -> Self
pub fn project(self, project: &str) -> Self
set searching for only data from specific project:
routeviews: RouteViewsriperis: RIPE RIS
use bgpkit_broker::QueryParams;
let mut params = QueryParams::new();
params = params.project("routeviews");Sourcepub fn collector_id(self, collector_id: &str) -> Self
pub fn collector_id(self, collector_id: &str) -> Self
set searching for only data from specific collector,
examples: rrc00, route-views2
use bgpkit_broker::QueryParams;
let mut params = QueryParams::new();
params = params.collector_id("rrc00");Trait Implementations§
Source§impl Clone for QueryParams
impl Clone for QueryParams
Source§fn clone(&self) -> QueryParams
fn clone(&self) -> QueryParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for QueryParams
impl Debug for QueryParams
Source§impl Default for QueryParams
Default QueryParams values
impl Default for QueryParams
Default QueryParams values