public class ReadOnlyIndex extends DelegateIndex
IIndex
.
Note: use this class sparingly. An index loaded from a historical commit point will always be read-only.
IResourceManager#getIndex(String, long)}
Constructor and Description |
---|
ReadOnlyIndex(IIndex src) |
Modifier and Type | Method and Description |
---|---|
ICounter |
getCounter()
Counter is read-only.
|
IndexMetadata |
getIndexMetadata()
IndexMetadata is cloned to disallow modification. |
IResourceMetadata[] |
getResourceMetadata()
IResourceMetadata [] is cloned to disallow modification (the
IResourceMetadata instances in the array are all dynamically
created so changes to them do not propagate back to the index). |
byte[] |
insert(byte[] key,
byte[] value)
Disabled.
|
ITupleIterator |
rangeIterator(byte[] fromKey,
byte[] toKey,
int capacity,
int flags,
IFilter filter)
IRangeQuery.REMOVEALL and Iterator.remove() are disabled. |
byte[] |
remove(byte[] key)
Disabled.
|
void |
submit(int fromIndex,
int toIndex,
byte[][] keys,
byte[][] vals,
AbstractKeyArrayIndexProcedureConstructor ctor,
IResultHandler aggregator)
Overridden to ensure that procedure is applied against read-only view and
not the
DelegateIndex . |
contains, contains, getCounters, insert, lookup, lookup, putIfAbsent, rangeCount, rangeCount, rangeCountExact, rangeCountExactWithDeleted, rangeIterator, rangeIterator, remove, submit, submit, toString
public ReadOnlyIndex(IIndex src)
public final IndexMetadata getIndexMetadata()
IndexMetadata
is cloned to disallow modification.getIndexMetadata
in interface IIndex
getIndexMetadata
in class DelegateIndex
ICheckpointProtocol.getIndexMetadata()
public final IResourceMetadata[] getResourceMetadata()
IResourceMetadata
[] is cloned to disallow modification (the
IResourceMetadata
instances in the array are all dynamically
created so changes to them do not propagate back to the index).getResourceMetadata
in interface IIndex
getResourceMetadata
in class DelegateIndex
public final ICounter getCounter()
getCounter
in interface IIndexLocalCounter
getCounter
in class DelegateIndex
public final byte[] insert(byte[] key, byte[] value)
insert
in interface ISimpleBTree
insert
in class DelegateIndex
key
- The key.value
- The value (may be null).null
if the
key was not found or if the previous entry for that key was
marked as deleted.public final byte[] remove(byte[] key)
remove
in interface ISimpleBTree
remove
in class DelegateIndex
key
- The key.null
if the key
was not found or if the previous entry under that key was marked
as deleted.public final ITupleIterator rangeIterator(byte[] fromKey, byte[] toKey, int capacity, int flags, IFilter filter)
IRangeQuery.REMOVEALL
and Iterator.remove()
are disabled.rangeIterator
in interface IRangeQuery
rangeIterator
in class DelegateIndex
fromKey
- The first key that will be visited (inclusive lower bound).
When null
there is no lower bound.toKey
- The first key that will NOT be visited (exclusive upper
bound). When null
there is no upper bound.capacity
- The #of entries to buffer at a time. This is a hint and MAY be
zero (0) to use an implementation specific default
capacity. A non-zero value may be used if you know that you
want at most N results or if you want to override the default
#of results to be buffered before sending them across a
network interface. (Note that you can control the default
value using
IBigdataClient.Options#DEFAULT_CLIENT_RANGE_QUERY_CAPACITY
).flags
- A bitwise OR of IRangeQuery.KEYS
, IRangeQuery.VALS
, etc.filter
- An optional object used to construct a stacked iterator. When
IRangeQuery.CURSOR
is specified in flags, the base
iterator will implement ITupleCursor
and the first
filter in the stack can safely cast the source iterator to an
ITupleCursor
. If the outermost filter in the stack
does not implement ITupleIterator
, then it will be
wrapped an ITupleIterator
.SuccessorUtil, which may be used to compute the successor of a value
before encoding it as a component of a key.
,
BytesUtil#successor(byte[]), which may be used to compute the
successor of an encoded key.
,
IFilterConstructor, which may be used to construct an iterator stack
performing filtering or other operations.
public final void submit(int fromIndex, int toIndex, byte[][] keys, byte[][] vals, AbstractKeyArrayIndexProcedureConstructor ctor, IResultHandler aggregator)
DelegateIndex
.submit
in interface IIndex
submit
in class DelegateIndex
fromIndex
- The index of the first key to be used (inclusive).toIndex
- The index of the last key to be used (exclusive).keys
- The keys (required).vals
- The values (optional depending on the procedure).ctor
- An object that can create instances of the procedure.aggregator
- When defined, results from each procedure application will be
reported to this object.
TODO In order to allow parallelization within a shard, we need to modify
this method signature to pass in an IResultHandler
constructor
object. That might be something which could be pushed down onto the ctor
argument. It would be used in scale-out to create a DS local result handler
so we can locally aggregate when parallelizing against each shard and then
return that aggregated result to the client which would extract the aggregate
result across the shards from the client's result handler. See BLZG-1537.(Schedule more IOs when loading data)
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.