|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.persist.SubIndex<PK,E>
class SubIndex<PK,E>
The EntityIndex returned by SecondaryIndex.subIndex. A SubIndex, in JE internal terms, is a duplicates btree for a single key in the main btree. From the user's viewpoint, the keys are primary keys. This class implements that viewpoint. In general, getSearchBoth and getSearchBothRange are used where in a normal index getSearchKey and getSearchRange would be used. The main tree key is always implied, not passed as a parameter.
Constructor Summary | |
---|---|
SubIndex(SecondaryIndex<SK,PK,E> secIndex,
EntityBinding entityBinding,
SK key)
|
Method Summary | |
---|---|
boolean |
contains(PK key)
Checks for existence of a key in this index. |
boolean |
contains(Transaction txn,
PK key,
LockMode lockMode)
Checks for existence of a key in this index. |
long |
count()
Returns a non-transactional count of the entities in this index. |
boolean |
delete(PK key)
Deletes all entities with a given index key. |
boolean |
delete(Transaction txn,
PK key)
Deletes all entities with a given index key. |
EntityCursor<E> |
entities()
Opens a cursor for traversing all entities in this index. |
EntityCursor<E> |
entities(PK fromKey,
boolean fromInclusive,
PK toKey,
boolean toInclusive)
Opens a cursor for traversing entities in a key range. |
EntityCursor<E> |
entities(Transaction txn,
CursorConfig config)
Opens a cursor for traversing all entities in this index. |
EntityCursor<E> |
entities(Transaction txn,
PK fromKey,
boolean fromInclusive,
PK toKey,
boolean toInclusive,
CursorConfig config)
Opens a cursor for traversing entities in a key range. |
E |
get(PK key)
Gets an entity via a key of this index. |
E |
get(Transaction txn,
PK key,
LockMode lockMode)
Gets an entity via a key of this index. |
EntityCursor<PK> |
keys()
Opens a cursor for traversing all keys in this index. |
EntityCursor<PK> |
keys(PK fromKey,
boolean fromInclusive,
PK toKey,
boolean toInclusive)
Opens a cursor for traversing keys in a key range. |
EntityCursor<PK> |
keys(Transaction txn,
CursorConfig config)
Opens a cursor for traversing all keys in this index. |
EntityCursor<PK> |
keys(Transaction txn,
PK fromKey,
boolean fromInclusive,
PK toKey,
boolean toInclusive,
CursorConfig config)
Opens a cursor for traversing keys in a key range. |
Map<PK,E> |
map()
Returns a standard Java map based on this entity index. |
SortedMap<PK,E> |
sortedMap()
Returns a standard Java sorted map based on this entity index. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
SubIndex(SecondaryIndex<SK,PK,E> secIndex, EntityBinding entityBinding, SK key)
Method Detail |
---|
public boolean contains(PK key) throws DatabaseException
EntityIndex
The operation will not be transaction protected, and LockMode.DEFAULT
is used implicitly.
contains
in interface EntityIndex<PK,E>
key
- the key to search for.
DatabaseException
public boolean contains(Transaction txn, PK key, LockMode lockMode) throws DatabaseException
EntityIndex
contains
in interface EntityIndex<PK,E>
txn
- the transaction used to protect this operation, or null
if the operation should not be transaction protected.key
- the key to search for.lockMode
- the lock mode to use for this operation, or null to
use LockMode.DEFAULT
.
DatabaseException
public E get(PK key) throws DatabaseException
EntityIndex
The operation will not be transaction protected, and LockMode.DEFAULT
is used implicitly.
get
in interface EntityIndex<PK,E>
key
- the key to search for.
DatabaseException
public E get(Transaction txn, PK key, LockMode lockMode) throws DatabaseException
EntityIndex
get
in interface EntityIndex<PK,E>
txn
- the transaction used to protect this operation, or null
if the operation should not be transaction protected.key
- the key to search for.lockMode
- the lock mode to use for this operation, or null to
use LockMode.DEFAULT
.
DatabaseException
public long count() throws DatabaseException
EntityIndex
This operation is faster than obtaining a count by scanning the index manually, and will not perturb the current contents of the cache. However, the count is not guaranteed to be accurate if there are concurrent updates.
count
in interface EntityIndex<PK,E>
DatabaseException
public boolean delete(PK key) throws DatabaseException
EntityIndex
Auto-commit is used implicitly if the store is transactional.
delete
in interface EntityIndex<PK,E>
key
- the key to search for.
DatabaseException
public boolean delete(Transaction txn, PK key) throws DatabaseException
EntityIndex
delete
in interface EntityIndex<PK,E>
txn
- the transaction used to protect this operation, null to use
auto-commit, or null if the store is non-transactional.key
- the key to search for.
DatabaseException
public EntityCursor<PK> keys() throws DatabaseException
EntityIndex
The operations performed with the cursor will not be transaction
protected, and CursorConfig.DEFAULT
is used implicitly. If the
store is transactional, the cursor may not be used to update or delete
entities.
keys
in interface EntityIndex<PK,E>
DatabaseException
public EntityCursor<PK> keys(Transaction txn, CursorConfig config) throws DatabaseException
EntityIndex
keys
in interface EntityIndex<PK,E>
txn
- the transaction used to protect all operations performed with
the cursor, or null if the operations should not be transaction
protected. If null is specified and the store is transactional, the
cursor may not be used to update or delete entities.config
- the cursor configuration that determines the default lock
mode used for all cursor operations, or null to implicitly use CursorConfig.DEFAULT
.
DatabaseException
public EntityCursor<E> entities() throws DatabaseException
EntityIndex
The operations performed with the cursor will not be transaction
protected, and CursorConfig.DEFAULT
is used implicitly. If the
store is transactional, the cursor may not be used to update or delete
entities.
entities
in interface EntityIndex<PK,E>
DatabaseException
public EntityCursor<E> entities(Transaction txn, CursorConfig config) throws DatabaseException
EntityIndex
entities
in interface EntityIndex<PK,E>
txn
- the transaction used to protect all operations performed with
the cursor, or null if the operations should not be transaction
protected. If null is specified and the store is transactional, the
cursor may not be used to update or delete entities.config
- the cursor configuration that determines the default lock
mode used for all cursor operations, or null to implicitly use CursorConfig.DEFAULT
.
DatabaseException
public EntityCursor<PK> keys(PK fromKey, boolean fromInclusive, PK toKey, boolean toInclusive) throws DatabaseException
EntityIndex
The operations performed with the cursor will not be transaction
protected, and CursorConfig.DEFAULT
is used implicitly. If the
store is transactional, the cursor may not be used to update or delete
entities.
keys
in interface EntityIndex<PK,E>
fromKey
- is the lower bound of the key range, or null if the range
has no lower bound.fromInclusive
- is true if keys greater than or equal to fromKey
should be included in the key range, or false if only keys greater than
fromKey should be included.toKey
- is the upper bound of the key range, or null if the range
has no upper bound.toInclusive
- is true if keys less than or equal to toKey should be
included in the key range, or false if only keys less than toKey should
be included.
DatabaseException
public EntityCursor<PK> keys(Transaction txn, PK fromKey, boolean fromInclusive, PK toKey, boolean toInclusive, CursorConfig config) throws DatabaseException
EntityIndex
keys
in interface EntityIndex<PK,E>
txn
- the transaction used to protect all operations performed with
the cursor, or null if the operations should not be transaction
protected. If null is specified and the store is transactional, the
cursor may not be used to update or delete entities.fromKey
- is the lower bound of the key range, or null if the range
has no lower bound.fromInclusive
- is true if keys greater than or equal to fromKey
should be included in the key range, or false if only keys greater than
fromKey should be included.toKey
- is the upper bound of the key range, or null if the range
has no upper bound.toInclusive
- is true if keys less than or equal to toKey should be
included in the key range, or false if only keys less than toKey should
be included.config
- the cursor configuration that determines the default lock
mode used for all cursor operations, or null to implicitly use CursorConfig.DEFAULT
.
DatabaseException
public EntityCursor<E> entities(PK fromKey, boolean fromInclusive, PK toKey, boolean toInclusive) throws DatabaseException
EntityIndex
The operations performed with the cursor will not be transaction
protected, and CursorConfig.DEFAULT
is used implicitly. If the
store is transactional, the cursor may not be used to update or delete
entities.
entities
in interface EntityIndex<PK,E>
fromKey
- is the lower bound of the key range, or null if the range
has no lower bound.fromInclusive
- is true if keys greater than or equal to fromKey
should be included in the key range, or false if only keys greater than
fromKey should be included.toKey
- is the upper bound of the key range, or null if the range
has no upper bound.toInclusive
- is true if keys less than or equal to toKey should be
included in the key range, or false if only keys less than toKey should
be included.
DatabaseException
public EntityCursor<E> entities(Transaction txn, PK fromKey, boolean fromInclusive, PK toKey, boolean toInclusive, CursorConfig config) throws DatabaseException
EntityIndex
entities
in interface EntityIndex<PK,E>
txn
- the transaction used to protect all operations performed with
the cursor, or null if the operations should not be transaction
protected. If null is specified and the store is transactional, the
cursor may not be used to update or delete entities.fromKey
- is the lower bound of the key range, or null if the range
has no lower bound.fromInclusive
- is true if keys greater than or equal to fromKey
should be included in the key range, or false if only keys greater than
fromKey should be included.toKey
- is the upper bound of the key range, or null if the range
has no upper bound.toInclusive
- is true if keys less than or equal to toKey should be
included in the key range, or false if only keys less than toKey should
be included.config
- the cursor configuration that determines the default lock
mode used for all cursor operations, or null to implicitly use CursorConfig.DEFAULT
.
DatabaseException
public Map<PK,E> map()
EntityIndex
StoredMap
returned is defined by the Collections API. Stored collections conform
to the standard Java collections framework interface.
map
in interface EntityIndex<PK,E>
public SortedMap<PK,E> sortedMap()
EntityIndex
StoredSortedMap
returned is defined by the Collections API. Stored collections conform
to the standard Java collections framework interface.
sortedMap
in interface EntityIndex<PK,E>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |