Skip to content

Commit

Permalink
pin rust version
Browse files Browse the repository at this point in the history
  • Loading branch information
devillove084 committed Oct 1, 2023
1 parent 151b954 commit 3d4a276
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 27 deletions.
4 changes: 2 additions & 2 deletions rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly"
components = ["rustfmt", "clippy", "miri"]
channel = "nightly-2023-10-01"
components = ["rustfmt", "clippy", "miri"]
23 changes: 15 additions & 8 deletions src/runtime/src/operators/learned_index/message.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use actix::{Message, dev::MessageResponse, Actor, MessageResult};
use actix::{dev::MessageResponse, Actor, Message, MessageResult};

use super::{error::OperatorError, opt::Operation, state::ActorID, pointer::Pointer};
use super::{error::OperatorError, opt::Operation, pointer::Pointer, state::ActorID};

Check warning on line 3 in src/runtime/src/operators/learned_index/message.rs

View workflow job for this annotation

GitHub Actions / Run tests (ubuntu-latest)

unused imports: `error::OperatorError`, `state::ActorID`

Check warning on line 3 in src/runtime/src/operators/learned_index/message.rs

View workflow job for this annotation

GitHub Actions / Run tests (macos-latest)

unused imports: `error::OperatorError`, `state::ActorID`

#[derive(Debug, Message)]
#[rtype(result = "DataMessage")]
Expand All @@ -25,14 +25,17 @@ pub struct DataMessage {
// }

// impl<A: Actor, M: Message> MessageResponse<A, M> for DataMessage {
// fn handle(self, ctx: &mut <A as Actor>::Context, tx: Option<actix::dev::OneshotSender<<M as Message>::Result>>) {
// tx.unwrap().send(self);
// fn handle(self, ctx: &mut <A as Actor>::Context, tx: Option<actix::dev::OneshotSender<<M as
// Message>::Result>>) { tx.unwrap().send(self);
// }
// }

impl ControlMessage {
pub fn new(target: Pointer) -> Self {
ControlMessage { target, operation: Operation::Read}
ControlMessage {
target,
operation: Operation::Read,
}
}

pub fn get_operation(&self) -> Operation {
Expand All @@ -44,7 +47,7 @@ impl ControlMessage {
let addr = p.pref as *mut u8;
let len = p.size;
if p.cap.is_some() {
return unsafe {String::from_raw_parts(addr, len, p.cap.unwrap()) };
return unsafe { String::from_raw_parts(addr, len, p.cap.unwrap()) };
} else {
panic!()
}
Expand All @@ -53,6 +56,10 @@ impl ControlMessage {

impl DataMessage {
pub fn new(value: String) -> Self {

Check warning on line 58 in src/runtime/src/operators/learned_index/message.rs

View workflow job for this annotation

GitHub Actions / Run tests (ubuntu-latest)

unused variable: `value`

Check warning on line 58 in src/runtime/src/operators/learned_index/message.rs

View workflow job for this annotation

GitHub Actions / Run tests (macos-latest)

unused variable: `value`
DataMessage { size: 0, is_continous: false, data: "".to_string() }
DataMessage {
size: 0,
is_continous: false,
data: "".to_string(),
}
}
}
}
2 changes: 1 addition & 1 deletion src/runtime/src/operators/learned_index/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ pub mod message;
pub mod nonlinear;
pub mod opt;
pub mod planner;
pub mod pointer;
pub mod read;
pub mod sink;
pub mod state;
pub mod update;
pub mod write;
pub mod pointer;
4 changes: 1 addition & 3 deletions src/runtime/src/operators/learned_index/pointer.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@


#[derive(Debug, Default)]
pub struct Pointer {
pub pref: usize,
pub size: usize,
pub cap: Option<usize>,
}
}
38 changes: 27 additions & 11 deletions src/runtime/src/operators/learned_index/read.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
use actix::{Actor, ActorState, Context, Handler, dev::MessageResponse, Message, Recipient, MessageResult};
use actix::{
dev::MessageResponse, Actor, ActorState, Context, Handler, Message, MessageResult, Recipient,

Check warning on line 2 in src/runtime/src/operators/learned_index/read.rs

View workflow job for this annotation

GitHub Actions / Run tests (ubuntu-latest)

unused imports: `Message`, `Recipient`, `dev::MessageResponse`

Check warning on line 2 in src/runtime/src/operators/learned_index/read.rs

View workflow job for this annotation

GitHub Actions / Run tests (macos-latest)

unused imports: `Message`, `Recipient`, `dev::MessageResponse`
};

use super::{allocator::AllocatorActor, sink::Buffer, message::{ControlMessage, DataMessage}, error::OperatorError, state::ActorID, opt::Operation};
use super::{
allocator::AllocatorActor,
error::OperatorError,

Check warning on line 7 in src/runtime/src/operators/learned_index/read.rs

View workflow job for this annotation

GitHub Actions / Run tests (ubuntu-latest)

unused imports: `error::OperatorError`, `state::ActorID`

Check warning on line 7 in src/runtime/src/operators/learned_index/read.rs

View workflow job for this annotation

GitHub Actions / Run tests (macos-latest)

unused imports: `error::OperatorError`, `state::ActorID`
message::{ControlMessage, DataMessage},
opt::Operation,
sink::Buffer,
state::ActorID,
};

pub struct ReadActor {
state: ActorState,
Expand All @@ -23,28 +32,35 @@ impl Handler<ControlMessage> for ReadActor {
}
}


#[cfg(test)]
mod test {
use actix::{System, Actor, Context, AsyncContext};

use crate::operators::learned_index::{sink::Buffer, allocator::AllocatorActor, message::ControlMessage, pointer::Pointer};
use actix::{Actor, AsyncContext, Context, System};

use super::ReadActor;
use crate::operators::learned_index::{
allocator::AllocatorActor, message::ControlMessage, pointer::Pointer, sink::Buffer,
};


#[actix::test]
async fn read_actor_test() {
let addr = ReadActor { state: actix::ActorState::Started, buffer: Buffer::<AllocatorActor>::default() }.start();
let addr = ReadActor {
state: actix::ActorState::Started,
buffer: Buffer::<AllocatorActor>::default(),
}
.start();
let test_string = "TestString".to_string();
let (_, len, cap) = test_string.clone().into_raw_parts();

let ptr = Pointer { pref: unsafe {*test_string.as_ptr() as usize}, size: len, cap: Some(cap) };
let ptr = Pointer {
pref: unsafe { *test_string.as_ptr() as usize },
size: len,
cap: Some(cap),
};
let control_message = ControlMessage::new(ptr);

let res = addr.send(control_message).await.unwrap();
println!("{:?}", res);

System::current().stop();
}
}
}
2 changes: 1 addition & 1 deletion src/runtime/src/operators/learned_index/sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct Buffer<A: Allocator> {

// impl<A: Allocator> Buffer<A> {
// pub fn new() -> Self {

// }
// }

Expand Down
2 changes: 1 addition & 1 deletion src/runtime/src/operators/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pub mod learned_index;
pub mod transfom_store;
pub mod transfom_store;
1 change: 1 addition & 0 deletions src/runtime/src/operators/transfom_store/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit 3d4a276

Please sign in to comment.