new LokiPartitioningAdapter(adapter, optionsopt)
An adapter for adapters. Converts a non reference mode adapter into a reference mode adapter which can perform destructuring and partioning. Each collection will be stored in its own key/save and only dirty collections will be saved. If you turn on paging with default page size of 25megs and save a 75 meg collection it should use up roughly 3 save slots (key/value pairs sent to inner adapter). A dirty collection that spans three pages will save all three pages again Paging mode was added mainly because Chrome has issues saving 'too large' of a string within a single indexeddb row. If a single document update causes the collection to be flagged as dirty, all of that collection's pages will be written on next save.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
adapter |
object | reference to a 'non-reference' mode loki adapter instance. |
|||||||||||||
options |
object |
<optional> |
configuration options for partitioning and paging Properties
|
Methods
exportDatabase(dbname, dbref, callback)
Saves a database by partioning into separate key/value saves. (Loki 'reference mode' persistence adapter interface function)
Parameters:
Name | Type | Description |
---|---|---|
dbname |
string | name of the database (filename/keyname) |
dbref |
object | reference to database which we will partition and save. |
callback |
function | adapter callback to return load result to caller |
loadDatabase(dbname, callback)
Loads a database which was partitioned into several key/value saves. (Loki persistence adapter interface function)
Parameters:
Name | Type | Description |
---|---|---|
dbname |
string | name of the database (filename/keyname) |
callback |
function | adapter callback to return load result to caller |