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
-
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::admin
now exposes collections that are used to manageBonsaiDb
.bonsaidb::local::Storage
now 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::vault
for more information.Collection
now defines easier methods for dealingwith documents.
NamedCollection
allows collections that expose a unique nameview to have easy ways to convert between IDs and names.
Backend
trait now defines connection lifecycle functions that can beoverridden to customize behavior when clients connect, disconnect, or
authenticate.
Client
now has abuild()
method to allow for customizing connections.CustomApi
responses can now be sent by the server viaConnectedClient::send()
. The client can now register a callback to receiveout-of-band responses.
Backend
has a new associated type,CustomApiDispatcher
which replacesServer::set_custom_api_dispatcher
. This change allows custom api dispatchersto receive the
server
orclient
during initialization if needed. Forexample, if a custom API needs to know the caller's identity, you can store
the
client
in your dispatcher and access it in your handlers.Backend
has a new associated type:ClientData
. This associated type can beused to associate data on a per-
ConnectedClient
basis.ServerConfiguration
has 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.
ServerConfiguration
now supportsauthenticated_permissions
,allowing a set of permissions to be defined that are applied to any user that
has successfully authenticated.
CollectionView
is a new trait that can be implemented instead ofView
. Themap()
function takes aCollectionDocument
parameter that is alreadydeserialized for you.
bonsaidb_core
now has two new macros to ease some tedium of writing simpleviews:
define_basic_mapped_view
anddefine_basic_unique_mapped_view
.log
internally to reporterrors that are being ignored or happened in a background task.
instrumentation using the
tracing
ecosystem.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_on
andlisten_for_secure_tcp_on
accept a parameter thatimplements the
TcpService
trait. See the Axum example for how thisintegration can be used in conjunction with websockets.
Transaction
andOperation
to make it easierto build multi-operation transactions.
Key
trait 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::Configuration
has been renamedStorageConfiguration
, andbonsaidb::server::ServerConfiguration
has beenrenamed
ServerConfiguration
.Database::open_local
andStorage::open_local
have been renamed toopen
.Database::open
,Storage::open
, andServer::open
no 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
sled
has been changed for an in-house storageimplementation
nebari
.The command-line interface has received an overhaul.
CommandLine
can be implemented on a type that implementsBackend
to 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::map
now returns aMappings
instead of anOption
, allowing foremitting of multiple keys.
View mapping now stores the source document header, not just the ID.
ServerConfiguration::default_permissions
has been changed into aDefaultPermissions
enum.Changed the default serialization format from
CBOR
to an in-house format,Pot
.Key
now 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
Key
trait fortuples.
The
Key
implementation forEnumKey
has been updated to useordered-varint
to minimize the size of the indexes. Previously, each entryin the view was always 8 bytes.
Connection
andSerializedCollection
have had theirinsert
/insert_into
functions modified to include an id parameter. New functions named
push
andpush_into
have been added that do not accept an id parameter. This is in aneffort to keep naming consistent with common collection names in Rust.
Operation::insert
andCommand::Insert
now 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::backup
has been replaced withStorage::backup
andStorage::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.
KeyValue
storage 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
\0
is a single null byte.ExecutedTransactions::changes
is now aChanges
enum, which can be a listof
ChangedDocument
s orChangedKey
s.The Key-Value store is now semi-transactional and more optimized. The behavior
of persistence can be customized using the
key_value_persistence
option
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::Format
can be used within BonsaiDb by setting theFormat
associated type within yourSerializedCollection
implementation.For users who just want the default serialization, a convenience trait
DefaultSerialization
has been added. All types that implement this traitwill automatically implement
SerializedCollection
using 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
DefaultViewSerialization
has beenadded. All types that implement this trait will automatically implement
SerializedView
using BonsaiDb's preferred settings.The
view-histogram
example has been updated to define a customtransmog::Format
implementation rather creating a Serde-based wrapper.View
has been split into two traits to allow separating client and serverlogic entirely if desired. The
ViewSchema
trait is wheremap()
,reduce()
,version()
, andunique()
have moved. If you're using aCollectionView
, the implementation should now be a combination ofView
andCollectionViewSchema
.CollectionName
,SchemaName
, andName
all 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
Document
type has been renamed toOwnedDocument
. A trait namedDocument
has been introduced that contains most of the functionality ofDocument
, but is now implemented byOwnedDocument
in addition to a newtype:
BorrowedDocument
. Most APIs have been updated to returnOwnedDocument
s. The View mapping process receives aBorrowedDocument
within 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
CollectionDocument
frombonsaidb_core::schema
tobonsaidb_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-keys
mydb.bonsaidb/vault-keys/
(or remove the keys from your S3 bucket)query_with_docs()
andquery_with_collection_docs()
now return aMappedDocuments
structure, which contains a list of mappings and aBTreeMap
containing 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.
Beta Was this translation helpful? Give feedback.
All reactions