K2V #293

Merged
lx merged 68 commits from k2v into main 2022-05-10 11:16:58 +00:00
Showing only changes of commit 12dd378fca - Show all commits

View file

@ -1,13 +1,10 @@
//! Function related to GET and HEAD requests //! Function related to GET and HEAD requests
use std::sync::Arc; use std::sync::Arc;
use std::time::{Duration, UNIX_EPOCH};
use futures::stream::*;
use http::header; use http::header;
use hyper::body::Bytes;
use hyper::{Body, Request, Response, StatusCode}; use hyper::{Body, Request, Response, StatusCode};
use garage_table::EmptyKey;
use garage_util::data::*; use garage_util::data::*;
use garage_model::garage::Garage; use garage_model::garage::Garage;
@ -15,7 +12,7 @@ use garage_model::k2v::item_table::*;
use crate::error::*; use crate::error::*;
const X_GARAGE_CAUSALITY_TOKEN: &'static str = "X-Garage-Causality-Token"; const X_GARAGE_CAUSALITY_TOKEN: &str = "X-Garage-Causality-Token";
pub enum ReturnFormat { pub enum ReturnFormat {
Json, Json,
@ -45,7 +42,7 @@ impl ReturnFormat {
pub fn make_response(&self, item: &K2VItem) -> Result<Response<Body>, Error> { pub fn make_response(&self, item: &K2VItem) -> Result<Response<Body>, Error> {
let vals = item.values(); let vals = item.values();
if vals.len() == 0 { if vals.is_empty() {
return Err(Error::NoSuchKey); return Err(Error::NoSuchKey);
} }
@ -98,6 +95,7 @@ impl ReturnFormat {
} }
/// Handle ReadItem request /// Handle ReadItem request
#[allow(clippy::ptr_arg)]
pub async fn handle_read_item( pub async fn handle_read_item(
garage: Arc<Garage>, garage: Arc<Garage>,
req: &Request<Body>, req: &Request<Body>,