#ifndef SPARKEY_INTERNAL_H
#define SPARKEY_INTERNAL_H
#include <stdint.h>
#include "sparkey.h"
#include "logheader.h"
#include "hashheader.h"
#include "buf.h"
struct sparkey_logreader {
uint32_t open_status;
sparkey_logheader header;
int fd;
uint64_t data_len;
uint8_t *data;
};
struct sparkey_logiter {
uint32_t open_status;
uint32_t file_identifier;
uint64_t block_position;
uint64_t next_block_position;
uint64_t block_offset;
uint64_t block_len;
int entry_count;
int compression_buf_allocated;
uint8_t *compression_buf;
uint64_t entry_block_position;
uint64_t entry_block_offset;
sparkey_entry_type type;
sparkey_iter_state state;
uint64_t keylen;
uint64_t valuelen;
uint64_t key_remaining;
uint64_t value_remaining;
};
struct sparkey_logwriter {
uint32_t open_status;
sparkey_logheader header;
int fd;
sparkey_buf block_buf;
uint32_t max_compressed_size;
uint8_t *compressed;
sparkey_buf file_buf;
int flushed;
int entry_count;
};
struct sparkey_hashreader {
uint32_t open_status;
sparkey_hashheader header;
sparkey_logreader log;
int fd;
uint64_t data_len;
uint8_t *data;
};
sparkey_returncode sparkey_logreader_open_noalloc(sparkey_logreader *log, const char *filename);
void sparkey_logreader_close_nodealloc(sparkey_logreader *log);
#endif