eventstore-client-c/esc.h

60 lines
1.8 KiB
C
Raw Normal View History

2018-03-19 05:44:23 +00:00
//
// 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;
2018-03-19 06:08:57 +00:00
const char* event_type;
2018-03-19 05:44:23 +00:00
};
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