Skip to content

anthonyu/KeptCollections

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KeptCollections Build Status

What is KeptCollections?

KeptCollections is a library of drop-in replacements for the data structures in the Java Collections framework. KeptCollections uses Apache ZooKeeper as a backing store, thus making its data structures distributed and scalable.

Changes made to a KeptCollection by one node are seen by all other nodes within milliseconds, allowing for easy communication between nodes in a computing cluster.

KeptCollections now supports Java generics, thanks to Gaurav Sharma. Classes that implement Serializable can be used as values in any of the collections. Classes that are serializable as strings (i.e. ints, doubles, etc.) will still be stored as strings on the ZooKeeper.

Why KeptCollections?

Implementing a distributed data structure from scratch is difficult. ZooKeeper programming is less hard, but still no walk in the park. Conversely, KeptCollections implements the well known Java Collections APIs, so they can be dropped into new or existing Java code and easily make those applications distributed.

How does one use KeptCollections?

The only difference between the KeptCollections collections and the JDK collections are the names of the classes and their constructors.

For instance, where a Map from Java Collections could be instantiated like:

Map<String, String> map = new HashMap<String, String>();

KeptCollections is instead instantiated like:

Zookeeper zk = new ZooKeeper("localhost:2181", 20000, watcher);

Map<String, String> map =
  new KeptMap(zk, "/mymap", Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);

Both are accessed the same way:

map.put("key", "value");

String value = map.get("key");

See the JavaDoc help for more information.

How stable are the collections?

The KeptSet, KeptMap and KeptLock implementations have seen several years of usage in a production environment at two different cloud computing companies.

The other implementations are similar in code base and well unit tested, but have not seen production usage.

Which Collections interfaces are implemented?

Set

Map

ConcurrentMap

Collection

List

Queue

BlockingQueue

Lock (not from Java Collections, but it sort of fits here regardless).

Which interfaces will (likely) be implemented in the future?

SortedSet

SortedMap

A few of the java.concurrent interfaces, but not those, mainly lock and barrier related, that are already implemented by Menagerie [https://github.com/openUtility/menagerie]

Where can I get a Jar?

Use Maven:

<dependency>
  <groupId>net.killa.kept</groupId>
  <artifactId>KeptCollections</artifactId>
  <version>1.0.0</version>
</dependency>

About

Distributed Java Collections for ZooKeeper

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages