90 lines
2.4 KiB
C
90 lines
2.4 KiB
C
|
|
#ifndef AMDUATD_FED_PUSH_APPLY_H
|
||
|
|
#define AMDUATD_FED_PUSH_APPLY_H
|
||
|
|
|
||
|
|
#include "amduat/asl/core.h"
|
||
|
|
#include "amduat/fed/replay.h"
|
||
|
|
#include "amduatd_fed.h"
|
||
|
|
#include "amduatd_fed_cursor.h"
|
||
|
|
#include "amduatd_fed_push_plan.h"
|
||
|
|
#include "amduatd_space.h"
|
||
|
|
|
||
|
|
#include <stdbool.h>
|
||
|
|
#include <stddef.h>
|
||
|
|
#include <stdint.h>
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
extern "C" {
|
||
|
|
#endif
|
||
|
|
|
||
|
|
typedef struct {
|
||
|
|
void *ctx;
|
||
|
|
bool (*post_ingest)(void *ctx,
|
||
|
|
amduat_fed_record_type_t record_type,
|
||
|
|
amduat_reference_t ref,
|
||
|
|
amduat_octets_t bytes,
|
||
|
|
int *out_status,
|
||
|
|
char **out_body);
|
||
|
|
} amduatd_fed_push_transport_t;
|
||
|
|
|
||
|
|
typedef enum {
|
||
|
|
AMDUATD_FED_PUSH_APPLY_OK = 0,
|
||
|
|
AMDUATD_FED_PUSH_APPLY_ERR_INVALID = 1,
|
||
|
|
AMDUATD_FED_PUSH_APPLY_ERR_DISABLED = 2,
|
||
|
|
AMDUATD_FED_PUSH_APPLY_ERR_UNSUPPORTED = 3,
|
||
|
|
AMDUATD_FED_PUSH_APPLY_ERR_REMOTE = 4,
|
||
|
|
AMDUATD_FED_PUSH_APPLY_ERR_STORE = 5,
|
||
|
|
AMDUATD_FED_PUSH_APPLY_ERR_CONFLICT = 6,
|
||
|
|
AMDUATD_FED_PUSH_APPLY_ERR_OOM = 7
|
||
|
|
} amduatd_fed_push_apply_status_t;
|
||
|
|
|
||
|
|
typedef struct {
|
||
|
|
const char *peer_key;
|
||
|
|
const amduatd_space_t *effective_space;
|
||
|
|
uint64_t limit;
|
||
|
|
bool cursor_present;
|
||
|
|
bool cursor_has_logseq;
|
||
|
|
uint64_t cursor_logseq;
|
||
|
|
bool cursor_ref_set;
|
||
|
|
amduat_reference_t cursor_ref;
|
||
|
|
size_t plan_record_count;
|
||
|
|
amduatd_fed_push_cursor_candidate_t plan_candidate;
|
||
|
|
size_t sent_record_count;
|
||
|
|
uint64_t sent_bytes_total;
|
||
|
|
size_t sent_artifact_count;
|
||
|
|
size_t sent_per_count;
|
||
|
|
size_t sent_tgk_edge_count;
|
||
|
|
size_t sent_tombstone_count;
|
||
|
|
size_t peer_ok_count;
|
||
|
|
size_t peer_already_present_count;
|
||
|
|
bool cursor_advanced;
|
||
|
|
bool cursor_after_has_logseq;
|
||
|
|
uint64_t cursor_after_logseq;
|
||
|
|
bool cursor_after_ref_set;
|
||
|
|
amduat_reference_t cursor_after_ref;
|
||
|
|
int remote_status;
|
||
|
|
char error[256];
|
||
|
|
} amduatd_fed_push_apply_report_t;
|
||
|
|
|
||
|
|
void amduatd_fed_push_apply_report_init(
|
||
|
|
amduatd_fed_push_apply_report_t *report);
|
||
|
|
|
||
|
|
void amduatd_fed_push_apply_report_free(
|
||
|
|
amduatd_fed_push_apply_report_t *report);
|
||
|
|
|
||
|
|
amduatd_fed_push_apply_status_t amduatd_fed_push_apply(
|
||
|
|
amduat_asl_store_t *store,
|
||
|
|
amduat_asl_pointer_store_t *pointer_store,
|
||
|
|
const amduatd_space_t *effective_space,
|
||
|
|
const char *peer_key,
|
||
|
|
uint64_t limit,
|
||
|
|
const char *root_path,
|
||
|
|
const amduatd_fed_cfg_t *fed_cfg,
|
||
|
|
const amduatd_fed_push_transport_t *transport,
|
||
|
|
amduatd_fed_push_apply_report_t *out_report);
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
} /* extern "C" */
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#endif /* AMDUATD_FED_PUSH_APPLY_H */
|