diff --git a/src/adlist.c b/src/adlist.c index d74f893..d4b84bf 100644 --- a/src/adlist.c +++ b/src/adlist.c @@ -123,6 +123,18 @@ list *listAddNodeTail(list *list, void *value) return list; } +/* Insert a node to the list, to a specific position, containing the + * specified 'value' pointer as value. The position can be specified + * using an after index or the previous node. Using after you need to + * specify which position it will occupy, which is after an existing + * one. Using the previous node, you specify a pointer to the previous + * node. + * + * If after is set to 0, then the previous node is used. + * + * On error, NULL is returned and no operation is performed (i.e. the + * list remains unaltered). + * On success the 'list' pointer you pass to the function is returned. */ list *listInsertNode(list *list, listNode *old_node, void *value, int after) { listNode *node; diff --git a/src/bio.c b/src/bio.c index 6d1b538..f23500d 100644 --- a/src/bio.c +++ b/src/bio.c @@ -137,6 +137,7 @@ void bioCreateBackgroundJob(int type, void *arg1, void *arg2, void *arg3) { pthread_mutex_unlock(&bio_mutex[type]); } +/* Process the available bio background jobs. */ void *bioProcessBackgroundJobs(void *arg) { struct bio_job *job; unsigned long type = (unsigned long) arg; diff --git a/src/cluster.c b/src/cluster.c index ad7e0a0..9ef9017 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -321,6 +321,7 @@ int clusterLockConfig(char *filename) { return C_OK; } +/* Initialize the cluster with defaults */ void clusterInit(void) { int saveconf = 0; diff --git a/src/disque-cli.c b/src/disque-cli.c index 010bdfd..18363ce 100644 --- a/src/disque-cli.c +++ b/src/disque-cli.c @@ -158,6 +158,7 @@ typedef struct { static helpEntry *helpEntries; static int helpEntriesLen; +/* Return the version of disque. */ static sds cliVersion(void) { sds version; version = sdscatprintf(sdsempty(), "%s", DISQUE_VERSION); @@ -474,6 +475,7 @@ static sds cliFormatReplyRaw(redisReply *r) { return out; } +/* Format a reply in CSV format. */ static sds cliFormatReplyCSV(redisReply *r) { unsigned int i; diff --git a/src/job.c b/src/job.c index 2299304..6713b71 100644 --- a/src/job.c +++ b/src/job.c @@ -534,6 +534,8 @@ void processJob(job *j) { logJobsDebugInfo(LL_WARNING, "~~~WARNING~~~ NOT PROCESSABLE JOB", j); } +/* Fetch jobs from the server and process them with a 1-100ms interval. + * A maximum processing limit of 10M jobs/sec exists. */ int processJobs(struct aeEventLoop *eventLoop, long long id, void *clientData) { int period = 100; /* 100 ms default period. */ int max = 10000; /* 10k jobs * 1000 milliseconds = 10M jobs/sec max. */ diff --git a/src/object.c b/src/object.c index d500716..8e078e8 100644 --- a/src/object.c +++ b/src/object.c @@ -161,16 +161,20 @@ robj *dupStringObject(robj *o) { } } +/* Remove a string object. */ void freeStringObject(robj *o) { if (o->encoding == OBJ_ENCODING_RAW) { sdsfree(o->ptr); } } +/* Increment the reference counter. */ void incrRefCount(robj *o) { o->refcount++; } +/* Decrement the reference counter, if reference counter falls below 0 or + * the type of the object is not a string object, then it exits the system. */ void decrRefCount(robj *o) { if (o->refcount <= 0) serverPanic("decrRefCount against refcount <= 0"); if (o->refcount == 1) { @@ -216,6 +220,11 @@ int checkType(client *c, robj *o, int type) { return 0; } +/* Verify that an object is represented with a type 'long long'. If the object + * type is not a string object, then exit the system. If the object is + * can be casted to 'long long' return 'C_OK'. Otherwise convert the string + * object to 'long long', if it succeeds then return 'C_OK', + * otherwise 'C_ERR'. */ int isObjectRepresentableAsLongLong(robj *o, long long *llval) { serverAssertWithInfo(NULL,o,o->type == OBJ_STRING); if (o->encoding == OBJ_ENCODING_INT) { @@ -226,7 +235,7 @@ int isObjectRepresentableAsLongLong(robj *o, long long *llval) { } } -/* Try to encode a string object in order to save space */ +/* Try to encode a string object in order to save space. */ robj *tryObjectEncoding(robj *o) { long value; sds s = o->ptr; @@ -389,6 +398,7 @@ int equalStringObjects(robj *a, robj *b) { } } +/* Return the length of a string object. */ size_t stringObjectLen(robj *o) { serverAssertWithInfo(NULL,o,o->type == OBJ_STRING); if (sdsEncodedObject(o)) {