Skip to content

Commit

Permalink
feat(crdt): Add is_tombstoned method and refactor ListCRDT
Browse files Browse the repository at this point in the history
Adds public is_tombstoned method to CRDT class for checking
record deletion status. Refactors ListCRDT for improved
readability, consistency, and performance. Updates comments
and formatting throughout the code.
  • Loading branch information
sinkingsugar committed Oct 5, 2024
1 parent 493f428 commit eb33c15
Show file tree
Hide file tree
Showing 2 changed files with 308 additions and 288 deletions.
17 changes: 17 additions & 0 deletions crdt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,23 @@ template <typename K, typename V> class CRDT : public std::enable_shared_from_th
}
}

// Add this public method to the CRDT class
/// Checks if a record is tombstoned.
///
/// # Arguments
///
/// * `record_id` - The unique identifier for the record.
/// * `ignore_parent` - If true, only checks the current CRDT instance, ignoring the parent.
///
/// # Returns
///
/// True if the record is tombstoned, false otherwise.
///
/// Complexity: O(1) average case for hash table lookup
bool is_tombstoned(const K &record_id, bool ignore_parent = false) const {
return is_record_tombstoned(record_id, ignore_parent);
}

private:
CrdtNodeId node_id_;
LogicalClock clock_;
Expand Down
Loading

0 comments on commit eb33c15

Please sign in to comment.