Skip to content

Commit

Permalink
Merge pull request #8 from FalkorDB/delta-matrix
Browse files Browse the repository at this point in the history
implement delta matrix
  • Loading branch information
swilly22 authored Sep 26, 2024
2 parents dcd9b1b + 052643d commit 8a82588
Show file tree
Hide file tree
Showing 17 changed files with 18,412 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ jobs:
run: cargo fmt --check
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
# - name: Run tests
# run: cargo test --verbose
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ crate-type = ["staticlib", "rlib"]
falkordb_allocator = []

[dependencies]
libc = "0.2.153"
25 changes: 25 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use std::env;

fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-env-changed=BINROOT");

let bin_root = env::var("BINROOT");
if let Ok(bin_root) = bin_root {
let graphblas_dir = env::var("GRAPHBLAS_BINDIR").unwrap();
let clang = env::var("CLANG").unwrap_or("0".to_string());

println!("cargo:rustc-link-arg=-Wl,-rpath,{bin_root}/src");
println!("cargo:rustc-link-arg={bin_root}/src/falkordb.so");
println!("cargo:rustc-link-arg=-L{graphblas_dir}");
println!("cargo:rustc-link-arg=-lgraphblas");
if clang == "1" {
println!("cargo:rustc-link-arg=-L/opt/homebrew/opt/libomp/lib");
println!("cargo:rustc-link-arg=-L/usr/lib/llvm-17/lib");
println!("cargo:rustc-link-arg=-L/usr/lib/llvm-18/lib/");
println!("cargo:rustc-link-arg=-lomp");
} else {
println!("cargo:rustc-link-arg=-lgomp");
}
}
}
2 changes: 2 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Documentation
missing-docs-in-crate-items = true
42 changes: 32 additions & 10 deletions src/binding/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,8 @@ pub type SchemaID = i32;
pub type RelationID = i32;
pub type AttributeID = i32;
pub type AttributeSet = *mut c_void;

#[repr(C)]
pub struct Graph {
// TODO
}

#[repr(C)]
pub struct GraphContext {
// TODO
}
pub type Graph = c_void;
pub type GraphContext = c_void;

#[repr(C)]
#[derive(Copy, Clone, PartialEq)]
Expand Down Expand Up @@ -83,6 +75,27 @@ impl Edge {
}
}

#[repr(C)]
pub enum ConfigOptionField {
TIMEOUT = 0, // timeout value for queries
TIMEOUT_DEFAULT = 1, // default timeout for read and write queries
TIMEOUT_MAX = 2, // max timeout that can be enforced
CACHE_SIZE = 3, // number of entries in cache
ASYNC_DELETE = 4, // delete graph asynchronously
OPENMP_NTHREAD = 5, // max number of OpenMP threads to use
THREAD_POOL_SIZE = 6, // number of threads in thread pool
RESULTSET_MAX_SIZE = 7, // max number of records in result-set
VKEY_MAX_ENTITY_COUNT = 8, // max number of elements in vkey
MAX_QUEUED_QUERIES = 9, // max number of queued queries
QUERY_MEM_CAPACITY = 10, // max mem(bytes) that query/thread can utilize at any given time
DELTA_MAX_PENDING_CHANGES = 11, // number of pending changes before Delta_Matrix flushed
NODE_CREATION_BUFFER = 12, // size of buffer to maintain as margin in matrices
CMD_INFO = 13, // toggle on/off the GRAPH.INFO
CMD_INFO_MAX_QUERY_COUNT = 14, // the max number of info queries count
EFFECTS_THRESHOLD = 15, // bolt protocol port
BOLT_PORT = 16, // replicate queries via effects
}

extern "C" {
fn Graph_CreateNode(
g: *mut Graph,
Expand Down Expand Up @@ -163,6 +176,15 @@ extern "C" {
e: *mut Edge,
);
pub fn AttributeSet_Free(set: *mut AttributeSet);
pub fn Config_Option_get(
field: ConfigOptionField,
...
) -> bool;
pub fn Config_Option_set(
field: ConfigOptionField,
val: *const c_char,
err: *mut *mut c_char,
) -> bool;
}

pub struct GraphAPI {
Expand Down
Loading

0 comments on commit 8a82588

Please sign in to comment.