org.elasticsearch.index.translog.fs
Class FsTranslog

java.lang.Object
  extended by org.elasticsearch.index.shard.AbstractIndexShardComponent
      extended by org.elasticsearch.index.translog.fs.FsTranslog
All Implemented Interfaces:
IndexShardComponent, Translog

public class FsTranslog
extends AbstractIndexShardComponent
implements Translog


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.elasticsearch.index.translog.Translog
Translog.Create, Translog.Delete, Translog.DeleteByQuery, Translog.Index, Translog.Operation, Translog.Snapshot
 
Field Summary
 
Fields inherited from class org.elasticsearch.index.shard.AbstractIndexShardComponent
componentSettings, indexSettings, logger, shardId
 
Constructor Summary
FsTranslog(ShardId shardId, Settings indexSettings, java.io.File location)
           
FsTranslog(ShardId shardId, Settings indexSettings, java.io.File location, boolean useStream)
           
FsTranslog(ShardId shardId, Settings indexSettings, NodeEnvironment nodeEnv)
           
 
Method Summary
 void add(Translog.Operation operation)
          Adds a create operation to the transaction log.
 void clearUnreferenced()
          Clears unreferenced transaclogs.
 void close(boolean delete)
          Closes the transaction log.
 long currentId()
          Returns the id of the current transaction log.
 ByteSizeValue estimateMemorySize()
          The estimated memory size this translog is taking.
 java.io.File location()
           
 void newTranslog()
          Creates a new transaction log internally.
 void newTranslog(long id)
          Creates a new transaction log internally.
 int size()
          Returns the number of operations in the transaction log.
 Translog.Snapshot snapshot()
          Snapshots the current transaction log allowing to safely iterate over the snapshot.
 Translog.Snapshot snapshot(Translog.Snapshot snapshot)
          Snapshots the delta between the current state of the translog, and the state defined by the provided snapshot.
 void sync()
          Sync's the translog.
 void syncOnEachOperation(boolean syncOnEachOperation)
           
 
Methods inherited from class org.elasticsearch.index.shard.AbstractIndexShardComponent
indexSettings, managementGroupName, nodeName, shardId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.elasticsearch.index.shard.IndexShardComponent
indexSettings, shardId
 

Constructor Detail

FsTranslog

@Inject
public FsTranslog(ShardId shardId,
                         @IndexSettings
                         Settings indexSettings,
                         NodeEnvironment nodeEnv)

FsTranslog

public FsTranslog(ShardId shardId,
                  @IndexSettings
                  Settings indexSettings,
                  java.io.File location)

FsTranslog

public FsTranslog(ShardId shardId,
                  @IndexSettings
                  Settings indexSettings,
                  java.io.File location,
                  boolean useStream)
Method Detail

location

public java.io.File location()

currentId

public long currentId()
Description copied from interface: Translog
Returns the id of the current transaction log.

Specified by:
currentId in interface Translog

size

public int size()
Description copied from interface: Translog
Returns the number of operations in the transaction log.

Specified by:
size in interface Translog

estimateMemorySize

public ByteSizeValue estimateMemorySize()
Description copied from interface: Translog
The estimated memory size this translog is taking.

Specified by:
estimateMemorySize in interface Translog

clearUnreferenced

public void clearUnreferenced()
Description copied from interface: Translog
Clears unreferenced transaclogs.

Specified by:
clearUnreferenced in interface Translog

newTranslog

public void newTranslog()
                 throws TranslogException
Description copied from interface: Translog
Creates a new transaction log internally. Note, users of this class should make sure that no operations are performed on the trans log when this is called.

Specified by:
newTranslog in interface Translog
Throws:
TranslogException

newTranslog

public void newTranslog(long id)
                 throws TranslogException
Description copied from interface: Translog
Creates a new transaction log internally. Note, users of this class should make sure that no operations are performed on the trans log when this is called.

Specified by:
newTranslog in interface Translog
Throws:
TranslogException

add

public void add(Translog.Operation operation)
         throws TranslogException
Description copied from interface: Translog
Adds a create operation to the transaction log.

Specified by:
add in interface Translog
Throws:
TranslogException

snapshot

public Translog.Snapshot snapshot()
                           throws TranslogException
Description copied from interface: Translog
Snapshots the current transaction log allowing to safely iterate over the snapshot.

Specified by:
snapshot in interface Translog
Throws:
TranslogException

snapshot

public Translog.Snapshot snapshot(Translog.Snapshot snapshot)
Description copied from interface: Translog
Snapshots the delta between the current state of the translog, and the state defined by the provided snapshot. If a new translog has been created after the provided snapshot has been take, will return a snapshot on the current trasnlog.

Specified by:
snapshot in interface Translog

sync

public void sync()
Description copied from interface: Translog
Sync's the translog.

Specified by:
sync in interface Translog

syncOnEachOperation

public void syncOnEachOperation(boolean syncOnEachOperation)
Specified by:
syncOnEachOperation in interface Translog

close

public void close(boolean delete)
Description copied from interface: Translog
Closes the transaction log.

Specified by:
close in interface Translog