/*
 * Copyright (C) 2014  Ohm Data
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package c5db.interfaces;

import c5db.interfaces.log.Reader;
import c5db.interfaces.log.SequentialEntry;
import c5db.interfaces.replication.ReplicatorLog;
import c5db.messages.generated.ModuleType;

import java.io.IOException;

/**
 * The log module is responsible for running all the threads and IO for write-ahead-logging.
 * <p>
 * The write-ahead-log is responsible for maintaining persistence in the face of node or machine
 * failure.
 */
@ModuleTypeBinding(ModuleType.Log)
public interface LogModule<E extends SequentialEntry> extends C5Module {
  // TODO: Replicator interaction is specified by protostuff message (LogEntry) but Reader by SequentialEntry;
  // TODO  should Mooring move to SequentialEntry specification?

  public ReplicatorLog getMooring(String quorumId) throws IOException;

  public Reader<E> getLogReader(String quorumId);
}

@@ -1021,58 +1021,30 @@
 for 
-write-ahead-logging.%0A * %3Cp%3E%0A * The write-ahead-log
+replicated%0A * logs. It
  is 
@@ -1126,16 +1126,174 @@
 ailure.%0A
+ * %3Cp%3E%0A * One use case for replicating logs is to implement a fault-tolerant distributed%0A * write-ahead log.%0A *%0A * @param %3CE%3E The type of entry the log uses.%0A
  */%0A@Mod
@@ -1579,77 +1579,993 @@
 %0A%0A  
-public ReplicatorLog getMooring(String quorumId) throws IOException;%0A
+/**%0A   * Obtain a new quorum-specific ReplicatorLog -- that is, an interface to the%0A   * LogModule's services, specialized for one Replicator to use.%0A   *%0A   * @param quorumId Quorum ID -- an identifier of which continuity of distributed%0A   *                 log the ReplicatorLog should interface with. In other words,%0A   *                 a quorum is the unit of maintaining a single sequence of logged%0A   *                 entries. Multiple replicators may cooperate to replicate that%0A   *                 sequence, each having its own local log.%0A   * @return A new ReplicatorLog. The caller does not need to close it or release%0A   * of resources; the resources, if any, will be released when the LogModule stops.%0A   * @throws IOException%0A   */%0A  public ReplicatorLog getMooring(String quorumId) throws IOException;%0A%0A  /**%0A   * Obtain a Reader, to access entries that have been logged for a given quorum.%0A   *%0A   * @param quorumId Quorum ID%0A   * @return A new Reader instance.%0A   */
 %0A  p

Add LogModule javadoc