com.bigdata.journal
Enum BufferMode

java.lang.Object
  extended by java.lang.Enum<BufferMode>
      extended by com.bigdata.journal.BufferMode
All Implemented Interfaces:
Serializable, Comparable<BufferMode>

public enum BufferMode
extends Enum<BufferMode>

The buffer mode in which the journal is opened.

The Direct and Mapped options may not be used for files exceeding Integer.MAX_VALUE bytes in length since a ByteBuffer is indexed with an int (the pragmatic limit is typically much lower and depends on the size of the JVM heap for the Direct mode).

Version:
$Id: BufferMode.java 6284 2012-04-13 13:36:27Z thompsonbry $
Author:
Bryan Thompson

Enum Constant Summary
Direct
          This mode is not being actively developed and should not be used outside of unit tests.
Disk
           This is a synonym for DiskWORM.
DiskRW
           The journal is managed on disk.
DiskWORM
           The journal is managed on disk.
Mapped
          This mode is not being actively developed and should not be used outside of unit tests.
MemStore
          A transient buffer mode backed by the MemoryManager, which is similar to the RWStore but optimized for main memory.
Temporary
           A variant on the Disk mode that is not restart-safe.
TemporaryRW
           A variant on the DiskRW backed by a temporary file.
Transient
           A variant on the Direct mode that is not restart-safe.
 
Method Summary
static BufferMode getDefaultBufferMode(StoreTypeEnum storeType)
           
 long getMaxExtent()
          The maximum extent for the BufferMode.
 StoreTypeEnum getStoreType()
          The kind of persistence store (RW or WORM).
 boolean isFullyBuffered()
          true iff this BufferMode is fully buffered in memory.
 boolean isStable()
          true iff this BufferMode uses a stable media (disk).
static BufferMode valueOf(String name)
          Returns the enum constant of this type with the specified name.
static BufferMode[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

Transient

public static final BufferMode Transient

A variant on the Direct mode that is not restart-safe. This mode is useful for temporary stores which can reside entirely in memory and do not require disk. It can be used in environments, such as an applet, where you can not access the disk (however, you can also use a transient BTree with much the same effect). The Temporary mode is much more scalable.

See Also:
TransientBufferStrategy

Direct

public static final BufferMode Direct
This mode is not being actively developed and should not be used outside of unit tests.

A direct buffer is allocated for the file image. Writes are applied to the buffer. The buffer tracks dirty slots regardless of the transaction that wrote them and periodically writes dirty slots through to disk. On commit, any dirty index or allocation nodes are written onto the buffer and all dirty slots on the buffer. Dirty slots in the buffer are then synchronously written to disk, the appropriate root block is updated, and the file is (optionally) flushed to disk.

This option wires an image of the journal file into memory and allows the journal to optimize IO operations.

See Also:
DirectBufferStrategy

Mapped

public static final BufferMode Mapped
This mode is not being actively developed and should not be used outside of unit tests. Memory mapped IO has the fatal weakness under Java that you can not reliably close or extend the backing file.

A memory-mapped buffer is allocated for the file image. Writes are applied to the buffer. Reads read from the buffer. On commit, the map is forced disk disk.

This option yields control over IO and memory resources to the OS. However, there is currently no way to force release of the mapped memory per the bug described below. This means (a) you might not be able to delete the mapped file; and (b) that native memory can be exhausted. While performance is good on at least some benchmarks, it is difficult to recommend this solution given its downsides.

See Also:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4724038, MappedBufferStrategy

Disk

public static final BufferMode Disk

This is a synonym for DiskWORM.

See Also:
WORMStrategy

DiskWORM

public static final BufferMode DiskWORM

The journal is managed on disk. This option may be used with files of more than Integer.MAX_VALUE bytes in extent. Journal performance for large files should be fair on write, but performance will degrade as the journal is NOT optimized for random reads (poor locality).

See Also:
WORMStrategy

DiskRW

public static final BufferMode DiskRW

The journal is managed on disk. This option may be used with files of more than Integer.MAX_VALUE bytes in extent. RW indicates that it is not a WORM with append only semantics but rather a disk alloc/realloc mechanism that supports updates to values. In general the store locality may be poor but should normally benefit in comparison to a WORM with smaller disk size.

See Also:
RWStrategy

TemporaryRW

public static final BufferMode TemporaryRW

A variant on the DiskRW backed by a temporary file. Options enable part of the store to be held with Direct ByteBuffers. A significant use case would be an in-memory store but with disk overflow if required.

See Also:
RWStrategy

Temporary

public static final BufferMode Temporary

A variant on the Disk mode that is not restart-safe. This mode is useful for all manners of temporary data with full concurrency control and scales-up to very large temporary files. The backing file (if any) is always destroyed when the store is closed. This is much more scalable than the Transient mode.

See Also:
DiskOnlyStrategy

MemStore

public static final BufferMode MemStore
A transient buffer mode backed by the MemoryManager, which is similar to the RWStore but optimized for main memory. This can scale up to 4TB of main memory.

Method Detail

values

public static BufferMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (BufferMode c : BufferMode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static BufferMode valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

isStable

public boolean isStable()
true iff this BufferMode uses a stable media (disk).


isFullyBuffered

public boolean isFullyBuffered()
true iff this BufferMode is fully buffered in memory.


getMaxExtent

public long getMaxExtent()
The maximum extent for the BufferMode.


getStoreType

public StoreTypeEnum getStoreType()
The kind of persistence store (RW or WORM).

See Also:
StoreTypeEnum

getDefaultBufferMode

public static BufferMode getDefaultBufferMode(StoreTypeEnum storeType)


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.