Methods
(tstamp, id)
Parameters:
| Name | Type | Description |
|---|---|---|
tstamp |
Number | |
id |
string |
add_t_stamp(tstamp, id)
Parameters:
| Name | Type | Description |
|---|---|---|
tstamp |
Number | a timestamp |
id |
string |
add_to_storage_map(obj) → {Error|boolean}
Put an object into a timestamp map.
If the object does not have a wide area id, then this method makes one and adds it in the _id field.
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
object |
Returns:
- if the object is stored, returns an Error, otherwise false (indicates to bypass error handling)
- Type
- Error | boolean
chrono_update_all()
Updates all the timestamps of all the objects in the storage map. Usually called just in intialization ... starts the clock on each piece of data...
hash_from_key(id) → {string|boolean}
If the object is in the storage map and keyed by the wide area id, then make a hash of the object and return it.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string |
Returns:
- the universal hash of the object or false
- Type
- string | boolean
id_maker() → {string}
Calls global_appwide_token on behalf of the class.
Subclasses should override if they want to use this class outside the context of a Copious Transitions application.
Returns:
- the wide are id for the object
- Type
- string
(async) initialize(conf)
Look for a special subobject in configurations for this configuration. For example, StaticDB has conf.static_db.
This intializer loads the storage map. The storage map either contains complete objects or partial objects and indicators of where complete objects are stored on local disks.
Parameters:
| Name | Type | Description |
|---|---|---|
conf |
object |
(async) local_db_load_map() → {object}
Reads in the storage map from disk and loads it.
Returns:
the storage map object that is in the file on disk as an object.
- Type
- object
(async) local_db_store_map(storage_map)
Stores the _storage_map object in the file db_file.
Parameters:
| Name | Type | Description |
|---|---|---|
storage_map |
object |
missing(obj) → {boolean}
Returns true if the object is not in the storage map
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
object |
Returns:
- Type
- boolean
object_add_t_stamp(obj)
Put the object in a timestamp bucket when it is first placed into storage.
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
object |
object_update_stamp(obj)
Changes the timestamp of the object calling update_stamp after the object wide area id has been found.
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
object |
prune_storage_map()
Prune storage based on time stamps and the current processor time.
remove_from_storage_map(id) → {boolean}
Erases the object form the _storage_map
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string |
Returns:
true for success - false otherwise
- Type
- boolean
update_stamp(tstamp, id) → {Number}
when data is touched make it newer
Removes the object from an old bucket and puts it in a new one.
Parameters:
| Name | Type | Description |
|---|---|---|
tstamp |
Number | |
id |
string |
Returns:
- the new timestamp
- Type
- Number