use crate::mmr::Location; use commonware_utils::Array; /// An operation that can be applied to a database. pub trait Operation { /// The key type for this operation. type Key: Array; /// Returns the key if this operation involves a key, None otherwise. fn key(&self) -> Option<&Self::Key>; /// If this operation updates its key's value. fn is_update(&self) -> bool; /// If this operation deletes its key's value. fn is_delete(&self) -> bool; /// The inactivity floor location if this operation is a commit operation with a floor value, /// None otherwise. fn has_floor(&self) -> Option; } /// A trait for operations used by database variants that support commit operations. pub trait Committable { /// If this operation is a commit operation. fn is_commit(&self) -> bool; }