|
PebbleOS v4.47.0-512-g5285d4236
|
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. | |
| struct pbl_settings_file * | 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 (struct pbl_settings_file *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. | |
| int | persist_service_delete_file (const Uuid *uuid) |
| Delete the persist file of an app. | |
Per-app persistent key-value stores.
A store is a struct pbl_settings_file named after the app UUID. An app and its worker share one store, file handle and struct pbl_settings_file state. The file is created lazily on first access.
The struct pbl_settings_file 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. |
| int persist_service_delete_file | ( | const Uuid * | uuid | ) |
Delete the persist file of an app.
| uuid | App UUID. |
| 0 | File removed. |
| 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.
| struct pbl_settings_file * 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 | ( | struct pbl_settings_file * | store | ) |
Unlock a store obtained with persist_service_lock_and_get_store().
| store | Store to unlock. |