diff options
author | Kaiden Fey <kookie@spacekookie.de> | 2020-10-25 05:36:08 +0100 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2020-10-25 05:36:08 +0100 |
commit | 63cd5d0a8d3f77c0267f12a6aef52533cc2f7d09 (patch) | |
tree | d46fb6058a6ade2726154fff76d5bda1d6dfc7e0 /supergit/src/lib.rs | |
parent | 392444d21101ce7b637f2e5a385490605f93ccf1 (diff) |
Adding a whole lot of shit (octopus and supergit)
Diffstat (limited to '')
-rw-r--r-- | supergit/src/lib.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/supergit/src/lib.rs b/supergit/src/lib.rs new file mode 100644 index 0000000..3e02d30 --- /dev/null +++ b/supergit/src/lib.rs @@ -0,0 +1,39 @@ +//! Strongly typed git repository explorer library +//! + +mod branch; +pub use branch::{Branch, BranchCommit}; + +mod commit; +pub use commit::{CommitId, Commit}; + +pub(crate) mod raw; + +use std::sync::atomic::{AtomicUsize, Ordering}; + +/// Represents a git repository with lazy data loading +pub struct Repository {} + +impl Repository { + pub fn open(path: &std::path::Path) -> Self { + todo!() + } + + /// Sync the repository with the backing git files + /// + /// This function can be invoked manually, but should be invoked + /// basically every time your program expects changes to have + /// happened. Polling this function is not recommended. + pub fn sync(&self) { + + } +} + +/////////// IDs are created from the same pool to save on code size //////////// + +const ID_CTR: AtomicUsize = AtomicUsize::new(0); + +/// Get monotonically increasing IDs for objects +pub(crate) fn id() -> usize { + ID_CTR.fetch_add(1, Ordering::Relaxed) +} |