de.zib.scalaris
Date: 2016-02-29

# Package de.zib.scalaris

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

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  ErlangValue.ListElementConverter<T> | Converts list elements to a desired type.
  NodeDiscovery.NewNodeHandler | Handler that is invoked whenever a new node is found by the `NodeDiscovery` thread.

- Class Summary
  Class | Description
  --- | ---
  AbstractTransaction<ReqL extends RequestList,ResL extends ResultList> | Generic base class for `Transaction` and `TransactionSingleOp`.
  Benchmark | Provides methods to run benchmarks and print the results.
  CommonErlangObjects | Contains some often used objects as static objects as static members in order to avoid re-creating them each time they are needed.
  Connection | Wraps an `OtpConnection` and allows automatic re-connects using a `ConnectionPolicy` object.
  ConnectionFactory | Provides means to create connections to scalaris nodes.
  ConnectionPolicy | Defines a policy on how to select a node to connect to from a set of possible nodes and whether to automatically re-connect.
  ConnectionPool | Implements a simple (thread-safe) connection pool for Scalaris connections.
  DefaultConnectionPolicy | Implements a `ConnectionPolicy` by choosing nodes randomly.
  DeleteResult | Stores the result of a delete operation.
  ErlangValue | Encapsulates a result from a read operation on scalaris.
  ErlangValue.StringListElementConverter | Converts list elements to `String`s.
  FixedNodeConnectionPolicy | Implements a `ConnectionPolicy` which only supports a single node and does not issue automatic re-tries.
  Main | Class to test basic functionality of the package and to use scalaris from command line.
  Monitor | Provides methods to monitor a specific Scalaris (Erlang) VM.
  Monitor.GetNodeInfoResult | Plain old data object for results of `Monitor.getNodeInfo()`.
  Monitor.GetNodePerformanceResult | Plain old data object for results of `Monitor.getNodePerformance()`.
  Monitor.GetServiceInfoResult | Plain old data object for results of `Monitor.getServiceInfo()`.
  Monitor.GetServicePerformanceResult | Plain old data object for results of `Monitor.getServicePerformance()`.
  NodeDiscovery | Provides a node discovery service.
  PeerNode | Wrapper class to the `OtpPeer` class, adding some additional information.
  ReplicatedDHT | Provides methods to delete all replicas of the given key (from `api_rdht.erl`).
  RequestList | Generic request list.
  ResultList | Generic result list.
  RoundRobinConnectionPolicy | Implements a `ConnectionPolicy` by choosing nodes round-robin.
  RoutingTable | Scalaris interface to basic routing table information.
  Scalaris | Provides methods to interact with some Scalaris (Erlang) VM.
  ScalarisVM | Provides methods to interact with a specific Scalaris (Erlang) VM.
  ScalarisVM.AddNodesResult | Plain old data object for results of `ScalarisVM.addNodes(int)`.
  ScalarisVM.DeleteNodesByNameResult | Plain old data object for results of `ScalarisVM.shutdownNodes(int)`, `ScalarisVM.shutdownNodesByName(List)`, `ScalarisVM.killNodes(int)` and `ScalarisVM.killNodes(List)`.
  ScalarisVM.GetInfoResult | Plain old data object for results of `ScalarisVM.getInfo()`.
  Transaction | Provides means to realise a transaction with the scalaris ring using Java.
  Transaction.RequestList | Encapsulates requests that can be used for transactions in `Transaction.req_list(RequestList)`.
  Transaction.ResultList | Encapsulates a list of results as returned by `Transaction.req_list(RequestList)`.
  TransactionSingleOp | Provides methods to read and write key/value pairs to/from a scalaris ring.
  TransactionSingleOp.RequestList | Encapsulates requests that can be used for transactions in `TransactionSingleOp.req_list(RequestList)`.
  TransactionSingleOp.ResultList | Encapsulates a list of results as returned by `TransactionSingleOp.req_list(RequestList)`.

- Exception Summary
  Exception | Description
  --- | ---
  AbortException | Exception that is thrown if a the commit of a transaction on a scalaris ring fails.
  ConnectionException | Exception that is thrown if an operation on a scalaris ring fails because the connection is not active, a communication error occurred, an exit signal was received or the remote node sent a message containing an invalid cookie.
  EmptyListException | Exception that is thrown if a read of a random list element on a scalaris ring fails because the participating values are empty lists.
  KeyChangedException | Exception that is thrown if a test_and_set operation on a scalaris ring fails because the old value did not match the expected value.
  NotAListException | Exception that is thrown if a add_del_on_list operation on a scalaris ring fails because the participating values are not lists.
  NotANumberException | Exception that is thrown if a add_del_on_list operation on a scalaris ring fails because the participating values are not numbers.
  NotFoundException | Exception that is thrown if a read operation on a scalaris ring fails because the key did not exist before.
  TimeoutException | Exception that is thrown if a read or write operation on a scalaris ring fails due to a timeout.
  UnknownException | Generic exception that is thrown during operations on a scalaris ring, e.g.

## 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