(storage): impl remaining todo! in mock module (#5681)

This commit is contained in:
Federico Gimenez
2023-12-04 23:48:31 +01:00
committed by GitHub
parent 73a5b6ced9
commit f7b08d4ab7

View File

@ -45,7 +45,7 @@ impl DbTx for TxMock {
type DupCursor<T: DupSort> = CursorMock;
fn get<T: Table>(&self, _key: T::Key) -> Result<Option<T::Value>, DatabaseError> {
todo!()
Ok(None)
}
fn commit(self) -> Result<bool, DatabaseError> {
@ -72,7 +72,7 @@ impl DbTxMut for TxMock {
type DupCursorMut<T: DupSort> = CursorMock;
fn put<T: Table>(&self, _key: T::Key, _value: T::Value) -> Result<(), DatabaseError> {
todo!()
Ok(())
}
fn delete<T: Table>(
@ -80,19 +80,19 @@ impl DbTxMut for TxMock {
_key: T::Key,
_value: Option<T::Value>,
) -> Result<bool, DatabaseError> {
todo!()
Ok(true)
}
fn clear<T: Table>(&self) -> Result<(), DatabaseError> {
todo!()
Ok(())
}
fn cursor_write<T: Table>(&self) -> Result<Self::CursorMut<T>, DatabaseError> {
todo!()
Ok(CursorMock { _cursor: 0 })
}
fn cursor_dup_write<T: DupSort>(&self) -> Result<Self::DupCursorMut<T>, DatabaseError> {
todo!()
Ok(CursorMock { _cursor: 0 })
}
}
@ -174,15 +174,15 @@ impl<T: Table> DbCursorRO<T> for CursorMock {
impl<T: DupSort> DbDupCursorRO<T> for CursorMock {
fn next_dup(&mut self) -> PairResult<T> {
todo!()
Ok(None)
}
fn next_no_dup(&mut self) -> PairResult<T> {
todo!()
Ok(None)
}
fn next_dup_val(&mut self) -> ValueOnlyResult<T> {
todo!()
Ok(None)
}
fn seek_by_key_subkey(
@ -190,7 +190,7 @@ impl<T: DupSort> DbDupCursorRO<T> for CursorMock {
_key: <T as Table>::Key,
_subkey: <T as DupSort>::SubKey,
) -> ValueOnlyResult<T> {
todo!()
Ok(None)
}
fn walk_dup(
@ -198,7 +198,7 @@ impl<T: DupSort> DbDupCursorRO<T> for CursorMock {
_key: Option<<T>::Key>,
_subkey: Option<<T as DupSort>::SubKey>,
) -> Result<DupWalker<'_, T, Self>, DatabaseError> {
todo!()
Ok(DupWalker { cursor: self, start: None })
}
}
@ -208,7 +208,7 @@ impl<T: Table> DbCursorRW<T> for CursorMock {
_key: <T as Table>::Key,
_value: <T as Table>::Value,
) -> Result<(), DatabaseError> {
todo!()
Ok(())
}
fn insert(
@ -216,7 +216,7 @@ impl<T: Table> DbCursorRW<T> for CursorMock {
_key: <T as Table>::Key,
_value: <T as Table>::Value,
) -> Result<(), DatabaseError> {
todo!()
Ok(())
}
fn append(
@ -224,20 +224,20 @@ impl<T: Table> DbCursorRW<T> for CursorMock {
_key: <T as Table>::Key,
_value: <T as Table>::Value,
) -> Result<(), DatabaseError> {
todo!()
Ok(())
}
fn delete_current(&mut self) -> Result<(), DatabaseError> {
todo!()
Ok(())
}
}
impl<T: DupSort> DbDupCursorRW<T> for CursorMock {
fn delete_current_duplicates(&mut self) -> Result<(), DatabaseError> {
todo!()
Ok(())
}
fn append_dup(&mut self, _key: <T>::Key, _value: <T>::Value) -> Result<(), DatabaseError> {
todo!()
Ok(())
}
}