Crate libquery [−] [src]
Traits used internally to query the data.
As we have multiple sources of data (in-memory, the journal and the aggregated data, we define several traits to handle them uniformly during the query.
There are two important traits. One is for the containers (note that the in-memory is actually
multiple containers and the files on the disk is one container each), called
Container
. The other is on the bits of data ‒ flow slices ‒ which is
ValueSrc
. They depend on further traits.
The plan of how the filtering is done is as follows:
- Each large container is first checked if it may contain flows in the given interval (so it
must implement
InTimeInterval
. - Then, it is checked if it may contain flows matching the filter. For that it must implement
Container
. Note that some kinds of containers can have a trivial (egreturn MayUse
) implementation. Also, a container might refuse the query because it doesn't contain the right columns even if it may contain the relevant data. - Each container that passes both preliminary checks is turned into an iterator with
into_iter
(from std). - The iterator is iterated through and each item is checked for interval again (because the
flows there might be shorter ‒ but if they span the whole length of the container, simple
return true
is enough) and is queried for relevant columns through theValueSrc
, which are used both for filtering and aggregation. - Each passing item is asked to provide
Stat
through theValueSrc
trait to add to the result.
Modules
query |
Data structures describing a query to the data contained in the keeper. |
Enums
PreFilterResult |
Result of the |
Traits
Container |
A trait to choose which containers are to be examined to find relevant data. |
InTimeInterval |
A trait to check if the data fall into the queried time interval. |
ValueSrc |
A trait to extract values out of flow slices. |