Skip to content

Commit

Permalink
More dead_code
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Cattermole <[email protected]>
  • Loading branch information
adam-cattermole committed Oct 4, 2024
1 parent c901347 commit c108005
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
19 changes: 0 additions & 19 deletions src/operation_dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ use std::collections::HashMap;
use std::rc::Rc;
use std::time::Duration;

#[allow(dead_code)]
#[derive(PartialEq, Debug, Clone, Copy)]
pub(crate) enum State {
Pending,
Waiting,
Done,
}

#[allow(dead_code)]
impl State {
fn next(&mut self) {
match self {
Expand All @@ -33,7 +31,6 @@ impl State {
}
}

#[allow(dead_code)]
#[derive(Clone)]
pub(crate) struct Operation {
state: RefCell<State>,
Expand All @@ -46,7 +43,6 @@ pub(crate) struct Operation {
grpc_message_build_fn: GrpcMessageBuildFn,
}

#[allow(dead_code)]
impl Operation {
pub fn new(extension: Rc<Extension>, action: Action, service: Rc<GrpcServiceHandler>) -> Self {
Self {
Expand Down Expand Up @@ -105,22 +101,13 @@ impl Operation {
}
}

#[allow(dead_code)]
pub struct OperationDispatcher {
operations: Vec<Rc<Operation>>,
waiting_operations: HashMap<u32, Rc<Operation>>,
service_handlers: HashMap<String, Rc<GrpcServiceHandler>>,
}

#[allow(dead_code)]
impl OperationDispatcher {
pub fn default() -> Self {
OperationDispatcher {
operations: vec![],
waiting_operations: HashMap::default(),
service_handlers: HashMap::default(),
}
}
pub fn new(service_handlers: HashMap<String, Rc<GrpcServiceHandler>>) -> Self {
Self {
service_handlers,
Expand Down Expand Up @@ -152,12 +139,6 @@ impl OperationDispatcher {
self.operations.extend(operations);
}

pub fn get_current_operation_state(&self) -> Option<State> {
self.operations
.first()
.map(|operation| operation.get_state())
}

pub fn next(&mut self) -> Option<Rc<Operation>> {
if let Some((i, operation)) = self.operations.iter_mut().enumerate().next() {
match operation.get_state() {
Expand Down
7 changes: 1 addition & 6 deletions src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pub(crate) mod auth;
pub(crate) mod grpc_message;
pub(crate) mod rate_limit;

use crate::configuration::{Action, Extension, ExtensionType, FailureMode};
use crate::configuration::{Action, Extension, ExtensionType};
use crate::service::auth::{AUTH_METHOD_NAME, AUTH_SERVICE_NAME};
use crate::service::grpc_message::GrpcMessageRequest;
use crate::service::rate_limit::{RATELIMIT_METHOD_NAME, RATELIMIT_SERVICE_NAME};
Expand All @@ -15,7 +15,6 @@ use std::time::Duration;

#[derive(Default)]
pub struct GrpcService {
#[allow(dead_code)]
extension: Rc<Extension>,
name: &'static str,
method: &'static str,
Expand Down Expand Up @@ -46,10 +45,6 @@ impl GrpcService {
fn method(&self) -> &str {
self.method
}
#[allow(dead_code)]
pub fn failure_mode(&self) -> &FailureMode {
&self.extension.failure_mode
}
}

pub type GrpcCallFn = fn(
Expand Down

0 comments on commit c108005

Please sign in to comment.