Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

Enable caching in RoutingNode. #662

Merged
merged 7 commits into from Sep 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

use messages::{SignedMessage, Content};
use authority::Authority;
use types::CacheOptions;

/// An Action initiates a message flow < A | B > where we are (a part of) A.
/// 1. Action::SendMessage hands a fully formed SignedMessage over to RoutingNode
Expand All @@ -36,6 +37,7 @@ pub enum Action {
// | the destination authority
// RoutingNode will form the RoutingMessage and sign it as its own identity
Churn(::direct_messages::Churn, Vec<::crust::Endpoint>),
SetCacheOptions(CacheOptions),
WakeUp,
Terminate,
}
1 change: 1 addition & 0 deletions src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ impl Data {

#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, RustcEncodable, RustcDecodable)]
pub enum DataRequest {
// (Identifier, TypeTag) pair for name resolution.
StructuredData(NameType, u64),
ImmutableData(NameType, ImmutableDataType),
PlainData(NameType),
Expand Down
8 changes: 7 additions & 1 deletion src/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use messages::SignedToken;
use routing_node::RoutingNode;
use NameType;
use data::{Data, DataRequest};
use types::Bytes;
use types::{Bytes, CacheOptions};
use error::{RoutingError, ResponseError};
use authority::Authority;
use sodiumoxide::crypto;
Expand Down Expand Up @@ -155,6 +155,12 @@ impl Routing {

}

/// Dynamically enable/disable caching for Data types.
pub fn set_cache_options(&self, cache_options: CacheOptions) {
let _ = self.action_sender.send(Action::SetCacheOptions(cache_options));

}

/// Signal to RoutingNode that it needs to refuse new messages and handle all outstanding
/// messages. After handling all messages it will send an Event::Terminated to the user.
pub fn stop(&mut self) {
Expand Down
Loading