PebbleOS
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
timeline_item_storage.h File Reference
#include <pbl/util/uuid.h>
#include <pbl/services/regular_timer.h>
#include <pbl/services/settings/settings_file.h>
#include <pbl/kernel/mutex.h>
#include <pbl/services/timeline/item.h>

Data Structures

struct  TimelineItemStorage
 Timeline item store backed by a settings file. More...
 

Typedefs

typedef bool(* TimelineItemStorageFilterCallback) (SerializedTimelineItemHeader *hdr, void *context)
 Filter for timeline_item_storage_next_item().
 
typedef SettingsFileEachCallback TimelineItemStorageEachCallback
 Callback for timeline_item_storage_each().
 
typedef void(* TimelineItemStorageChildDeleteCallback) (const Uuid *id)
 Callback of timeline_item_storage_delete_with_parent().
 

Functions

void timeline_item_storage_init (TimelineItemStorage *storage, char *filename, uint32_t max_size, uint32_t max_age)
 Initialize a storage and open its settings file.
 
void timeline_item_storage_deinit (TimelineItemStorage *storage)
 Close the settings file of a storage.
 
status_t timeline_item_storage_compact (TimelineItemStorage *storage)
 Compact and shrink the backing settings file.
 
bool timeline_item_storage_exists_with_parent (TimelineItemStorage *storage, const Uuid *parent_id)
 Check whether any item has a given parent.
 
status_t timeline_item_storage_flush (TimelineItemStorage *storage)
 Delete all items except those created on the watch.
 
status_t timeline_item_storage_delete (TimelineItemStorage *storage, const uint8_t *key, int key_len)
 Delete an item.
 
status_t timeline_item_storage_read (TimelineItemStorage *storage, const uint8_t *key, int key_len, uint8_t *val_out, int val_len)
 Read a serialized item.
 
status_t timeline_item_storage_get_from_settings_record (SettingsFile *file, SettingsRecordInfo *info, TimelineItem *item)
 Deserialize the item of a settings file record, from an each callback.
 
status_t timeline_item_storage_set_status_bits (TimelineItemStorage *storage, const uint8_t *key, int key_len, uint8_t status)
 Overwrite the status bits of an item in place.
 
int timeline_item_storage_get_len (TimelineItemStorage *storage, const uint8_t *key, int key_len)
 Get the length of a serialized item.
 
status_t timeline_item_storage_insert (TimelineItemStorage *storage, const uint8_t *key, int key_len, const uint8_t *val, int val_len, bool mark_as_synced)
 Insert or replace a serialized item.
 
status_t timeline_item_storage_each (TimelineItemStorage *storage, TimelineItemStorageEachCallback each, void *data)
 Call a function for every record, with the storage locked.
 
status_t timeline_item_storage_mark_synced (TimelineItemStorage *storage, const uint8_t *key, int key_len)
 Mark an item as synced.
 
status_t timeline_item_storage_delete_with_parent (TimelineItemStorage *storage, const Uuid *parent_id, TimelineItemStorageChildDeleteCallback child_delete_cb)
 Delete the children of a parent.
 
status_t timeline_item_storage_next_item (TimelineItemStorage *storage, Uuid *id_out, TimelineItemStorageFilterCallback filter_cb)
 Find the earliest item that is not older than the maximum age.
 
bool timeline_item_storage_is_empty (TimelineItemStorage *storage)
 Check whether the storage holds no valid item.