|
PebbleOS
|
Per-app persistent key-value stores. More...
Functions | |
| void | persist_service_init (void) |
| Initialize the persist service. | |
| size_t | persist_service_get_max_size (void) |
| Get the per-app storage capacity. | |
| SettingsFile * | persist_service_lock_and_get_store (const Uuid *uuid) |
| Lock the persist service and get the store of an app. | |
| void | persist_service_unlock_store (SettingsFile *store) |
| Unlock a store obtained with persist_service_lock_and_get_store(). | |
| void | persist_service_client_open (const Uuid *uuid) |
| Register a process using the store of an app. | |
| void | persist_service_client_close (const Uuid *uuid) |
| Unregister a process using the store of an app. | |
| status_t | persist_service_delete_file (const Uuid *uuid) |
| Delete the persist file of an app. | |
Per-app persistent key-value stores.
A store is a SettingsFile named after the app UUID. An app and its worker share one store, file handle and SettingsFile state. The file is created lazily on first access.
The SettingsFile is not reentrant: access it only between persist_service_lock_and_get_store() and persist_service_unlock_store().
| void persist_service_client_close | ( | const Uuid * | uuid | ) |
Unregister a process using the store of an app.
Called after the process exits. The store is closed and released when its last user leaves.
| uuid | App UUID. |
| void persist_service_client_open | ( | const Uuid * | uuid | ) |
Register a process using the store of an app.
Called during process startup.
| uuid | App UUID. |
| status_t persist_service_delete_file | ( | const Uuid * | uuid | ) |
Delete the persist file of an app.
| uuid | App UUID. |
| size_t persist_service_get_max_size | ( | void | ) |
Get the per-app storage capacity.
| void persist_service_init | ( | void | ) |
Initialize the persist service.
Called once at boot. Migrates and cleans up files in legacy naming schemes.
| SettingsFile * persist_service_lock_and_get_store | ( | const Uuid * | uuid | ) |
Lock the persist service and get the store of an app.
Opens or creates the file on first use. The app must have been opened with persist_service_client_open(). The lock is held until persist_service_unlock_store().
| uuid | App UUID. |
| void persist_service_unlock_store | ( | SettingsFile * | store | ) |
Unlock a store obtained with persist_service_lock_and_get_store().
| store | Store to unlock. |