v0.1.0 - The first alpha release of BonsaiDb #175
ecton
announced in
Announcements
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.
v0.1.0
Announcement Blog Post: https://bonsaidb.io/blog/announcing-bonsaidb-alpha
Closed Issues: https://github.com/khonsulabs/bonsaidb/milestone/2?closed=1
All Commits: v0.1.0-dev.4...v0.1.0
Added
bonsaidb::local::adminnow exposes collections that are used to manageBonsaiDb.bonsaidb::local::Storagenow has a unique ID. It will be randomlygenerated upon launch. If for some reason a random value isn't desired, it can
be overridden in the
Configuration.bonsaidb::core::vaultfor more information.Collectionnow defines easier methods for dealingwith documents.
NamedCollectionallows collections that expose a unique nameview to have easy ways to convert between IDs and names.
Backendtrait now defines connection lifecycle functions that can beoverridden to customize behavior when clients connect, disconnect, or
authenticate.
Clientnow has abuild()method to allow for customizing connections.CustomApiresponses can now be sent by the server viaConnectedClient::send(). The client can now register a callback to receiveout-of-band responses.
Backendhas a new associated type,CustomApiDispatcherwhich replacesServer::set_custom_api_dispatcher. This change allows custom api dispatchersto receive the
serverorclientduring initialization if needed. Forexample, if a custom API needs to know the caller's identity, you can store
the
clientin your dispatcher and access it in your handlers.Backendhas a new associated type:ClientData. This associated type can beused to associate data on a per-
ConnectedClientbasis.ServerConfigurationhas a new setting:client_simultaneous_request_limit. It controls the amount of querypipelining a single connection can achieve. Submitting more queries on a
single connection will block reading additional requests from the network
connection until responses have been sent.
ServerConfigurationnow supportsauthenticated_permissions,allowing a set of permissions to be defined that are applied to any user that
has successfully authenticated.
CollectionViewis a new trait that can be implemented instead ofView. Themap()function takes aCollectionDocumentparameter that is alreadydeserialized for you.
bonsaidb_corenow has two new macros to ease some tedium of writing simpleviews:
define_basic_mapped_viewanddefine_basic_unique_mapped_view.loginternally to reporterrors that are being ignored or happened in a background task.
instrumentation using the
tracingecosystem.database()functions toStorageConnection. This allows fullygeneric code to be written against a "server".
listen_for_shutdown()which listens for SIGINT and SIGQUIT and attempsto shut the server down gracefully.
443. This is automatically performed if the feature flag is enabled.
TLS. This is primarily designed to allow extending the HTTP port to support
additional HTTP endpoints than just websockets. However, because the TLS
certificate aquired on port 443 can be used in other protocols such as SMTP,
it can be useful to allow BonsaiDb to control the networking connections.
listen_for_tcp_onandlisten_for_secure_tcp_onaccept a parameter thatimplements the
TcpServicetrait. See the Axum example for how thisintegration can be used in conjunction with websockets.
TransactionandOperationto make it easierto build multi-operation transactions.
Keytrait is now automatically implemented for tuples of up to 8 entriesin length.
CollectionDocument::modify()enables updating a document using a flow thatwill automatically fetch the document if a conflict is detected, re-invoking
the callback to redo the modifications. This is useful for situations where
you may have cached a document locally and wish to update it in the future,
but don't want to refresh it before saving. It also will help, in general,
with saving documents that might have some contention.
CustomServer::authenticate_client_as()allows setting aConnectedClient'sauthenticated user, skipping BonsaiDb's authentication. This allows developers
to still utilize the users and permissions within BonsaiDb while
authenticating via some other mechanism.
SerializedCollection::list()andSerializedCollection::get_multiple()havebeen added to make it easier to retrieve
CollectionDocument<T>s.Changed
Configuration has been refactored to use a builder-style pattern.
bonsaidb::local::config::Configurationhas been renamedStorageConfiguration, andbonsaidb::server::ServerConfigurationhas beenrenamed
ServerConfiguration.Database::open_localandStorage::open_localhave been renamed toopen.Database::open,Storage::open, andServer::openno longer take a pathargument. The path is provided from the configuration.
Listing all schemas and databases will now include the built-in admin database.
The underlying dependency on
sledhas been changed for an in-house storageimplementation
nebari.The command-line interface has received an overhaul.
CommandLinecan be implemented on a type that implementsBackendto utilize the built-in, extensible command line interface. Anexample of this is located at
./examples/basic-server/examples/cli.rs.execute()functions have changed.3.0 once it is fully released.
View::mapnow returns aMappingsinstead of anOption, allowing foremitting of multiple keys.
View mapping now stores the source document header, not just the ID.
ServerConfiguration::default_permissionshas been changed into aDefaultPermissionsenum.Changed the default serialization format from
CBORto an in-house format,Pot.Keynow has a new associated constant:LENGTH. If a value is provided, theresult of converting the value should always produce the length specified.
This new information is used to automatically implement the
Keytrait fortuples.
The
Keyimplementation forEnumKeyhas been updated to useordered-varintto minimize the size of the indexes. Previously, each entryin the view was always 8 bytes.
ConnectionandSerializedCollectionhave had theirinsert/insert_intofunctions modified to include an id parameter. New functions named
pushandpush_intohave been added that do not accept an id parameter. This is in aneffort to keep naming consistent with common collection names in Rust.
Operation::insertandCommand::Insertnow take an optional u64 parameterwhich can be used to insert a document with a specific ID rather than having
one chosen. If an document exists already, a conflict error will be returned.
bonsaidb::local::backuphas been replaced withStorage::backupandStorage::restore. This backup format is incompatible with the old format,but is built with proper support for restoring at-rest encrypted collections.
Backups are not encrypted, but the old implementation could not be updated
to support restoring the documents into an encrypted state.
This new functionality exposes
BackupLocation, an async_trait that enablesarbitrary backup locations.
KeyValuestorage has internally changed its format. Because this waspre-alpha, this data loss was premitted. If this is an issue for anyone, the
data is still there, the format of the key has been changed. By editing any
database files directly using Nebari, you can change the format from
"namespace.key" to "namespace\0key", where
\0is a single null byte.ExecutedTransactions::changesis now aChangesenum, which can be a listof
ChangedDocuments orChangedKeys.The Key-Value store is now semi-transactional and more optimized. The behavior
of persistence can be customized using the
key_value_persistenceoption
when opening a BonsaiDb instance. This can enable higher performace at the
risk of data loss in the event of an unexpected hardware or power failure.
A new trait,
SerializedCollection, now controls serialization withinCollectionDocument,CollectionView, and other helper methods thatserialized document contents. This allows any serialization format that
implements
transmog::Formatcan be used within BonsaiDb by setting theFormatassociated type within yourSerializedCollectionimplementation.For users who just want the default serialization, a convenience trait
DefaultSerializationhas been added. All types that implement this traitwill automatically implement
SerializedCollectionusing BonsaiDb's preferredsettings.
A new trait,
SerializedView, now controls serialization of view values. Thisuses a similar approach to
SerializedCollection. For users who just want thedefault serialization, a convenience trait
DefaultViewSerializationhas beenadded. All types that implement this trait will automatically implement
SerializedViewusing BonsaiDb's preferred settings.The
view-histogramexample has been updated to define a customtransmog::Formatimplementation rather creating a Serde-based wrapper.Viewhas been split into two traits to allow separating client and serverlogic entirely if desired. The
ViewSchematrait is wheremap(),reduce(),version(), andunique()have moved. If you're using aCollectionView, the implementation should now be a combination ofViewandCollectionViewSchema.CollectionName,SchemaName, andNameall no longer generate errors ifusing invalid characters. When BonsaiDb needs to use these names in a context
that must be able to be parsed, the names are encoded automatically into a
safe format. This change also means that
View::view_name(),Collection::collection_name(), andSchema::schema_name()have been updatedto not return error types.
The
Documenttype has been renamed toOwnedDocument. A trait namedDocumenthas been introduced that contains most of the functionality ofDocument, but is now implemented byOwnedDocumentin addition to a newtype:
BorrowedDocument. Most APIs have been updated to returnOwnedDocuments. The View mapping process receives aBorrowedDocumentwithin the
map()function.This refactor changes the signatures of
ViewSchema::map(),ViewSchema::reduce(),CollectionViewSchema::map(), andCollectionViewSchema::reduce().The benefit of this breaking change is that the view mapping process now can
happen with fewer copies of data.
A new function,
query_with_collection_docs()is provided that isfunctionally identical to
query_with_docs()except the return type containsalready deserialized
CollectionDocument<T>s.Moved
CollectionDocumentfrombonsaidb_core::schematobonsaidb_core::document.Due to issues with unmaintained crates, X25519 has been swapped for P256 in
the vault implementation. This is an intra-alpha breaking change. Use the
backup functionality with the existing version of BonsaiDb to export a
decrypted version of your data that you can restore into the new version of
BonsaiDb.
If you have encryption enabled but aren't actually storing any encrypted data yet, you can remove these files from inside your database:
mydb.bonsaidb/master-keysmydb.bonsaidb/vault-keys/(or remove the keys from your S3 bucket)query_with_docs()andquery_with_collection_docs()now return aMappedDocumentsstructure, which contains a list of mappings and aBTreeMapcontaining the associated documents. Documents are allowed to emitmore than one mapping, and due to that design, a single document can be
returned multiple times.
Fixed
This discussion was created from the release v0.1.0 - The first alpha release of BonsaiDb.
All reactions