public final class IndexStore extends Object
None intuitively, this object also handles unique ids.
Constructor and Description |
---|
IndexStore(File file_name,
DebugLogger logger)
Constructs the IndexStore.
|
Modifier and Type | Method and Description |
---|---|
void |
addIndexLists(int count,
byte type)
Adds a number of blank index tables to the index store.
|
void |
close()
Cleanly closes the index store.
|
void |
commitIndexSet(IndexSet index_set)
Commits changes made to a snapshop of an IndexSet as being permanent
changes to the state of the index store.
|
void |
copyTo(File path)
Copies the persistant part of this to another store.
|
void |
create(int block_size)
Creates a new black index store and returns leaving the newly created
store in an open state.
|
void |
delete()
Deletes the store.
|
boolean |
exists()
Returns true if the index store file exists.
|
boolean |
fix(UserTerminal terminal)
Performs checks to determine that the index store
is stable.
|
void |
flush()
Flushes all information in this index store to the file representing this
store in the file system.
|
IndexSet |
getSnapshotIndexSet()
Returns a current snapshot of the current indexes that are committed in
this store.
|
void |
hardSynch()
Performs a hard synchronization of this index store.
|
void |
init()
Initializes the IndexStore.
|
boolean |
isReadOnly()
Returns true if this store is read only.
|
boolean |
open(boolean read_only)
Opens this index store.
|
String |
statusString()
Returns a string that contains diagnostic information.
|
public IndexStore(File file_name, DebugLogger logger)
file_name
- the path to the file of the index store in the file
system.public boolean exists() throws IOException
IOException
public void create(int block_size) throws IOException
block_size
- the number of ints stored in each block. This
can be optimized for specific use. Must be between 0 and 32768.IOException
public boolean open(boolean read_only) throws IOException
Returns true if opening the store was dirty (was not closed properly) and may need repair.
If the index store does not exist before this method is called then it is created.
IOException
public void init() throws IOException
IOException
public boolean fix(UserTerminal terminal) throws IOException
Assumes the index store has been opened previous to calling this.
Returns true if the IndexStore is stable.
IOException
public boolean isReadOnly()
public void delete()
public void copyTo(File path) throws IOException
IOException
public void close() throws IOException
IOException
public void flush() throws IOException
IOException
public void hardSynch() throws IOException
For this to be useful, 'flush' should be called before a hardSynch.
IOException
public void addIndexLists(int count, byte type)
NOTE: This doesn't write the updated information to the file. You must call 'flush' to write the information to the store.
public IndexSet getSnapshotIndexSet()
A transaction must grab an IndexSet object when it opens.
NOTE: We MUST guarentee that the IndexSet is disposed when the transaction finishes.
public void commitIndexSet(IndexSet index_set)
For this to be used, during the transaction commit function a 'getSnapshopIndexSet' must be obtained, changes made to it from info in the journal, then a call to this method. There must be a guarentee that 'getSnapshotIndexSet' is not called again during this process.
NOTE: This doesn't write the updated information to the file. You must call 'flush' to write the information to the store.
NOTE: We must be guarenteed that when this method is called no other calls to other methods in this object can be called.
public String statusString() throws IOException
IOException
Copyright © 2015. All rights reserved.