dirty 0.1.5

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 43

Dart Dirty

The dart dirty library is persistent HashMap for Dart.

Create a new database with the constructor:

var db = new Dirty('test/test.db');

Open an existing database with the same constructor:

var db = new Dirty('test/test.db');

Then use the usual HashMap methods to add records:

db['everything'] = {'answer': 42};

And to remove records:

db.remove('everything');

To ensure that everything is written to the filesystem, it is best to properly close a database:

db.close();

Performance

I have not really optimized this yet. Using readAsLines to read DB records seems less than ideal, but it actually works fairly well. Writing could probably be sped up if data was buffered more, but I focused on read for the first pass.

If you would like to improve, see the test/mk_perf_db.dart and test/perf.dart scripts. The former creates a 100,000 record DB and the latter reads it back in. On my machine the former takes ~4 minutes to write and ~10 seconds to read. Performance patches welcome!

Contributors

##License

This software is licensed under the MIT License.

Copyright Chris Strom, 2014.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0.1.5

Test Changes

  • unittest package has been removed and replaced with test
  • a few new tests have also been added

Core library changes

  • OnLoadCallback typedef added, constructor onLoad parameter now has to match it
  • operator[], remove, containsKey interface overrides have been adjusted to to match declaration signature
  • addAll now adds keys to queue and attempts to flush as well, just like operator[]=
  • Initialization changes:
    • if the DB file is not present on the disk, it will be created. If that cannot be performed, an exception is raised.
  • If flushing is in progress and a new flush is invoked, Dirty will no longer fail silently, a StateError will be raised.
  • Fixed an issue: sometimes keys would not get persisted

Code cleanup

  • Doc comments have been converted from block comments to /// format
  • Minor code-style upgrades
  • strong mode enabled for library

Possible breaking changes

  • changes to addAll
  • database file will be created on Class instantiation if it is not present on path

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dirty: "^0.1.5"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dirty/dirty.dart';
        
Version Uploaded Documentation Archive
0.1.5 May 28, 2016 Go to the documentation of dirty 0.1.5 Download dirty 0.1.5 archive
0.1.4 Feb 10, 2014 Go to the documentation of dirty 0.1.4 Download dirty 0.1.4 archive
0.1.3 Nov 7, 2013 Go to the documentation of dirty 0.1.3 Download dirty 0.1.3 archive
0.1.2 Oct 10, 2013 Go to the documentation of dirty 0.1.2 Download dirty 0.1.2 archive
0.1.1 Aug 31, 2013 Go to the documentation of dirty 0.1.1 Download dirty 0.1.1 archive
0.1.0 Aug 28, 2013 Go to the documentation of dirty 0.1.0 Download dirty 0.1.0 archive
0.0.5 Jul 20, 2013 Go to the documentation of dirty 0.0.5 Download dirty 0.0.5 archive
0.0.4 Jun 9, 2013 Go to the documentation of dirty 0.0.4 Download dirty 0.0.4 archive
0.0.3 Mar 12, 2013 Go to the documentation of dirty 0.0.3 Download dirty 0.0.3 archive
0.0.2 Dec 14, 2012 Go to the documentation of dirty 0.0.2 Download dirty 0.0.2 archive

All 11 versions...

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
15 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
30 / 100
Overall score:
Weighted score of the above. [more]
43

Platforms

Detected platforms: Flutter, other

Primary library: package:dirty/dirty.dart with components: io.

Suggestions

  • Use constrained dependencies.

    The pubspec.yaml contains 1 dependency without version constraints. Specify version ranges for the following dependencies: logging.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use dirty.dart.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.

Dependencies

Package Constraint Resolved Available
Direct dependencies
logging any 0.11.3+1
Dev dependencies
test any