Compare commits
No commits in common. "1da26ebd01647028bd750a2e77f4145d1abefd48" and "157af7bec1fe11cbb8911acb2831757c9459a8dd" have entirely different histories.
1da26ebd01
...
157af7bec1
34
README.md
34
README.md
@ -160,11 +160,10 @@ PostalPoint uses the Jimp library version 1.6 for creating and manipulating imag
|
|||||||
|
|
||||||
PostalPoint provides a UI for user-configurable plugin settings. See `exports.config` in examples/basic-demo/plugin.js for details.
|
PostalPoint provides a UI for user-configurable plugin settings. See `exports.config` in examples/basic-demo/plugin.js for details.
|
||||||
|
|
||||||
Settings are typically very short strings. Do not store data in settings. For data storage, see **Storing Data**.
|
Settings are typically very short strings. Do not store data in settings. Non-string settings values
|
||||||
Non-string settings values are transparently converted to/from JSON objects.
|
are transparently converted to/from JSON objects.
|
||||||
|
|
||||||
Use a unique key name prefix for your plugin to prevent key name conflicts.
|
Use a unique prefix for your plugin to prevent key name conflicts.
|
||||||
Reverse domain style is recommended (i.e. `"com.example.pluginname.keyname"`).
|
|
||||||
|
|
||||||
`global.apis.settings.`:
|
`global.apis.settings.`:
|
||||||
|
|
||||||
@ -174,35 +173,16 @@ Reverse domain style is recommended (i.e. `"com.example.pluginname.keyname"`).
|
|||||||
|
|
||||||
#### Storing Data
|
#### Storing Data
|
||||||
|
|
||||||
There are three key/value stores available in PostalPoint.
|
Behavior is the same as the settings storage. `setBig` stores the data to disk as a JSON file,
|
||||||
|
while `setSmall` uses the settings storage.
|
||||||
1. `setSmall` and `getSmall` currently use
|
Use `setBig` and `getBig` for storing data except for very short string or number values.
|
||||||
[localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) as a backend,
|
|
||||||
but this may change in the future.
|
|
||||||
2. `setBig` and `getBig` store the data to disk as a JSON file.
|
|
||||||
3. `setDatabase` and `getDatabase` store the data in the PostalPoint database, making stored data
|
|
||||||
available on the network to other PostalPoint installations. Depending on the backend in use, data
|
|
||||||
is stored either as a SQLite TEXT column or a MariaDB/MySQL LONGTEXT.
|
|
||||||
|
|
||||||
`*Big` and `*Small` functions perform synchronous disk access while `*Database` functions are
|
|
||||||
asynchronous and return a Promise.
|
|
||||||
|
|
||||||
String values are stored and fetched as-is; all other datatypes are encoded to JSON before saving,
|
|
||||||
and decoded back when fetched.
|
|
||||||
|
|
||||||
Storing a value of `null` causes the key to be deleted. Fetching a key that doesn't exist without
|
|
||||||
specifying a default value returns `null`.
|
|
||||||
|
|
||||||
Behavior if the host machine is out of disk space or has a drive failure is undefined.
|
|
||||||
|
|
||||||
`global.apis.storage.`:
|
`global.apis.storage.`:
|
||||||
|
|
||||||
* `getBig(key, defaultValue)`
|
* `getBig(key, defaultValue)`
|
||||||
* `setBig(key, value)`
|
|
||||||
* `getSmall(key, defaultValue)`
|
* `getSmall(key, defaultValue)`
|
||||||
|
* `setBig(key, value)`
|
||||||
* `setSmall(key, value)`
|
* `setSmall(key, value)`
|
||||||
* `async getDatabase(key, defaultValue)`
|
|
||||||
* `async setDatabase(key, value)`
|
|
||||||
|
|
||||||
|
|
||||||
#### Shipping and Rates
|
#### Shipping and Rates
|
||||||
|
Loading…
x
Reference in New Issue
Block a user