UNPKG

10.7 kBHTMLView Raw
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="utf-8">
5 <title>JSDoc: Class: LokiPartitioningAdapter</title>
6
7 <script src="scripts/prettify/prettify.js"> </script>
8 <script src="scripts/prettify/lang-css.js"> </script>
9 <!--[if lt IE 9]>
10 <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11 <![endif]-->
12 <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13 <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14</head>
15
16<body>
17
18<div id="main">
19
20 <h1 class="page-title">Class: LokiPartitioningAdapter</h1>
21
22
23
24
25
26
27<section>
28
29<header>
30
31 <h2>LokiPartitioningAdapter</h2>
32
33
34</header>
35
36<article>
37 <div class="container-overview">
38
39
40
41
42
43 <h4 class="name" id="LokiPartitioningAdapter"><span class="type-signature"></span>new LokiPartitioningAdapter<span class="signature">(adapter, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
44
45
46
47
48
49<div class="description">
50 <p>An adapter for adapters. Converts a non reference mode adapter into a reference mode adapter
51which can perform destructuring and partioning. Each collection will be stored in its own key/save and
52only dirty collections will be saved. If you turn on paging with default page size of 25megs and save
53a 75 meg collection it should use up roughly 3 save slots (key/value pairs sent to inner adapter).
54A dirty collection that spans three pages will save all three pages again
55Paging mode was added mainly because Chrome has issues saving 'too large' of a string within a
56single indexeddb row. If a single document update causes the collection to be flagged as dirty, all
57of that collection's pages will be written on next save.</p>
58</div>
59
60
61
62
63
64
65
66
67
68 <h5>Parameters:</h5>
69
70
71<table class="params">
72 <thead>
73 <tr>
74
75 <th>Name</th>
76
77
78 <th>Type</th>
79
80
81 <th>Attributes</th>
82
83
84
85
86 <th class="last">Description</th>
87 </tr>
88 </thead>
89
90 <tbody>
91
92
93 <tr>
94
95 <td class="name"><code>adapter</code></td>
96
97
98 <td class="type">
99
100
101<span class="param-type">object</span>
102
103
104
105 </td>
106
107
108 <td class="attributes">
109
110
111
112
113
114 </td>
115
116
117
118
119 <td class="description last"><p>reference to a 'non-reference' mode loki adapter instance.</p></td>
120 </tr>
121
122
123
124 <tr>
125
126 <td class="name"><code>options</code></td>
127
128
129 <td class="type">
130
131
132<span class="param-type">object</span>
133
134
135
136 </td>
137
138
139 <td class="attributes">
140
141 &lt;optional><br>
142
143
144
145
146
147 </td>
148
149
150
151
152 <td class="description last"><p>configuration options for partitioning and paging</p>
153 <h6>Properties</h6>
154
155
156<table class="params">
157 <thead>
158 <tr>
159
160 <th>Name</th>
161
162
163 <th>Type</th>
164
165
166
167
168
169 <th class="last">Description</th>
170 </tr>
171 </thead>
172
173 <tbody>
174
175
176 <tr>
177
178 <td class="name"><code>paging</code></td>
179
180
181 <td class="type">
182
183
184<span class="param-type">bool</span>
185
186
187
188 </td>
189
190
191
192
193
194 <td class="description last"><p>(default: false) set to true to enable paging collection data.</p></td>
195 </tr>
196
197
198
199 <tr>
200
201 <td class="name"><code>pageSize</code></td>
202
203
204 <td class="type">
205
206
207<span class="param-type">int</span>
208
209
210
211 </td>
212
213
214
215
216
217 <td class="description last"><p>(default : 25MB) you can use this to limit size of strings passed to inner adapter.</p></td>
218 </tr>
219
220
221
222 <tr>
223
224 <td class="name"><code>delimiter</code></td>
225
226
227 <td class="type">
228
229
230<span class="param-type">string</span>
231
232
233
234 </td>
235
236
237
238
239
240 <td class="description last"><p>allows you to override the default delimeter</p></td>
241 </tr>
242
243
244 </tbody>
245</table>
246
247 </td>
248 </tr>
249
250
251 </tbody>
252</table>
253
254
255
256
257
258
259<dl class="details">
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286 <dt class="tag-source">Source:</dt>
287 <dd class="tag-source"><ul class="dummy"><li>
288 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line1645">line 1645</a>
289 </li></ul></dd>
290
291
292
293
294
295
296
297</dl>
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315 </div>
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330 <h3 class="subsection-title">Methods</h3>
331
332
333
334
335
336
337 <h4 class="name" id="exportDatabase"><span class="type-signature"></span>exportDatabase<span class="signature">(dbname, dbref, callback)</span><span class="type-signature"></span></h4>
338
339
340
341
342
343<div class="description">
344 <p>Saves a database by partioning into separate key/value saves.
345(Loki 'reference mode' persistence adapter interface function)</p>
346</div>
347
348
349
350
351
352
353
354
355
356 <h5>Parameters:</h5>
357
358
359<table class="params">
360 <thead>
361 <tr>
362
363 <th>Name</th>
364
365
366 <th>Type</th>
367
368
369
370
371
372 <th class="last">Description</th>
373 </tr>
374 </thead>
375
376 <tbody>
377
378
379 <tr>
380
381 <td class="name"><code>dbname</code></td>
382
383
384 <td class="type">
385
386
387<span class="param-type">string</span>
388
389
390
391 </td>
392
393
394
395
396
397 <td class="description last"><p>name of the database (filename/keyname)</p></td>
398 </tr>
399
400
401
402 <tr>
403
404 <td class="name"><code>dbref</code></td>
405
406
407 <td class="type">
408
409
410<span class="param-type">object</span>
411
412
413
414 </td>
415
416
417
418
419
420 <td class="description last"><p>reference to database which we will partition and save.</p></td>
421 </tr>
422
423
424
425 <tr>
426
427 <td class="name"><code>callback</code></td>
428
429
430 <td class="type">
431
432
433<span class="param-type">function</span>
434
435
436
437 </td>
438
439
440
441
442
443 <td class="description last"><p>adapter callback to return load result to caller</p></td>
444 </tr>
445
446
447 </tbody>
448</table>
449
450
451
452
453
454
455<dl class="details">
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482 <dt class="tag-source">Source:</dt>
483 <dd class="tag-source"><ul class="dummy"><li>
484 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line1833">line 1833</a>
485 </li></ul></dd>
486
487
488
489
490
491
492
493</dl>
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515 <h4 class="name" id="loadDatabase"><span class="type-signature"></span>loadDatabase<span class="signature">(dbname, callback)</span><span class="type-signature"></span></h4>
516
517
518
519
520
521<div class="description">
522 <p>Loads a database which was partitioned into several key/value saves.
523(Loki persistence adapter interface function)</p>
524</div>
525
526
527
528
529
530
531
532
533
534 <h5>Parameters:</h5>
535
536
537<table class="params">
538 <thead>
539 <tr>
540
541 <th>Name</th>
542
543
544 <th>Type</th>
545
546
547
548
549
550 <th class="last">Description</th>
551 </tr>
552 </thead>
553
554 <tbody>
555
556
557 <tr>
558
559 <td class="name"><code>dbname</code></td>
560
561
562 <td class="type">
563
564
565<span class="param-type">string</span>
566
567
568
569 </td>
570
571
572
573
574
575 <td class="description last"><p>name of the database (filename/keyname)</p></td>
576 </tr>
577
578
579
580 <tr>
581
582 <td class="name"><code>callback</code></td>
583
584
585 <td class="type">
586
587
588<span class="param-type">function</span>
589
590
591
592 </td>
593
594
595
596
597
598 <td class="description last"><p>adapter callback to return load result to caller</p></td>
599 </tr>
600
601
602 </tbody>
603</table>
604
605
606
607
608
609
610<dl class="details">
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637 <dt class="tag-source">Source:</dt>
638 <dd class="tag-source"><ul class="dummy"><li>
639 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line1706">line 1706</a>
640 </li></ul></dd>
641
642
643
644
645
646
647
648</dl>
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671</article>
672
673</section>
674
675
676
677
678</div>
679
680<nav>
681 <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Collection.html">Collection</a></li><li><a href="DynamicView.html">DynamicView</a></li><li><a href="Loki.html">Loki</a></li><li><a href="LokiEventEmitter.html">LokiEventEmitter</a></li><li><a href="LokiFsAdapter.html">LokiFsAdapter</a></li><li><a href="LokiFsStructuredAdapter.html">LokiFsStructuredAdapter</a></li><li><a href="LokiIndexedAdapter.html">LokiIndexedAdapter</a></li><li><a href="LokiLocalStorageAdapter.html">LokiLocalStorageAdapter</a></li><li><a href="LokiMemoryAdapter.html">LokiMemoryAdapter</a></li><li><a href="LokiPartitioningAdapter.html">LokiPartitioningAdapter</a></li><li><a href="Resultset.html">Resultset</a></li></ul><h3>Tutorials</h3><ul><li><a href="tutorial-Autoupdating Collections.html">Autoupdating Collections</a></li><li><a href="tutorial-Changes API.html">Changes API</a></li><li><a href="tutorial-Collection Transforms.html">Collection Transforms</a></li><li><a href="tutorial-Indexing and Query performance.html">Indexing and Query performance</a></li><li><a href="tutorial-Loki Angular.html">Loki Angular</a></li><li><a href="tutorial-Persistence Adapters.html">Persistence Adapters</a></li><li><a href="tutorial-Query Examples.html">Query Examples</a></li></ul>
682</nav>
683
684<br class="clear">
685
686<footer>
687 Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun Dec 18 2016 19:39:52 GMT-0500 (Eastern Standard Time)
688</footer>
689
690<script> prettyPrint(); </script>
691<script src="scripts/linenumber.js"> </script>
692</body>
693</html>
\No newline at end of file