You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2014/09/03 15:42:48 UTC
svn commit: r1622254 - in
/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb:
base/file/BlockAccess.java base/file/BufferChannel.java lib/NodeLib.java
nodetable/NodeTableNative.java nodetable/Nodec.java
Author: andy
Date: Wed Sep 3 13:42:48 2014
New Revision: 1622254
URL: http://svn.apache.org/r1622254
Log:
Javadoc corrections and some reformating
Modified:
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccess.java
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannel.java
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/NodeLib.java
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableNative.java
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/Nodec.java
Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccess.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccess.java?rev=1622254&r1=1622253&r2=1622254&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccess.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/BlockAccess.java Wed Sep 3 13:42:48 2014
@@ -27,8 +27,11 @@ import com.hp.hpl.jena.tdb.base.block.Bl
* Interface to concrete storage - read and write Blocks, addressed by id.
* Suitable for memory mapped I/O (returns
* internally allocated space for read, not provided from outside; write() can
- * insist the block written comes from allocate()). This is wrapped in a
- * BlockMgr to provide a higher level abstraction.
+ * insist the block written comes from allocate()).
+ * This interfce can also be backed by an in-memory implemntation
+ * ({@linkplain BlockAccessMem}, {@linkplain BlockAccessByteArray}).
+ *
+ * This is wrapped in a BlockMgr to provide a higher level abstraction.
*
* @see BufferChannel
*/
Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannel.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannel.java?rev=1622254&r1=1622253&r2=1622254&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannel.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/BufferChannel.java Wed Sep 3 13:42:48 2014
@@ -25,20 +25,16 @@ import org.apache.jena.atlas.lib.Closeab
import org.apache.jena.atlas.lib.Sync ;
-/** Interface to storage : a simplified version of FileChannel.
- * Read and write bytes, passed via ByteBuffers, addressed
- * by file location.
- *
- * Not suitable for memory mapped I/O - no allocation from the
- * I/O resource but instead reads into storage provided outside
- * and writes from storage provided outside.
- *
- * Does not insert size of ByteBuffer - size of ByteBuffer passed to
- * read controls the number of bytes read.
- *
- * Having our own abstraction enables us to implement memory-backed versions.
- * @see BlockAccess
- * @see FileChannel
+/**
+ * Interface to storage : a simplified version of FileChannel. Read and write
+ * bytes, passed via ByteBuffers, addressed by file location. This interface is
+ * not suitable for memory mapped I/O - there is no ability to use slices of a
+ * memort mapped file. This interface does not insert size of ByteBuffer - size
+ * of ByteBuffer passed to read controls the number of bytes read. Having our
+ * own abstraction enables us to implement memory-backed versions.
+ *
+ * @see BlockAccess
+ * @see FileChannel
*/
public interface BufferChannel extends Sync, Closeable
{
Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/NodeLib.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/NodeLib.java?rev=1622254&r1=1622253&r2=1622254&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/NodeLib.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/lib/NodeLib.java Wed Sep 3 13:42:48 2014
@@ -82,7 +82,10 @@ public class NodeLib
return decode(bb) ;
}
- /** Encode a node - pref use encodeStore */
+ /**
+ * Encode a node - it is better to use encodeStore which may avoid
+ * anadditional copy in getting the node into the ObjectFile
+ */
public static ByteBuffer encode(Node node)
{
int maxSize = nodec.maxSize(node) ;
@@ -93,7 +96,10 @@ public class NodeLib
return bb ;
}
- /** Decode a node - pref use fetchDecode */
+ /**
+ * Decode a node - it is better to use fetchDecode which may avoid an
+ * additional copy in getting the node from the ObjectFile.
+ */
public static Node decode(ByteBuffer bb)
{
bb.position(0) ;
Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableNative.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableNative.java?rev=1622254&r1=1622253&r2=1622254&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableNative.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableNative.java Wed Sep 3 13:42:48 2014
@@ -39,12 +39,9 @@ import com.hp.hpl.jena.tdb.store.NodeId
/** A concrete NodeTable based on native storage (string file and an index) */
public class NodeTableNative implements NodeTable
{
- // TODO Split intio a general accessor (get and put (node,NodeId) pairs)
+ // TODO Split into a general accessor (get and put (node,NodeId) pairs)
// Abstracts the getAllocateNodeId requirements.
- // Assumes an StringFile and an Indexer, which may be an Index but allows
- // this to be overriden for a direct use of BDB.
-
protected ObjectFile objects ;
protected Index nodeHashToId ; // hash -> int
private boolean syncNeeded = false ;
Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/Nodec.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/Nodec.java?rev=1622254&r1=1622253&r2=1622254&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/Nodec.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/Nodec.java Wed Sep 3 13:42:48 2014
@@ -16,26 +16,41 @@
* limitations under the License.
*/
-package com.hp.hpl.jena.tdb.nodetable;
+package com.hp.hpl.jena.tdb.nodetable ;
-import java.nio.ByteBuffer;
+import java.nio.ByteBuffer ;
-import com.hp.hpl.jena.graph.Node;
-import com.hp.hpl.jena.shared.PrefixMapping;
+import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.shared.PrefixMapping ;
/** Encode/decode for Nodes into bytes */
-public interface Nodec
-{
- /** Calucate the maximum number of bytes needed for a Node */
+public interface Nodec {
+ /**
+ * Calculate the maximum number of bytes needed for a Node. This needs to be
+ * an overestimate and is used to ensure there is space in the bytebuffer
+ * passed to encode.
+ */
public int maxSize(Node node) ;
-
- /** Encode the node into the byte buffer, starting at the given offset.
- * The ByteBuffer will have position/limit around the space used on return, <b>without a length code<b>.
- *
+
+ /**
+ * Encode the node into the byte buffer, starting at the given offset. The
+ * ByteBuffer will have position/limit around the space used on return,
+ * <b>without a length code<b>.
+ *
+ * @param node Node to encode.
+ * @param bb ByteBuffer
+ * @param pmap Optional prefix mapping. Can be null.
* @return Length of byte buffer used for the whole encoding.
- */
+ */
public int encode(Node node, ByteBuffer bb, PrefixMapping pmap) ;
-
- /** Decode the node from the byte buffer. The ByteBuffer position shoudl be the start of the encoding (no binary length for example) */
- public Node decode(ByteBuffer bb, PrefixMapping pmap) ;
+
+ /**
+ * Decode the node from the byte buffer. The ByteBuffer position should be
+ * the start of the encoding (no binary length for example)
+ *
+ * @param bb ByteBuffer
+ * @param pmap Optional prefix mapping. Can be null.
+ * @return the decoded Node.
+ */
+ public Node decode(ByteBuffer bb, PrefixMapping pmap) ;
}