#ifndef RAY_STORE_STREAM_H
#define RAY_STORE_STREAM_H
#include <rayforce.h>
#include <stdio.h>
#include "ops/idxop.h"
typedef struct {
FILE* fp;
FILE* pool_fp;
uint64_t pool_bytes;
char pool_path[1024];
char path[1024];
char tmp_path[1024];
int8_t type;
uint8_t attrs;
int64_t rows;
bool had_nulls;
struct ray_sym_domain_s* dom;
int64_t* lut_id;
uint32_t* lut_pos;
ray_zone_acc_t* zone;
ray_dict_acc_t* dict;
ray_t* index;
bool wants_hash;
bool finished;
} ray_col_stream_t;
ray_err_t ray_col_stream_open(ray_col_stream_t* w, const char* dir, int64_t name,
int8_t type, struct ray_sym_domain_s* domain);
ray_err_t ray_col_stream_index_begin(ray_col_stream_t* w, int64_t start_row);
ray_err_t ray_col_stream_index_merge(ray_col_stream_t* dst, ray_col_stream_t* src);
ray_err_t ray_col_stream_append(ray_col_stream_t* w, ray_t* column);
ray_err_t ray_col_stream_close(ray_col_stream_t* w, bool durable);
ray_err_t ray_col_stream_finish(ray_col_stream_t* w, bool durable);
ray_err_t ray_col_stream_publish(ray_col_stream_t* w, bool durable);
ray_err_t ray_col_stream_close_all(ray_col_stream_t* w, int64_t n, bool durable,
int64_t* col_ns);
void ray_col_stream_hash_all(ray_col_stream_t* w, int64_t n, int64_t* col_ns);
int64_t ray_col_stream_hash_wave(int64_t ram_limit, int64_t rows, int64_t candidates);
void ray_col_stream_abort(ray_col_stream_t* w);
#endif