Update of /cvsroot/cweb/bigdata/src/java/com/bigdata/journal
In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv24378/bigdata/src/java/com/bigdata/journal
Modified Files:
TemporaryStore.java
Log Message:
Converted entailment collection arrays to btrees.
Index: TemporaryStore.java
===================================================================
RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/journal/TemporaryStore.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** TemporaryStore.java 15 Feb 2007 22:01:18 -0000 1.2
--- TemporaryStore.java 17 Feb 2007 03:08:00 -0000 1.3
***************
*** 52,55 ****
--- 52,58 ----
import java.nio.ByteBuffer;
+ import com.bigdata.objndx.BTree;
+ import com.bigdata.objndx.BTreeMetadata;
+ import com.bigdata.objndx.IIndex;
import com.bigdata.rawstore.Addr;
import com.bigdata.rawstore.Bytes;
***************
*** 136,139 ****
--- 139,144 ----
this.useDirectBuffers = useDirectBuffers;
+ setupName2AddrBTree();
+
}
***************
*** 279,282 ****
--- 284,343 ----
}
+
+
+ /**
+ * BTree mapping index names to the last metadata record committed for the
+ * named index. The keys are index names (unicode strings). The values are
+ * the last known {@link Addr address} of the named btree.
+ */
+ private Name2Addr name2Addr;
+
+ /**
+ * Setup the btree that resolved named btrees.
+ */
+ private void setupName2AddrBTree() {
+
+ assert name2Addr == null;
+
+ name2Addr = new Name2Addr(this);
+
+ }
+
+ public IIndex registerIndex(String name, IIndex btree) {
+
+ if( getIndex(name) != null ) {
+
+ throw new IllegalStateException("BTree already registered: name="+name);
+
+ }
+
+ // add to the persistent name map.
+ name2Addr.add(name, btree);
+
+ return btree;
+
+ }
+
+ public void dropIndex(String name) {
+
+ name2Addr.dropIndex(name);
+
+ }
+
+ /**
+ * Return the named index (unisolated). Writes on the returned index will be
+ * made restart-safe with the next {@link #commit()} regardless of the
+ * success or failure of a transaction. Transactional writes must use the
+ * same named method on the {@link Tx} in order to obtain an isolated
+ * version of the named btree.
+ */
+ public IIndex getIndex(String name) {
+
+ if(name==null) throw new IllegalArgumentException();
+
+ return name2Addr.get(name);
+
+ }
+
}
|