com.splout.db.common
Class ReplicationMap

java.lang.Object
  extended by com.splout.db.common.ReplicationMap
All Implemented Interfaces:
java.io.Serializable

public class ReplicationMap
extends java.lang.Object
implements java.io.Serializable

A Splout's replication map definition.

A replication map is made up by a list of ReplicationEntry. Each of them specifies the list of addresses (nodes) that hold the data for a shard. It is understood that if one ReplicationEntry has more than one node then they will all hold the same data.

See Also:
Serialized Form

Constructor Summary
ReplicationMap()
           
ReplicationMap(java.util.List<ReplicationEntry> replicationMap)
           
 
Method Summary
 java.util.List<ReplicationEntry> getReplicationEntries()
           
static ReplicationMap oneToOneMap(java.lang.String... hosts)
          Returns a one to one replication map with consecutive shard Ids from a list of hosts.
static ReplicationMap roundRobinMap(int nPartitions, int repFactor, java.lang.String... hosts)
           
 void setReplicationEntries(java.util.List<ReplicationEntry> replicationEntries)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReplicationMap

public ReplicationMap()

ReplicationMap

public ReplicationMap(java.util.List<ReplicationEntry> replicationMap)
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

roundRobinMap

public static ReplicationMap roundRobinMap(int nPartitions,
                                           int repFactor,
                                           java.lang.String... hosts)

oneToOneMap

public static ReplicationMap oneToOneMap(java.lang.String... hosts)
Returns a one to one replication map with consecutive shard Ids from a list of hosts. This method is useful for quickly having an instance of ReplicationMap that has no replication (1 shard -> 1 host).


getReplicationEntries

public java.util.List<ReplicationEntry> getReplicationEntries()

setReplicationEntries

public void setReplicationEntries(java.util.List<ReplicationEntry> replicationEntries)


Copyright © 2012-2013 Datasalt Systems S.L.. All Rights Reserved.