I_QueueStruct Struct Reference

Interface for a queue implementation. More...

#include <QueueInterface.h>


Data Fields

void * userObject
I_QueueGetProperties getProperties
 Access the configuration properties (readonly).
I_QueuePut put
 Puts a new entry into the queue.
I_QueuePeekWithSamePriority peekWithSamePriority
 Returns maximum the first num element in the queue of highest priority but does not remove it from that queue (leaves it untouched).
I_QueueRandomRemove randomRemove
 Removes the given entries from persistence.
I_QueueClear clear
 Clears (removes all entries) this queue.
I_QueueShutdown shutdown
 Shutdown the queue and free memory resources, no persistent entries are destroyed.
I_QueueDestroy destroy
 An administrative command to remove the backend store (e.g.
I_QueueNumOfEntries getNumOfEntries
 Access the current number of entries.
I_QueueMaxNumOfEntries getMaxNumOfEntries
 Access the configured maximum number of elements for this queue.
I_QueueNumOfBytes getNumOfBytes
 Returns the amount of bytes currently in the queue If the implementation of this interface is not able to return the correct number of entries (for example if the implementation must make a remote call to a DB which is temporarly not available) it will return -1.
I_QueueMaxNumOfBytes getMaxNumOfBytes
 Access the configured capacity (maximum bytes) for this queue.
I_QueueEmpty empty
 Check if queue is empty.
XMLBLASTER_LOG_LEVEL logLevel
 Set the logLevel to LOG_TRACE to get logging output.
XmlBlasterLogging log
 Assign your logging function pointer to receive logging output.
I_QueueInitialize initialize
 For internal use only.
int isInitialized
void * privateObject
 Hold current state of I_QueueStruct.


Detailed Description

Interface for a queue implementation.

See SQLiteQueue.c for a DB based persistent queue implementation. The 'I_' stands for 'interface'.

See also:
The client.c.queue requirement

Definition at line 88 of file QueueInterface.h.


Field Documentation

void* I_QueueStruct::userObject

Definition at line 90 of file QueueInterface.h.

Referenced by persistentQueueInitialize(), test_queue(), and xmlBlasterInitQueue().

I_QueueGetProperties I_QueueStruct::getProperties

Access the configuration properties (readonly).

Parameters:
queueP The 'this' pointer (similar to the hidden C++ 'this' pointer)
Returns:
The queue configuration

Definition at line 97 of file QueueInterface.h.

Referenced by createQueue(), and test_queue().

I_QueuePut I_QueueStruct::put

Puts a new entry into the queue.

Note that this method takes the entry pointed to by the argument and puts a reference to it into the queue. This means that you can not destroy the entry before the reference to it has been processed.

Parameters:
queueP The 'this' pointer (similar to the hidden C++ 'this' pointer)
queueEntry The data of type QueueEntry to put into the queue Please initialize it with memset(&queueEntry, 0, sizeof(QueueEntry)); before setting your values so we can add new fields without breaking your code
exception Check *exception.errorCode!=0 for errors: "user.illegalArgument", "resource.db.unavailable", "resource.db.block", "resource.db.unknown" "resource.overflow.queue.entries", "resource.overflow.queue.bytes"

Definition at line 113 of file QueueInterface.h.

Referenced by createQueue(), and test_illegal().

I_QueuePeekWithSamePriority I_QueueStruct::peekWithSamePriority

Returns maximum the first num element in the queue of highest priority but does not remove it from that queue (leaves it untouched).

Parameters:
queueP The 'this' pointer (similar to the hidden C++ 'this' pointer)
maxNumOfEntries Access num entries, if -1 access all entries currently found
maxNumOfBytes so many entries are returned as not to exceed the amount specified. If the first entry is bigger than this amount, it is returned anyway. -1 is unlimited.
exception *exception.errorCode!=0 if the underlying implementation gets an exception: "user.illegalArgument", "resource.db.unavailable", "resource.db.block", "resource.db.unknown"
Returns:
list with QueueEntry, the least elements with respect to the given time ordering or QueueEntryArr.len==0. Returned pointer is only NULL on exception

Definition at line 129 of file QueueInterface.h.

Referenced by createQueue(), and test_illegal().

I_QueueRandomRemove I_QueueStruct::randomRemove

Removes the given entries from persistence.

Parameters:
queueP The 'this' pointer (similar to the hidden C++ 'this' pointer)
queueEntryArr The entries to remove Please initialize each entry with memset(&queueEntry, 0, sizeof(QueueEntry)); (or use calloc()) before setting your values so we can add new fields without breaking your code
exception Check *exception.errorCode!=0 for errors: "user.illegalArgument", "resource.db.unavailable", "resource.db.block", "resource.db.unknown" "resource.overflow.queue.entries", "resource.overflow.queue.bytes"
Returns:
The number of removed entries

Definition at line 144 of file QueueInterface.h.

Referenced by createQueue(), and test_illegal().

I_QueueClear I_QueueStruct::clear

Clears (removes all entries) this queue.

Parameters:
queueP The 'this' pointer (similar to the hidden C++ 'this' pointer)
exception Check *exception.errorCode!=0 for errors: "user.illegalArgument", "resource.db.unavailable", "resource.db.block", "resource.db.unknown"
Returns:
true on success, if false *exception.errorCode is not 0

Definition at line 154 of file QueueInterface.h.

Referenced by createQueue(), and test_illegal().

I_QueueShutdown I_QueueStruct::shutdown

Shutdown the queue and free memory resources, no persistent entries are destroyed.

The backend store is closed and all memory allocation are freed and the queueP is set to NULL
NOTE: Your queueP is not usable anymore after this call.

Parameters:
queuePP The pointer to your queue pointer, after freeing it is set to *queuePP=0
exception *exception.errorCode!=0 if the underlying implementation gets an exception

Definition at line 163 of file QueueInterface.h.

Referenced by createQueue().

I_QueueDestroy I_QueueStruct::destroy

An administrative command to remove the backend store (e.g.

clear all entries and the database files).

Parameters:
queueP The 'this' pointer (similar to the hidden C++ 'this' pointer)
Returns:
true on success, if false *exception.errorCode is not 0

Definition at line 170 of file QueueInterface.h.

Referenced by createQueue(), and destroy().

I_QueueNumOfEntries I_QueueStruct::getNumOfEntries

Access the current number of entries.

Parameters:
queueP The 'this' pointer (similar to the hidden C++ 'this' pointer)
Returns:
The number of entries in the queue, returns -1 on error

Definition at line 177 of file QueueInterface.h.

Referenced by createQueue(), and test_illegal().

I_QueueMaxNumOfEntries I_QueueStruct::getMaxNumOfEntries

Access the configured maximum number of elements for this queue.

Parameters:
queueP The 'this' pointer (similar to the hidden C++ 'this' pointer)
Returns:
The maximum number of elements in the queue, returns -1 when passing a NULL pointer

Definition at line 184 of file QueueInterface.h.

Referenced by createQueue(), test_overflow(), and test_queue().

I_QueueNumOfBytes I_QueueStruct::getNumOfBytes

Returns the amount of bytes currently in the queue If the implementation of this interface is not able to return the correct number of entries (for example if the implementation must make a remote call to a DB which is temporarly not available) it will return -1.

Parameters:
queueP The 'this' pointer (similar to the hidden C++ 'this' pointer)
Returns:
The amount of bytes currently in the queue, returns -1 on error

Definition at line 194 of file QueueInterface.h.

Referenced by createQueue(), and test_illegal().

I_QueueMaxNumOfBytes I_QueueStruct::getMaxNumOfBytes

Access the configured capacity (maximum bytes) for this queue.

Parameters:
queueP The 'this' pointer (similar to the hidden C++ 'this' pointer)
Returns:
The maximum capacity for the queue in bytes, returns -1 when passing a NULL pointer

Definition at line 201 of file QueueInterface.h.

Referenced by createQueue().

I_QueueEmpty I_QueueStruct::empty

Check if queue is empty.

Parameters:
queueP The 'this' pointer (similar to the hidden C++ 'this' pointer) returns true if the queue is empty, false otherwise

Definition at line 208 of file QueueInterface.h.

Referenced by createQueue(), and test_illegal().

XMLBLASTER_LOG_LEVEL I_QueueStruct::logLevel

Set the logLevel to LOG_TRACE to get logging output.

Other levels are not supported

Definition at line 214 of file QueueInterface.h.

Referenced by persistentQueueInitialize().

XmlBlasterLogging I_QueueStruct::log

Assign your logging function pointer to receive logging output.

See also:
xmlBlaster/demo/c/socket/LogRedirect.c for an example

Definition at line 220 of file QueueInterface.h.

Referenced by persistentQueueInitialize().

I_QueueInitialize I_QueueStruct::initialize

For internal use only.

Returns:
false on error

Definition at line 228 of file QueueInterface.h.

Referenced by createQueue().

int I_QueueStruct::isInitialized

Definition at line 229 of file QueueInterface.h.

Referenced by checkArgs(), createQueue(), persistentQueueInitialize(), and test_queue().

void* I_QueueStruct::privateObject

Hold current state of I_QueueStruct.

Definition at line 230 of file QueueInterface.h.

Referenced by checkArgs(), createQueue(), createTables(), freeQueue(), and getDbInfo().


The documentation for this struct was generated from the following file: