org.elasticsearch.index.translog.fs
Class FsStreamSnapshot

java.lang.Object
  extended by org.elasticsearch.index.translog.fs.FsStreamSnapshot
All Implemented Interfaces:
Releasable, Translog.Snapshot

public class FsStreamSnapshot
extends java.lang.Object
implements Translog.Snapshot


Constructor Summary
FsStreamSnapshot(ShardId shardId, long id, RafReference raf, long length, int totalOperations, int snapshotOperations)
           
 
Method Summary
 boolean hasNext()
           
 long length()
          Returns the internal length (*not* number of operations) of this snapshot.
 long lengthInBytes()
          The length in bytes of this stream.
 Translog.Operation next()
           
 long position()
           
 boolean release()
           
 void seekForward(long length)
           
 int snapshotOperations()
          The number of operations in this snapshot.
 java.io.InputStream stream()
          Returns a stream of this snapshot.
 int totalOperations()
          The total number of operations in the translog.
 long translogId()
          The id of the translog the snapshot was taken with.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FsStreamSnapshot

public FsStreamSnapshot(ShardId shardId,
                        long id,
                        RafReference raf,
                        long length,
                        int totalOperations,
                        int snapshotOperations)
                 throws java.io.FileNotFoundException
Throws:
java.io.FileNotFoundException
Method Detail

translogId

public long translogId()
Description copied from interface: Translog.Snapshot
The id of the translog the snapshot was taken with.

Specified by:
translogId in interface Translog.Snapshot

position

public long position()
Specified by:
position in interface Translog.Snapshot

length

public long length()
Description copied from interface: Translog.Snapshot
Returns the internal length (*not* number of operations) of this snapshot.

Specified by:
length in interface Translog.Snapshot

totalOperations

public int totalOperations()
Description copied from interface: Translog.Snapshot
The total number of operations in the translog.

Specified by:
totalOperations in interface Translog.Snapshot

snapshotOperations

public int snapshotOperations()
Description copied from interface: Translog.Snapshot
The number of operations in this snapshot.

Specified by:
snapshotOperations in interface Translog.Snapshot

stream

public java.io.InputStream stream()
                           throws java.io.IOException
Description copied from interface: Translog.Snapshot
Returns a stream of this snapshot.

Specified by:
stream in interface Translog.Snapshot
Throws:
java.io.IOException

lengthInBytes

public long lengthInBytes()
Description copied from interface: Translog.Snapshot
The length in bytes of this stream.

Specified by:
lengthInBytes in interface Translog.Snapshot

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Translog.Snapshot

next

public Translog.Operation next()
Specified by:
next in interface Translog.Snapshot

seekForward

public void seekForward(long length)
Specified by:
seekForward in interface Translog.Snapshot

release

public boolean release()
                throws ElasticSearchException
Specified by:
release in interface Releasable
Throws:
ElasticSearchException