During my redeisgn of the implementation of PRiDe, I found out that if you feel that there is a simpler way to implement something or that something can be done with less code, do that! The time it takes for you to create a simpler implementation, you will gain when you don’t have to search for bugs in 500+ lines of code where it is hard to follow the application flow.
I would recommend that anyone that writes software for a living that simplicity doesn’t mean that the features needs to suffer!
Well, after some list implementations, I now have multiple object support in PRiDe.
This marks the final feature that needs to be inserted into PRiDe. The next step is to make a shell script that can create a number of instances and then be able to create a number of updates without me interacting. This is so that I can perform all tests in one go.
I have now added conflict resolution and object storage to the implementation. The basic functionality is now done.
Time to add support for multiple conflict sets and multiple objects.
"No matter what, they can’t eat you"
— Merlin Mann
Needed a unique identifier for database objects that are unique on all nodes and after some googling, I found ossp-uuid. A simple and portable library for UUID:s. Love the lib!
Some code sample:
uuid_create(&uuid);
uuid_create(&uuid_ns);
uuid_load(uuid_ns, "ns:URL");
uuid_make(uuid, UUID_MAKE_V3, uuid_ns, name );
str = NULL;
uuid_export(uuid, UUID_FMT_STR,&str, NULL);
Simple huh?
After some compile issues on my Linux box (and not on the OSX box), I realized that the getaddrinfo() function is not in c99 standard.
Anyone that has a alternative function ? :)
Added locking code in the Conflict set so that multiple threads can insert updates.
Now, after some bug hunting, I have basic propagation and stabilization working with 2 replicas. The next thing is to add parameters to updates and to be able to control the number of replicas that is used.
Iterating through a array with modulus function in the incrementing function and have multiple conditions for increasing that value, …. IT FUCKS UP YOUR HEAD!.