Permalink
Browse files

Non blocking replication (finally!). C-side linked lists API improved.

  • Loading branch information...
1 parent 40d224a commit 6208b3a77644afe5c7c28688cd6d7554a0281953 @antirez committed Apr 20, 2009
Showing with 171 additions and 106 deletions.
  1. +5 −1 TODO
  2. +20 −4 adlist.c
  3. +10 −7 adlist.h
  4. +132 −93 redis.c
  5. +4 −1 utils/redis-sha1.rb
View
6 TODO
@@ -1,12 +1,15 @@
BEFORE REDIS 1.0.0-rc1
+- What happens if the saving child gets killed instead to end normally? Handle this.
- Fix INCRBY argument that is limited to 32bit int.
+- Make sinterstore / unionstore / sdiffstore returning the cardinality of the resulting set.
- Add a new field as INFO output: bgsaveinprogress
- Remove max number of args limit
- GETSET
-- network layer stresser in test in demo
+- network layer stresser in test in demo, make sure to set/get random streams of data and check that what we read back is byte-by-byte the same.
- maxclients directive
- check 'server.dirty' everywere
+- config parameter to change the name of the DB file
- replication automated tests
- replication non stopping master<->slave syncronization
- an external tool able to perform the 'difference' between two Redis servers. It's like 'diff', but against Redis servers, and the output is the set of commands needed to turn the first server into the second, suitable to be sent via netcat.
@@ -21,6 +24,7 @@ This command should be smart and don't use too much memory, that is, take two co
- Add missing commands in documentation
- Document replication
- Objects sharing configuration, add the directive "objectsharingpool <size>"
+- Make sure to confert all the fstat() calls to 64bit versions.
FUTURE HINTS
View
@@ -143,7 +143,7 @@ void listDelNode(list *list, listNode *node)
}
/* Returns a list iterator 'iter'. After the initialization every
- * call to listNextElement() will return the next element of the list.
+ * call to listNext() will return the next element of the list.
*
* This function can't fail. */
listIter *listGetIterator(list *list, int direction)
@@ -164,6 +164,17 @@ void listReleaseIterator(listIter *iter) {
zfree(iter);
}
+/* Create an iterator in the list private iterator structure */
+void listRewind(list *list) {
+ list->iter.next = list->head;
+ list->iter.direction = AL_START_HEAD;
+}
+
+void listRewindTail(list *list) {
+ list->iter.next = list->tail;
+ list->iter.direction = AL_START_TAIL;
+}
+
/* Return the next element of an iterator.
* It's valid to remove the currently returned element using
* listDelNode(), but not to remove other elements.
@@ -178,7 +189,7 @@ void listReleaseIterator(listIter *iter) {
* }
*
* */
-listNode *listNextElement(listIter *iter)
+listNode *listNext(listIter *iter)
{
listNode *current = iter->next;
@@ -191,6 +202,11 @@ listNode *listNextElement(listIter *iter)
return current;
}
+/* List Yield just call listNext() against the list private iterator */
+listNode *listYield(list *list) {
+ return listNext(&list->iter);
+}
+
/* Duplicate the whole list. On out of memory NULL is returned.
* On success a copy of the original list is returned.
*
@@ -211,7 +227,7 @@ list *listDup(list *orig)
copy->free = orig->free;
copy->match = orig->match;
iter = listGetIterator(orig, AL_START_HEAD);
- while((node = listNextElement(iter)) != NULL) {
+ while((node = listNext(iter)) != NULL) {
void *value;
if (copy->dup) {
@@ -248,7 +264,7 @@ listNode *listSearchKey(list *list, void *key)
listNode *node;
iter = listGetIterator(list, AL_START_HEAD);
- while((node = listNextElement(iter)) != NULL) {
+ while((node = listNext(iter)) != NULL) {
if (list->match) {
if (list->match(node->value, key)) {
listReleaseIterator(iter);
View
@@ -39,21 +39,21 @@ typedef struct listNode {
void *value;
} listNode;
+typedef struct listIter {
+ listNode *next;
+ int direction;
+} listIter;
+
typedef struct list {
listNode *head;
listNode *tail;
void *(*dup)(void *ptr);
void (*free)(void *ptr);
int (*match)(void *ptr, void *key);
unsigned int len;
+ listIter iter;
} list;
-typedef struct listIter {
- listNode *next;
- listNode *prev;
- int direction;
-} listIter;
-
/* Functions implemented as macros */
#define listLength(l) ((l)->len)
#define listFirst(l) ((l)->head)
@@ -77,11 +77,14 @@ list *listAddNodeHead(list *list, void *value);
list *listAddNodeTail(list *list, void *value);
void listDelNode(list *list, listNode *node);
listIter *listGetIterator(list *list, int direction);
-listNode *listNextElement(listIter *iter);
+listNode *listNext(listIter *iter);
void listReleaseIterator(listIter *iter);
list *listDup(list *orig);
listNode *listSearchKey(list *list, void *key);
listNode *listIndex(list *list, int index);
+void listRewind(list *list);
+void listRewindTail(list *list);
+listNode *listYield(list *list);
/* Directions for iterators */
#define AL_START_HEAD 0
Oops, something went wrong.

0 comments on commit 6208b3a

Please sign in to comment.