Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 9e478bc2b6
Fetching contributors…

Cannot retrieve contributors at this time

53 lines (42 sloc) 1.49 kb
#ifndef __REDIS_DRV_H_
#define __REDIS_DRV_H_
#include <erl_driver.h>
#include <ei.h>
#include <credis.h>
#define REDIS_INVALID_COMMAND 255
#define REDIS_SET 0
#define REDIS_GET 1
#define REDIS_DEL 2
#define REDIS_SADD 3
#define REDIS_SREM 4
#define REDIS_SMEMBERS 5
typedef struct _redis_drv_t {
ErlDrvPort port;
REDIS redis;
} redis_drv_t;
enum _ReaderError {
READER_NO_ERROR = 0,
READER_READ_ALL_DATA = 1,
READER_PACKING_ERROR = 2
};
typedef enum _ReaderError ReaderError;
typedef struct {
ErlIOVec *ev;
size_t row;
size_t column;
ReaderError last_error;
} Reader;
static ErlDrvData start(ErlDrvPort port, char* cmd);
static void stop(ErlDrvData handle);
static void outputv(ErlDrvData handle, ErlIOVec *ev);
static void redis_drv_set(redis_drv_t *redis_drv, Reader *const reader);
static void redis_drv_get(redis_drv_t *redis_drv, Reader *const reader);
static void redis_drv_del(redis_drv_t *redis_drv, Reader *const reader);
static void redis_drv_sadd(redis_drv_t *redis_drv, Reader *const reader);
static void redis_drv_srem(redis_drv_t *redis_drv, Reader *const reader);
static void redis_drv_smembers(redis_drv_t *redis_drv, Reader *const reader);
static void redis_drv_unknown(redis_drv_t *redis_drv);
static void return_empty_list(redis_drv_t *redis_drv);
static void return_error(redis_drv_t *redis_drv, int errorno);
static void return_ok(redis_drv_t *redis_drv, int msgno);
#endif
Jump to Line
Something went wrong with that request. Please try again.