From cfbb74e7a59c93c3816b431ffb25adf2032c5ef0 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 7 Jan 2008 09:51:55 +0000 Subject: implemented disk queue as far as I could without an object de-serializer --- queue.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'queue.h') diff --git a/queue.h b/queue.h index 8c8782d3..f0740c44 100644 --- a/queue.h +++ b/queue.h @@ -26,6 +26,18 @@ #include #include "obj.h" +/* some information about disk files used by the queue. In the long term, we may + * export this settings to a separate file module - or not (if they are too + * queue-specific. I just thought I mention it here so that everyone is aware + * of this possibility. -- rgerhards, 2008-01-07 + */ +typedef struct { + int fd; /* the file descriptor, -1 if closed */ + int iCurrFileNum;/* current file number (NOT descriptor, but the number in the file name!) */ + int iCurrOffs; /* current offset */ +} queueFileDescription_t; + + /* queue types */ typedef enum { QUEUETYPE_FIXED_ARRAY = 0,/* a simple queue made out of a fixed (initially malloced) array fast but memoryhog */ @@ -73,10 +85,10 @@ typedef struct queue_s { size_t lenSpoolDir; uchar *pszFilePrefix; size_t lenFilePrefix; - int iCurrFileNum; /* number of file currently processed */ - int fd; /* current file descriptor */ - long iWritePos; /* next write position offset */ - long iReadPos; /* next read position offset */ + int iNumberFiles; /* how many files make up the queue? */ + int iMaxFileSize; /* max size for a single queue file */ + queueFileDescription_t fWrite; /* current file to be written */ + queueFileDescription_t fRead; /* current file to be read */ } disk; } tVars; } queue_t; -- cgit v1.2.3