Methods
application_hash_key(obj) → {string}
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
object |
- Source:
Returns:
- value in a field
_key, which is expected to be the hash of the data
- Type
- string
del_key_value(whokey) → {boolean}
Clear out the local knowledge of this object. Requests the wider area to forget the object. Removes any files associated with the object.
The call to delete
Parameters:
| Name | Type | Description |
|---|---|---|
whokey |
string | named this to emphasize that this stack is usually used just for user objects. |
- Source:
Returns:
- Type
- boolean
flat_object(obj) → {string}
Stringify the object -- some implementations might want to use some other method to turn an object into a packed array.
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
object |
- Source:
Returns:
- the stringified object
- Type
- string
flat_object_size(obj) → {Number}
Add up all the fields values of an object that have a length field.
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
object |
- Source:
Returns:
- object size
- Type
- Number
(async) get_key_value(whokey) → {object}
Returns the object that can be found by the key.
Searches for the id of the data object by using a local identity, where the id mapped by the whokey refers to a universal wide area identity of the data.
If a local copy cannot be found it searches the wide area using the application defined field and the
whokey as its value.
Otherwise, it finds one and tries to load its psme (PageableMemStoreElement). The object returned to the application will be
stored with the psme. If the object is not large, it should be in the storage map, _storage_map. The method findOne
will return the object from _storage_map which is defined in the super class. Also, it _storage_map is out of sync,
then findOne will bring it back to sync (and take longer).
Parameters:
| Name | Type | Description |
|---|---|---|
whokey |
string |
- Source:
Returns:
- the value stored
- Type
- object
has(whokey) → {string|boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
whokey |
string |
- Source:
Returns:
- returns fals if the elementis not in the
_whokey_to_idsmap. Otherwise, the id.
- Type
- string | boolean
hash(data) → {string}
Parameters:
| Name | Type | Description |
|---|---|---|
data |
string |
- Source:
Returns:
the hash of the data
- Type
- string
hash_from_persitence(obj) → {string}
Returns the intrinsic hash key
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
object |
- Source:
Returns:
- object hash
- Type
- string
initialize(conf)
Calls the initializer for FilesAndRelays and the immediate LocalStorageSerialization
Parameters:
| Name | Type | Description |
|---|---|---|
conf |
object |
- Source:
newer(remote_obj, up_obj) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
remote_obj |
object | |
up_obj |
object |
- Source:
Returns:
- Type
- boolean
setPersistence(presistence_db)
quite possibly another DB made fore keeping objects around for a long time will be used
Parameters:
| Name | Type | Description |
|---|---|---|
presistence_db |
* |
- Source:
(async) set_key_value(whokey, data) → {boolean}
Searches for the id of the data object by using a local identity, where the id mapped by the whokey refers to a universal wide area identity of the data.
If it finds a local copy of the object, it will check to see if the local persistence storage keeps a copy.
Given there is a local copy, this method calls get_key_value primarily for loadging instances of PageableMemStoreElement
as it is already established the object exists.
If it does not find a local copy of the object, it will check to see if the larger world knows about it. Without a local copy,
the object _id cannot be known, so it searches for the object using the whokey using the field _whokey_field, which
is hopefully known universally. (It is expected the application has standardized some field and way of obtaining a universal
id for the objects stored here.) The search performed is the same as in get_key_value, however this method attempts to update
the object data. It calls load_missing_or_update to perform this operation.
Once the knowledge of the object is established, it will make sure the data is updated and synced with the local disk.
If the object has not been seen anywhere, this method will store it as a the definitive entry and send out to the wider area.
Parameters:
| Name | Type | Description |
|---|---|---|
whokey |
string | |
data |
object |
- Source:
Returns:
- Type
- boolean