public class LogicalRowSplitHandler extends Object implements ISimpleSplitHandler, Externalizable
Modifier and Type | Field and Description |
---|---|
static ISimpleSplitHandler |
INSTANCE |
protected static org.apache.log4j.Logger |
log |
Constructor and Description |
---|
LogicalRowSplitHandler() |
Modifier and Type | Method and Description |
---|---|
byte[] |
getSeparatorKey(IndexSegment seg,
int fromIndex,
int toIndex,
int splitAt)
Return a separator key close to the recommended separator key
(splitAt) which is acceptable to the constraints imposed by the
application on the index.
|
void |
readExternal(ObjectInput in) |
void |
writeExternal(ObjectOutput out) |
protected static final transient org.apache.log4j.Logger log
public static final transient ISimpleSplitHandler INSTANCE
public byte[] getSeparatorKey(IndexSegment seg, int fromIndex, int toIndex, int splitAt)
ISimpleSplitHandler
null
separator key is
returned, the fromIndex is advanced to the first key GTE the
separator key. This process continues until no more splits may be formed,
whether because there are not enough tuples remaining to justify a split
or because the application has refused a split for the key range by
returning null
from this method. To accept the recommended
separator key, the application should do
return seg.keyAt(splitAt)
An application may apply a constraint when it provides some guarantee
which would otherwise not be obtained. For example, the
SparseRowStore
uses this mechanism to constrain splits such that
a logical row is never split, which gives the SparseRowStore
the
ability to offer ACID operations on logical rows using only local
locking.
Applications can implement this constraint in many different ways. For
example: (A) applications can scan forward or backward using an
ITupleCursor
looking for an acceptable separatorKey near to the
recommended separatorKey; (B) applications can use the
ILinearList
API to probe for a suitable key; or (C) applications
can truncate the recommended separator key in order to obtain a prefix
which will respect some application constraint such as all RDF statements
sharing a common subject.
If the implementation returns null
then it is asserting that
there is no separator key in the half-open range which is acceptable and
therefore that the key-range CAN NOT be split. All tuples in that key
range will therefore go into a single split.
getSeparatorKey
in interface ISimpleSplitHandler
seg
- The IndexSegment
containing the data to be split.fromIndex
- The index of the first tuple which may be considered
(inclusive lower bound).toIndex
- The index of the last tuple which may be considered (exclusive
upper bound).splitAt
- The index of the recommended separator key.null
.public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.