Commit 81f06b8 1 parent 7f8ca77 commit 81f06b8 Copy full SHA for 81f06b8
File tree 9 files changed +36
-36
lines changed
9 files changed +36
-36
lines changed Original file line number Diff line number Diff line change @@ -2,14 +2,14 @@ use std::time::Duration;
2
2
3
3
use bytes:: Bytes ;
4
4
use bytestring:: ByteString ;
5
- use crc :: { Crc , CRC_16_XMODEM } ;
5
+
6
6
7
7
use super :: parse:: { Parse , ParseError } ;
8
8
use super :: CommandExecution ;
9
9
use crate :: application:: server:: connection:: WriteConnection ;
10
10
use crate :: application:: server:: context:: Context ;
11
11
use crate :: application:: server:: frame:: Frame ;
12
- use crate :: application:: server:: { crc_hash, CRC } ;
12
+ use crate :: application:: server:: { crc_hash} ;
13
13
use crate :: domain:: storage:: SetOptions ;
14
14
15
15
/// Set key to hold the string value. If key already holds a value, it is
Original file line number Diff line number Diff line change 1
1
use std:: fmt:: Debug ;
2
2
use std:: io:: { self , Cursor } ;
3
- use std :: rc :: Rc ;
3
+
4
4
5
5
use bytes:: BytesMut ;
6
6
use monoio:: buf:: IoBuf ;
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ impl Context {
22
22
self . storage . is_in_slot ( hash)
23
23
}
24
24
25
- pub fn slot_nb ( & self , hash : u16 ) -> Option < usize > {
25
+ pub fn slot_nb ( & self , _hash : u16 ) -> Option < usize > {
26
26
todo ! ( )
27
27
// self.storage.slot_nb(hash)
28
28
}
Original file line number Diff line number Diff line change 1
1
use std:: cell:: RefCell ;
2
- use std:: os:: fd:: { AsRawFd , IntoRawFd } ;
2
+ use std:: os:: fd:: { IntoRawFd } ;
3
3
use std:: rc:: Rc ;
4
4
use std:: time:: Duration ;
5
5
6
- use monoio :: net :: TcpStream ;
7
- use monoio :: time :: Instant ;
6
+
7
+
8
8
use sharded_thread:: shard:: Shard ;
9
9
10
10
use super :: cmd:: Command ;
Original file line number Diff line number Diff line change 1
1
//! The whole redis server implementation is here.
2
2
use std:: net:: SocketAddr ;
3
- use std :: os :: fd :: { FromRawFd , RawFd } ;
4
- use std :: rc :: Rc ;
3
+
4
+
5
5
use std:: sync:: atomic:: AtomicU16 ;
6
6
use std:: sync:: Arc ;
7
7
use std:: thread:: JoinHandle ;
8
8
9
9
use crc:: { Crc , CRC_16_XMODEM } ;
10
10
use derive_builder:: Builder ;
11
- use futures :: StreamExt ;
12
- use monoio :: net :: { ListenerConfig , TcpListener , TcpStream } ;
11
+
12
+
13
13
14
14
mod connection;
15
15
mod context;
16
16
pub mod frame;
17
17
pub ( crate ) mod handle;
18
- use handle :: Handler ;
19
- use monoio :: time :: Instant ;
20
- use sharded_thread :: shard :: Shard ;
18
+
19
+
20
+
21
21
22
22
mod cmd;
23
23
mod server_thread;
24
24
25
25
use self :: server_thread:: ServerMonoThreadedHandle ;
26
- use crate :: application :: server :: connection :: WriteConnection ;
27
- use crate :: application :: server :: context :: Context ;
26
+
27
+
28
28
use crate :: application:: server:: handle:: ConnectionMsg ;
29
- use crate :: domain ;
30
- use crate :: domain:: dialer:: { Dialer , RootDialer , Slot } ;
29
+
30
+ use crate :: domain:: dialer:: { RootDialer , Slot } ;
31
31
use crate :: domain:: storage:: Storage ;
32
32
33
33
#[ derive( Debug , Builder , Clone ) ]
Original file line number Diff line number Diff line change 1
1
use std:: rc:: Rc ;
2
2
use std:: thread:: JoinHandle ;
3
3
4
- use futures :: future :: Join ;
5
- use monoio:: net:: { ListenerConfig , TcpListener , TcpStream } ;
4
+
5
+ use monoio:: net:: { ListenerConfig , TcpListener } ;
6
6
7
7
use super :: ServerConfig ;
8
8
use crate :: application:: server:: connection:: WriteConnection ;
@@ -43,7 +43,7 @@ impl ServerMonoThreadedHandle {
43
43
cpu : usize ,
44
44
storage : & Storage ,
45
45
) -> Self {
46
- let ( slot , storage_segment) = storage. part ( cpu as u16 ) ;
46
+ let ( _slot , storage_segment) = storage. part ( cpu as u16 ) ;
47
47
let dialer = dialer. part ( cpu as u16 ) . unwrap ( ) ;
48
48
49
49
Self {
@@ -55,7 +55,9 @@ impl ServerMonoThreadedHandle {
55
55
}
56
56
57
57
pub fn initialize ( self ) -> JoinHandle < ( ) > {
58
- let handle = std:: thread:: spawn ( move || {
58
+
59
+
60
+ std:: thread:: spawn ( move || {
59
61
monoio:: utils:: bind_to_cpu_set ( Some ( self . cpu ) ) . unwrap ( ) ;
60
62
61
63
let mut rt = monoio:: RuntimeBuilder :: < Driver > :: new ( )
@@ -111,8 +113,6 @@ impl ServerMonoThreadedHandle {
111
113
#[ allow( unreachable_code) ]
112
114
Ok :: < ( ) , anyhow:: Error > ( ( ) )
113
115
} ) ;
114
- } ) ;
115
-
116
- handle
116
+ } )
117
117
}
118
118
}
Original file line number Diff line number Diff line change 1
1
use std:: ops:: { Deref , Range } ;
2
- use std :: rc :: Rc ;
3
- use std :: sync :: Arc ;
2
+
3
+
4
4
5
5
use sharded_thread:: mesh:: MeshBuilder ;
6
6
use sharded_thread:: shard:: Shard ;
Original file line number Diff line number Diff line change 1
1
//! Storage primitive which is used to interact with Keys
2
2
3
3
use std:: hash:: BuildHasherDefault ;
4
- use std :: ops :: Range ;
5
- use std :: rc :: Rc ;
4
+
5
+
6
6
use std:: sync:: atomic:: AtomicU32 ;
7
7
use std:: sync:: Arc ;
8
8
@@ -68,7 +68,7 @@ impl StorageSegment {
68
68
val,
69
69
} ;
70
70
71
- let old = self
71
+ let _old = self
72
72
. count
73
73
. fetch_add ( 1 , std:: sync:: atomic:: Ordering :: Relaxed ) ;
74
74
/*
@@ -141,14 +141,14 @@ impl Storage {
141
141
// We generate the Slot where we need to create a StorageSegment.
142
142
let mut slots: Vec < ( Slot , StorageSegment ) > = Vec :: new ( ) ;
143
143
for slot in 0 ..nb_slot {
144
- let part_size: u16 = HASH_SLOT_MAX / nb_slot as u16 ;
145
- let remainder: u16 = HASH_SLOT_MAX % nb_slot as u16 ;
144
+ let part_size: u16 = HASH_SLOT_MAX / nb_slot;
145
+ let remainder: u16 = HASH_SLOT_MAX % nb_slot;
146
146
147
- let start = slot as u16 * part_size as u16 ;
147
+ let start = slot * part_size;
148
148
let end = if slot == nb_slot - 1 {
149
- ( slot as u16 + 1 ) * part_size + remainder as u16
149
+ ( slot + 1 ) * part_size + remainder
150
150
} else {
151
- ( slot as u16 + 1 ) * part_size as u16
151
+ ( slot + 1 ) * part_size
152
152
} ;
153
153
154
154
let slot = Slot :: from ( start..end) ;
Original file line number Diff line number Diff line change 1
1
use std:: net:: SocketAddr ;
2
- use std :: str :: FromStr ;
2
+
3
3
4
4
mod port_picker;
5
5
You can’t perform that action at this time.
0 commit comments