Skip to content
Permalink
Browse files

Per bert's suggestion, remove records_reset

  • Loading branch information...
ry committed Mar 14, 2019
1 parent 64a16bf commit eb0ef5d534b5bb8834318a6671531547e890345c
Showing with 8 additions and 20 deletions.
  1. +6 −5 core/http_bench.rs
  2. +2 −11 core/isolate.rs
  3. +0 −4 src/cli.rs
@@ -58,6 +58,12 @@ impl HttpBench {
shared32[INDEX_END] = 0;
Self { shared32 }
}

#[allow(dead_code)]
fn records_reset(&mut self) {
self.shared32[INDEX_START] = 0;
self.shared32[INDEX_END] = 0;
}
}

fn idx(i: usize, off: usize) -> usize {
@@ -130,11 +136,6 @@ impl Behavior<Record> for HttpBench {
(is_sync, op)
}

fn records_reset(&mut self) {
self.shared32[INDEX_START] = 0;
self.shared32[INDEX_END] = 0;
}

fn records_push(&mut self, record: Record) -> bool {
debug!("push {:?}", record);
let i = self.shared32[INDEX_END] as usize;
@@ -51,9 +51,6 @@ pub trait Behavior<R> {
zero_copy_buf: deno_buf,
) -> (bool, Box<Op<R>>);

/// Clears the shared buffer.
fn records_reset(&mut self);

/// Returns false if not enough room.
fn records_push(&mut self, record: R) -> bool;

@@ -117,7 +114,7 @@ impl<R, B: Behavior<R>> Isolate<R, B> {

let req_record = isolate.behavior.records_shift().unwrap();

isolate.behavior.records_reset();
// TODO assert shared buffer is empty.

let (is_sync, op) = isolate.behavior.dispatch(req_record, zero_copy_buf);
if is_sync {
@@ -323,7 +320,7 @@ impl<R, B: Behavior<R>> Future for Isolate<R, B> {

self.polled_recently = true;

self.behavior.records_reset();
// TODO assert shared buffer is empty.

let mut i = 0;
while i != self.pending_ops.len() {
@@ -383,7 +380,6 @@ mod tests {
resolve_count: usize,
push_count: usize,
shift_count: usize,
reset_count: usize,
mod_map: HashMap<String, deno_mod>,
}

@@ -394,7 +390,6 @@ mod tests {
resolve_count: 0,
push_count: 0,
shift_count: 0,
reset_count: 0,
mod_map: HashMap::new(),
}
}
@@ -430,10 +425,6 @@ mod tests {
}
}

fn records_reset(&mut self) {
self.reset_count += 1;
}

fn records_push(&mut self, _record: ()) -> bool {
self.push_count += 1;
true
@@ -120,10 +120,6 @@ impl Behavior<Buf> for Cli {
ops::dispatch(self, control, zero_copy)
}

fn records_reset(&mut self) {
// No-op.
}

fn records_push(&mut self, record: Buf) -> bool {
let maybe_msg = self.tx.compose(record.len());
if let Some(mut msg) = maybe_msg {

0 comments on commit eb0ef5d

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.