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
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

on:
pull_request:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Bootstrap local path dependencies
shell: bash
run: |
set -euo pipefail

declare -A seen
queue=("$PWD")
seen["$PWD"]=1

while ((${#queue[@]})); do
dir="${queue[0]}"
queue=("${queue[@]:1}")

while IFS= read -r cargo; do
while IFS= read -r dep; do
[[ -n "$dep" ]] || continue
dep_dir="$(cd "$dir/.." && pwd)/$dep"

if [[ ! -d "$dep_dir" ]]; then
echo "Cloning dependency repo: $dep"
git clone --depth 1 "https://github.com/TinyChain-Inc/$dep.git" "$dep_dir"
fi

if [[ -z "${seen[$dep_dir]+x}" ]]; then
queue+=("$dep_dir")
seen["$dep_dir"]=1
fi
done < <(
grep -hoE 'path[[:space:]]*=[[:space:]]*"\.\./[^"]+"' "$cargo" \
| sed -E 's/.*"\.\.\/([^"]+)".*/\1/' \
| sort -u || true
)
done < <(find "$dir" -name Cargo.toml -type f)
done

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo registry + build
uses: Swatinem/rust-cache@v2

- name: Run tests
run: cargo test --verbose
6 changes: 3 additions & 3 deletions examples/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ async fn main() -> Result<(), io::Error> {
let path = setup_tmp_dir().await?;

// initialize the cache
let cache = Cache::<File>::new(BLOCK_SIZE, None);
let cache = Cache::<File>::new(BLOCK_SIZE, None, 0, std::time::Duration::from_secs(3));

// load the directory and file paths into memory (not file contents, yet)
let dir = cache.load(path.clone())?;
Expand All @@ -206,14 +206,14 @@ async fn main() -> Result<(), io::Error> {
],
);

let row1 = vec![
let row1 = [
1.into(),
"one".to_string().into(),
9.into(),
"nine".to_string().into(),
];

let row2 = vec![
let row2 = [
2.into(),
"two".to_string().into(),
8.into(),
Expand Down
1 change: 1 addition & 0 deletions src/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ impl<'a, K: Clone + Eq + Hash + fmt::Debug> QueryPlan<'a, K> {

let mut covered_range = Columns::with_capacity(index.len());
for (i, col_name) in index.columns()[present..].iter().enumerate() {
#[allow(clippy::collapsible_if)] // Keep nested form for stable-toolchain compatibility.
if let Some(order_col) = order.get(supported_order.len() + i) {
if col_name != order_col {
break;
Expand Down
4 changes: 2 additions & 2 deletions src/table/table_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ where

let mut deletes = IndexStack::with_capacity(self.auxiliary.len() + 1);

for (_name, index) in self.auxiliary.iter_mut() {
for index in self.auxiliary.values_mut() {
let index_key = borrow_columns(
&row,
self.primary.schema().columns(),
Expand Down Expand Up @@ -442,7 +442,7 @@ where
pub(super) async fn upsert(&mut self, row: Vec<IS::Value>) -> Result<bool, io::Error> {
let mut inserts = IndexStack::with_capacity(self.auxiliary.len() + 1);

for (_name, index) in self.auxiliary.iter_mut() {
for index in self.auxiliary.values_mut() {
let index_key = clone_columns(
&row,
self.primary.schema().columns(),
Expand Down
Loading