eventstore-client-c/esc.h
Nicolas Dextraze 716a6223a7 First commit
2018-03-18 22:44:23 -07:00

59 lines
1.7 KiB
C

//
// Created by nicol on 2018-03-18.
//
#ifndef ESC_ESC_H
#define ESC_ESC_H
#include "uuid.h"
struct st_connection_settings;
typedef struct st_connection_settings esc_connection_settings_t;
struct st_connection;
typedef struct st_connection esc_connection_t;
struct st_credentials {
const char* username;
const char* password;
};
typedef struct st_credentials esc_credentials_t;
struct st_esc_position {
__int64 prepare_position;
__int64 commit_position;
};
typedef struct st_esc_position esc_position_t;
struct st_recorded_event {
const esc_uuid_t* event_id;
};
typedef struct st_recorded_event esc_recorded_event_t;
struct st_resolved_event {
const esc_recorded_event_t* event;
const esc_recorded_event_t* link;
esc_position_t original_position;
};
typedef struct st_resolved_event esc_resolved_event_t;
struct st_all_events_slice {
char* read_direction;
esc_position_t from_position;
esc_position_t next_position;
size_t n_events;
esc_resolved_event_t** events;
int is_end_of_stream;
};
typedef struct st_all_events_slice esc_all_events_slice_t;
const esc_connection_settings_t* esc_default_connection_settings;
const esc_connection_t* esc_connection_create(const esc_connection_settings_t* connection_settings, const char* addr, const char* connection_name);
int esc_connection_connect(const esc_connection_t* conn);
const esc_credentials_t* esc_credentials_create(const char* username, const char* password);
const esc_all_events_slice_t* esc_connection_read_all_forward(const esc_connection_t* conn, const esc_position_t* last_checkpoint, unsigned int count, const esc_credentials_t* credentials);
const char* esc_position_format(const esc_position_t* position, char* buffer, size_t buf_size);
#endif //ESC_ESC_H