Giter Club home page Giter Club logo

immu-level's People

Contributors

lukaswelinder avatar sarapetersen avatar

Watchers

 avatar  avatar

immu-level's Issues

[refactor] integrate 'bytewise' encoding/decoding

The currently used 'bytewise' module is poorly written and throws errors when used in 'strict' mode.

Internal implementation should utilize Immutable.js structures all the way down for performance/memory optimization purposes.

[feat] implement 'delete' methods

Delete methods shouldn't be much more complicated than using the internal stream method to find all keys/paths contained within target.

[design] decide on internal API

Internal methods should be designed in a way to maximize their extensibility; most if not all public API methods will delegate to these in one way or another.

This might take a few refactors to get right, but will be worth the time in the end. One particular consideration needs to be the decision of where (what layer) to do type & error handling. My preference is to do that on the top layer (within the public API methods) for the sake of predictability.

[feat] add internal iteration methods

Public API methods ._**()should delegate to.**_In() in order to keep code dry. It's likely that some of the methods listed below will not be implemented.

Public API for forEach:

  • .forEach([key,] cb)
  • .forEachIn(keyPath, cb)
  • .forEachRight([key,] cb)
  • .forEachRightIn(keyPath, cb)
  • .flatForEach([key,] cb)
  • .flatForEachIn(keyPath, cb)
  • .flatForEachRight([key,] cb)
  • .flatForEachRightIn(keyPath, cb)

Public API for map:
All return instance of Immutable.js Map() or OrderedMap()

  • .map([key,] cb)
  • .mapIn(keyPath, cb)
  • .mapRight([key,] cb)
  • .mapRightIn(keyPath, cb)
  • .flatMap([key,] cb)
  • .flatMapIn(keyPath, cb)
  • .flatMapRight([key,] cb)
  • .flatMapRightIn(keyPath, cb)

Callback arguments (undecided):

  • cb(val, key || keyPath, db)
    • for non 'flat' methods, val is instance of Immutable.js Map()

Public API for reduce:
Optional argument curr defaults to Immutable.js Map() - (undecided)

  • .reduce([key,] cb[, curr])
  • .reduceIn(keyPath, cb[, curr])
  • .reduceRight([key,] cb[, curr])
  • .reduceRightIn(keyPath, cb[, curr])
  • .flatReduce([key,] cb[, curr])
  • .flatReduceIn(keyPath, cb[, curr])
  • .flatReduceRight([key,] cb[, curr])
  • .flatReduceRightIn(keyPath, cb[, curr])

Callback arguments (undecided):

  • cb(curr, val, key || keyPath, db)
    • for non 'flat' methods, val is instance of Immutable.js Map()

Reasoning:

While many of these methods exist on Immutable.js structures, they can be more efficiently done using a readStream on the db instance.

Some of these methods, in particular those prefixed with 'flat', will also be used internally for generating batch-updates and/or other iteration methods.

[fix] remove value at key-path when inserting obj

If the value is left behind, it could cause issues when traversing/querying in reverse order (based on the nature of immutable.Map().setIn(keyPath, val) method.

If an object were to be set/constructed within the value keyPath, then a primitive were to be set, the primitive value would overwrite the object that existed there. This would only happen if the primitive were encountered later, thus the reason this would cause problems when traversing k/v pairs in reverse order.

[fix] check for circular ref in set methods

My current thought is to do as follows:

try {
  JSON.stringify(val);
} catch(err) {
  reject(err);
}

However, this doesn't feel like a particularly efficient approach...

It would be great to handle (set and get) circular objects, but I will not be making that a priority at this moment.

[feat] implement 'set' & 'get' methods

Public API:

  • .set(key, val)
  • .setIn(keyPath, val)
  • .get(key)
  • .getIn(keyPath)

Private API:

  • .__read(opt) - create read stream over contents of opt.root
  • '.__write(root, obj)- build LevelDB batch fromobj`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.