Trait libquery::InTimeInterval [] [src]

pub trait InTimeInterval {
    fn interval(&self) -> (SystemTime, SystemTime);
fn granularity(&self) -> Duration; fn in_time_interval(
        &self,
        start: Option<SystemTime>,
        end: Option<SystemTime>
    ) -> bool { ... } }

A trait to check if the data fall into the queried time interval.

This is expected to be implemented on larger containers of potentially many flows as well as on any flow slices provided by these containers. However, providing the actual interval is enough, as there's the default implementation. Furthermore, slices spanning the whole container might simply return true.

Required Methods

The interval of the data inside.

The tuple is (start, end) and start must not be larger than end.

Provides the granularity of the container.

This specifies in how long slices the container cuts time. Note that this may be different than the time covered by the container (as the container may contain multiple consecutive time slices). Also, even for flow slices, this provides the information about the container, not the duration of the flow.

Provided Methods

Returns if the queried interval is for the data contained.

Note that the queries interval is something like ℝ* ‒ it allows -∞ and ∞ as well.

The slice is considered inside the query interval if it is either fully inside or if it overlaps by at least half of the granularity length (which is something like rounding to whole time slices when considering if it's inside or not). This might act in a seemingly wierd way for very short query intervals, as that would match nothing, but if we have very coarse data, we can't reasonably provide anything better.

Parameters

  • start: Start of the interval, or None if the interval is infinite to the left.
  • end: End of the interval, or None if it is infinite to the right.

Implementors