Dolphin_srv: fix state load on startup (#731)

* Dolphin_srv: fix dolphin state load on startup
* Dolphin: new sync and async API, state autosave. Makefile: properly escaped asterisks.

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
its your bedtime
2021-09-30 22:50:58 +03:00
committed by GitHub
parent 2eafae6b90
commit 7a89791b2b
7 changed files with 101 additions and 51 deletions

View File

@@ -4,27 +4,23 @@
typedef struct Dolphin Dolphin;
/* Load Dolphin state
* Thread safe
*/
typedef struct {
uint32_t icounter;
uint32_t butthurt;
} DolphinStats;
bool dolphin_load(Dolphin* dolphin);
/* Deed complete notification. Call it on deed completion.
/** Deed complete notification. Call it on deed completion.
* See dolphin_deed.h for available deeds. In futures it will become part of assets.
* Thread safe
* Thread safe, async
*/
void dolphin_deed(Dolphin* dolphin, DolphinDeed deed);
/* Save Dolphin state (write to permanent memory)
* Thread safe
/** Retrieve dolphin stats
* Thread safe, blocking
*/
DolphinStats dolphin_stats(Dolphin* dolphin);
void dolphin_save(Dolphin* dolphin);
/* Retrieve dolphin's icounter and butthurt values
* Thread safe
/** Flush dolphin queue and save state
* Thread safe, blocking
*/
DolphinDeedWeight dolphin_stats(Dolphin* dolphin);
void dolphin_flush(Dolphin* dolphin);