com.threerings.presents.peer.server.persist
Class NodeRepository

java.lang.Object
  extended by com.samskivert.depot.DepotRepository
      extended by com.threerings.presents.peer.server.persist.NodeRepository

public class NodeRepository
extends DepotRepository

Used to share information on active nodes in a Presents server cluster.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.samskivert.depot.DepotRepository
DepotRepository.CacheStrategy
 
Field Summary
 
Fields inherited from class com.samskivert.depot.DepotRepository
_ctx, _dataMigs
 
Constructor Summary
NodeRepository(PersistenceContext ctx)
          Constructs a new repository with the specified persistence context.
 
Method Summary
protected  void getManagedRecords(Set<Class<? extends PersistentRecord>> classes)
           
 void heartbeatNode(String nodeName)
          Updates NodeRecord.lastUpdated for the specified node, indicating that the node is alive and well.
 List<NodeRecord> loadNodes()
          Returns a list of all nodes registered in the repository that are not explicitly shut down.
 List<NodeRecord> loadNodes(String namespace)
          Returns a list of all nodes registered in the repository with names starting with the given string that are not explicitly shut down.
 List<NodeRecord> loadNodes(String namespace, boolean includeShutdown)
          Returns a list of all nodes registered in the repository with names starting with the given string, optionally including nodes that are explicitly shut down.
 void shutdownNode(String nodeName)
          Marks the identified node as shut down in its record.
 void updateNode(NodeRecord record)
          Updates the supplied node record, inserting it into the database if necessary.
 
Methods inherited from class com.samskivert.depot.DepotRepository
delete, delete, deleteAll, deleteAll, deleteAll, deleteAll, doUpdate, findAll, findAll, findAll, findAll, findAllKeys, findAllKeys, from, init, insert, load, load, load, load, loadAll, loadAll, makeValue, map, registerMigration, requireNotComputed, resolveRecords, runMigration, store, update, update, updatePartial, updatePartial, updatePartial, updatePartial, updatePartial
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeRepository

@Inject
public NodeRepository(PersistenceContext ctx)
Constructs a new repository with the specified persistence context.

Method Detail

loadNodes

public List<NodeRecord> loadNodes()
Returns a list of all nodes registered in the repository that are not explicitly shut down.


loadNodes

public List<NodeRecord> loadNodes(String namespace)
Returns a list of all nodes registered in the repository with names starting with the given string that are not explicitly shut down.


loadNodes

public List<NodeRecord> loadNodes(String namespace,
                                  boolean includeShutdown)
Returns a list of all nodes registered in the repository with names starting with the given string, optionally including nodes that are explicitly shut down.


updateNode

public void updateNode(NodeRecord record)
Updates the supplied node record, inserting it into the database if necessary.


heartbeatNode

public void heartbeatNode(String nodeName)
Updates NodeRecord.lastUpdated for the specified node, indicating that the node is alive and well.


shutdownNode

public void shutdownNode(String nodeName)
Marks the identified node as shut down in its record.


getManagedRecords

protected void getManagedRecords(Set<Class<? extends PersistentRecord>> classes)
Specified by:
getManagedRecords in class DepotRepository