Struct libflow::update::Update [] [src]

pub struct Update {
    pub keys: Vec<Key>,
    pub status: Status,
    pub tags: Tags,
    pub stats: Option<SizeStats>,
}

An update to one flow.

This is just a structure holding the data together (eg. it doesn't provide any kind of encapsulation).

Examples

#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct Id(pub String);
impl Type for Id { fn name() -> String { "test-flow-id".to_owned() } }

// We just discovered the flow is TCP
let mut tags = Tags::new();
tags.insert(IpProto::Tcp);

let update = Update {
    keys: vec![
        // Unfortunately, we know only our internal ID as the flow key
        Key::Simple(Value::from(Id("The Id".to_owned()))),
        // If we knew more keys, they go here
    ],
    status: Status::Ongoing,
    tags,
    // We know nothing about how much data goes there.
    stats: None,
};

Fields

The keys of the flow this updates.

In general, the source should provide as many keys as it can. If this is the first update from the given source, it should contain the Key::FlowTuple variant so it can be paired with any other source.

The (new) status of the flow.

This influences what happens to it during the processing.

New tags to add to the flow.

Adds these tags to the flow, or replaces them if they already exist. It is a logical error to change any value that is part of any key.

Newest snapshot of statistics.

This is expected to be cumulative (eg. from the start of the flow), the recipient is expected to keep track of when additions happened.

Trait Implementations

impl Debug for Update
[src]

Formats the value using the given formatter.

impl Eq for Update
[src]

impl PartialEq for Update
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.