Berkley DB is the first non-relational database I've had the pleasure of working with. It is a It has options to scale up to hundreds of terabytes. Though it is written in C, it provides API bindings for PHP, Java, Perl and Ruby just to name a few.
Embedded Database
Berkley DB is an embedded database, but what does that mean? It means that it must be integrated with an application that needs to access stored data.
One such weakness of embedded databases is the fact that it only supports one user (the application). But is that entirely bad? Not necessarily. Using another service, Restlet, we can integrate the two together to provide multiple user access to centralized data storage!
Kata 1: Timestamp as secondary index
The first distribution provided the user with three options: GET, PUT, DELETE. The task that was given was to implement a timestamp that could be used as a secondary index for each data entry.
get-timestamp: returns the Contact with the given timestamp, if such a Contact exists.
get-range: returns the set of Contacts with timestamps between two specified values.
get-range: returns the set of Contacts with timestamps between two specified values.
Implementing the new options was actually much easier than I thought it would be. The BerkleyDB API provides very helpful examples that can make implementation an easy processes.
Completed
Time spent: 2 hours
Kata 2: Wicket, REST, Berkley DB: A match made in heaven
![]() |
Wicket Interface |
Wicket
This is your user front end. Using markup language to create forms, textfields and buttons, along with Wicket tags, it allows you to create a structured program over stateless HTTP.
It's a very tough gap that wicket tries to accomplish, and I think it does a pretty good job at it. The one thing I haven't gotten down is the implementation of sessions. Though I feel I came pretty close to understanding the principle, I could not get the sessions to work properly. Wicket allows for developers to create Session objects. Sessions have various applications depending on what you need. In this application we implement sessions in order to create concurrency. If you have many users trying to PUT and GET contacts from a centralized database, you want to make sure that people get what they asked for and not what someone else queried.
Restlet
This is the essential median between Wicket and BerkleyDB. BerkleyDB is designed to only allow for one person to update/query the database at a time. We add a Restlet layer on top of BerkleyDB in order to regulate all requests that are coming into the server. The good thing is that you won't have to worry about dirty reads, when a user requests data that is being modified by another user, because restlet will sequence the read/writes to the database. Another great thing about Restlet is that it can allow for multiple people to access the database (even though it is designed for one). In future implementations you could have many users/devices sending requests to the server as long as you can implement a Restlet layer on top of those devices to interact with the Restlet layer that handles the server's requests.
Not Completed
Time spent: 10 hours+
Download my kata distribution here.
No comments:
Post a Comment