fuel-core
fuel-core copied to clipboard
Some improvements during work with the database
Use Option<&[u8]>
instead of Option<Vec<u8>>
in the iter_all
of fuel_core::state::KeyValueStore
. Also decide, do we really need usage of Option
? If len
is zero it is the same as None
. Apply the same change for all upper functions.

Also there in the implementation of the iterator, we can avoid the copy of the slices into vectors. Also think about comment.

Minor improvement in Database::insert
:
To use the same naming across the project in Database::exists
:
If len is zero it is the same as None
Not necessarily, there is value in being able to distinguish between empty values and non-existent ones.
@Voxelot What do you think about renaming all Database
's methods by underscore? To highlight that they are internal methods, and you need to work with StorageMutate
and StorageInspect
.
-
Database::insert
->Database::_insert
-
Database::remove
->Database::_remove
-
Database::get
->Database::_get
-
Database::exists
->Database::_contains_key
-
Database::iter_all
->Database::_iter_all
Hey @xgreenx & @Voxelot, is the issue still open. i'd like to work on it :))
There is in progress PR https://github.com/FuelLabs/fuel-core/pull/643 that is blocked by refactoring https://github.com/FuelLabs/fuel-core/issues/809. The change is almost ready, so it is better to select another issue=D