/*
**  Internal history API interface for the SQLite (hissqlite) backend.
**
**  Exposes the HIS_METHOD vtable functions to history/hismethods.c (which is
**  auto-generated by buildconfig from the per-method hismethod.config files).
**  See hissqlite(5) for the design rationale.
**
**  Written by Kevin Bowling in 2026.
*/

#ifndef HISSQLITE_H
#define HISSQLITE_H

#include "inn/libinn.h"

struct token;
struct history;

void *hissqlite_open(const char *path, int flags, struct history *);

bool hissqlite_close(void *);

bool hissqlite_sync(void *);

bool hissqlite_lookup(void *, const char *key, time_t *arrived, time_t *posted,
                      time_t *expires, struct token *token);

bool hissqlite_check(void *, const char *key);

bool hissqlite_write(void *, const char *key, time_t arrived, time_t posted,
                     time_t expires, const struct token *token);

bool hissqlite_replace(void *, const char *key, time_t arrived, time_t posted,
                       time_t expires, const struct token *token);

bool hissqlite_expire(void *, const char *, const char *, bool, void *,
                      time_t threshold,
                      bool (*exists)(void *, time_t, time_t, time_t,
                                     struct token *));

bool hissqlite_walk(void *, const char *, void *,
                    bool (*)(void *, const HASH *, time_t, time_t, time_t,
                             const struct token *));

bool hissqlite_remember(void *, const char *key, time_t arrived,
                        time_t posted);

bool hissqlite_ctl(void *, int, void *);

#endif /* HISSQLITE_H */
