I want to think about removing the PolyDatabase and only keeping the Database one to simplify the usage of the crate.
A Database<K, D> is always typed on the key and data, which can not be used in certain cases that the PolyDatabase was fulfilling. Fortunately, we could introduce a new UnknowCodec that could either return a runtime error when used to encode/decode or, even better, couldn't be used at compile time as we don't implement the BytesDecode and BytesEncode traits. Can we change the default error message and help the users by forcing them to define the code with a call to remap_types?
If this is too complex we could also use the ByteSlice codec as the default one for when a Database is created with unspecified codecs types.
To Introduce a Database Builder
If we want to introduce a DatabaseBuilder we will need to either create two of them i.e. PolyDatabaseBuilder and DatabaseBuilder, that will switch everytime the DatabaseBuilder::untype or PolyDatabaseBuilder::type will be call or by removing the PolyDatabase type as described above.
I want to think about removing the
PolyDatabase
and only keeping theDatabase
one to simplify the usage of the crate.A
Database<K, D>
is always typed on the key and data, which can not be used in certain cases that thePolyDatabase
was fulfilling. Fortunately, we could introduce a newUnknowCodec
that could either return a runtime error when used to encode/decode or, even better, couldn't be used at compile time as we don't implement theBytesDecode
andBytesEncode
traits. Can we change the default error message and help the users by forcing them to define the code with a call toremap_types
?If this is too complex we could also use the
ByteSlice
codec as the default one for when aDatabase
is created with unspecified codecs types.To Introduce a Database Builder
If we want to introduce a
DatabaseBuilder
we will need to either create two of them i.e.PolyDatabaseBuilder
andDatabaseBuilder
, that will switch everytime theDatabaseBuilder::untype
orPolyDatabaseBuilder::type
will be call or by removing thePolyDatabase
type as described above.