Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed Oct 13, 2020
1 parent 2b79914 commit fa2a816
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/db_3.rs
Expand Up @@ -24,8 +24,7 @@ pub struct Db {
config: DbConfig,
stores: BTreeMap<String, Store>,
fs_thread: Arc<FsThread>,
next_batch: AtomicU64,
next_view: AtomicU64,
next_batch_view: AtomicU64,
}

struct Store {
Expand Down Expand Up @@ -71,8 +70,7 @@ impl Db {
config,
stores,
fs_thread,
next_batch: AtomicU64::new(0),
next_view: AtomicU64::new(0),
next_batch_view: AtomicU64::new(0),
});

fn tree_path(dir: &Path, tree: &str) -> Result<PathBuf> {
Expand All @@ -83,7 +81,7 @@ impl Db {

impl Db {
pub fn new_batch(&self) -> u64 {
let next = self.next_batch.fetch_add(1, Ordering::Relaxed);
let next = self.next_batch_view.fetch_add(1, Ordering::Relaxed);
assert_ne!(next, u64::max_value());
next
}
Expand Down Expand Up @@ -120,7 +118,7 @@ impl Db {

impl Db {
pub fn new_view(&self) -> u64 {
let next = self.next_view.fetch_add(1, Ordering::Relaxed);
let next = self.next_batch_view.fetch_add(1, Ordering::Relaxed);
assert_ne!(next, u64::max_value());
next
}
Expand Down

0 comments on commit fa2a816

Please sign in to comment.