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.Location, Translog.Operation, Translog.Snapshot, Translog.Source
 
Field Summary
 
Fields inherited from class org.elasticsearch.index.shard.AbstractIndexShardComponent
componentSettings, indexSettings, logger, shardId
 
Fields inherited from interface org.elasticsearch.index.translog.Translog
TRANSLOG_ID_KEY
 
Constructor Summary
FsTranslog(ShardId shardId, Settings indexSettings, File location)
           
FsTranslog(ShardId shardId, Settings indexSettings, IndexSettingsService indexSettingsService, NodeEnvironment nodeEnv)
           
 
Method Summary
 Translog.Location 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.
 int estimatedNumberOfOperations()
          Returns the number of operations in the transaction log.
 File[] locations()
           
 void makeTransientCurrent()
          Swaps the transient translog to be the current one.
 long memorySizeInBytes()
          The estimated memory size this translog is taking.
 void newTransientTranslog(long id)
          Creates a new transient translog, where added ops will be added to the current one, and to it.
 void newTranslog(long id)
          Creates a new transaction log internally.
 byte[] read(Translog.Location location)
           
 void revertTransient()
          Reverts back to not have a transient translog.
 FsChannelSnapshot 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.
 boolean syncNeeded()
           
 void syncOnEachOperation(boolean syncOnEachOperation)
           
 long translogSizeInBytes()
          Returns the size in bytes of the translog.
 
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,
                         IndexSettingsService indexSettingsService,
                         NodeEnvironment nodeEnv)

FsTranslog

public FsTranslog(ShardId shardId,
                  @IndexSettings
                  Settings indexSettings,
                  File location)
Method Detail

close

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

Can only be called by one thread.

Specified by:
close in interface Translog

locations

public File[] locations()

currentId

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

Specified by:
currentId in interface Translog

estimatedNumberOfOperations

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

Specified by:
estimatedNumberOfOperations in interface Translog

memorySizeInBytes

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

Specified by:
memorySizeInBytes in interface Translog

translogSizeInBytes

public long translogSizeInBytes()
Description copied from interface: Translog
Returns the size in bytes of the translog.

Specified by:
translogSizeInBytes 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(long id)
                 throws TranslogException
Description copied from interface: Translog
Creates a new transaction log internally.

Can only be called by one thread.

Specified by:
newTranslog in interface Translog
Throws:
TranslogException

newTransientTranslog

public void newTransientTranslog(long id)
                          throws TranslogException
Description copied from interface: Translog
Creates a new transient translog, where added ops will be added to the current one, and to it.

Can only be called by one thread.

Specified by:
newTransientTranslog in interface Translog
Throws:
TranslogException

makeTransientCurrent

public void makeTransientCurrent()
Description copied from interface: Translog
Swaps the transient translog to be the current one.

Can only be called by one thread.

Specified by:
makeTransientCurrent in interface Translog

revertTransient

public void revertTransient()
Description copied from interface: Translog
Reverts back to not have a transient translog.

Specified by:
revertTransient in interface Translog

read

public byte[] read(Translog.Location location)
Specified by:
read in interface Translog

add

public Translog.Location 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 FsChannelSnapshot 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

syncNeeded

public boolean syncNeeded()
Specified by:
syncNeeded in interface Translog

syncOnEachOperation

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


Copyright © 2009-2012. All Rights Reserved.