-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move minimal structs into raphtory-api * clippy * fmt * no raphtory-arrow * no default features * no changes to ra * more fmt * add raphtory-api to publish as well
- Loading branch information
1 parent
0fc1fe2
commit f470292
Showing
63 changed files
with
458 additions
and
518 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[package] | ||
name = "raphtory-api" | ||
version.workspace = true | ||
documentation.workspace = true | ||
repository.workspace = true | ||
license.workspace = true | ||
readme.workspace = true | ||
homepage.workspace = true | ||
keywords.workspace = true | ||
authors.workspace = true | ||
rust-version.workspace = true | ||
edition.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
serde = { workspace = true, features = ["derive"] } | ||
chrono.workspace = true |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod edge_ref; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use self::edges::edge_ref::EdgeRef; | ||
|
||
pub mod edges; | ||
|
||
// the only reason this is public is because the physical ids of the nodes don't move | ||
#[repr(transparent)] | ||
#[derive( | ||
Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Deserialize, Serialize, Default, | ||
)] | ||
pub struct VID(pub usize); | ||
|
||
impl VID { | ||
pub fn index(&self) -> usize { | ||
self.0 | ||
} | ||
|
||
pub fn as_u64(&self) -> u64 { | ||
self.0 as u64 | ||
} | ||
} | ||
|
||
impl From<usize> for VID { | ||
fn from(id: usize) -> Self { | ||
VID(id) | ||
} | ||
} | ||
|
||
impl From<VID> for usize { | ||
fn from(id: VID) -> Self { | ||
id.0 | ||
} | ||
} | ||
|
||
#[repr(transparent)] | ||
#[derive( | ||
Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Deserialize, Serialize, Default, | ||
)] | ||
pub struct EID(pub usize); | ||
|
||
impl From<EID> for usize { | ||
fn from(id: EID) -> Self { | ||
id.0 | ||
} | ||
} | ||
|
||
impl From<usize> for EID { | ||
fn from(id: usize) -> Self { | ||
EID(id) | ||
} | ||
} | ||
|
||
#[derive( | ||
Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Deserialize, Serialize, Default, | ||
)] | ||
pub struct ELID { | ||
edge: EID, | ||
layer: Option<usize>, | ||
} | ||
|
||
impl ELID { | ||
pub fn new(edge: EID, layer: Option<usize>) -> Self { | ||
Self { edge, layer } | ||
} | ||
pub fn pid(&self) -> EID { | ||
self.edge | ||
} | ||
|
||
pub fn layer(&self) -> Option<usize> { | ||
self.layer | ||
} | ||
} | ||
|
||
impl From<EdgeRef> for ELID { | ||
fn from(value: EdgeRef) -> Self { | ||
ELID { | ||
edge: value.pid(), | ||
layer: value.layer().copied(), | ||
} | ||
} | ||
} | ||
impl EID { | ||
pub fn from_u64(id: u64) -> Self { | ||
EID(id as usize) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
pub mod entities; | ||
pub mod storage; | ||
|
||
/// Denotes the direction of an edge. Can be incoming, outgoing or both. | ||
#[derive( | ||
Clone, | ||
Copy, | ||
Hash, | ||
Eq, | ||
PartialEq, | ||
PartialOrd, | ||
Debug, | ||
Default, | ||
serde::Serialize, | ||
serde::Deserialize, | ||
)] | ||
pub enum Direction { | ||
OUT, | ||
IN, | ||
#[default] | ||
BOTH, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod timeindex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
use std::{fmt, ops::Range}; | ||
|
||
use chrono::{DateTime, Utc}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Ord, PartialOrd, Eq)] | ||
pub struct TimeIndexEntry(pub i64, pub usize); | ||
|
||
pub trait AsTime: fmt::Debug + Copy + Ord + Eq + Send + Sync + 'static { | ||
fn t(&self) -> i64; | ||
|
||
fn dt(&self) -> Option<DateTime<Utc>> { | ||
let t = self.t(); | ||
DateTime::from_timestamp_millis(t) | ||
} | ||
|
||
fn range(w: Range<i64>) -> Range<Self>; | ||
|
||
fn i(&self) -> usize { | ||
0 | ||
} | ||
|
||
fn new(t: i64, s: usize) -> Self; | ||
} | ||
|
||
impl From<i64> for TimeIndexEntry { | ||
fn from(value: i64) -> Self { | ||
Self::start(value) | ||
} | ||
} | ||
|
||
impl TimeIndexEntry { | ||
pub const MIN: TimeIndexEntry = TimeIndexEntry(i64::MIN, 0); | ||
|
||
pub const MAX: TimeIndexEntry = TimeIndexEntry(i64::MAX, usize::MAX); | ||
pub fn new(t: i64, s: usize) -> Self { | ||
Self(t, s) | ||
} | ||
|
||
pub fn start(t: i64) -> Self { | ||
Self(t, 0) | ||
} | ||
|
||
pub fn end(t: i64) -> Self { | ||
Self(t.saturating_add(1), 0) | ||
} | ||
} | ||
|
||
impl AsTime for i64 { | ||
fn t(&self) -> i64 { | ||
*self | ||
} | ||
|
||
fn range(w: Range<i64>) -> Range<Self> { | ||
w | ||
} | ||
|
||
fn new(t: i64, _s: usize) -> Self { | ||
t | ||
} | ||
} | ||
|
||
impl AsTime for TimeIndexEntry { | ||
fn t(&self) -> i64 { | ||
self.0 | ||
} | ||
fn range(w: Range<i64>) -> Range<Self> { | ||
Self::start(w.start)..Self::start(w.end) | ||
} | ||
|
||
fn i(&self) -> usize { | ||
self.1 | ||
} | ||
|
||
fn new(t: i64, s: usize) -> Self { | ||
Self(t, s) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod core; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
[package] | ||
name = "raphtory-arrow" | ||
version = "0.8.1" | ||
[dependencies] | ||
version = "0.8.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.