Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adamlofts/leveldb_dart
Dart bindings for the LevelDB key value store.
https://github.com/adamlofts/leveldb_dart
dart leveldb
Last synced: 10 days ago
JSON representation
Dart bindings for the LevelDB key value store.
- Host: GitHub
- URL: https://github.com/adamlofts/leveldb_dart
- Owner: adamlofts
- License: mit
- Created: 2016-01-14T12:28:43.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-02-01T09:16:06.000Z (almost 3 years ago)
- Last Synced: 2024-10-10T03:04:59.307Z (28 days ago)
- Topics: dart, leveldb
- Language: Dart
- Homepage:
- Size: 1.1 MB
- Stars: 24
- Watchers: 5
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
*Fast & simple storage - a Dart LevelDB wrapper*
Introduction
------------**[LevelDB](https://github.com/google/leveldb)** is a simple key/value data store built by Google, inspired by BigTable. It's used in Google
Chrome and many other products. LevelDB supports arbitrary byte arrays as both keys and values, singular *get*, *put* and *delete*
operations, *batched put and delete*, bi-directional iterators and simple compression using the very fast
[Snappy](http://google.github.io/snappy/) algorithm.**leveldb_dart** aims to expose the features of LevelDB in a **Dart-friendly way**.
LevelDB stores entries **sorted lexicographically by keys**. This makes [LevelDB.getItems](https://www.dartdocs.org/documentation/leveldb/latest/leveldb/LevelDB/getItems.html) a very powerful query mechanism.
Platform Support
----------------- [x] Modern 64-bit Linux platforms (e.g. Fedora 25, 26, Ubuntu 14.04, 15.10)
- [x] Mac OS XUnsupported platforms:
- [ ] Android (See [issue #12](https://github.com/adamlofts/leveldb_dart/issues/12))
- [ ] Windows (Not supported in base library [issue #466](https://github.com/google/leveldb/issues/466))Basic usage
-----------Add `leveldb` to your `pubspec.yaml` file.
```
name: myproject
dependencies:
leveldb:
```Open a database and read/write some keys and values..
```
import 'dart:async';
import 'package:leveldb/leveldb.dart';Future main() async {
LevelDB db = await LevelDB.openUtf8("/tmp/testdb");
db.put("abc", "def");
String value = db.get("abc");
print("value is $value"); // value2 is def
}
```
Check out [example/main.dart](https://github.com/adamlofts/leveldb_dart/blob/master/example/main.dart) to see how to read, write and iterate over keys and values.Documentation
-------------API Documentation is available at https://www.dartdocs.org/documentation/leveldb/latest/
Isolates (Threads)
------------------*leveldb_dart* supports access to a database from multiple isolates by passing
`shared: true` to the
[LevelDB.open](https://www.dartdocs.org/documentation/leveldb/latest/leveldb/LevelDB/open.html) function. The `LevelDB` object
returned by this function will share an underlying reference to the object in other isolates and changes will
be visible between isolates.See [example/isolate.dart](https://github.com/adamlofts/leveldb_dart/blob/master/example/isolate.dart) for an example of using a database from multiple isolates (OS threads).
Feature Support
---------------- [x] Read and write keys
- [x] Forward iteration
- [x] Multi-isolate
- [ ] Backward iteration
- [ ] Snapshots
- [ ] Bulk get / putCustom Encoding and Decoding
----------------------------By default you can use `LevelDB.openUtf8` to open a database with `String` keys and values which are encoded in UTF8. The `dart:codec` library
can be used to create databases with custom encodings. See [example/json.dart](https://github.com/adamlofts/leveldb_dart/blob/master/example/json.dart)
for an example which stores dart objects to the database via JSON encoding.