Package de.zib.scalaris

This package contains means to communicate with the erlang scalaris ring from Java.

See: Description

Package de.zib.scalaris Description

This package contains means to communicate with the erlang scalaris ring from Java.

The TransactionSingleOp class

The TransactionSingleOp class provides methods for reading and writing values, with both, erlang objects (OtpErlangObject) and Java objects like String.

Example:

 
   try {
     TransactionSingleOp sc = new TransactionSingleOp();
     String value = sc.read("key").stringValue();
   } catch (ConnectionException e) {
     System.err.println("read failed: " + e.getMessage());
   } catch (NotFoundException e) {
     System.err.println("read failed with not found: " + e.getMessage());
   } catch (ClassCastException e) {
     System.err.println("read failed with unexpected return type: " + e.getMessage());
   } catch (UnknownException e) {
     System.err.println("read failed with unknown: " + e.getMessage());
   }
 
 

See the TransactionSingleOp class documentation for more details.

The Transaction class

The Transaction class provides means to realise a scalaris transaction from Java. There are methods to read and write values with both erlang objects (OtpErlangObject) and Java objects like String. The transaction can then be committed or aborted.

Example:

 
   try {
     Transaction transaction = new Transaction();
     String value = transaction.read("key").stringValue();
     transaction.write("key", "value");
     transaction.commit();
   } catch (ConnectionException e) {
     System.err.println("read failed: " + e.getMessage());
   } catch (NotFoundException e) {
     System.err.println("read failed with not found: " + e.getMessage());
   } catch (UnknownException e) {
     System.err.println("read failed with unknown: " + e.getMessage());
   }
 
 

See the Transaction class documentation for more details.

The ReplicatedDHT class

The ReplicatedDHT class provides methods for working inconsistently on replicated key/value pairs, e.g. to delete replicas. It supports both, erlang strings (OtpErlangString) and Java strings (String).

Example:

 
   try {
     ReplicatedDHT sc = new ReplicatedDHT();
     long deleted = sc.delete("key");
     DeleteResult delRes = sc.getLastDeleteResult();
   } catch (ConnectionException e) {
     System.err.println("delete failed: " + e.getMessage());
   } catch (TimeoutException e) {
     System.err.println("delete failed with timeout: " + e.getMessage());
   } catch (NodeNotFoundException e) {
     System.err.println("delete failed with node not found: " + e.getMessage());
   } catch (UnknownException e) {
     System.err.println("delete failed with unknown: " + e.getMessage());
   }
 
 

See the ReplicatedDHT class documentation for more details.

Since:
2.0
Version:
2.9
Author:
Nico Kruber, kruber@zib.de