eventio/
fluentd.rs

1//! A partial implementation of [Fluentd Forward Protocol].
2//!
3//! [Fluentd Forward Protocol]:
4//! https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1
5
6use serde::{Deserialize, Serialize};
7use serde_bytes::ByteBuf;
8use std::collections::HashMap;
9
10/// An array representation of pairs of time and record, used in Forward mode.
11///
12/// See [Entry] in the protocol specification.
13///
14/// [Entry]:
15/// https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1#entry
16#[derive(Debug, Deserialize, Serialize)]
17pub struct Entry {
18    pub time: u64,
19    pub record: HashMap<String, ByteBuf>,
20}
21
22/// A series of events packed into a single message.
23///
24/// See [Forward Mode] in the protocol specification.
25///
26/// [Forward Mode]:
27/// https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1#forward-mode
28#[derive(Debug, Deserialize, Serialize)]
29pub struct ForwardMode {
30    pub tag: String,
31    pub entries: Vec<Entry>,
32    pub option: Option<HashMap<String, String>>,
33}