com.thinkaurelius.titan.diskstorage.log

## Interface Log

- All Known Implementing Classes:
    KCVSLog

      public interface Log

  Represents a log that allows content to be added to it in the form of messages and to read messages and their content from the log via registered `MessageReader`s.
  Author:
    Matthias Broecheler (me@matthiasb.com)

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Future<Message>` | `add(StaticBuffer content)` Attempts to add the given content to the log and returns a `Future` for this action.
    `Future<Message>` | `add(StaticBuffer content, StaticBuffer key)` Attempts to add the given content to the log and returns a `Future` for this action.
    `void` | `close()` Closes this log and stops the reading process.
    `String` | `getName()` Returns the name of this log
    `void` | `registerReader(ReadMarker readMarker, MessageReader... reader)`
    `void` | `registerReaders(ReadMarker readMarker, Iterable<MessageReader> readers)` Registers the given readers with this log.
    `boolean` | `unregisterReader(MessageReader reader)` Removes the given reader from the list of registered readers and returns whether this reader was registered in the first place.

- - ### Method Detail

    - #### add

          Future<Message> add(StaticBuffer content)

      Attempts to add the given content to the log and returns a `Future` for this action. If the log is configured for immediate sending, then any exception encountered during this process is thrown by this method. Otherwise, encountered exceptions are attached to the returned future.
      Parameters:
        `content` -
      Returns:

    - #### add

          Future<Message> add(StaticBuffer content,
                            StaticBuffer key)

      Attempts to add the given content to the log and returns a `Future` for this action. In addition, a key is provided to signal the recipient of the log message in partitioned logging systems. If the log is configured for immediate sending, then any exception encountered during this process is thrown by this method. Otherwise, encountered exceptions are attached to the returned future.
      Parameters:
        `content` -
      Returns:

    - #### registerReader

          void registerReader(ReadMarker readMarker,
                            MessageReader... reader)

      Parameters:
        `readMarker` - Indicates where to start reading from the log once message readers are registered
        `reader` - The readers to register (all at once)
      See Also:
        `registerReaders(ReadMarker, Iterable)`

    - #### registerReaders

          void registerReaders(ReadMarker readMarker,
                             Iterable<MessageReader> readers)

      Registers the given readers with this log. These readers will be invoked for each newly read message from the log starting at the point identified by the provided `ReadMarker`.

      If no previous readers were registered, invoking this method triggers reader threads to be instantiated. If readers have been previously registered, then the provided `ReadMarker` must be compatible with the previous `ReadMarker` or an exception will be thrown.
      Parameters:
        `readMarker` - Indicates where to start reading from the log once message readers are registered
        `readers` - The readers to register (all at once)

    - #### unregisterReader

          boolean unregisterReader(MessageReader reader)

      Removes the given reader from the list of registered readers and returns whether this reader was registered in the first place. Note, that removing the last reader does not stop the reading process. Use `close()` instead.
      Parameters:
        `reader` -
      Returns:
        true if this MessageReader was registered before and was successfully unregistered, else false

    - #### getName

          String getName()

      Returns the name of this log
      Returns:

    - #### close

          void close()
                     throws BackendException

      Closes this log and stops the reading process.
      Throws:
        `BackendException`

Copyright © 2012–2014. All rights reserved.