v0.2.0 #205
ecton
announced in
Announcements
v0.2.0
#205
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Breaking Changes
bonsaidb::core::Error::DocumentConflictnow contains aHeaderinstead ofjust the document's ID. This allows an application to re-submit an update with
the updated header without another request to the database.
StorageConfiguratation::vault_key_storagenow uses anArcinstead of aBox. This change allowsStorageConfigurationandServerConfigurationtoimplement
Clone.Document::create_new_revisionhas been removed. It was meant to be aninternal function.
Documentnow requiresAsRef<Header>andAsMut<Header>instead ofDeref<Header>/DerefMut. The publicly visible change is that the shortcutof accessing
document.header.emit_*through deref by usingdocument.emit_*will no longer work. This impacts
CollectionDocument,OwnedDocument, andBorrowedDocument.This removes a little magic, but in some code flows, it was impossible to use
Deref anyways due to Deref borrowing the entire document, not just the header.
Collection::PrimaryKeyis a new associated type that allows customizing thetype that uniquely identifies documents inside of a
Collection. Users of thederive macro will be unaffected by this change. If you're upgrading existing
collections and wish to maintain backwards compatibility, use
u64as thetype.
A
natural_id()function can now be implemented onSerializedCollectionorDefaultSerializationwhich allows extracting a primary key value from a newdocument being pushed
A new example,
primary-keys.rs, as been added showing basic usage ofchanging the primary key type. This change resulted in a sequnce of breaking
changes that will be listed independently.
Keyhas been moved frombonsaidb::core::schema::viewtobonsaidb::core::key.Key::as/from_big_endian_byteshave been renamed toKey::as/from_ord_bytes.Key::first_value()andKey::next_value()are new provided functions. Bydefault, these functions return
NextValueError::Unsupported.Key::first_value()allows aKeytype to define the first value in itssequence. For example,
0_u64is the result ofu64::first_value().Key::next_value()allows aKeytype to find the next value in sequencefrom the current value. Implementors should never wrap, and should instead
return
NextValueError::WouldWrap.Sensible defaults have been implemented for all numeric types.
Connectionand its related types have had all previously hard-codedprimary keys pf
u64changed to generic parameters that can accept either aDocumentIdorCollection::PrimaryKey. The affected methods are:Connection::insertConnection::overwriteConnection::getConnection::get_multipleConnection::listconnection::Collection::insertconnection::Collection::overwriteconnection::Collection::getconnection::Collection::get_multipleconnection::Collection::listSerializedCollection::insertSerializedCollection::insert_intoSerializedCollection::overwriteSerializedCollection::overwrite_intoSerializedCollection::getSerializedCollection::get_multipleSerializedCollection::listtransaction::Operation::insert_serializedtransaction::Operation::overwrite_serializedHeader::idhas changed fromu64toDocumentId, andCollectionHeader<PrimaryKey>has been added which containsCollection::PrimaryKeydeserialized.These previous usages of
Headerhave been changed toCollectionHeader:Connection::insertresult typeConnection::overwriteresult typeconnection::Collection::insertresult typeconnection::Collection::insert_bytesresult typeconnection::Collection::pushresult typeconnection::Collection::push_bytesresult typeCollectionDocument::headerThe
Header::emit*functions have been moved to a new trait,Emit. Thistrait is implemented by both
HeaderandCollectionHeader. The functions moved are:emit()emit_key()emit_value()emit_key_and_value()These functions now return a
Result, as encoding a primary key value canfail if it is larger than
DocumentId::MAX_LENGTH.HasHeaderis a new trait that allows accessing aHeadergenerically frommany types. This type is used in
Connection::deleteandconnection::Collection::delete.Types and functions that used
u64as a document ID have been replaced withDocumentIds. The number of locations are too many to list. If you need toconvert from a u64 to a
DocumentId, you can useDocumentId::from_u64().Document::contentsandDocument::set_contentsare now ore "painful" toaccess due to the generic parameter added to
Document.SerializedCollection::document_contents(doc)andSerializedCollection::set_document_contents(doc, new_contents)have beenprovided as easier ways to invoke the same functionality. For example:
Becomes:
Backups made prior to
0.2.0will not be able to be restored with thisupdated version. The document IDs are encoded differently than in prior
versions.
Added
Optional compression is now available, using the LZ4 algorithm.
StorageConfiguration::default_compressioncontrols the setting. When usingthe
bonsaidbcrate, the feature can be made available using eitherlocal-compressionorserver-compression. When usingbonsaidb-serverorbonsaidb-localdirectly, the feature name iscompression.This compression is currently applied on all chunks of data written to
BonsaiDb that are larger than a hardcoded threshold. This includes the
Key-Value store. The threshold may be configurable in the future.
Some of the benchmark suite has been expanded to include comparisons between
local storage with and without compression.
Added ability to "overwrite" documents without checking the stored revision
information. Because this removes a layer of safety, it has its own permissible
action:
DocumentAction::Overwrite. The functions that have been added are:connection::Connection::overwriteconnection::Collection::overwriteschema::SerializedCollection::overwriteschema::SerializedCollection::overwrite_intodocument::CollectionDocument::overwritetransaction::Transaction::overwritetransaction::Operation::overwriteChanged
Internal dependencies between crates are now pinned based on their needs. This
means that
bonsaidb-severwill require a matching verison ofbonsaidb-localwhen compiling. A simple example of a change that is abreaking compilation change but is not breaking from a compatibility
standpoint is a change to a structure where
#[serde(rename)]is used toremap an old value to a new value.
The only crate currently not pinning its dependencies is
bonsaidb-keystorage-s3. This crate, and hopefully many crates to come, areonly tying themselves to the public API of BonsaiDb.
This may generate slightly more crate updates than absolutely necessary, but
for a small team it seems like the most manageable approach.
Fixed
version specified in the view definiton. This allows internal structures to be
upgraded transparently.
mapping job has finished if the view's integrity check spawns one before
allowing the transaction to begin.
This discussion was created from the release v0.2.0.
All reactions