Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## Project Overview

OpenData is a collection of deployable database systems that share common infrastructure. Each database is its own crate but leverages shared logic from `opendata-common`.
OpenData is a collection of deployable database systems that share common infrastructure. Each database is its own crate but leverages shared logic from `common`.

### Crates

- **opendata-common**: Shared library containing common utilities and abstractions used by all database implementations
- **common**: Shared library containing common utilities and abstractions used by all database implementations
- **timeseries**: A timeseries database optimized for time-ordered data
- **log**: A Kafka-like log abstraction for append-only event streams

Expand Down
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]
resolver = "2"
members = [
"opendata-common",
"common",
"timeseries",
"log",
]
Expand All @@ -20,7 +20,7 @@ config = "0.14"
dashmap = "6.1.0"
fail = "0.5"
moka = { version = "0.12", features = ["future"] }
opendata-common = { path = "./opendata-common" }
common = { path = "./common" }
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] }
rstest = "0.19"
serde = { version = "1.0", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion opendata-common/Cargo.toml → common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "opendata-common"
name = "common"
version.workspace = true
edition.workspace = true

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ use super::{MergeOperator, Storage, StorageError, StorageResult};
/// # Examples
///
/// ```rust,ignore
/// use opendata_common::storage::config::StorageConfig;
/// use opendata_common::storage::factory::create_storage;
/// use common::storage::config::StorageConfig;
/// use common::storage::factory::create_storage;
///
/// // Create in-memory storage (default)
/// let storage = create_storage(&StorageConfig::default(), None).await?;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl SlateDbStorage {
///
/// This adapter can be used when constructing a SlateDB database with a merge operator:
/// ```rust,ignore
/// use opendata_common::storage::MergeOperator;
/// use common::storage::MergeOperator;
/// use slatedb::{DbBuilder, object_store::ObjectStore};
///
/// let my_merge_op: Arc<dyn MergeOperator> = Arc::new(MyMergeOperator);
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion log/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ edition.workspace = true

[dependencies]
bytes.workspace = true
opendata-common.workspace = true
common.workspace = true
slatedb.workspace = true
tokio.workspace = true
4 changes: 2 additions & 2 deletions log/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! This module defines the configuration and options structs that control
//! the behavior of the log, including storage setup and operation parameters.

use opendata_common::StorageConfig;
use common::StorageConfig;

/// Configuration for opening a [`Log`](crate::Log).
///
Expand All @@ -14,7 +14,7 @@ use opendata_common::StorageConfig;
///
/// ```ignore
/// use log::Config;
/// use opendata_common::StorageConfig;
/// use common::StorageConfig;
///
/// let config = Config {
/// storage: StorageConfig::default(),
Expand Down
2 changes: 1 addition & 1 deletion log/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! This module defines [`Error`], the primary error type for all log
//! operations, along with a convenient [`Result`] type alias.

use opendata_common::StorageError;
use common::StorageError;

/// Error type for OpenData Log operations.
///
Expand Down
4 changes: 2 additions & 2 deletions log/src/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
use std::sync::Arc;

use bytes::Bytes;
use opendata_common::{Record, Storage};
use common::{Record, Storage};
use tokio::sync::Mutex;

use crate::error::Result;
Expand Down Expand Up @@ -212,7 +212,7 @@ impl SequenceAllocator {
#[cfg(test)]
mod tests {
use super::*;
use opendata_common::storage::in_memory::InMemoryStorage;
use common::storage::in_memory::InMemoryStorage;

#[tokio::test]
async fn should_return_none_when_no_block_allocated() {
Expand Down
6 changes: 3 additions & 3 deletions log/src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
//! prefix-based range queries: start at `prefix + 0x00`, end at `prefix + 0xFF`.

use bytes::{BufMut, Bytes, BytesMut};
use opendata_common::serde::terminated_bytes;
use common::serde::terminated_bytes;

use crate::error::Error;

impl From<opendata_common::serde::DeserializeError> for Error {
fn from(err: opendata_common::serde::DeserializeError) -> Self {
impl From<common::serde::DeserializeError> for Error {
fn from(err: common::serde::DeserializeError) -> Self {
Error::Encoding(err.message)
}
}
Expand Down
2 changes: 1 addition & 1 deletion timeseries/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ clap.workspace = true
config.workspace = true
dashmap.workspace = true
moka.workspace = true
opendata-common.workspace = true
common.workspace = true
reqwest.workspace = true
serde.workspace = true
serde_json.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions timeseries/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use std::time::Duration;

use opendata_common::StorageConfig;
use common::StorageConfig;

/// Configuration for opening a [`TimeSeries`](crate::TimeSeries) database.
///
Expand All @@ -17,7 +17,7 @@ use opendata_common::StorageConfig;
///
/// ```ignore
/// use timeseries::Config;
/// use opendata_common::StorageConfig;
/// use common::StorageConfig;
/// use std::time::Duration;
///
/// let config = Config {
Expand Down
2 changes: 1 addition & 1 deletion timeseries/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! This module defines [`Error`], the primary error type for all time series
//! operations, along with a convenient [`Result`] type alias.

use opendata_common::StorageError;
use common::StorageError;

/// Error type for OpenData TimeSeries operations.
///
Expand Down
4 changes: 2 additions & 2 deletions timeseries/src/head.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};

use dashmap::DashMap;
use opendata_common::Storage;
use opendata_common::storage::StorageSnapshot;
use common::Storage;
use common::storage::StorageSnapshot;

use crate::error::Error;
use crate::model::{Sample, SeriesFingerprint, SeriesId, TimeBucket};
Expand Down
2 changes: 1 addition & 1 deletion timeseries/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod util;
use std::sync::Arc;

use clap::Parser;
use opendata_common::storage::factory::create_storage;
use common::storage::factory::create_storage;

use promql::config::{CliArgs, PrometheusConfig, load_config};
use promql::server::{PromqlServer, ServerConfig};
Expand Down
2 changes: 1 addition & 1 deletion timeseries/src/minitsdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::sync::{Arc, atomic::AtomicU32};

use async_trait::async_trait;
use dashmap::DashMap;
use opendata_common::{Storage, StorageRead};
use common::{Storage, StorageRead};
use tokio::sync::{Mutex, RwLock};

use crate::delta::{TsdbDelta, TsdbDeltaBuilder};
Expand Down
2 changes: 1 addition & 1 deletion timeseries/src/promql/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::path::Path;
use std::time::Duration;

use clap::Parser;
use opendata_common::storage::config::StorageConfig;
use common::storage::config::StorageConfig;
use serde::Deserialize;

use crate::util::Result;
Expand Down
4 changes: 2 additions & 2 deletions timeseries/src/promql/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use thiserror::Error;

use crate::promql::request::QueryRangeRequest;
use crate::promql::request::QueryRequest;
use opendata_common::Clock;
use common::Clock;

pub const DEFAULT_LOOKBACK_DURATION: Duration = Duration::from_secs(5 * 60);

Expand Down Expand Up @@ -58,7 +58,7 @@ mod tests {
use crate::promql::parser::{DEFAULT_LOOKBACK_DURATION, Parseable};
use crate::promql::request::{QueryRangeRequest, QueryRequest};
use chrono::DateTime;
use opendata_common::clock::{Clock, MockClock, SystemClock};
use common::clock::{Clock, MockClock, SystemClock};
use std::sync::Arc;
use std::time::{Duration, SystemTime};

Expand Down
2 changes: 1 addition & 1 deletion timeseries/src/promql/scraper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ mod tests {
fn should_create_scraper() {
// given
let storage = Arc::new(
opendata_common::storage::in_memory::InMemoryStorage::with_merge_operator(Arc::new(
common::storage::in_memory::InMemoryStorage::with_merge_operator(Arc::new(
crate::storage::merge_operator::OpenTsdbMergeOperator,
)),
);
Expand Down
6 changes: 3 additions & 3 deletions timeseries/src/promql/tsdb_router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::sync::Arc;
use std::time::{Duration, UNIX_EPOCH};

use async_trait::async_trait;
use opendata_common::clock::SystemClock;
use common::clock::SystemClock;
use promql_parser::parser::{EvalStmt, Expr, VectorSelector};

use super::evaluator::Evaluator;
Expand Down Expand Up @@ -541,8 +541,8 @@ mod tests {
use crate::model::TimeBucket;
use crate::model::{Label, MetricType, Sample, Series};
use crate::storage::merge_operator::OpenTsdbMergeOperator;
use opendata_common::Storage;
use opendata_common::storage::in_memory::InMemoryStorage;
use common::Storage;
use common::storage::in_memory::InMemoryStorage;
use std::time::{Duration, UNIX_EPOCH};

async fn create_test_storage() -> Arc<dyn Storage> {
Expand Down
2 changes: 1 addition & 1 deletion timeseries/src/serde/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use super::*;
use crate::model::{BucketSize, BucketStart, RecordTag, SeriesFingerprint, SeriesId};
use bytes::{Bytes, BytesMut};
use opendata_common::BytesRange;
use common::BytesRange;

/// BucketList key (global-scoped)
#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down
2 changes: 1 addition & 1 deletion timeseries/src/serde/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub mod timeseries;

use crate::model::{RecordTag, TimeBucket};
use bytes::{BufMut, BytesMut};
use opendata_common::BytesRange;
use common::BytesRange;

/// Key format version (currently 0x01)
pub const KEY_VERSION: u8 = 0x01;
Expand Down
4 changes: 2 additions & 2 deletions timeseries/src/storage/merge_operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::serde::{EncodingError, RecordType};
/// record type encoded in the key.
pub(crate) struct OpenTsdbMergeOperator;

impl opendata_common::storage::MergeOperator for OpenTsdbMergeOperator {
impl common::storage::MergeOperator for OpenTsdbMergeOperator {
fn merge(&self, key: &Bytes, existing_value: Option<Bytes>, new_value: Bytes) -> Bytes {
// If no existing value, just return the new value
let Some(existing) = existing_value else {
Expand Down Expand Up @@ -90,7 +90,7 @@ mod tests {
use crate::serde::key::{BucketListKey, InvertedIndexKey, TimeSeriesKey};
use crate::serde::timeseries::TimeSeriesValue;
use bytes::Bytes;
use opendata_common::storage::MergeOperator;
use common::storage::MergeOperator;
use roaring::RoaringBitmap;
use rstest::rstest;

Expand Down
4 changes: 2 additions & 2 deletions timeseries/src/storage/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use opendata_common::storage::RecordOp;
use opendata_common::{Record, Storage, StorageRead};
use common::storage::RecordOp;
use common::{Record, Storage, StorageRead};
use roaring::RoaringBitmap;

use crate::index::{InvertedIndex, SeriesSpec};
Expand Down
4 changes: 2 additions & 2 deletions timeseries/src/tsdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::time::Duration;

use async_trait::async_trait;
use moka::future::Cache;
use opendata_common::Storage;
use common::Storage;

use crate::index::{ForwardIndex, ForwardIndexLookup, InvertedIndex, InvertedIndexLookup};
use crate::minitsdb::MiniTsdb;
Expand Down Expand Up @@ -284,7 +284,7 @@ mod tests {
use super::*;
use crate::model::MetricType;
use crate::storage::merge_operator::OpenTsdbMergeOperator;
use opendata_common::storage::in_memory::InMemoryStorage;
use common::storage::in_memory::InMemoryStorage;

async fn create_test_storage() -> Arc<dyn Storage> {
Arc::new(InMemoryStorage::with_merge_operator(Arc::new(
Expand Down
2 changes: 1 addition & 1 deletion timeseries/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ mod tests {
parse_duration, parse_timestamp, parse_timestamp_to_seconds, time_bucket_size_hours,
};
use bytes::{BufMut, Bytes, BytesMut};
use opendata_common::BytesRange;
use common::BytesRange;
use std::ops::Bound::{Excluded, Included, Unbounded};
use std::time::{Duration, SystemTime};

Expand Down