Skip to content

Commit 5e308ca

Browse files
committed
Implement Unix Datagram sink
1 parent 2706cc4 commit 5e308ca

File tree

6 files changed

+1028
-395
lines changed

6 files changed

+1028
-395
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "tokio-cadence"
33
description = "Tokio-based metric sinks for Cadence "
4-
version = "0.1.1"
4+
version = "0.2.0"
55
repository = "https://github.com/ecliptical/tokio-cadence"
66
authors = ["Peter Nehrer <pnehrer@eclipticalsoftware.com>"]
77
license = "MIT"

src/builder.rs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//! TODO docs!
2+
3+
use tokio::time::Duration;
4+
5+
use crate::{
6+
DEFAULT_BATCH_BUF_SIZE,
7+
DEFAULT_MAX_BATCH_DELAY,
8+
DEFAULT_QUEUE_CAPACITY,
9+
};
10+
11+
/// TODO docs!
12+
#[derive(Debug)]
13+
pub struct Builder<T, S> {
14+
pub(crate) addr: T,
15+
pub(crate) sock: S,
16+
pub(crate) queue_cap: usize,
17+
pub(crate) buf_size: usize,
18+
pub(crate) max_delay: Duration,
19+
}
20+
21+
impl<T, S> Builder<T, S> {
22+
pub(crate) fn new(addr: T, sock: S) -> Self {
23+
Self {
24+
addr,
25+
sock,
26+
queue_cap: DEFAULT_QUEUE_CAPACITY,
27+
buf_size: DEFAULT_BATCH_BUF_SIZE,
28+
max_delay: DEFAULT_MAX_BATCH_DELAY,
29+
}
30+
}
31+
32+
/// TODO docs!
33+
pub fn queue_cap(&mut self, queue_cap: usize) -> &mut Self {
34+
self.queue_cap = queue_cap;
35+
self
36+
}
37+
38+
/// TODO docs!
39+
pub fn buf_size(&mut self, buf_size: usize) -> &mut Self {
40+
self.buf_size = buf_size;
41+
self
42+
}
43+
44+
/// TODO docs!
45+
pub fn max_delay(&mut self, max_delay: Duration) -> &mut Self {
46+
self.max_delay = max_delay;
47+
self
48+
}
49+
}

0 commit comments

Comments
 (0)