#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include <unistd.h>
#include <errno.h>
#include "util/queue/QueueInterface.h"
#include "sqlite.h"
Include dependency graph for SQLiteQueue.c:
Go to the source code of this file.
Data Structures | ||||
struct | DbInfoStruct | |||
Holds Prepared statements for better performance. More... | ||||
struct | TmpHelper | |||
Used temporary for peekWithSamePriority(). More... | ||||
Defines | ||||
#define | LOG if (queueP && queueP->log) queueP->log(queueP, queueP->logLevel, XMLBLASTER_LOG_TRACE, | |||
#define | LEN512 512 | |||
#define | LEN256 256 | |||
#define | DBNAME_MAX 128 | |||
#define | ID_MAX 256 | |||
Typedefs | ||||
typedef int(*) | ParseDataFp (I_Queue *queueP, size_t currIndex, void *userP, char **pazValue, char **pazColName, ExceptionStruct *exception) | |||
Called for each SQL result row and does the specific result parsing depending on the query. | ||||
typedef DbInfoStruct | DbInfo | |||
Holds Prepared statements for better performance. | ||||
Enumerations | ||||
enum | { XB_ENTRIES_DATA_ID = 0, XB_ENTRIES_QUEUE_NAME, XB_ENTRIES_PRIO, XB_ENTRIES_TYPE_NAME, XB_ENTRIES_PERSISTENT, XB_ENTRIES_SIZE_IN_BYTES, XB_ENTRIES_BLOB } | |||
Column index into XB_ENTRIES table. More... | ||||
Functions | ||||
static int | persistentQueueInitialize (I_Queue *queueP, QueueProperties *queueProperties, ExceptionStruct *exception) | |||
Called internally by createQueue(). | ||||
static QueueProperties * | getProperties (I_Queue *queueP) | |||
Access the queue configuration. | ||||
static void | persistentQueuePut (I_Queue *queueP, QueueEntry *queueEntry, ExceptionStruct *exception) | |||
| ||||
static QueueEntryArr * | persistentQueuePeekWithSamePriority (I_Queue *queueP, int32_t maxNumOfEntries, int64_t maxNumOfBytes, ExceptionStruct *exception) | |||
Access queue entries without removing them. | ||||
static int32_t | persistentQueueRandomRemove (I_Queue *queueP, QueueEntryArr *queueEntryArr, ExceptionStruct *exception) | |||
Removes the given entries from persistence. | ||||
static int | persistentQueueClear (I_Queue *queueP, ExceptionStruct *exception) | |||
Destroy all entries in queue. | ||||
static int32_t | getNumOfEntries (I_Queue *queueP) | |||
static int32_t | getMaxNumOfEntries (I_Queue *queueP) | |||
static int64_t | getNumOfBytes (I_Queue *queueP) | |||
static int64_t | getMaxNumOfBytes (I_Queue *queueP) | |||
static int | persistentQueueEmpty (I_Queue *queueP) | |||
static void | persistentQueueShutdown (I_Queue **queuePP, ExceptionStruct *exception) | |||
Shutdown without destroying any entry. | ||||
static int | persistentQueueDestroy (I_Queue **queuePP, ExceptionStruct *exception) | |||
Destroy all entries in queue and releases all resources in memory and on HD. | ||||
static int | checkArgs (I_Queue *queueP, char *methodName, int checkIsConnected, ExceptionStruct *exception) | |||
Checks the given arguments to be valid. | ||||
static int | createTables (I_Queue *queueP, ExceptionStruct *exception) | |||
Create the necessary DB table if not already existing. | ||||
static int | execSilent (I_Queue *queueP, char *queryString, char *comment, ExceptionStruct *exception) | |||
Invoke SQL query. | ||||
static int | compilePreparedQuery (I_Queue *queueP, char *methodName, sqlite_vm **ppVm, char *queryString, ExceptionStruct *exception) | |||
Compile a prepared query. | ||||
static int | fillCache (I_Queue *queueP, ExceptionStruct *exception) | |||
Reload cached information from database. | ||||
static void | shutdownInternal (I_Queue **queuePP, ExceptionStruct *exception) | |||
Shutdown used internally without calling freeQueue(). | ||||
static void | freeQueueEntryData (QueueEntry *queueEntry) | |||
Does not free the queueEntry itself. | ||||
static int32_t | getResultRows (I_Queue *queueP, char *methodName, sqlite_vm *pVm, ParseDataFp parseDataFp, void *userP, int finalize, ExceptionStruct *exception) | |||
Execute the query and get the query result. | ||||
I_Queue * | createQueue (QueueProperties *queueProperties, ExceptionStruct *exception) | |||
Create a new persistent queue instance. | ||||
static DbInfo * | getDbInfo (I_Queue *queueP) | |||
Access the DB handle, queueP pointer is not checked. | ||||
static void | freeQueue (I_Queue **queuePP) | |||
static int | parseQueueEntryArr (I_Queue *queueP, size_t currIndex, void *userP, char **pazValue, char **pazColName, ExceptionStruct *exception) | |||
For each SQL result row parse it into a QueueEntry. | ||||
static int | parseCacheInfo (I_Queue *queueP, size_t currIndex, void *userP, char **pazValue, char **pazColName, ExceptionStruct *exception) | |||
Parse response of "SELECT count(dataId), sum(byteSize) FROM %.20sENTRIES where queueName='%s'",. | ||||
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 *entryDump) | |||
Free the memory allocated by queueEntryToXml(). | ||||
Variables | ||||
static char | int64Str_ [22] | |||
static char * | int64Str = int64Str_ |
#define DBNAME_MAX 128 |
Definition at line 102 of file SQLiteQueue.c.
#define ID_MAX 256 |
#define LEN256 256 |
Definition at line 100 of file SQLiteQueue.c.
Referenced by persistentQueueClear(), and persistentQueuePut().
#define LEN512 512 |
Definition at line 99 of file SQLiteQueue.c.
Referenced by createTables(), fillCache(), and persistentQueuePeekWithSamePriority().
#define LOG if (queueP && queueP->log) queueP->log(queueP, queueP->logLevel, XMLBLASTER_LOG_TRACE, |
Definition at line 97 of file SQLiteQueue.c.
Referenced by checkArgs(), compilePreparedQuery(), createQueue(), execSilent(), fillCache(), freeQueue(), getResultRows(), parseQueueEntryArr(), persistentQueueClear(), persistentQueueInitialize(), persistentQueuePeekWithSamePriority(), persistentQueuePut(), persistentQueueRandomRemove(), and shutdownInternal().
typedef struct DbInfoStruct DbInfo |
Holds Prepared statements for better performance.
typedef int( * ) ParseDataFp(I_Queue *queueP, size_t currIndex, void *userP, char **pazValue, char **pazColName, ExceptionStruct *exception) |
Called for each SQL result row and does the specific result parsing depending on the query.
userP | Pointer on a data struct which contains the parsed data |
Definition at line 85 of file SQLiteQueue.c.
anonymous enum |
Column index into XB_ENTRIES table.
XB_ENTRIES_DATA_ID | |
XB_ENTRIES_QUEUE_NAME | |
XB_ENTRIES_PRIO | |
XB_ENTRIES_TYPE_NAME | |
XB_ENTRIES_PERSISTENT | |
XB_ENTRIES_SIZE_IN_BYTES | |
XB_ENTRIES_BLOB |
Definition at line 133 of file SQLiteQueue.c.
static int checkArgs | ( | I_Queue * | queueP, | |
char * | methodName, | |||
int | checkIsConnected, | |||
ExceptionStruct * | exception | |||
) | [static] |
Checks the given arguments to be valid.
queueP | The queue instance | |
methodName | For logging | |
checkIsConnected | If true does check the connection state as well | |
exception | Transporting errors |
Definition at line 1238 of file SQLiteQueue.c.
References ExceptionStruct::errorCode, EXCEPTIONSTRUCT_ERRORCODE_LEN, EXCEPTIONSTRUCT_MESSAGE_LEN, initializeExceptionStruct(), I_QueueStruct::isInitialized, LOG, ExceptionStruct::message, I_QueueStruct::privateObject, SNPRINTF, and strncpy0().
Referenced by fillCache(), getMaxNumOfBytes(), getMaxNumOfEntries(), getNumOfBytes(), getNumOfEntries(), getProperties(), initialize(), persistentQueueClear(), persistentQueueDestroy(), persistentQueueInitialize(), persistentQueuePeekWithSamePriority(), persistentQueuePut(), persistentQueueRandomRemove(), persistentQueueShutdown(), shutdownInternal(), xmlBlasterConnect(), xmlBlasterDisconnect(), xmlBlasterErase(), xmlBlasterGet(), xmlBlasterInitQueue(), xmlBlasterPing(), xmlBlasterPublish(), xmlBlasterPublishArr(), xmlBlasterPublishOneway(), xmlBlasterSubscribe(), and xmlBlasterUnSubscribe().
Here is the call graph for this function:
static int compilePreparedQuery | ( | I_Queue * | queueP, | |
char * | methodName, | |||
sqlite_vm ** | ppVm, | |||
char * | queryString, | |||
ExceptionStruct * | exception | |||
) | [static] |
Compile a prepared query.
No parameters are checked, they must be valid
queueP | The queue instance to use | |
methodName | A nice string for logging | |
ppVm | The virtual machine will be initialized if still 0 | |
queryString | ||
exception | The exception is set to *exception->errorCode==0 on success, else to != 0 |
Definition at line 539 of file SQLiteQueue.c.
References DbInfoStruct::db, ExceptionStruct::errorCode, EXCEPTIONSTRUCT_ERRORCODE_LEN, EXCEPTIONSTRUCT_MESSAGE_LEN, getDbInfo(), LOG, ExceptionStruct::message, sleepMillis(), SNPRINTF, and strncpy0().
Referenced by fillCache(), persistentQueueClear(), persistentQueuePeekWithSamePriority(), persistentQueuePut(), and persistentQueueRandomRemove().
Here is the call graph for this function:
I_Queue* createQueue | ( | QueueProperties * | queueProperties, | |
ExceptionStruct * | exception | |||
) |
Create a new persistent queue instance.
exception |
Definition at line 151 of file SQLiteQueue.c.
References I_QueueStruct::clear, I_QueueStruct::destroy, embedException(), I_QueueStruct::empty, ExceptionStruct::errorCode, getMaxNumOfBytes(), I_QueueStruct::getMaxNumOfBytes, getMaxNumOfEntries(), I_QueueStruct::getMaxNumOfEntries, getNumOfBytes(), I_QueueStruct::getNumOfBytes, getNumOfEntries(), I_QueueStruct::getNumOfEntries, getProperties(), I_QueueStruct::getProperties, I_QueueStruct::initialize, I_QueueStruct::isInitialized, LOG, ExceptionStruct::message, DbInfoStruct::numOfBytes, DbInfoStruct::numOfEntries, I_QueueStruct::peekWithSamePriority, persistentQueueClear(), persistentQueueDestroy(), persistentQueueEmpty(), persistentQueueInitialize(), persistentQueuePeekWithSamePriority(), persistentQueuePut(), persistentQueueRandomRemove(), persistentQueueShutdown(), I_QueueStruct::privateObject, I_QueueStruct::put, I_QueueStruct::randomRemove, and I_QueueStruct::shutdown.
Here is the call graph for this function:
static int createTables | ( | I_Queue * | queueP, | |
ExceptionStruct * | exception | |||
) | [static] |
Create the necessary DB table if not already existing.
queueP | ||
exception | Can contain error information (out parameter) |
Definition at line 338 of file SQLiteQueue.c.
References execSilent(), LEN512, I_QueueStruct::privateObject, and SNPRINTF.
Referenced by persistentQueueInitialize().
Here is the call graph for this function:
static int execSilent | ( | I_Queue * | queueP, | |
char * | queryString, | |||
char * | comment, | |||
ExceptionStruct * | exception | |||
) | [static] |
Invoke SQL query.
queueP | Is not checked, must not be 0 | |
queryString | The SQL to execute | |
comment | For logging or exception text | |
exception | Can contain error information (out parameter) |
Definition at line 362 of file SQLiteQueue.c.
References DbInfoStruct::db, ExceptionStruct::errorCode, EXCEPTIONSTRUCT_ERRORCODE_LEN, EXCEPTIONSTRUCT_MESSAGE_LEN, getDbInfo(), LOG, ExceptionStruct::message, SNPRINTF, and strncpy0().
Referenced by createTables().
Here is the call graph for this function:
static int fillCache | ( | I_Queue * | queueP, | |
ExceptionStruct * | exception | |||
) | [static] |
Reload cached information from database.
queueP | The this pointer | |
exception | Returns error |
Definition at line 1010 of file SQLiteQueue.c.
References checkArgs(), compilePreparedQuery(), getDbInfo(), getResultRows(), int64Str, int64ToStr(), LEN512, LOG, DbInfoStruct::numOfBytes, DbInfoStruct::numOfEntries, parseCacheInfo(), DbInfoStruct::prop, DbInfoStruct::pVm_fillCache, QueueProperties::queueName, SNPRINTF, and QueueProperties::tablePrefix.
Referenced by getNumOfBytes(), getNumOfEntries(), persistentQueueInitialize(), and persistentQueueRandomRemove().
Here is the call graph for this function:
void freeEntryDump | ( | char * | queueDump | ) |
Free the memory allocated by queueEntryToXml().
queueDump | NULL is OK |
Definition at line 1224 of file SQLiteQueue.c.
Referenced by test_queue().
static void freeQueue | ( | I_Queue ** | queuePP | ) | [static] |
Definition at line 210 of file SQLiteQueue.c.
References LOG, and I_QueueStruct::privateObject.
Referenced by persistentQueueDestroy(), and persistentQueueShutdown().
void freeQueueEntry | ( | QueueEntry * | queueEntry | ) |
Frees the internal blob and the queueEntry itself.
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.
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.
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:
static void freeQueueEntryData | ( | QueueEntry * | queueEntry | ) | [static] |
Does not free the queueEntry itself.
Definition at line 1165 of file SQLiteQueue.c.
References BlobHolder::data, BlobHolder::dataLen, and QueueEntry::embeddedBlob.
Referenced by freeQueueEntry(), and freeQueueEntryArrInternal().
Access the DB handle, queueP pointer is not checked.
Definition at line 192 of file SQLiteQueue.c.
References I_QueueStruct::privateObject.
Referenced by compilePreparedQuery(), execSilent(), fillCache(), getMaxNumOfBytes(), getMaxNumOfEntries(), getNumOfBytes(), getNumOfEntries(), getProperties(), parseCacheInfo(), persistentQueueClear(), persistentQueueDestroy(), persistentQueueInitialize(), persistentQueuePeekWithSamePriority(), persistentQueuePut(), persistentQueueRandomRemove(), and shutdownInternal().
static int64_t getMaxNumOfBytes | ( | I_Queue * | queueP | ) | [static] |
Definition at line 1077 of file SQLiteQueue.c.
References checkArgs(), getDbInfo(), QueueProperties::maxNumOfBytes, and DbInfoStruct::prop.
Referenced by createQueue().
Here is the call graph for this function:
static int32_t getMaxNumOfEntries | ( | I_Queue * | queueP | ) | [static] |
Definition at line 1055 of file SQLiteQueue.c.
References checkArgs(), getDbInfo(), QueueProperties::maxNumOfEntries, and DbInfoStruct::prop.
Referenced by createQueue().
Here is the call graph for this function:
static int64_t getNumOfBytes | ( | I_Queue * | queueP | ) | [static] |
Definition at line 1064 of file SQLiteQueue.c.
References checkArgs(), fillCache(), getDbInfo(), and DbInfoStruct::numOfBytes.
Referenced by createQueue().
Here is the call graph for this function:
static int32_t getNumOfEntries | ( | I_Queue * | queueP | ) | [static] |
Definition at line 1042 of file SQLiteQueue.c.
References checkArgs(), fillCache(), getDbInfo(), and DbInfoStruct::numOfEntries.
Referenced by createQueue(), and persistentQueueEmpty().
Here is the call graph for this function:
static QueueProperties * getProperties | ( | I_Queue * | queueP | ) | [static] |
Access the queue configuration.
queueP | The this pointer |
Definition at line 201 of file SQLiteQueue.c.
References checkArgs(), getDbInfo(), and DbInfoStruct::prop.
Referenced by createQueue().
Here is the call graph for this function:
static int32_t getResultRows | ( | I_Queue * | queueP, | |
char * | methodName, | |||
sqlite_vm * | pVm, | |||
ParseDataFp | parseDataFp, | |||
void * | userP, | |||
int | finalize, | |||
ExceptionStruct * | exception | |||
) | [static] |
Execute the query and get the query result.
No parameters are checked, they must be valid
queueP | The this pointer | |
methodName | The method called | |
pVm | sqlite virtual machine | |
parseDataFp | The function which is called for each SQL result row or 0 if no function shall be called | |
userP | The pointer which is passed to parseDataFp | |
finalize | true to call sqlite_finalize which deletes the virtual machine, false to call sqlite_reset to reuse the prepared query | |
exception | The exception is set to *exception->errorCode==0 on success, else to != 0 |
Definition at line 699 of file SQLiteQueue.c.
References ExceptionStruct::errorCode, LOG, and sleepMillis().
Referenced by fillCache(), persistentQueueClear(), persistentQueuePeekWithSamePriority(), persistentQueuePut(), and persistentQueueRandomRemove().
Here is the call graph for this function:
static int parseCacheInfo | ( | I_Queue * | queueP, | |
size_t | currIndex, | |||
void * | userP, | |||
char ** | pazValue, | |||
char ** | pazColName, | |||
ExceptionStruct * | exception | |||
) | [static] |
Parse response of "SELECT count(dataId), sum(byteSize) FROM %.20sENTRIES where queueName='%s'",.
Definition at line 975 of file SQLiteQueue.c.
References ExceptionStruct::errorCode, EXCEPTIONSTRUCT_ERRORCODE_LEN, EXCEPTIONSTRUCT_MESSAGE_LEN, getDbInfo(), ExceptionStruct::message, DbInfoStruct::numOfBytes, DbInfoStruct::numOfEntries, SNPRINTF, strncpy0(), strToInt64(), and XB_ENTRIES_DATA_ID.
Referenced by fillCache().
Here is the call graph for this function:
static int parseQueueEntryArr | ( | I_Queue * | queueP, | |
size_t | currIndex, | |||
void * | userP, | |||
char ** | pazValue, | |||
char ** | pazColName, | |||
ExceptionStruct * | exception | |||
) | [static] |
For each SQL result row parse it into a QueueEntry.
No parameters are checked, they must be valid Implements a ParseDataFp (function pointer)
queueP | The 'this' pointer | |
currIndex | ||
userP | ||
pazValue | ||
pazColName | ||
exception | The exception is set to *exception->errorCode==0 on success, else to != 0 |
Definition at line 596 of file SQLiteQueue.c.
References TmpHelper::currBytes, TmpHelper::currEntries, BlobHolder::data, BlobHolder::dataLen, QueueEntry::embeddedBlob, QueueEntry::embeddedType, ExceptionStruct::errorCode, EXCEPTIONSTRUCT_ERRORCODE_LEN, EXCEPTIONSTRUCT_MESSAGE_LEN, int64Str, int64ToStr(), QueueEntry::isPersistent, QueueEntryStructArr::len, LOG, TmpHelper::maxNumOfBytes, TmpHelper::maxNumOfEntries, ExceptionStruct::message, QueueEntry::priority, QUEUE_ENTRY_EMBEDDEDTYPE_LEN, QueueEntryStructArr::queueEntryArr, TmpHelper::queueEntryArrPP, SNPRINTF, strncpy0(), strToInt64(), QueueEntry::uniqueId, XB_ENTRIES_BLOB, XB_ENTRIES_DATA_ID, XB_ENTRIES_PERSISTENT, XB_ENTRIES_PRIO, XB_ENTRIES_SIZE_IN_BYTES, and XB_ENTRIES_TYPE_NAME.
Referenced by persistentQueuePeekWithSamePriority().
Here is the call graph for this function:
static int persistentQueueClear | ( | I_Queue * | queueP, | |
ExceptionStruct * | exception | |||
) | [static] |
Destroy all entries in queue.
Definition at line 946 of file SQLiteQueue.c.
References checkArgs(), compilePreparedQuery(), getDbInfo(), getResultRows(), LEN256, LOG, DbInfoStruct::numOfBytes, DbInfoStruct::numOfEntries, DbInfoStruct::prop, SNPRINTF, and QueueProperties::tablePrefix.
Referenced by createQueue().
Here is the call graph for this function:
static int persistentQueueDestroy | ( | I_Queue ** | queuePP, | |
ExceptionStruct * | exception | |||
) | [static] |
Destroy all entries in queue and releases all resources in memory and on HD.
Definition at line 919 of file SQLiteQueue.c.
References checkArgs(), QueueProperties::dbName, ExceptionStruct::errorCode, EXCEPTIONSTRUCT_ERRORCODE_LEN, EXCEPTIONSTRUCT_MESSAGE_LEN, freeQueue(), getDbInfo(), ExceptionStruct::message, DbInfoStruct::prop, shutdownInternal(), SNPRINTF, and strncpy0().
Referenced by createQueue().
Here is the call graph for this function:
static int persistentQueueEmpty | ( | I_Queue * | queueP | ) | [static] |
Definition at line 1037 of file SQLiteQueue.c.
References getNumOfEntries().
Referenced by createQueue().
Here is the call graph for this function:
static int persistentQueueInitialize | ( | I_Queue * | queueP, | |
QueueProperties * | queueProperties, | |||
ExceptionStruct * | exception | |||
) | [static] |
Called internally by createQueue().
queueP | The this pointer | |
queueProperties | The configuration | |
exception | Can contain error information (out parameter) |
Definition at line 236 of file SQLiteQueue.c.
References checkArgs(), createTables(), DbInfoStruct::db, QueueProperties::dbName, ExceptionStruct::errorCode, EXCEPTIONSTRUCT_ERRORCODE_LEN, EXCEPTIONSTRUCT_MESSAGE_LEN, fillCache(), getDbInfo(), I_QueueStruct::isInitialized, LOG, I_QueueStruct::log, QueueProperties::logFp, QueueProperties::logLevel, I_QueueStruct::logLevel, QueueProperties::maxNumOfBytes, QueueProperties::maxNumOfEntries, ExceptionStruct::message, DbInfoStruct::prop, QUEUE_DBNAME_MAX, QUEUE_ID_MAX, QUEUE_PREFIX_MAX, QueueProperties::queueName, SNPRINTF, strncpy0(), QueueProperties::tablePrefix, QueueProperties::userObject, and I_QueueStruct::userObject.
Referenced by createQueue().
Here is the call graph for this function:
static QueueEntryArr * persistentQueuePeekWithSamePriority | ( | I_Queue * | queueP, | |
int32_t | maxNumOfEntries, | |||
int64_t | maxNumOfBytes, | |||
ExceptionStruct * | exception | |||
) | [static] |
Access queue entries without removing them.
Definition at line 779 of file SQLiteQueue.c.
References checkArgs(), compilePreparedQuery(), ExceptionStruct::errorCode, EXCEPTIONSTRUCT_ERRORCODE_LEN, EXCEPTIONSTRUCT_MESSAGE_LEN, getDbInfo(), getResultRows(), int64Str, int64ToStr(), QueueEntryStructArr::len, LEN512, LOG, TmpHelper::maxNumOfBytes, TmpHelper::maxNumOfEntries, ExceptionStruct::message, parseQueueEntryArr(), DbInfoStruct::prop, DbInfoStruct::pVm_peekWithSamePriority, QueueEntryStructArr::queueEntryArr, TmpHelper::queueEntryArrPP, QueueProperties::queueName, SNPRINTF, strncpy0(), and QueueProperties::tablePrefix.
Referenced by createQueue().
Here is the call graph for this function:
static void persistentQueuePut | ( | I_Queue * | queueP, | |
QueueEntry * | queueEntry, | |||
ExceptionStruct * | exception | |||
) | [static] |
queueP | The queue instance |
queueEntry | The entry | |
exception | The exception is set to *exception->errorCode==0 on success, else to != 0 |
< Size of a max int64_t dumped to a string including an optional LL and termination '': LLONG_MAX from limits.h 9223372036854775807LL
< Size of a max int64_t dumped to a string including an optional LL and termination '': LLONG_MAX from limits.h 9223372036854775807LL
< Size of a max int64_t dumped to a string including an optional LL and termination '': LLONG_MAX from limits.h 9223372036854775807LL
Definition at line 423 of file SQLiteQueue.c.
References checkArgs(), compilePreparedQuery(), BlobHolder::data, BlobHolder::dataLen, QueueEntry::embeddedBlob, QueueEntry::embeddedType, ExceptionStruct::errorCode, EXCEPTIONSTRUCT_ERRORCODE_LEN, EXCEPTIONSTRUCT_MESSAGE_LEN, getDbInfo(), getResultRows(), INT64_STRLEN_MAX, int64Str, int64ToStr(), QueueEntry::isPersistent, LEN256, LOG, QueueProperties::maxNumOfBytes, QueueProperties::maxNumOfEntries, ExceptionStruct::message, DbInfoStruct::numOfBytes, DbInfoStruct::numOfEntries, QueueEntry::priority, DbInfoStruct::prop, DbInfoStruct::pVm_put, QUEUE_ENTRY_EMBEDDEDTYPE_LEN, QueueProperties::queueName, QueueEntry::sizeInBytes, SNPRINTF, strncpy0(), QueueProperties::tablePrefix, and QueueEntry::uniqueId.
Referenced by createQueue().
Here is the call graph for this function:
static int32_t persistentQueueRandomRemove | ( | I_Queue * | queueP, | |
QueueEntryArr * | queueEntryArr, | |||
ExceptionStruct * | exception | |||
) | [static] |
Removes the given entries from persistence.
< Size of a max int64_t dumped to a string including an optional LL and termination '': LLONG_MAX from limits.h 9223372036854775807LL
Definition at line 860 of file SQLiteQueue.c.
References checkArgs(), compilePreparedQuery(), BlobHolder::dataLen, DbInfoStruct::db, QueueEntry::embeddedBlob, fillCache(), getDbInfo(), getResultRows(), ID_MAX, INT64_STRLEN_MAX, int64Str, int64ToStr(), QueueEntryStructArr::len, LOG, DbInfoStruct::numOfBytes, DbInfoStruct::numOfEntries, DbInfoStruct::prop, QueueEntryStructArr::queueEntryArr, QueueProperties::queueName, QueueEntry::sizeInBytes, SNPRINTF, QueueProperties::tablePrefix, and QueueEntry::uniqueId.
Referenced by createQueue().
Here is the call graph for this function:
static void persistentQueueShutdown | ( | I_Queue ** | queuePP, | |
ExceptionStruct * | exception | |||
) | [static] |
Shutdown without destroying any entry.
Clears all open DB resources.
Definition at line 1090 of file SQLiteQueue.c.
References checkArgs(), freeQueue(), and shutdownInternal().
Referenced by createQueue().
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())!
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 |
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:
static void shutdownInternal | ( | I_Queue ** | queuePP, | |
ExceptionStruct * | exception | |||
) | [static] |
Shutdown used internally without calling freeQueue().
Definition at line 1101 of file SQLiteQueue.c.
References checkArgs(), DbInfoStruct::db, getDbInfo(), LOG, DbInfoStruct::pVm_fillCache, DbInfoStruct::pVm_peekWithSamePriority, and DbInfoStruct::pVm_put.
Referenced by persistentQueueDestroy(), and persistentQueueShutdown().
Here is the call graph for this function:
Definition at line 130 of file SQLiteQueue.c.
Referenced by fillCache(), parseQueueEntryArr(), persistentQueuePeekWithSamePriority(), persistentQueuePut(), persistentQueueRandomRemove(), queueEntryToXml(), test_overflow(), and test_queue().
char int64Str_[22] [static] |
Definition at line 129 of file SQLiteQueue.c.