Methods
(obj, do_remote)
Enters the object into the storage map. Tells the application to handle it in case that it is large. Tells the remote storage partners that this has created a new object for them to know about.
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
object | |
do_remote |
boolean |
|
all_keys()
Returns:
an array (list) of wide area identifiers
delete(id, dont_remote)
This attempts to remove data from everywhere.
The local data stash is cleared of the data.
Removes the object from the local _stroage_map
Then, it suggests to the remote that the object be forgotten.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | |
dont_remote |
boolean |
|
(async) findOne(wa_id, dont_create) → {object|boolean}
First looks in the _storage_map. If it is there, this method updates the object's timestamp and then
calls on the application's data completion method, application_large_data_from_stash.
If the object is not in the _storage_map, this attemps to fetch the object from remote stores.
(Note that the object is already known in this case in that the wide area id is the parameter of the method.)
If the object cannot be found in a remote store, then this method will attempt to create one
unless dont_create is set.
Parameters:
| Name | Type | Description |
|---|---|---|
wa_id |
string | |
dont_create |
boolean | only the static descendant has to worry about dont_create |
Returns:
The found object or false. Returns false if the object is nowhere...
- Type
- object | boolean
initialize(conf)
Sets up the db file and then calls its super intializer (LocalStorageLifeCycle). Finally, it sets up the pub/sub system configured by knowledge domains.
The pub/sub aspect of this data management interface allows subscription to a number of topics refered to as knowledge_domains. Knowledge domains are listed in an array on the configuration. This initialization subscribes to a number of topcis and then passes the subscription response down to the application implementation
Parameters:
| Name | Type | Description |
|---|---|---|
conf |
object |
remote_store_sync(ids, prune)
Looks through all the objecs in the _storage_map and tells the remote store about them.
If the prune parameter is provded, deletes the object from the do_remote.
This is a helper method that does its task without asking anymore questions.
Parameters:
| Name | Type | Description |
|---|---|---|
ids |
string | |
prune |
boolean |
(async) search_one(key, field) → {object|boolean}
like findOne, but will return false if the remote object cannot be found (i.e does not create)
Also, this will pass along data for a key search on the remote.
When the object comes back the application has a chance to reset ID fields to match remote data.
This method also calls application_large_data_from_stash.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string | |
field |
string |
Returns:
- false if the object cannot be restored from the remotes, otherwise the sanitized object
- Type
- object | boolean
(async) update(obj, dont_remote, udpate_op) → {Error|boolean}
This adds an object to the storage map if it is not already there. An error will be returned if the object is already stored. (This is useful for debugging but it is ignored)
If the option to to remote is true, the object will be completed by reading in large data if the object is of that size.
Then, the object will be sent to the remote with a default operation update. The data will be marked for writing to a file.
If the is not telling the remote anything, the large data of the object will be stashed.
That is this calls application_large_data_from_stash which should put excessive data into a file and keep a skeleton of the
data in storage.
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
object | |
dont_remote |
boolean | |
udpate_op |
string |
Returns:
- returns false if it does not return an error
- Type
- Error | boolean