public class LocalPartitionMetadata extends Object implements IPartitionMetadata, Externalizable
IResourceMetadata
[] required to materialize a view of
that index partition.Modifier and Type | Field and Description |
---|---|
protected static int |
MAX_HISTORY_LENGTH
Deprecated.
|
Constructor and Description |
---|
LocalPartitionMetadata()
De-serialization constructor.
|
LocalPartitionMetadata(int partitionId,
int sourcePartitionId,
byte[] leftSeparatorKey,
byte[] rightSeparatorKey,
IResourceMetadata[] resources,
IndexPartitionCause cause) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
IndexPartitionCause |
getIndexPartitionCause()
The reason why an index partition was created together with some metadata
about when it was created.
|
byte[] |
getLeftSeparatorKey()
The separator key that defines the left edge of that index partition
(always defined) - this is the first key that can enter the index
partition.
|
int |
getPartitionId()
The unique partition identifier.
|
IResourceMetadata[] |
getResources()
Description of the resources required to materialize a view of the index
partition (optional, but required for a
BTree ). |
byte[] |
getRightSeparatorKey()
The separator key that defines the right edge of that index partition or
null iff the index partition does not have a right sibling
(a null has the semantics of having no upper bound). |
int |
getSourcePartitionId()
Deprecated.
MoveTask manages without this field (it was required by the
previous MOVE implementation).
|
int |
hashCode()
|
void |
readExternal(ObjectInput in) |
String |
toString() |
void |
writeExternal(ObjectOutput out) |
protected static final transient int MAX_HISTORY_LENGTH
Note: The history is written each time the IndexMetadata
is
written and is read each time it is read so this can be the main driver
of the size of the IndexMetadata
record.
public LocalPartitionMetadata()
public LocalPartitionMetadata(int partitionId, int sourcePartitionId, byte[] leftSeparatorKey, byte[] rightSeparatorKey, IResourceMetadata[] resources, IndexPartitionCause cause)
partitionId
- The unique partition identifier assigned by the
MetadataIndex
.sourcePartitionId
- -1
unless this index partition is the target
for a move, in which case this is the partition identifier of
the source index partition.leftSeparatorKey
- The first key that can enter this index partition. The left
separator key for the first index partition is always
new byte[]{}
. The left separator key MAY NOT
be null
.rightSeparatorKey
- The first key that is excluded from this index partition or
null
iff there is no upper bound.resources
- A description of each Journal
or IndexSegment
resource(s) required to compose a view of the index partition
(optional).
The entries in the array reflect the creation time of the resources. The earliest resource is listed first. The most recently created resource is listed last.
Note: This is required if the LocalPartitionMetadata
record will be saved on the IndexMetadata
of a
BTree
. It is NOT recommended when it will be saved on
the IndexMetadata
of an IndexSegment
. When
the IndexMetadata
is sent to a remote
DataService
this field MUST be null
and
the remote DataService
will fill it in on arrival.
cause
- The underlying cause for the creation of the index partition.public final int getPartitionId()
IPartitionMetadata
getPartitionId
in interface IPartitionMetadata
public final int getSourcePartitionId()
-1
unless this index partition is the target for a move,
in which case this is the partition identifier of the source index
partition and the move operation has not been completed. This property is
used to prevent the target data service from de-defining the index
partition using a split, join or move operation while the MOVE operation
is proceeding. The property is cleared to -1
(which is an
invalid index partition identifier) once the move has been completed
successfully.public final byte[] getLeftSeparatorKey()
ISeparatorKeys
byte[]
since that is the smallest key that may be
defined.getLeftSeparatorKey
in interface ISeparatorKeys
public final byte[] getRightSeparatorKey()
ISeparatorKeys
null
iff the index partition does not have a right sibling
(a null
has the semantics of having no upper bound).getRightSeparatorKey
in interface ISeparatorKeys
public final IResourceMetadata[] getResources()
BTree
).
The entries in the array reflect the creation time of the resources. The earliest resource is listed first. The most recently created resource is listed last. The order of the resources corresponds to the order in which a fused view of the index partition will be read. Reads begin with the most "recent" data for the index partition and stop as soon as there is a "hit" on one of the resources (including a hit on a deleted index entry).
When present, the #of sources in the index partition view includes: the
mutable BTree
, any BTree
s on historical journal(s)
still incorporated into the view, and any IndexSegment
s
incorporated into the view.
Note: the IResourceMetadata
[] is only available when the
LocalPartitionMetadata
is attached to the IndexMetadata
of a BTree
and is NOT defined when the
LocalPartitionMetadata
is attached to an IndexSegment
.
The reason is that the index partition view is always described by the
BTree
and that view evolves as journals overflow. On the other
hand, IndexSegment
s are used as resources in index partition
views but exist in a one to many relationship to those views.
public final IndexPartitionCause getIndexPartitionCause()
public final int hashCode()
IPartitionMetadata
hashCode
in interface IPartitionMetadata
hashCode
in class Object
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.