Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions server/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ mod ui {
use static_files::resource_dir;
use ureq::get as get_from_url;

const CARGO_MANIFEST_DIR: &str = "CARGO_MANIFEST_DIR";
const OUT_DIR: &str = "OUT_DIR";
const LOCAL_ASSETS_PATH: &str = "LOCAL_ASSETS_PATH";

fn build_resource_from(local_path: impl AsRef<Path>) -> io::Result<()> {
let local_path = local_path.as_ref();
if local_path.exists() {
Expand All @@ -49,9 +53,9 @@ mod ui {
}

pub fn setup() -> io::Result<()> {
let cargo_manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
let cargo_manifest_dir = PathBuf::from(env::var(CARGO_MANIFEST_DIR).unwrap());
let cargo_toml = cargo_manifest_dir.join("Cargo.toml");
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let out_dir = PathBuf::from(env::var(OUT_DIR).unwrap());
let parseable_ui_path = out_dir.join("ui");
let checksum_path = out_dir.join("parseable_ui.sha1");

Expand All @@ -69,7 +73,7 @@ mod ui {

// try fetching frontend path from env var
let local_assets_path: Option<PathBuf> =
env::var("LOCAL_ASSETS_PATH").ok().map(PathBuf::from);
env::var(LOCAL_ASSETS_PATH).ok().map(PathBuf::from);

// If local build of ui is to be used
if let Some(ref path) = local_assets_path {
Expand Down
2 changes: 1 addition & 1 deletion server/src/handlers/logstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ pub async fn put(req: HttpRequest) -> HttpResponse {
// Proceed to create log stream if it doesn't exist
if s3.get_schema(&stream_name).await.is_err() {
if let Err(e) =
metadata::STREAM_INFO.add_stream(stream_name.to_string(), None, Default::default())
metadata::STREAM_INFO.add_stream(stream_name.to_string(), None, Alerts::default())
{
return response::ServerResponse {
msg: format!(
Expand Down
4 changes: 0 additions & 4 deletions server/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,13 @@ impl STREAM_INFO {
alerts,
..Default::default()
};
// TODO: Add check to confirm data insertion
map.insert(stream_name, metadata);

Ok(())
}

pub fn delete_stream(&self, stream_name: &str) -> Result<(), Error> {
let mut map = self.write().unwrap();
// TODO: Add check to confirm data deletion
map.remove(stream_name);

Ok(())
Expand All @@ -147,8 +145,6 @@ impl STREAM_INFO {
for stream in storage.list_streams().await? {
// Ignore S3 errors here, because we are just trying
// to load the stream metadata based on whatever is available.
//
// TODO: ignore failure(s) if any and skip to next stream
let alerts = storage
.get_alerts(&stream.name)
.await
Expand Down
2 changes: 1 addition & 1 deletion server/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Query {
}

/// Execute query on object storage(and if necessary on cache as well) with given stream information
/// TODO: find a way to query all selected parquet files together in a single context.
/// TODO: Query local and remote S3 parquet files in a single context
pub async fn execute(&self, storage: &impl ObjectStorage) -> Result<Vec<RecordBatch>, Error> {
let mut results = vec![];
storage.query(self, &mut results).await?;
Expand Down
3 changes: 1 addition & 2 deletions server/src/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,7 @@ impl S3 {

#[allow(dead_code)]
async fn prefix_exists(&self, prefix: &str) -> Result<bool, AwsSdkError> {
// TODO check if head object is faster compared to
// list objects
// TODO check if head object is faster compared to list objects
let resp = self
.client
.list_objects_v2()
Expand Down
2 changes: 1 addition & 1 deletion server/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::metadata::STREAM_INFO;
use crate::query::Query;
use crate::Error;

// TODO: add more sql keywords here in lower case
// Add more sql keywords here in lower case
const DENIED_NAMES: &[&str] = &[
"select", "from", "where", "group", "by", "order", "limit", "offset", "join", "and",
];
Expand Down