public class Log
extends java.lang.Object
Log.Reader
and written to using a
Log.Writer
.
Both the Reader and Writer will require a quorum which defines the ratio of active Mesos Masters that need to be available for a successful read or write. The quorum will be satisfied when the number of active Masters is greater than the given number:
Quorum > (Number of Masters)/2
If a read or write is executed the operation will wait until their is quorum to succeed.
Modifier and Type | Class and Description |
---|---|
static class |
Log.Entry
Represents an opaque data entry in the
Log with a
Log.Position . |
static class |
Log.OperationFailedException
An exception that gets thrown when an error occurs while
performing a read or write operation.
|
static class |
Log.Position
An opaque identifier of a log entry's position within the
log.
|
static class |
Log.Reader
Provides read access to the
Log . |
static class |
Log.Writer
Provides write access to the
Log . |
static class |
Log.WriterFailedException
An exception that gets thrown when a writer no longer has the
ability to perform operations (e.g., because it was superseded by
another writer).
|
Constructor and Description |
---|
Log(int quorum,
java.lang.String path,
java.util.Set<java.lang.String> pids)
Creates a new replicated log that assumes the specified quorum
size, is backed by a file at the specified path, and coordiantes
with other replicas via the set of process PIDs.
|
Log(int quorum,
java.lang.String path,
java.lang.String servers,
long timeout,
java.util.concurrent.TimeUnit unit,
java.lang.String znode)
Creates a new replicated log that assumes the specified quorum
size, is backed by a file at the specified path, and coordiantes
with other replicas associated with the specified ZooKeeper
servers, timeout, and znode (or Zookeeper name space).
|
Log(int quorum,
java.lang.String path,
java.lang.String servers,
long timeout,
java.util.concurrent.TimeUnit unit,
java.lang.String znode,
java.lang.String scheme,
byte[] credentials)
Creates a new replicated log that assumes the specified quorum
size, is backed by a file at the specified path, and coordiantes
with other replicas associated with the specified ZooKeeper
servers, timeout, and znode (or Zookeeper name space).
|
Modifier and Type | Method and Description |
---|---|
protected void |
finalize() |
protected void |
initialize(int quorum,
java.lang.String path,
java.util.Set<java.lang.String> pids) |
protected void |
initialize(int quorum,
java.lang.String path,
java.lang.String servers,
long timeout,
java.util.concurrent.TimeUnit unit,
java.lang.String znode) |
protected void |
initialize(int quorum,
java.lang.String path,
java.lang.String servers,
long timeout,
java.util.concurrent.TimeUnit unit,
java.lang.String znode,
java.lang.String scheme,
byte[] credentials) |
Log.Position |
position(byte[] identity)
Returns a position based off of the bytes recovered from
Position.identity().
|
public Log(int quorum, java.lang.String path, java.util.Set<java.lang.String> pids)
quorum
- The quorum size.path
- Path to the file backing this log.pids
- PIDs of the replicas to coordinate with.public Log(int quorum, java.lang.String path, java.lang.String servers, long timeout, java.util.concurrent.TimeUnit unit, java.lang.String znode)
quorum
- The quorum size.path
- Path to the file backing this log.servers
- List of ZooKeeper servers (e.g., 'ip1:port1,ip2:port2').timeout
- Max number of time units to wait before a
TimeoutException
.unit
- Type of time units used for the timeout, e.g. seconds,
minutes, etc.znode
- Path to znode where "state" should be rooted.public Log(int quorum, java.lang.String path, java.lang.String servers, long timeout, java.util.concurrent.TimeUnit unit, java.lang.String znode, java.lang.String scheme, byte[] credentials)
quorum
- The quorum size.path
- Path to the file backing this log.servers
- Zookeper servers/connection string.timeout
- Max number of time units to wait before a
TimeoutException
.unit
- Type of time units used for the timeout, e.g. seconds,
minutes, etc.znode
- The Zookeeper name space.scheme
- Authentication scheme (e.g., "digest").credentials
- Authentication credentials (e.g., "user:pass").public Log.Position position(byte[] identity)
identity
- Identity, in bytes, of the position.protected void initialize(int quorum, java.lang.String path, java.util.Set<java.lang.String> pids)
protected void initialize(int quorum, java.lang.String path, java.lang.String servers, long timeout, java.util.concurrent.TimeUnit unit, java.lang.String znode)
protected void initialize(int quorum, java.lang.String path, java.lang.String servers, long timeout, java.util.concurrent.TimeUnit unit, java.lang.String znode, java.lang.String scheme, byte[] credentials)
protected void finalize()
finalize
in class java.lang.Object