<commit_before>#ifndef GWKV_HT_WRAPPER
#define GWKV_HT_WRAPPER

#include <stdlib.h>
#include "../lib/hashtable/hashtable.h"

/* Types of hashing algorithms we support */
typedef enum {
        MD5
} hash_type;

/* All encompassing datatype for server datastore */
struct {
        ht* hashtable;
        hash_type hash;
} gwkv_server;

/* Operations the table supports */
typedef enum {
        GET,
        SET
} method;

/* Defines for result codes */
#define STORED 0
#define NOT_STORED 1
#define EXISTS 2
#define NOT_FOUND 3

/* Datatype for wrapping datastore values */
struct {
        method method_type;
        const char* key;
        size_t key_length;
        const char* value;
        size_t value_length;
} operation;

/* Defines for hashtable params */
#define HT_SIZE 10 // number of buckets
#define HT_BUCKET_LENGTH 10 // max entry/bucket (only if rebalancing)
#define HT_FILL_PCT 0.1 // % bucket fill (only if rebalancing)
#define HT_REBAL 0 //disable rebalancing for now

/* Initialize a new key/value datastore */
gwkv_server*
gwkv_server_init(hash_type hash_algorithm);

/* Function to perform MD5 hash of key */
static int
gwkv_md5_hash(char* key);

/* Function to compare the equality of two entries */
static int
gwkv_node_cmp(struct ht_node* node1, struct ht_node node2);

/**
 * Wrapper function to set a value in the hashtable
 * Returns either STORED or NOT_STORED (defined above)
 */
int
gwkv_server_set (memcached_st *ptr,
                 const char *key,
                 size_t key_length,
                 const char *value,
                 size_t value_length);

/**
 * Wrapper function to read a value from the hashtable
 * Returns the data if sucessful, or NULL on error
 * These correspond to the EXISTS and NOT_FOUND codes above
 */
char*
gwkv_server_get (memcached_st *ptr,
                 const char *key,
                 size_t key_length,
                 size_t *value_length);

/* Frees all memory associated with the datastore */
void
gwkv_server_free(gwkv_server* server);

#endif<commit_msg>Update server struct type in args<commit_after>#ifndef GWKV_HT_WRAPPER
#define GWKV_HT_WRAPPER

#include <stdlib.h>
#include "../lib/hashtable/hashtable.h"

/* Types of hashing algorithms we support */
typedef enum {
        MD5
} hash_type;

/* All encompassing datatype for server datastore */
struct {
        ht* hashtable;
        hash_type hash;
} gwkv_server;

/* Operations the table supports */
typedef enum {
        GET,
        SET
} method;

/* Defines for result codes */
#define STORED 0
#define NOT_STORED 1
#define EXISTS 2
#define NOT_FOUND 3

/* Datatype for wrapping datastore values */
struct {
        method method_type;
        const char* key;
        size_t key_length;
        const char* value;
        size_t value_length;
} operation;

/* Defines for hashtable params */
#define HT_SIZE 10 // number of buckets
#define HT_BUCKET_LENGTH 10 // max entry/bucket (only if rebalancing)
#define HT_FILL_PCT 0.1 // % bucket fill (only if rebalancing)
#define HT_REBAL 0 //disable rebalancing for now

/* Initialize a new key/value datastore */
gwkv_server*
gwkv_server_init(hash_type hash_algorithm);

/* Function to perform MD5 hash of key */
static int
gwkv_md5_hash(char* key);

/* Function to compare the equality of two entries */
static int
gwkv_node_cmp(struct ht_node* node1, struct ht_node node2);

/**
 * Wrapper function to set a value in the hashtable
 * Returns either STORED or NOT_STORED (defined above)
 */
int
gwkv_server_set (gwkv_server* server,
                 const char *key,
                 size_t key_length,
                 const char *value,
                 size_t value_length);

/**
 * Wrapper function to read a value from the hashtable
 * Returns the data if sucessful, or NULL on error
 * These correspond to the EXISTS and NOT_FOUND codes above
 */
char*
gwkv_server_get (gwkv_server* server,
                 const char *key,
                 size_t key_length,
                 size_t *value_length);

/* Frees all memory associated with the datastore */
void
gwkv_server_free(gwkv_server* server);

#endif
{'fraction_non_alphanumeric': 0.07834549878345498, 'fraction_numerical': 0.007785888077858881, 'mean_word_length': 2.9077946768060836, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1326081', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1291, 'n_words': 446}