2007-06-11 21:36:57 +00:00
|
|
|
#include <stasis/transactional.h>
|
2005-03-13 20:39:32 +00:00
|
|
|
|
|
|
|
#ifndef __CONSUMER_H
|
2005-03-15 05:30:57 +00:00
|
|
|
#define __CONSUMER_H
|
2005-03-13 20:39:32 +00:00
|
|
|
|
2005-03-23 08:07:53 +00:00
|
|
|
#define MAX_CONSUMER_TYPES 10
|
2005-03-14 20:54:06 +00:00
|
|
|
#define FIFO_CONSUMER 0
|
|
|
|
#define ARRAY_CONSUMER 1
|
|
|
|
#define LOG_MEMORY_CONSUMER 2
|
2005-03-23 08:07:53 +00:00
|
|
|
#define POINTER_CONSUMER 3
|
2005-03-13 20:39:32 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int type;
|
|
|
|
void * impl;
|
|
|
|
} lladdConsumer_t;
|
|
|
|
|
2005-03-23 08:07:53 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int (*push)(int xid, void * it, byte * key, size_t keySize, byte * val, size_t valSize);
|
|
|
|
void(*close)(int xid, void *it);
|
|
|
|
} lladdConsumer_def_t;
|
|
|
|
|
2005-03-13 20:39:32 +00:00
|
|
|
/* call once per Tinit() call */
|
|
|
|
void consumer_init();
|
|
|
|
|
2005-03-14 00:25:29 +00:00
|
|
|
void Tconsumer_close(int xid, lladdConsumer_t * it);
|
2005-03-13 20:39:32 +00:00
|
|
|
/**
|
|
|
|
|
2005-03-14 20:54:06 +00:00
|
|
|
@param xid Transaction id @param it The consumer
|
2005-03-13 20:39:32 +00:00
|
|
|
@param key Can be null if there is no key.
|
2006-10-05 00:46:18 +00:00
|
|
|
@param keySize Length of key in bytes
|
|
|
|
@param val Can be null if there is no value, but both can't be null. (Or can they???)
|
|
|
|
@param valSize Length of value in bytes.
|
2005-03-13 20:39:32 +00:00
|
|
|
|
|
|
|
@return Error. Blocks when full.
|
|
|
|
|
|
|
|
*/
|
|
|
|
int Tconsumer_push(int xid, lladdConsumer_t * it, byte * key, size_t keySize, byte * val, size_t valSize);
|
|
|
|
|
|
|
|
/* @see Tconsumer_push
|
|
|
|
@return Error, or 'consumer full'
|
|
|
|
*/
|
2005-03-14 00:25:29 +00:00
|
|
|
//int Tconsumer_tryPush(int xid, ....);
|
|
|
|
|
2005-03-14 20:54:06 +00:00
|
|
|
#endif // __CONSUMER_H
|