-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce pelikan_bloomcache #468
Open
swlynch99
wants to merge
12
commits into
twitter:master
Choose a base branch
from
swlynch99:http
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+514
−2
Open
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3206be9
Introduce http protocol
swlynch99 0868694
Add bloom config
swlynch99 305e366
Add entrystore entry for bloom server using http
swlynch99 d2e780a
Add bloom cache server
swlynch99 ec6709f
Update cargo files
swlynch99 0f86703
Fix phantomdata in bloomfilter to keep bloomfilter sync
swlynch99 dcfc7fb
Add missing license to util.rs
swlynch99 7634047
Remove debug logging from util.rs
swlynch99 6846472
Fix bad assert
swlynch99 5b36a9d
Merge branch 'master' into http
swlynch99 2ab7c1e
Update bloomcache's depedencies to be workspace dependencies
swlynch99 eceae18
Update error messages in bloomcache main to use eprintln
swlynch99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add entrystore entry for bloom server using http
commit 305e36695f413c5b8a0d9e2b972ce5b7011bec8c
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,19 +2,17 @@ | |
// Licensed under the Apache License, Version 2.0 | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
use std::borrow::Cow; | ||
|
||
use protocol_common::Execute; | ||
use protocol_http::{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather not use this style here and would prefer two use statements. |
||
request::{Request, RequestData}, | ||
Headers, ParseResult, Response, Storage, | ||
request::{ParseData, Request, RequestData}, | ||
Headers, Response, Storage, | ||
}; | ||
|
||
use crate::Bloom; | ||
|
||
impl Execute<ParseResult, Response> for Bloom { | ||
fn execute(&mut self, result: &ParseResult) -> Response { | ||
let request = match result { | ||
impl Execute<ParseData, Response> for Bloom { | ||
fn execute(&mut self, data: &ParseData) -> Response { | ||
let request = match &data.0 { | ||
Ok(request) => request, | ||
Err(e) => return e.to_response(), | ||
}; | ||
|
@@ -31,20 +29,26 @@ impl Execute<ParseResult, Response> for Bloom { | |
impl Storage for Bloom { | ||
fn get(&mut self, key: &[u8], _headers: &Headers) -> Response { | ||
if self.data.contains(key) { | ||
Response::builder(204).empty() | ||
Response::builder(200).body(b"") | ||
} else { | ||
Response::builder(404).empty() | ||
Response::builder(404).body(b"") | ||
} | ||
} | ||
|
||
fn put(&mut self, key: &[u8], _value: &[u8], _headers: &Headers) -> Response { | ||
let exists = self.data.contains(key); | ||
self.data.insert(key); | ||
Response::builder(204).empty() | ||
|
||
if exists { | ||
Response::builder(200).body(b"") | ||
} else { | ||
Response::builder(201).body(b"") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we us named status codes? Had to look this one up. |
||
} | ||
} | ||
|
||
fn delete(&mut self, _key: &[u8], _headers: &Headers) -> Response { | ||
let mut builder = Response::builder(405); | ||
builder.header("Content-Type", b"text/plain"); | ||
builder.body(Cow::Borrowed(b"DELETE method not supported")) | ||
builder.body(b"DELETE method not supported") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer alphabetical ordering