Skip to content
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

feat(record): add record stub #46

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
19 changes: 19 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ serde = { version = "1.0", features = ["derive"]}
librocksdb-sys = "0.11.0"
thiserror = "1.0.44"
vlseqid = "0.2.0"
nummer = "0.2.1"


[dependencies.rocksdb]
Expand All @@ -21,6 +22,24 @@ default-features = false
features = ["multi-threaded-cf", "lz4"]


[dependencies.arrow]
package = "arrow2"
git = "https://github.com/jorgecarleitao/arrow2"
rev = "d5c78e7ba45fcebfbafd55a82ba2601ee3ea9617"
version = "0.17.2"
default-features = false
features = [
"compute_aggregate",
"compute_arithmetics",
"compute_boolean",
"compute_boolean_kleene",
"compute_cast",
"compute_comparison",
"compute_concatenate",
"compute_filter",
"compute_if_then_else",
]

[dev-dependencies]
tokio = "1.20.0"
criterion = { version = "0.3", features = ["html_reports", "async_tokio"]}
Expand Down
35 changes: 34 additions & 1 deletion src/record.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use std::fmt::{Debug, Display};

use arrow::datatypes::Field;
use nummer::NDArray;
use serde::{Deserialize, Serialize};
use vlseqid::id::BigID;

use crate::{serialization::BinCode, topic::TOPIC_KEY_PREFIX};
use crate::{serialization::BinCode, topic::TOPIC_KEY_PREFIX, timestamp::Timestamp};

pub type Record = Vec<u8>;

Expand Down Expand Up @@ -63,3 +65,34 @@
self.key.to_string().starts_with(TOPIC_KEY_PREFIX)
}
}

pub struct ValueIteration {
pub revision: u64,
pub version: u64,
}

pub struct RDFValue {
subject: Field,

Check warning on line 75 in src/record.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

fields `subject`, `predicate`, `object`, `iteration`, and `created_at` are never read

Check warning on line 75 in src/record.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

fields `subject`, `predicate`, `object`, `iteration`, and `created_at` are never read

Check warning on line 75 in src/record.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

fields `subject`, `predicate`, `object`, `iteration`, and `created_at` are never read

Check warning on line 75 in src/record.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

fields `subject`, `predicate`, `object`, `iteration`, and `created_at` are never read
predicate: Field,
object: Field,

iteration: ValueIteration,
created_at: Timestamp,
}

impl BinCode for RDFValue {}

pub struct TensorValue<T>
where
T: Clone + Default
{
tensor: NDArray<T>,

Check warning on line 89 in src/record.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

fields `tensor`, `iteration`, and `created_at` are never read

Check warning on line 89 in src/record.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

fields `tensor`, `iteration`, and `created_at` are never read

Check warning on line 89 in src/record.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

fields `tensor`, `iteration`, and `created_at` are never read

Check warning on line 89 in src/record.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

fields `tensor`, `iteration`, and `created_at` are never read

iteration: ValueIteration,
created_at: Timestamp,
}

impl<T> BinCode for TensorValue<T>
where
T: Clone + Default
{}
Loading