org.elasticsearch.index.translog
Interface Translog

All Superinterfaces:
IndexShardComponent
All Known Implementing Classes:
FsTranslog

public interface Translog
extends IndexShardComponent


Nested Class Summary
static class Translog.Create
           
static class Translog.Delete
           
static class Translog.DeleteByQuery
           
static class Translog.Index
           
static class Translog.Location
           
static interface Translog.Operation
          A generic interface representing an operation performed on the transaction log.
static interface Translog.Snapshot
          A snapshot of the transaction log, allows to iterate over all the transaction log operations.
static class Translog.Source
           
 
Field Summary
static String TRANSLOG_ID_KEY
           
 
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.
 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.
 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.
 boolean syncNeeded()
           
 void syncOnEachOperation(boolean syncOnEachOperation)
           
 long translogSizeInBytes()
          Returns the size in bytes of the translog.
 
Methods inherited from interface org.elasticsearch.index.shard.IndexShardComponent
indexSettings, shardId
 

Field Detail

TRANSLOG_ID_KEY

static final String TRANSLOG_ID_KEY
See Also:
Constant Field Values
Method Detail

currentId

long currentId()
Returns the id of the current transaction log.


estimatedNumberOfOperations

int estimatedNumberOfOperations()
Returns the number of operations in the transaction log.


memorySizeInBytes

long memorySizeInBytes()
The estimated memory size this translog is taking.


translogSizeInBytes

long translogSizeInBytes()
Returns the size in bytes of the translog.


newTranslog

void newTranslog(long id)
                 throws TranslogException
Creates a new transaction log internally.

Can only be called by one thread.

Throws:
TranslogException

newTransientTranslog

void newTransientTranslog(long id)
                          throws TranslogException
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.

Throws:
TranslogException

makeTransientCurrent

void makeTransientCurrent()
Swaps the transient translog to be the current one.

Can only be called by one thread.


revertTransient

void revertTransient()
Reverts back to not have a transient translog.


add

Translog.Location add(Translog.Operation operation)
                      throws TranslogException
Adds a create operation to the transaction log.

Throws:
TranslogException

read

byte[] read(Translog.Location location)

snapshot

Translog.Snapshot snapshot()
                           throws TranslogException
Snapshots the current transaction log allowing to safely iterate over the snapshot.

Throws:
TranslogException

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. If a new translog has been created after the provided snapshot has been take, will return a snapshot on the current trasnlog.


clearUnreferenced

void clearUnreferenced()
Clears unreferenced transaclogs.


sync

void sync()
Sync's the translog.


syncNeeded

boolean syncNeeded()

syncOnEachOperation

void syncOnEachOperation(boolean syncOnEachOperation)

close

void close(boolean delete)
Closes the transaction log.

Can only be called by one thread.



Copyright © 2009-2012. All Rights Reserved.