|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsimpledb.index.hash.HashIndex
public class HashIndex
A static hash implementation of the Index interface. A fixed number of buckets is allocated (currently, 100), and each bucket is implemented as a file of index records.
| Field Summary | |
|---|---|
static int |
NUM_BUCKETS
|
| Constructor Summary | |
|---|---|
HashIndex(String idxname,
Schema sch,
Transaction tx)
Opens a hash index for the specified index. |
|
| Method Summary | |
|---|---|
void |
beforeFirst(Constant searchkey)
Positions the index before the first index record having the specified search key. |
void |
close()
Closes the index by closing the current table scan. |
void |
delete(Constant val,
RID rid)
Deletes the specified record from the table scan for the bucket. |
RID |
getDataRid()
Retrieves the dataRID from the current record in the table scan for the bucket. |
void |
insert(Constant val,
RID rid)
Inserts a new record into the table scan for the bucket. |
boolean |
next()
Moves to the next record having the search key. |
static int |
searchCost(int numblocks,
int rpb)
Returns the cost of searching an index file having the specified number of blocks. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static int NUM_BUCKETS
| Constructor Detail |
|---|
public HashIndex(String idxname,
Schema sch,
Transaction tx)
idxname - the name of the indexsch - the schema of the index recordstx - the calling transaction| Method Detail |
|---|
public void beforeFirst(Constant searchkey)
beforeFirst in interface Indexsearchkey - the search key value.Index.beforeFirst(simpledb.query.Constant)public boolean next()
next in interface IndexIndex.next()public RID getDataRid()
getDataRid in interface IndexIndex.getDataRid()
public void insert(Constant val,
RID rid)
insert in interface Indexval - the dataval in the new index record.rid - the dataRID in the new index record.Index.insert(simpledb.query.Constant, simpledb.record.RID)
public void delete(Constant val,
RID rid)
delete in interface Indexval - the dataval of the deleted index recordrid - the dataRID of the deleted index recordIndex.delete(simpledb.query.Constant, simpledb.record.RID)public void close()
close in interface IndexIndex.close()
public static int searchCost(int numblocks,
int rpb)
numblocks - the number of blocks of index recordsrpb - the number of records per block (not used here)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||