mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 23:04:20 +01:00
8bed771536
git-svn-id: file:///svn/tokudb@1600 c7de825b-a66e-492c-adef-691d508d4ae1
38 lines
1.3 KiB
C
38 lines
1.3 KiB
C
#include "brttypes.h"
|
|
|
|
struct fifo_entry {
|
|
struct fifo_entry *next;
|
|
unsigned int keylen;
|
|
unsigned int vallen;
|
|
unsigned char type;
|
|
unsigned char key[];
|
|
};
|
|
|
|
struct fifo {
|
|
struct fifo_entry *head, *tail;
|
|
int n;
|
|
};
|
|
|
|
typedef struct fifo *FIFO;
|
|
|
|
int toku_fifo_create(FIFO *);
|
|
void toku_fifo_free(FIFO *);
|
|
int toku_fifo_n_entries(FIFO);
|
|
int toku_fifo_enq (FIFO, const void *key, ITEMLEN keylen, const void *data, ITEMLEN datalen, int type);
|
|
int toku_fifo_peek (FIFO, bytevec *key, ITEMLEN *keylen, bytevec *data, ITEMLEN *datalen, int *type);
|
|
int toku_fifo_deq(FIFO);
|
|
int toku_fifo_peek_deq (FIFO, bytevec *key, ITEMLEN *keylen, bytevec *data, ITEMLEN *datalen, int *type);
|
|
void toku_fifo_iterate (FIFO, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,ITEMLEN datalen,int type, void*), void*);
|
|
|
|
#define FIFO_ITERATE(fifo,keyvar,keylenvar,datavar,datalenvar,typevar,body) ({ \
|
|
struct fifo_entry *entry; \
|
|
for (entry = fifo->head; entry; entry = entry->next) { \
|
|
unsigned int keylenvar = entry->keylen; \
|
|
void *keyvar = entry->key; \
|
|
unsigned int datalenvar = entry->vallen; \
|
|
void *datavar = entry->key + entry->keylen; \
|
|
unsigned int typevar = entry->type; \
|
|
body; \
|
|
} \
|
|
})
|
|
|