Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/adlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions src/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ int clusterLockConfig(char *filename) {
return C_OK;
}

/* Initialize the cluster with defaults */
void clusterInit(void) {
int saveconf = 0;

Expand Down
2 changes: 2 additions & 0 deletions src/disque-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions src/job.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
12 changes: 11 additions & 1 deletion src/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down