diff --git a/README.md b/README.md
index b0a81452..99d729a5 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,23 @@
-# Terrabase - The new in-memory database
-Terrabase is an effort to provide the best of key/value stores, document stores and columnar databases - **simplicity, flexibility and queryability at scale**. This project is currently in a pre-alpha stage and is undergoing rapid development.
+# Terrabase**DB** - The next-generation database
+
+![Status: Pre-Alpha](https://img.shields.io/badge/Status-Pre--alpha-critical?style=flat-square)
+![Version: 0.1.0](https://img.shields.io/badge/Development-Actively%20Developed-success?style=flat-square) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/terrabasedb/terrabase?style=flat-square)
+
+## What is TerrabaseDB?
+
+TerrabaseDB (or TDB for short) is an effort to provide the best of key/value stores, document stores and columnar databases - **simplicity, flexibility and queryability at scale**. This project is currently in a pre-alpha stage and is undergoing rapid development.
## Status
-As noted earlier, Terrabase is pre-alpha software and the entire API is subject to major breaking changes, at the moment.
+As noted earlier, TerrabaseDB is pre-alpha software and the entire API is subject to major breaking changes, at the moment.
## Getting started
We have an experimental client and server implementation for the database already. You can download a pre-built binary for `x86_64-linux` in the releases section and try it out!
* First unzip the file
-* Start the database server by running `./tdb`
-* Start the client by running `./tsh`
+* Start the database server by running `./tdb`
+* Start the client by running `./tsh`
* You can run commands like `SET sayan 17` , `GET cat` , `UPDATE cat 100` or `DEL cat` !
## Goals
diff --git a/buildandbin.sh b/buildandbin.sh
new file mode 100755
index 00000000..332409fa
--- /dev/null
+++ b/buildandbin.sh
@@ -0,0 +1,5 @@
+# This is a simple script which creates a release build and
+# moves the release builds into my $HOME/bin folder
+cargo build --release
+cp target/release/tdb target/release/tsh $HOME/bin
+echo 'Done!'
\ No newline at end of file
diff --git a/server/src/dbnet.rs b/server/src/dbnet.rs
index 31418d14..e5fe34a3 100644
--- a/server/src/dbnet.rs
+++ b/server/src/dbnet.rs
@@ -135,7 +135,7 @@ impl CHandler {
};
match try_df {
Ok(df) => self.con.write_response(self.db.execute_query(df)).await,
- Err(e) => self.con.close_conn_with_error(e).await,
+ Err(e) => return self.con.close_conn_with_error(e).await,
}
}
}
diff --git a/server/src/protocol.rs b/server/src/protocol.rs
index c77f796f..f6bd7733 100644
--- a/server/src/protocol.rs
+++ b/server/src/protocol.rs
@@ -102,19 +102,13 @@ impl Connection {
let mut bufreader = BufReader::new(&mut self.stream);
let mut metaline_buf = String::with_capacity(DEF_QMETALINE_BUFSIZE);
bufreader.read_line(&mut metaline_buf).await.unwrap();
- let pqmf = match PreQMF::from_buffer(metaline_buf) {
- Ok(pq) => pq,
- Err(e) => return Err(e),
- };
+ let pqmf = PreQMF::from_buffer(metaline_buf)?;
let (mut metalayout_buf, mut dataframe_buf) = (
String::with_capacity(pqmf.metaline_size),
vec![0; pqmf.content_size],
);
bufreader.read_line(&mut metalayout_buf).await.unwrap();
- let ss = match get_sizes(metalayout_buf) {
- Ok(ss) => ss,
- Err(e) => return Err(e),
- };
+ let ss = get_sizes(metalayout_buf)?;
bufreader.read(&mut dataframe_buf).await.unwrap();
let qdf = QueryDataframe {
data: extract_idents(dataframe_buf, ss),
@@ -123,13 +117,22 @@ impl Connection {
Ok(qdf)
}
pub async fn write_response(&mut self, resp: Vec) {
- if let Ok(_) = self.stream.write(&resp).await {
+ if let Err(_) = self.stream.write_all(&resp).await {
+ eprintln!(
+ "Error while writing to stream: {:?}",
+ self.stream.peer_addr()
+ );
+ return;
+ }
+ if let Err(_) = self.stream.flush().await {
+ eprintln!(
+ "Error while flushing data to stream: {:?}",
+ self.stream.peer_addr()
+ );
return;
- } else {
- eprintln!("Error writing response to {:?}", self.stream.peer_addr())
}
}
pub async fn close_conn_with_error(&mut self, bytes: impl RespBytes) {
- self.stream.write_all(&bytes.into_response()).await.unwrap();
+ self.write_response(bytes.into_response()).await
}
}