2005-10-26 14:37:22 +02:00
|
|
|
// kelondroIndex.java
|
|
|
|
// ------------------
|
|
|
|
// part of the Kelondro Database
|
2008-07-20 19:14:51 +02:00
|
|
|
// (C) by Michael Peter Christen; mc@yacy.net
|
2005-10-26 14:37:22 +02:00
|
|
|
// first published on http://www.anomic.de
|
|
|
|
// Frankfurt, Germany, 2005
|
|
|
|
// created: 26.10.2005
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
2005-10-27 02:42:08 +02:00
|
|
|
/* A kelondroIndex is a table with indexed access on the first column
|
2005-10-26 14:37:22 +02:00
|
|
|
Elements may be selected from the table with logarithmic computation time
|
|
|
|
using the get-method. Inserts have also the same computation order and
|
|
|
|
can be done with the put-method.
|
|
|
|
|
|
|
|
The kelondro Database provides two implementations of this interface:
|
|
|
|
kelondroTree and kelondroHashtable
|
|
|
|
*/
|
|
|
|
|
2009-01-30 16:33:00 +01:00
|
|
|
package de.anomic.kelondro.index;
|
2005-10-26 14:37:22 +02:00
|
|
|
|
|
|
|
import java.io.IOException;
|
2008-01-20 02:22:46 +01:00
|
|
|
import java.util.ArrayList;
|
2006-10-13 01:14:41 +02:00
|
|
|
import java.util.Date;
|
2007-02-25 22:06:26 +01:00
|
|
|
import java.util.List;
|
2005-10-26 14:37:22 +02:00
|
|
|
|
2009-01-30 23:08:08 +01:00
|
|
|
import de.anomic.kelondro.order.CloneableIterator;
|
2009-01-30 16:33:00 +01:00
|
|
|
|
|
|
|
public interface ObjectIndex {
|
2005-10-26 14:37:22 +02:00
|
|
|
|
2007-03-06 23:43:32 +01:00
|
|
|
public String filename(); // returns a unique identified for this index; can be a real or artificial file name
|
2007-04-19 15:37:02 +02:00
|
|
|
public int size();
|
2009-01-30 16:33:00 +01:00
|
|
|
public Row row();
|
2008-06-18 01:56:39 +02:00
|
|
|
public boolean has(byte[] key); // use this only if there is no get in case that has returns true
|
2009-01-30 16:33:00 +01:00
|
|
|
public Row.Entry get(byte[] key) throws IOException;
|
|
|
|
public Row.Entry put(Row.Entry row) throws IOException;
|
|
|
|
public Row.Entry put(Row.Entry row, Date entryDate) throws IOException;
|
|
|
|
public void putMultiple(List<Row.Entry> rows) throws IOException; // for R/W head path optimization
|
|
|
|
public void addUnique(Row.Entry row) throws IOException; // no double-check
|
|
|
|
public void addUniqueMultiple(List<Row.Entry> rows) throws IOException; // no double-check
|
|
|
|
public ArrayList<RowCollection> removeDoubles() throws IOException; // removes all elements that are double (to be used after all addUnique)
|
|
|
|
public Row.Entry remove(byte[] key) throws IOException;
|
|
|
|
public Row.Entry removeOne() throws IOException;
|
2009-01-30 23:08:08 +01:00
|
|
|
public CloneableIterator<byte[]> keys(boolean up, byte[] firstKey) throws IOException; // iterates only the key
|
|
|
|
public CloneableIterator<Row.Entry> rows(boolean up, byte[] firstKey) throws IOException; // iterates the whole row
|
2008-09-12 13:51:48 +02:00
|
|
|
public void deleteOnExit();
|
2008-05-24 14:30:50 +02:00
|
|
|
public void clear() throws IOException;
|
2007-03-09 09:48:47 +01:00
|
|
|
public void close();
|
2005-10-26 14:37:22 +02:00
|
|
|
}
|