permanent-satori-hole/include/persist.h

35 lines
1,008 B
C
Raw Permalink Normal View History

2023-12-27 00:35:22 +00:00
#ifndef H_SATORI_PERIST
#define H_SATORI_PERIST
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <errno.h>
#include <threads.h>
#include "pack.h"
typedef struct _sat_persist {
FILE *stream;
bool ownsStream;
long offset;
mtx_t *lock;
} sat_persist, *sat_persist_ptr;
sat_persist_ptr sat_persist_alloc(void);
void sat_persist_free(sat_persist_ptr ctx);
int sat_persist_create(sat_persist_ptr ctx, FILE *stream, bool ownsStream);
int sat_persist_create_file(sat_persist_ptr ctx, char *path);
void sat_persist_flush(sat_persist_ptr ctx);
int sat_persist_header_refresh(sat_persist_ptr ctx);
uint64_t sat_persist_get_fii_forum_last_post_id(sat_persist_ptr ctx);
void sat_persist_set_fii_forum_last_post_id(sat_persist_ptr ctx, uint64_t postId);
uint64_t sat_persist_get_fii_user_last_register_id(sat_persist_ptr ctx);
void sat_persist_set_fii_user_last_register_id(sat_persist_ptr ctx, uint64_t userId);
#endif // H_SATORI_PERIST