QueryParams

Struct QueryParams 

Source
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 riperis collectors (already implied by collector=rrc00 though)
  • 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: i64

page number to seek to, starting from 1, default to 1

§page_size: i64

number 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: bool

collector peer full feed status (for listing peers info)

Implementations§

Source§

impl QueryParams

Source

pub fn new() -> QueryParams

Source

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");
Source

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");
Source

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);
Source

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);
Source

pub fn data_type(self, data_type: &str) -> Self

set the type of data to search for:

  • rib: table dump files
  • updates: 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");
Source

pub fn project(self, project: &str) -> Self

set searching for only data from specific project:

  • routeviews: RouteViews
  • riperis: RIPE RIS
use bgpkit_broker::QueryParams;
let mut params = QueryParams::new();
params = params.project("routeviews");
Source

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

Source§

fn clone(&self) -> QueryParams

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for QueryParams

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for QueryParams

Default QueryParams values

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for QueryParams

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for QueryParams

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Serialize for QueryParams

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,