Skip to content

Commit

Permalink
Merge pull request #589 from hivedb/nnbd
Browse files Browse the repository at this point in the history
Merging non nullable version into master
  • Loading branch information
themisir authored Mar 7, 2021
2 parents 59ad540 + 18a7d8f commit 2279300
Show file tree
Hide file tree
Showing 100 changed files with 2,416 additions and 760 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
pub global activate test_coverage
pub global run test_coverage --exclude "**/js/**"
working-directory: hive
- uses: codecov/[email protected]
- uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
file: hive/coverage/lcov.info
13 changes: 7 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ on: [push, pull_request]
jobs:
test-hive:
runs-on: ubuntu-latest

strategy:
matrix:
test-platform: [vm, chrome]
dart-channel: [stable, unstable]

dart-channel: [unstable]
steps:
- uses: actions/checkout@v1
- name: Install Dart
Expand All @@ -25,15 +23,18 @@ jobs:
run: |
export PATH="$PATH:/usr/lib/dart/bin"
pub get
pub run test -p ${{ matrix.test-platform }}
pub run --no-sound-null-safety test -p ${{ matrix.test-platform }}
working-directory: hive

check-score:
if: false
runs-on: ubuntu-latest
strategy:
matrix:
package: [hive, hive_generator, hive_flutter]
steps:
- uses: actions/checkout@v1
- uses: axel-op/dart_package_analyzer@stable
- uses: axel-op/dart-package-analyzer@v3
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
relativePath: ${{ matrix.package }}
minAnnotationLevel: warning
70 changes: 69 additions & 1 deletion hive/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,45 @@
# 2.0.0

### Fixes

- Stable null-safety version

# 1.6.0-nullsafety.2

### Fixes

- Added `defaultValue` property to `@HiveField()` annotation - [#557](https://github.com/hivedb/hive/pull/557)

# 1.6.0-nullsafety.1

### Fixes

- Changed `meta` dependency version to `^1.3.0-nullsafety` to support null-safety

# 1.6.0-nullsafety.0

### Breaking changes

- Migrate to null-safety - [#521](https://github.com/hivedb/hive/pull/521)
- Update minimum Dart sdk constraint to 2.12.0-0.
- In order to generate null-safe code use hive_generator >= 0.9.0-nullsafety.0

# 1.5.0-pre

### Enhancements

- Timezone support for DateTime - [#419](https://github.com/hivedb/hive/issues/419)

# 1.4.4+1

### Fixes

- Browser support for `BackendManager.boxExists(boxName, path)` - [#451](https://github.com/hivedb/hive/issues/451)

# 1.4.4

### Fixes

- Edge browser support - [#357](https://github.com/hivedb/hive/issues/357)

# 1.4.3
Expand All @@ -27,70 +56,85 @@
# 1.4.2

### Fixes

- Fixed dependency issues and minor improvements

# 1.4.1+1

### Other

- Added docs to all public members

# 1.4.1

### Enhancements

- Minor performance improvements

### Fixes

- When a database operation failed, subsequent operations would not be performed

### Other

- Fixed GitHub homepage path

# 1.4.0+1

### Enhancements

- Minor performance improvements

### Fixes

- Allow more versions of `crypto`

# 1.4.0

### Enhancements

- ~1000% encryption / decryption performance improvement
- Added option to implement custom encryption algorithm
- Added `box.valuesBetween(startKey, endKey)`
- Allow tree shaking to drop encryption engine if no encryption is used

### Fixes

- `Hive.deleteBoxFromDisk()` did not work for boxes with upper-case names

### More

- Deprecated `encryptionKey` parameter. Use `Hive.openBox('name', encryptionCipher: HiveAesCipher(yourKey))`.
- Dropped `pointycastle` dependency
- Dropped `path` dependency

# 1.3.0

*Use latest version of `hive_generator`*
_Use latest version of `hive_generator`_

### Breaking changes

- `TypeAdapters` and `@HiveType()` now require a `typeId`
- `Hive.registerAdapter()` does not need a `typeId` anymore.
- Removed `BinaryReader.readAsciiString()`
- Removed `BinaryWriter.writeAsciiString()`

### Enhancements

- New documentation with tutorials and live code

### Fixes

- `box.clear()` resets auto increment counter

### More

- Not calling `Hive.init()` results in better exception

# 1.2.0

### Breaking changes

- Removed the `Hive.path` getter
- Removed `Hive.openBoxFromBytes()` (use the `bytes` parameter of `Hive.openBox()` instead)
- `LazyBox` and `Box` now have a common parent class: `BoxBase`
Expand All @@ -99,6 +143,7 @@
- Box name bug resolved (more information below)

### Enhancements

- Support for relationships, `HiveLists` (see docs for details)
- Support for inheritance
- Lazy boxes can now have a type argument `LazyBox<YourModel>`
Expand All @@ -107,16 +152,19 @@
- Improved documentation

### Fixes

- `HiveObjects` have not been initialized correctly in lazy boxes
- Fixed bug where uppercase box name resulted in an uppercase filename
- Fixed compaction bug which caused corrupted boxes
- Fixed bug which did not allow the key `0xFFFFFFFF`
- Fixed bug where not all `BoxEvent`s have been broadcasted

### More

- Changed type of `encryptionKey` from `Uint8List` to `List<int>`

### Important:

Due to a bug in previous Hive versions, boxes whose name contains uppercase characters were stored in a file that also contains upper case characters (e.g. 'myBox' -> 'myBox.hive').

To avoid different behavior on case sensitive file systems, Hive should store files with lower case names. This bug has been resolved in version 1.2.0.
Expand All @@ -127,52 +175,63 @@ This also applies to the web version.
# 1.1.1

### Breaking changes

- `object.delete()` now throws exception if object is not stored in a box

### Fixes

- Fixed bug where `object.save()` would fail on subsequent calls

# 1.1.0+2

### Fixes

- Fixed bug that it was not possible to open typed boxes (`Box<E>`)

# 1.1.0+1

### Fixes

- Fixed bug that corrupted boxes were not detected

# 1.1.0

### Breaking changes

- Changed return type of `addAll()` from `List<int>` to `Iterable<int>`.
- Removed the option to register `TypeAdapters` for a specific box. E.g. `box.registerTypeAdapter()`.
- `getAt()`, `putAt()`, `deleteAt()` and `keyAt()` no longer allow indices out of range.

### Enhancements

- Added `HiveObject`
- Boxes have now an optional type parameter `Box<E>`
- Support opening boxes from assets

### Fixes

- Fixed bug which was caused by not awaiting write operations
- Fixed bug where custom compaction strategy was not applied
- Hive now locks box files while they are open to prevent concurrent access from multiple processes

### More

- Improved performance of `putAll()`, `deleteAll()`, `add()`, `addAll()`
- Changed `values` parameter of `addAll()` from `List` to `Iterable`
- Improved documentation
- Preparation for queries

# 1.0.0

- First stable release

# 0.5.1+1

- Change `keys` parameter of `deleteAll` from `List` to `Iterable`
- Fixed bug in `BinaryWriter`

# 0.5.1

- Fixed `Hive.init()` bug in browser
- Fixed a bug with large lists or strings
- Improved box opening time in the browser
Expand All @@ -181,6 +240,7 @@ This also applies to the web version.
- Added integration tests

# 0.5.0

- Added `keyComparator` parameter for custom key order
- Added `isEmpty` and `isNotEmpty` getters to box
- Added support for reading and writing subclasses
Expand All @@ -194,13 +254,16 @@ This also applies to the web version.
- **Breaking:** Binary format changed

# 0.4.1+1

- Document all public APIs
- Fixed flutter_web error

# 0.4.1

- Allow different versions of the `path` package

# 0.4.0

- Added `BigInt` support
- Added `compactionStrategy` parameter
- Added automatic crash recovery
Expand All @@ -217,9 +280,11 @@ This also applies to the web version.
- **Breaking:** API changes

# 0.3.0+1

- Bugfix: `Hive['yourBox']` didn't work with uppercase box names

# 0.3.0

- Big step towards stable API
- Support for transactions
- Annotations for hive_generator
Expand All @@ -229,6 +294,7 @@ This also applies to the web version.
- **Breaking:** Binary format changed

# 0.2.0

- Support for dart2js
- Improved performance
- Added `inMemory` option
Expand All @@ -237,7 +303,9 @@ This also applies to the web version.
- **Breaking:** Removed Migrator

# 0.1.1

- Downgrade to `meta: ^1.1.6` to support flutter

# 0.1.0

- First release
15 changes: 7 additions & 8 deletions hive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>
<h2 align="center">Fast, Enjoyable & Secure NoSQL Database</h2>

[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/hivedb/hive/Dart%20CI/master?label=tests&labelColor=333940&logo=github)](https://github.com/hivedb/hive/actions) [![Codecov branch](https://img.shields.io/codecov/c/github/hivedb/hive/master?labelColor=333940&logo=codecov&logoColor=white)](https://codecov.io/gh/hivedb/hive) [![Pub Version](https://img.shields.io/pub/v/hive?label=pub.dev&labelColor=333940&logo=dart)](https://pub.dev/packages/hive) [![GitHub](https://img.shields.io/github/license/hivedb/hive?color=%23007A88&labelColor=333940&logo=apache)](https://github.com/hivedb/hive/blob/master/LICENSE)
[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/hivedb/hive/Dart%20CI/nndb?label=tests&labelColor=333940&logo=github)](https://github.com/hivedb/hive/actions) [![Codecov branch](https://img.shields.io/codecov/c/github/hivedb/hive/nndb?labelColor=333940&logo=codecov&logoColor=white)](https://codecov.io/gh/hivedb/hive) [![Pub Version](https://img.shields.io/pub/v/hive?label=pub.dev&labelColor=333940&logo=dart)](https://pub.dev/packages/hive) [![GitHub](https://img.shields.io/github/license/hivedb/hive?color=%23007A88&labelColor=333940&logo=apache)](https://github.com/hivedb/hive/blob/master/LICENSE)

Hive is a lightweight and blazing fast key-value database written in pure Dart. Inspired by [Bitcask](https://en.wikipedia.org/wiki/Bitcask).

Expand All @@ -18,8 +18,8 @@ Hive is a lightweight and blazing fast key-value database written in pure Dart.
- 🎈 **NO** native dependencies
- 🔋 Batteries included


## Getting Started

Check out the [Quick Start](https://docs.hivedb.dev) documentation to get started.

## Usage
Expand Down Expand Up @@ -71,6 +71,7 @@ print(box.getAt(0)) // Dave - 30
```

## Hive ❤️ Flutter

Hive was written with Flutter in mind. It is a perfect fit if you need a lightweight datastore for your app. After adding the required dependencies and initializing Hive, you can use Hive in your project:

```dart
Expand All @@ -97,18 +98,16 @@ class SettingsPage extends StatelessWidget {

Boxes are cached and therefore fast enough to be used directly in the `build()` method of Flutter widgets.


## Benchmark

|1000 read iterations |1000 write iterations|
|:------------:|:------------:|
| ![](https://raw.githubusercontent.com/hivedb/hive/master/.github/benchmark_read.png) | ![](https://raw.githubusercontent.com/hivedb/hive/master/.github/benchmark_write.png) |
| 1000 read iterations | 1000 write iterations |
| :--------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------: |
| ![](https://raw.githubusercontent.com/hivedb/hive/master/.github/benchmark_read.png) | ![](https://raw.githubusercontent.com/hivedb/hive/master/.github/benchmark_write.png) |
| SharedPreferences is on par with Hive when it comes to read performance. SQLite performs much worse. | Hive greatly outperforms SQLite and SharedPreferences when it comes to writing or deleting. |

The benchmark was performed on a Oneplus 6T with Android Q. You can [run the benchmark yourself](https://github.com/hivedb/hive_benchmark).

*Take this benchmark with a grain of salt. It is very hard to compare databases objectively since they were made for different purposes.

\*Take this benchmark with a grain of salt. It is very hard to compare databases objectively since they were made for different purposes.

### Licence

Expand Down
Loading

0 comments on commit 2279300

Please sign in to comment.