com.bigdata.bfs
Class AtomicBlockWriteProc

java.lang.Object
  extended by com.bigdata.bfs.AtomicBlockWriteProc
All Implemented Interfaces:
IIndexProcedure, ISimpleIndexProcedure, Externalizable, Serializable

public class AtomicBlockWriteProc
extends Object
implements ISimpleIndexProcedure, Externalizable

Atomic write of a single block for a file version.

Version:
$Id: AtomicBlockWriteProc.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson
See Also:
Serialized Form

Field Summary
static boolean DEBUG
          True iff the log level is DEBUG or less.
static boolean INFO
          True iff the log level is INFO or less.
protected static org.apache.log4j.Logger log
           
 
Constructor Summary
AtomicBlockWriteProc(BigdataFileSystem repo, String id, int version, long block, byte[] b, int off, int len)
           
 
Method Summary
 Object apply(IIndex ndx)
          This procedure runs on the unisolated index.
 boolean isReadOnly()
          Return true iff the procedure asserts that it will not write on the index.
 void readExternal(ObjectInput in)
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static transient org.apache.log4j.Logger log

INFO

public static final transient boolean INFO
True iff the log level is INFO or less.


DEBUG

public static final transient boolean DEBUG
True iff the log level is DEBUG or less.

Constructor Detail

AtomicBlockWriteProc

public AtomicBlockWriteProc(BigdataFileSystem repo,
                            String id,
                            int version,
                            long block,
                            byte[] b,
                            int off,
                            int len)
Parameters:
id - The file identifier.
version - The file version.
block - The block identifier.
b - The buffer containing the data to be written.
off - The offset in the buffer of the first byte to be written.
len - The #of bytes to be written.
Method Detail

isReadOnly

public final boolean isReadOnly()
Description copied from interface: IIndexProcedure
Return true iff the procedure asserts that it will not write on the index. When true, the procedure may be run against a view of the index that is read-only or which allows concurrent processes to read on the same index object. When false the procedure will be run against a mutable view of the index (assuming that the procedure is executed in a context that has access to a mutable index view).

Specified by:
isReadOnly in interface IIndexProcedure

apply

public Object apply(IIndex ndx)
This procedure runs on the unisolated index. The raw data is written directly onto the Journal and the index is added/updated using the given file, version and block and the address of the block's data on the Journal.

Specified by:
apply in interface IIndexProcedure
Parameters:
ndx - The index.
Returns:
A Boolean whose value is true iff the block was overwritten.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException


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