Author: rajdavies
Date: Mon Sep 8 12:35:51 2008
New Revision: 693213
URL: http://svn.apache.org/viewvc?rev=693213&view=rev
Log:
Added strawman interfaces for Store and Containers
Added:
activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Accessor.java (with props)
activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Container.java (with props)
activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Extent.java (with props)
activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Store.java (with props)
activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Transaction.java (with props)
Added: activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Accessor.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Accessor.java?rev=693213&view=auto
==============================================================================
--- activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Accessor.java (added)
+++ activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Accessor.java Mon Sep 8 12:35:51
2008
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kahadb;
+
+
+/**
+ * Used to create a secondary index on a Container
+ */
+
+public interface Accessor{
+
+}
Propchange: activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Accessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Container.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Container.java?rev=693213&view=auto
==============================================================================
--- activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Container.java (added)
+++ activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Container.java Mon Sep 8 12:35:51
2008
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kahadb;
+
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * Represents a container of persistent objects in the Kahadb Store
+ *
+ * @version $Revision: 1.2 $
+ * @param <V>
+ * @param <K>
+ */
+public interface Container<V, K> {
+
+ /**
+ * The container is created or retrieved in an unloaded state. load
+ * populates the container will all the indexes used etc and should be
+ * called before any operations on the container
+ */
+ void load();
+
+ /**
+ * unload indexes from the container
+ *
+ */
+ void unload();
+
+ /**
+ * @return true if the indexes are loaded
+ */
+ boolean isLoaded();
+
+ /**
+ * close this container
+ */
+ void close();
+
+ /**
+ * remove the container, and all associated resources
+ */
+ void delete();
+
+ /**
+ * Get the primary key <tt>k</tt> (id), value <tt>v</tt> Map
for this container
+ * @return the Map
+ */
+ Map<K,V> getIdMap();
+
+ /**
+ * Get an existing extent or create on if it doesn't exist
+ * @param id
+ * @param a
+ * @return the extent
+ */
+ Extent<K, V> getExtent(Object id,Accessor a);
+
+ /**
+ * Get A list of all the extents available on this container
+ * @return
+ */
+ Set<Extent<K,V>> getExtents();
+
+}
Propchange: activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Container.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Extent.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Extent.java?rev=693213&view=auto
==============================================================================
--- activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Extent.java (added)
+++ activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Extent.java Mon Sep 8 12:35:51
2008
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kahadb;
+
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * An extent on a container, created from a secondary index
+ * @param <K> primary id
+ * @param <V> value
+ */
+
+public interface Extent<K,V>{
+
+ /**
+ * @return the unique id associated with this Extent
+ */
+ Object id();
+ /**
+ * Get the first Value associated with this Extent
+ * @return the first
+ */
+ V first();
+ /**
+ * Get the last Value associated with this Extent
+ * @return
+ */
+ V last();
+
+ /**
+ * ascending order secondary index
+ * @return the ascending order List
+ */
+ List<Map.Entry<K,V>> head();
+ /**
+ * descending order secondary index
+ * @return the descending order List
+ */
+ List<Map.Entry<K,V>> tail();
+ /**
+ * return a sub list of entries
+ * @param a
+ * @return
+ */
+ List<Map.Entry<K,V>> from(Accessor a);
+
+
+}
Propchange: activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Extent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Store.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Store.java?rev=693213&view=auto
==============================================================================
--- activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Store.java (added)
+++ activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Store.java Mon Sep 8 12:35:51
2008
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kahadb;
+
+import java.io.IOException;
+import java.util.Set;
+
+/**
+ * A Store is holds persistent containers
+ *
+ * @version $Revision: 1.2 $
+ */
+public interface Store {
+
+ /**
+ * close the store
+ *
+ * @throws IOException
+ */
+ void close() throws IOException;
+
+ /**
+ * empty all the contents of the store
+ *
+ * @throws IOException
+ */
+ void clear() throws IOException;
+
+ /**
+ * delete the store
+ *
+ * @return true if the delete was successful
+ * @throws IOException
+ */
+ boolean delete() throws IOException;
+
+ /**
+ * Get or create a Container
+ * @param id
+ * @return
+ */
+ Container getContainer(Object id);
+
+ /**
+ * @return all the containers that currently exist
+ */
+ Set<Container> getContainers();
+
+ /**
+ * @return a new Transaction associated with the Store
+ */
+ Transaction createTransaction();
+
+}
+
Propchange: activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Store.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Transaction.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Transaction.java?rev=693213&view=auto
==============================================================================
--- activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Transaction.java (added)
+++ activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Transaction.java Mon Sep 8 12:35:51
2008
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kahadb;
+
+import java.io.IOException;
+
+/**
+ * Handle for a Transaction
+ *
+ */
+public interface Transaction {
+
+
+ /**
+ * rollback the transaction
+ *
+ */
+ void rollback() throws IOException;
+
+ /**
+ * Commit the transaction
+ */
+ public void commit() throws IOException;
+}
Propchange: activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/Transaction.java
------------------------------------------------------------------------------
svn:eol-style = native
|