UNPKG

dbjs-persistence

Version:
220 lines (196 loc) 8.49 kB
For new changes log see CHANGELOG.md v0.1.1 -- 2017.05.16 * Fix multiple value support in searchComputed * Ensure object construction records in search * Reduce memory limit in recomputer v0.1.0 -- 2016.09.01 * Reduce call stack at recompute operation (try to avoid RangeErrors) * Implement error handling on driver * TextDriver: * Limit number of concurrent store operations * Fix export functionality (for computed tables) v0.0.21 -- 2016.07.01 * Improve and reorganize changes propagation * Improve cross process error reportings * Intelligent detection and handling of stamps coming from model and ones coming from data * Improve resolution of computed stamps * Strict events validation in recompute * Fix internal handling of events * Fix computed sets events handling * More controlled events propagation in recompute (they're batched into max 10000 at once) * Introduce stats for recompute * Improve data propagation queue resolution for recompute * Fix listener unregistration race condition * Optimise getAllObjectsId in text storage * Decrease safe memory limit for recompute * Fix resolution of owner ids in recompute * Improve logs v0.0.20 -- 2016.03.18 Changes: * Update `searchComputed` to use same API as `search`, it also now supports just value or both keyPath and value search. * In receiver & emitter setup allow fine grain storage resolution (also per driver) * In debug logs expose larger part of a value * Improve names of temporary files New API: * Introduced `storeManyReduced` method * Make resolveAutoSaveFilter an internal method on driver, and accept custom resolveAutoSaveFilter as an option * `path` on all events Bug fixes: * Fix store related race condition issue v0.0.19 -- 2016.03.02 * Support custom `keyPath` in `indexKeyPath` method * Improve `search` method: * Takes configuration object so user can search by both keyPath and value or none at all * Provides similar API to streams and now can be stopped only by calling stream.close() * Allows to postpone result promise and allow to choose resolution array of values * `searchOne` introduced to provide a possiblity to resolve with single value * Improve handling of `keyPaths` option in `getObject` etc, it can be now any iterable or * Support nested object paths in `getObject` and `deleteObject` array-like object * Improve recomputation handling: * Allow slave processes to end gracefully * Support propagation of direct records as well * Support initial record sets * Allow reinitialization of cleared storages * Support destruction of emitter/receiver bindings * Emit reduced and computed events globally * Log value with debug logs v0.0.18 -- 2016.02.06 * Fix detection of reduced storage in isStorage * Support for multiple drivers in receiver/emitter setup * Introduce `hasStorage` driver method * Introduce `storageNames` initialization option that comes with possibilty to work with strict set of storages * Improve update logging to show value (at least partially) * TextFile driver: * Fix handling of drop on newly initialized storages * Name directories in hyphen separated tokens format v0.0.17 -- 2016.01.28 * Global reduced storage with its track*Size methods * Fix race condition related to propagation of onDrain promises * Fix return value of trackCollectionSize * TextFile storage: * Improve internal filename recognition * Fail safe and more optimal file writes v0.0.16 -- 2016.01.22 * Split driver into a driver and many storages form * Expose dbjs database at `database` and not `db` * Instead of 'update' and 'delete' events emit just 'update' event * Bring back `storeReduced` method, as there can be custom reduction operations that are defined externally v0.0.15 -- 2015.12.30 * Fix getAllObjectIds to return also ids of undefined objects (such objects might be defined in model) v0.0.14 -- 2015.12.30 * Unify event name prefixes to `key`, `owner` and `keyid` * Cut 'Direct' token from public API names * Remove `storeReduced`, as reduction operations should be done by dedicated high level methods v0.0.13 -- 2015.12.29 * Introduce: - deleteDirectObject method - deleteDirectManyObjects method - storeDirectMany method - Generic receiver/emitter utils (to be removed to external repo in future) - Receiver/emitter driver modes configuration * Improvements to recompute functionality:q - Do not crash on invalid object ids - Refactor to use internal emitter/receiver utils - Process 10 objects at once - Multi process recomputation - Imply external object ids resolution and getData method * Introduce lazy stamps calculations with asonchronicity support, on computed properties updates * Emit update and delete events on direct changes * Fix collection change event 'batch' type handling * Fix keyPath validation in searchDirect * Fix queueing in store methods * Ensure expected resultion of get* operations (take into account uncertain states) * Change return value of __getDirectAllObjectIds, so it returns hash of events instead of array of ids * In getDirectAllObjectIds do not return ids for not initialized objects * Introduce new name convention for driver specific methods (\_method\_) * Improve tests organisation * Unify internal conventions v0.0.12 -- 2015.12.01 * Fix `record` events dispatch v0.0.11 -- 2015.12.01 * Introduce `recompute` utilities to recalculate computed data in outer process * Introduce - getDirectAllObjectIds - getDirectObjectKeyPath - searchDirect - recalculateAllSizes * Replace recalculateDiretSize and recalculateComputedSize with recalculateSize * Rename getReducedNs to getReducedObject * Allow early return in search* methods, and make breaking record a resolution value (they work similarily to `find` now) * Unify events names and structure * Do not emit 'size' events ('reduced' events should be observed instead) * Emit 'record' events (allows registration for specific ownerId + keyPath) * Ensure all registered listeners are unbound on close * Improve handling of bogus storages in TextFile driver * Reorganise and cleanup internals v0.0.10 -- 2015.11.18 * Significant reorganisation and improvements to internal logic * Removed various race condition vulnerabilities * Implement internally write lock functionality * Rename all driver methods so they start with `__` prefixes * Make one central method for writes: `__storeRaw` * Improve methods (both public and private) naming * `indexCollection` method * `clear` method * `trackColletionSize` method * `trackMultipleSize` method * Introduce `onWriteDrain` `onWriteLockDrain` (on demand promises) * Suppport observation of object creation * Fix emit of progress events * Fix keyPaths filter handling * Bring back support for function filters * Emit size change events * Introduce error codes * Do not memoize indexes, instead crash on duplicate names * Rename 'custom' namespace to 'reduced' * Rename 'index' namespace to 'computed' * Update TextFile storage to use three different (direct, computed, reduced) buckets of data instead of one v0.0.9 -- 2015.10.25 * Automatically resolve stamps when handling custom records * Ensure updates come with new data objects * No longer rely on index map being held in memory * Introduce public getIndexedValue method * Emit old value with events * Reorganize direct events store handling, and emit events on that as well * Introduce onDrain promise * Automatic size tracker for both direct and index records * Remove `name` support from indexKeyPath (one storage should be after one object type after all) * Fixes to default driver * Fix return value type in _close * Ensure database folder is created before any operations v0.0.8 -- 2015.10.22 * Fix isObjectId resolution * Improve debug logging v0.0.7 -- 2015.10.17 * Support any observable set for indexing * Improve internal organisation * Improve events handling v0.0.6 -- 2015.10.15 * Improve operations queue handling * Improval internal methods names v0.0.5 -- 2015.10.15 * Improve tests * Reconfigure handling of computed results * Make 'close' operation safe v0.0.4 -- 2015.10.13 * Fix computed properties handling * Generalize tests v0.0.3 -- 2015.10.12 * `is` and `ensure` utils * Export raw data functionality * Fix custom keys handling * Fix storage of undefined values in TextFile driver * Fix emit of progress events on loadAll v0.0.2 -- 2015.10.02 * Update dependencies v0.0.1 -- 2015.10.02 * Initial