You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 30, 2023. It is now read-only.
`options` is an object with any of the following properties
28
+
29
+
-`Index` ():
30
+
-`maxHistory` (Integer):
31
+
-`path` (String):
32
+
-`replicate` (Boolean):
33
+
-`referenceCount` (Integer):
34
+
-`replicationConcurrency` (Integer):
35
+
-`cache` ():
36
+
-`keystore` ():
37
+
-`key` ():
38
+
-`accessController` ():
39
+
-`onClose` (Function):
40
+
20
41
#### Public methods
21
42
22
43
##### `load(amount)`
23
44
24
45
Load the database using locally persisted state. Can specify how many entries to load with `amount` argument.
25
46
47
+
##### `loadMoreFrom(amount, entries)`
48
+
49
+
TODO
50
+
51
+
```javascript
52
+
//TODO
53
+
db.loadMoreFrom()
54
+
```
55
+
26
56
##### `saveSnapshot()`
27
57
28
58
Save the current state of the database locally. Returns a *Promise* that resolves to a IPFS Multihash as a Base58 encoded string. The the database can be loaded using this hash.
Store has an `events` ([EventEmitter](https://nodejs.org/api/events.html)) object that emits events that describe what's happening in the database.
86
124
87
-
-`load` - (dbname, hash)
125
+
-`load` - (address, heads)
88
126
89
-
Emitted before loading the database history. *hash* is the hash from which the history is loaded from.
127
+
Emitted before loading the database history. *address* is a string of the OrbitDB address that emitted the event. *heads*is an array of ipfs-log Entries.
90
128
91
129
```javascript
92
-
db.events.on('load', (id, hash) =>... )
130
+
db.events.on('load', (address, heads) =>... )
93
131
db.load()
94
132
```
95
133
96
-
-`ready`- (dbname)
134
+
-`ready`- (address, heads)
97
135
98
-
Emitted after fully loading the database history.
136
+
Emitted after fully loading the database history.*address* is a string of the OrbitDB address that emitted the event. *heads* is an array of ipfs-log Entries.
*Progress* is the current load count. *Total* is the maximum load count (ie. lengthof the full database). These are useful eg. for displaying a load progress percentage.
145
+
Emitted for each entry during load. *address* is a string of the OrbitDB address that emitted the event. *hash* is the multihash of the entry that was just loaded. *entry* is the ipfs-log Entry that was loaded. *Progress* is the current load count. *Total* is the maximum load count (ie. lengthof the full database). These are useful eg. for displaying a load progress percentage.
Emitted before replicating a part of the database. *address* is a string of the OrbitDB address that emitted the event. *entry* is the ipfs-log Entry that is being processed.
Emitted while replicating a database. *address* is a string of the OrbitDB address of the database that emitted the event. *hash* is the multihash of the entry that was just replicated. *entry* is the ipfs-log Entry that was replicated. *progress* is an integer representing the current progress. *total* is an integer representing the remaining operations.
Emitted after the database was synced with an update from a peer database. *address* is a string of the OrbitDB address that emitted the event. *logCount*...
Emitted after the databasewas synced withan update from a peer database.
178
+
Emitted after an entry was added locally to the database. *address* is a string of the OrbitDB address that emitted the event. *entry* is the Entry that was added. *heads* is an array of ipfs-log Entries.
Emitted after an entry was added locally to the database. *hash* is the IPFS hash of the latest state of the database. *entry* is the Entry that was added.
186
+
Emitted once the database has finished closing. *address* is a string of the OrbitDB address that emitted the event.
127
187
128
188
```javascript
129
-
db.events.on('write', (id, hash, entry) => ... )
189
+
db.events.on('closed', (address) => ... )
190
+
db.close()
130
191
```
131
192
132
193
#### Private methods
@@ -153,9 +214,9 @@ const Store = require('orbit-db-store');
0 commit comments