File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,9 +6,9 @@ use std::thread::{
66} ;
77use std:: time:: Duration ;
88
9+ use axum:: Router ;
910use axum:: extract:: State ;
1011use axum:: routing:: get;
11- use axum:: Router ;
1212use epoch_db:: DB ;
1313use metrics_exporter_prometheus:: {
1414 PrometheusBuilder ,
Original file line number Diff line number Diff line change @@ -4,9 +4,9 @@ use std::path::PathBuf;
44use std:: sync:: Arc ;
55use std:: time:: Duration ;
66
7+ use epoch_db:: DB ;
78use epoch_db:: server:: response_handler;
89use epoch_db:: server:: utils:: init_logger;
9- use epoch_db:: DB ;
1010use tokio:: net:: TcpListener ;
1111use tokio:: spawn;
1212use tokio:: time:: sleep;
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ use std::str::from_utf8;
33use std:: sync:: Arc ;
44
55use crate :: {
6- Metadata ,
7- DB
6+ DB ,
7+ Metadata
88} ;
99
1010/// This is an iterator struct that represents the Database main iterator
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ use std::io::{
1414} ;
1515use std:: path:: Path ;
1616use std:: str:: from_utf8;
17- use std:: sync:: atomic:: AtomicBool ;
1817use std:: sync:: Arc ;
18+ use std:: sync:: atomic:: AtomicBool ;
1919use std:: thread:: {
2020 self ,
2121 JoinHandle
@@ -28,12 +28,12 @@ use std::time::{
2828
2929use chrono:: Local ;
3030use errors:: TransientError ;
31+ use sled:: Config ;
3132use sled:: transaction:: {
3233 ConflictableTransactionError ,
3334 TransactionError ,
3435 Transactional
3536} ;
36- use sled:: Config ;
3737use zip:: write:: SimpleFileOptions ;
3838use zip:: {
3939 ZipArchive ,
@@ -42,8 +42,8 @@ use zip::{
4242
4343use crate :: metrics:: Metrics ;
4444use crate :: {
45- Metadata ,
46- DB
45+ DB ,
46+ Metadata
4747} ;
4848
4949impl DB {
Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ use sled::transaction::{
1616use crate :: db:: errors:: TransientError ;
1717use crate :: db:: transaction:: metric_handler:: GuardMetricChanged ;
1818use crate :: {
19- Metadata ,
20- DB
19+ DB ,
20+ Metadata
2121} ;
2222
2323pub mod metric_handler;
Original file line number Diff line number Diff line change 1212//! frequency** and **age** as first-class citizens.
1313
1414use std:: path:: PathBuf ;
15- use std:: sync:: atomic:: AtomicBool ;
1615use std:: sync:: Arc ;
16+ use std:: sync:: atomic:: AtomicBool ;
1717use std:: thread:: JoinHandle ;
1818
1919use db:: errors:: TransientError ;
Original file line number Diff line number Diff line change @@ -13,14 +13,15 @@ use tokio::io::{
1313 BufReader ,
1414 BufWriter
1515} ;
16- use tokio:: net:: tcp:: WriteHalf ;
1716use tokio:: net:: TcpStream ;
17+ use tokio:: net:: tcp:: WriteHalf ;
1818use tracing:: {
1919 error,
2020 info,
2121 warn
2222} ;
2323
24+ use crate :: DB ;
2425use crate :: db:: errors:: TransientError ;
2526use crate :: metadata:: RespValue ;
2627use crate :: server:: commands:: {
@@ -32,7 +33,6 @@ use crate::server::utils::{
3233 parse_bulk_string,
3334 parse_integer
3435} ;
35- use crate :: DB ;
3636
3737pub static CLIENT_COMMAND_SIZE : u64 = 4096 ;
3838
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ use tokio::io::{
99} ;
1010use tracing:: error;
1111use tracing_subscriber:: {
12- fmt ,
13- EnvFilter
12+ EnvFilter ,
13+ fmt
1414} ;
1515
1616use crate :: db:: errors:: TransientError ;
Original file line number Diff line number Diff line change 11use std:: io:: Cursor ;
22
3- use epoch_db:: server:: { commands:: ParsedResponse , parse_command} ;
3+ use epoch_db:: server:: commands:: ParsedResponse ;
4+ use epoch_db:: server:: parse_command;
45use tokio:: io:: BufReader ;
56
6- mod server_common;
7-
8-
9-
107#[ tokio:: test]
11- async fn valid_command_test ( ) {
12- /*
13- * *2\r\n$3\r\nGET\r\n$3\r\nkey\r\n
14- * *4\r\n$3\r\nSET\r\n$3\r\nkey\r\n$5\r\nvalue\r\n$4\r\n1000\r\n
15- * *3\r\n$3\r\nSET\r\n$3\r\nkey\r\n$0\r\n\r\n
16- */
8+ async fn valid_command_test ( ) {
9+ /*
10+ * *2\r\n$3\r\nGET\r\n$3\r\nkey\r\n
11+ * *4\r\n$3\r\nSET\r\n$3\r\nkey\r\n$5\r\nvalue\r\n$4\r\n1000\r\n
12+ * *3\r\n$3\r\nSET\r\n$3\r\nkey\r\n$0\r\n\r\n
13+ */
1714 let buf = b"*2\r \n $3\r \n GET\r \n $3\r \n key\r \n " ;
1815 let c = Cursor :: new ( buf) ;
1916
@@ -25,9 +22,8 @@ async fn valid_command_test () {
2522 command: epoch_db:: server:: commands:: Command :: Get ,
2623 key: Some ( Vec :: from( b"key" ) ) ,
2724 value: None ,
28- ttl: None ,
25+ ttl: None ,
2926 len: 2
3027 }
3128 )
32-
3329}
You can’t perform that action at this time.
0 commit comments