util/queue/QueueInterface.h File Reference

#include "util/helper.h"

Include dependency graph for QueueInterface.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  QueueProperties
 The QueueProperty struct holds all configuration parameters of the queue to create. More...
struct  QueueEntry
 A struct holding the necessary queue entry informations used by I_Queue. More...
struct  QueueEntryStructArr
 Holds an array of Messages. More...
struct  I_QueueStruct
 Interface for a queue implementation. More...

Defines

#define QUEUE_ENTRY_EMBEDDEDTYPE_LEN   28
#define QUEUE_PREFIX_MAX   20
#define QUEUE_DBNAME_MAX   256
#define QUEUE_ID_MAX   256

Typedefs

typedef QueueEntryStructArr QueueEntryArr
 Holds an array of Messages.
typedef I_QueueStruct I_Queue
typedef int(*) I_QueueInitialize (I_Queue *queueP, const QueueProperties *queueProperties, ExceptionStruct *exception)
 Declare function pointers to use in struct to simulate object oriented access.
typedef void(*) I_QueueShutdown (I_Queue **queuePP, ExceptionStruct *exception)
typedef int(*) I_QueueDestroy (I_Queue **queuePP, ExceptionStruct *exception)
typedef const QueueProperties *(*) I_QueueGetProperties (I_Queue *queueP)
typedef void(*) I_QueuePut (I_Queue *queueP, const QueueEntry *queueEntry, ExceptionStruct *exception)
typedef QueueEntryArr *(*) I_QueuePeekWithSamePriority (I_Queue *queueP, int32_t maxNumOfEntries, int64_t maxNumOfBytes, ExceptionStruct *exception)
typedef int32_t(*) I_QueueRandomRemove (I_Queue *queueP, const QueueEntryArr *queueEntryArr, ExceptionStruct *exception)
typedef int(*) I_QueueClear (I_Queue *queueP, ExceptionStruct *exception)
typedef int(*) I_QueueEmpty (I_Queue *queueP)
typedef int32_t(*) I_QueueNumOfEntries (I_Queue *queueP)
typedef int32_t(*) I_QueueMaxNumOfEntries (I_Queue *queueP)
typedef int64_t(*) I_QueueNumOfBytes (I_Queue *queueP)
typedef int64_t(*) I_QueueMaxNumOfBytes (I_Queue *queueP)

Functions

I_QueuecreateQueue (const QueueProperties *queueProperties, ExceptionStruct *exception)
 Get an instance of a persistent queue and initialize it.
void freeQueueEntryArr (QueueEntryArr *queueEntryArr)
 Frees everything inside QueueEntryArr and the struct QueueEntryArr itself.
void freeQueueEntryArrInternal (QueueEntryArr *queueEntryArr)
 Frees everything inside QueueEntryArr but NOT the struct QueueEntryArr itself.
void freeQueueEntry (QueueEntry *queueEntry)
 Frees the internal blob and the queueEntry itself.
char * queueEntryToXml (QueueEntry *queueEntry, int maxContentDumpLen)
 NOTE: You need to free the returned pointer with freeEntryDump() (which calls free())!
void freeEntryDump (char *queueDump)
 Free the memory allocated by queueEntryToXml().


Define Documentation

#define QUEUE_DBNAME_MAX   256

Definition at line 27 of file QueueInterface.h.

Referenced by destroy(), persistentQueueInitialize(), test_illegal(), test_overflow(), test_queue(), and xmlBlasterInitQueue().

#define QUEUE_ENTRY_EMBEDDEDTYPE_LEN   28

Definition at line 24 of file QueueInterface.h.

Referenced by parseQueueEntryArr(), persistentQueuePut(), queueEntryToXml(), test_overflow(), and test_queue().

#define QUEUE_ID_MAX   256

Definition at line 28 of file QueueInterface.h.

Referenced by destroy(), persistentQueueInitialize(), test_illegal(), test_overflow(), test_queue(), and xmlBlasterInitQueue().

#define QUEUE_PREFIX_MAX   20

Definition at line 26 of file QueueInterface.h.

Referenced by destroy(), persistentQueueInitialize(), test_illegal(), test_overflow(), test_queue(), and xmlBlasterInitQueue().


Typedef Documentation

typedef struct I_QueueStruct I_Queue

Definition at line 65 of file QueueInterface.h.

typedef int( * ) I_QueueClear(I_Queue *queueP, ExceptionStruct *exception)

Definition at line 75 of file QueueInterface.h.

typedef int( * ) I_QueueDestroy(I_Queue **queuePP, ExceptionStruct *exception)

Definition at line 70 of file QueueInterface.h.

typedef int( * ) I_QueueEmpty(I_Queue *queueP)

Definition at line 76 of file QueueInterface.h.

typedef const QueueProperties*( * ) I_QueueGetProperties(I_Queue *queueP)

Definition at line 71 of file QueueInterface.h.

typedef int( * ) I_QueueInitialize(I_Queue *queueP, const QueueProperties *queueProperties, ExceptionStruct *exception)

Declare function pointers to use in struct to simulate object oriented access.

Definition at line 68 of file QueueInterface.h.

typedef int64_t( * ) I_QueueMaxNumOfBytes(I_Queue *queueP)

Definition at line 80 of file QueueInterface.h.

typedef int32_t( * ) I_QueueMaxNumOfEntries(I_Queue *queueP)

Definition at line 78 of file QueueInterface.h.

typedef int64_t( * ) I_QueueNumOfBytes(I_Queue *queueP)

Definition at line 79 of file QueueInterface.h.

typedef int32_t( * ) I_QueueNumOfEntries(I_Queue *queueP)

Definition at line 77 of file QueueInterface.h.

typedef QueueEntryArr*( * ) I_QueuePeekWithSamePriority(I_Queue *queueP, int32_t maxNumOfEntries, int64_t maxNumOfBytes, ExceptionStruct *exception)

Definition at line 73 of file QueueInterface.h.

typedef void( * ) I_QueuePut(I_Queue *queueP, const QueueEntry *queueEntry, ExceptionStruct *exception)

Definition at line 72 of file QueueInterface.h.

typedef int32_t( * ) I_QueueRandomRemove(I_Queue *queueP, const QueueEntryArr *queueEntryArr, ExceptionStruct *exception)

Definition at line 74 of file QueueInterface.h.

typedef void( * ) I_QueueShutdown(I_Queue **queuePP, ExceptionStruct *exception)

Definition at line 69 of file QueueInterface.h.

typedef struct QueueEntryStructArr QueueEntryArr

Holds an array of Messages.


Function Documentation

I_Queue* createQueue ( const QueueProperties queueProperties,
ExceptionStruct exception 
)

Get an instance of a persistent queue and initialize it.

Every call creates a new and independent instance which shall be destroyed by a call to freeQueue() when you are done

Parameters:
queueProperties Configuration properties of the queue, always do a first memset(&queueProperties, 0, sizeof(QueueProperties)); to initialize new, future members.
        dbName The database name, for SQLite it is the file name on HD, "xmlBlasterClient.db"
        queueName The name of the queue, "connection_clientJoe"
        maxNumOfEntries The max. accepted entries, 10000000l
        maxNumOfBytes The max. accepted bytes, 1000000000ll
        logFp Your logging implementation or NULL if no logging callbacks are desired
        logLevel Set to LOG_TRACE to receive any logging
        userObject A pointer of your choice, is passed back when calling logFp in queueP->userObject
 
exception 
Returns:
queueP The 'this' pointer

Referenced by destroy(), test_illegal(), test_overflow(), test_queue(), and xmlBlasterInitQueue().

void freeEntryDump ( char *  queueDump  ) 

Free the memory allocated by queueEntryToXml().

Parameters:
queueDump NULL is OK

Definition at line 1224 of file SQLiteQueue.c.

Referenced by test_queue().

void freeQueueEntry ( QueueEntry queueEntry  ) 

Frees the internal blob and the queueEntry itself.

Parameters:
queueEntry Its memory is freed, it is not usable anymore after this call

Definition at line 1179 of file SQLiteQueue.c.

References freeQueueEntryData().

Here is the call graph for this function:

void freeQueueEntryArr ( QueueEntryArr queueEntryArr  ) 

Frees everything inside QueueEntryArr and the struct QueueEntryArr itself.

Parameters:
queueEntryArr The struct to free, passing NULL is OK

Definition at line 1140 of file SQLiteQueue.c.

References freeQueueEntryArrInternal().

Referenced by test_illegal(), and test_queue().

Here is the call graph for this function:

void freeQueueEntryArrInternal ( QueueEntryArr queueEntryArr  ) 

Frees everything inside QueueEntryArr but NOT the struct QueueEntryArr itself.

Parameters:
queueEntryArr The struct internals to free, passing NULL is OK

Definition at line 1151 of file SQLiteQueue.c.

References freeQueueEntryData(), QueueEntryStructArr::len, and QueueEntryStructArr::queueEntryArr.

Referenced by freeQueueEntryArr().

Here is the call graph for this function:

char* queueEntryToXml ( QueueEntry queueEntry,
int  maxContentDumpLen 
)

NOTE: You need to free the returned pointer with freeEntryDump() (which calls free())!

Parameters:
queueEntry The data to put to the queue
maxContentDumpLen for -1 get the complete content, else limit the content to the given number of bytes
Returns:
A ASCII XML formatted entry or NULL if out of memory

Definition at line 1194 of file SQLiteQueue.c.

References BlobHolder::data, BlobHolder::dataLen, QueueEntry::embeddedBlob, QueueEntry::embeddedType, int64Str, int64ToStr(), QueueEntry::isPersistent, QueueEntry::priority, QUEUE_ENTRY_EMBEDDEDTYPE_LEN, SNPRINTF, strFromBlobAlloc(), and QueueEntry::uniqueId.

Referenced by test_queue().

Here is the call graph for this function: