This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn started(&mut self, ctx: &mut Self::Context) { | |
let address = ctx.state().address; | |
address.send(msg) | |
.into_actor(self) | |
.map_err(|e| println!("error from 1st send: {:?}", e)) | |
.and_then(|result, a, c| { | |
a.foo = result.foo; | |
address.send(msg2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::time::Instant; | |
use std::mem; | |
use crossbeam::channel::Sender; | |
pub enum Sample<T> { | |
Timing(T, Instant, Instant), | |
Count(T, i64) | |
} | |
pub struct ScopedSamples<T>(String, Vec<Sample<T>>); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub trait DirectService<Request> { | |
/// Responses given by the service. | |
type Response; | |
/// Errors produced by servicing a request. | |
type ResponseError; | |
/// Errors produced during attempts to drive the service. | |
type ServiceError; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setsockopt(0x3, 0xFFFF, 0x1022) = 0 0 | |
setsockopt(0x3, 0x0, 0x1B) = 0 0 | |
setsockopt(0x4, 0xFFFF, 0x1022) = 0 0 | |
setsockopt(0x4, 0x0, 0x1B) = 0 0 | |
setsockopt(0x3, 0xFFFF, 0x1022) = 0 0 | |
setsockopt(0x3, 0x0, 0x1B) = -1 Err#22 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.fold(HashMap::new(), move |mut writers, encoded| { | |
let message = bincode::deserialize(&encoded).unwrap(); | |
match message { | |
proto::Message::Start(m) => { | |
let restore_path = pgdata.join(m.path.clone()); | |
let (tx, rx) = mpsc::unbounded(); | |
let fut = OpenOptions::new() | |
.create(true) | |
.write(true) | |
.open(restore_path) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:partymungus_chungus_1_1::partymungus_chungus_1_2::partymungus_chungus_1_3::partymungus_chungus_1_4::partymungus_chungus_1_5: | |
:partymungus_chungus_2_1::partymungus_chungus_2_2::partymungus_chungus_2_3::partymungus_chungus_2_4::partymungus_chungus_2_5: | |
:partymungus_chungus_3_1::partymungus_chungus_3_2::partymungus_chungus_3_3::partymungus_chungus_3_4::partymungus_chungus_3_5: | |
:partymungus_chungus_4_1::partymungus_chungus_4_2::partymungus_chungus_4_3::partymungus_chungus_4_4::partymungus_chungus_4_5: | |
:partymungus_chungus_5_1::partymungus_chungus_5_2::partymungus_chungus_5_3::partymungus_chungus_5_4::partymungus_chungus_5_5: | |
:partymungus_chungus_6_1::partymungus_chungus_6_2::partymungus_chungus_6_3::partymungus_chungus_6_4::partymungus_chungus_6_5: | |
:partymungus_chungus_7_1::partymungus_chungus_7_2::partymungus_chungus_7_3::partymungus_chungus_7_4::partymungus_chungus_7_5: | |
:partymungus_chungus_8_1::partymungus_chungus_8_2::partymungus_chungus_8_3::partymungus_chungus_8_4::partymungus_chungus_8_5: | |
:partymungus_chu |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub trait MetricsRecorder { | |
fn record_counter<K: AsRef<str>>(&mut self, key: K, value: i64); | |
fn record_gauge<K: AsRef<str>>(&mut self, key: K, value: i64); | |
fn record_histogram<K: AsRef<str>>(&mut self, key: K, quantile: f64, value: u64); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let receiver = Receiver::builder().build(); | |
let controller = receiver.get_controller(); | |
let percentiles = [0.0f64, 0.5f64, 0.9f64, 0.95f64, 0.99f64, 0.999f64, 1.0f64]; | |
let formatter = PrometheusFormatter::new(percentiles); | |
let exporter = StdoutExporter::new(controller, formatter); | |
exporter.run() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn build_hyper_server<C, R>(controller: C, recorder: R, address: SocketAddr) -> impl Future<Item = (), Error = ()> | |
where | |
C: AsyncSnapshotProvider + Clone + Send + 'static, | |
C::SnapshotFuture: Send + 'static, | |
C::SnapshotError: Error + Send + Sync + 'static, | |
R: Recorder + Clone + Into<String> + Send + 'static, | |
{ | |
let service = move || { | |
let controller2 = controller.clone(); | |
let recorder2 = recorder.clone(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mpl Bucket { | |
pub fn new() -> Self { | |
Bucket { | |
inner: ArcSwap::new(Arc::new(Vector::new())), | |
} | |
} | |
pub fn record(&self, value: u64) { | |
loop { | |
let original = self.inner.lease(); |