Package com.apple.foundationdb.record
Class MutableRecordStoreState
- java.lang.Object
-
- com.apple.foundationdb.record.RecordStoreState
-
- com.apple.foundationdb.record.MutableRecordStoreState
-
@API(INTERNAL) public class MutableRecordStoreState extends RecordStoreState
A record store that can be modified to reflect changes made to the database. Such modifications are only allowed betweenbeginWrite()
andendWrite()
and will conflict withbeginRead()
...endRead()
.
-
-
Field Summary
-
Fields inherited from class com.apple.foundationdb.record.RecordStoreState
EMPTY, indexStateMap, storeHeader
-
-
Constructor Summary
Constructors Constructor Description MutableRecordStoreState(RecordMetaDataProto.DataStoreInfo storeHeader, Map<String,IndexState> indexStateMap)
MutableRecordStoreState(Map<String,IndexState> indexStateMap)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beginRead()
Begin using this record store state.void
beginWrite()
Begin modifying this record store state.void
endRead()
End using this record store state.void
endWrite()
End modifying this record store state.boolean
equals(Object o)
Checks if thisRecordStoreState
specifies identical state as the given object.int
hashCode()
Creates a valid hash code of this state based on the hashes of its members.IndexState
setState(String indexName, IndexState state)
Modify the state of an index in this map.RecordMetaDataProto.DataStoreInfo
setStoreHeader(RecordMetaDataProto.DataStoreInfo storeHeader)
Update the store header in this record store state.RecordStoreState
toImmutable()
Create an immutable version of thisRecordStoreState
.MutableRecordStoreState
withWriteOnlyIndexes(List<String> writeOnlyIndexNames)
Create a new version of thisRecordStoreState
, but with additionalIndexState.WRITE_ONLY
indexes.-
Methods inherited from class com.apple.foundationdb.record.RecordStoreState
allIndexesReadable, compatibleWith, getDisabledIndexNames, getIndexStates, getState, getState, getStoreHeader, getWriteOnlyIndexNames, isDisabled, isDisabled, isReadable, isReadable, isWriteOnly, isWriteOnly, toMutable, toString, withIndexesInState, writeOnlyMap
-
-
-
-
Constructor Detail
-
MutableRecordStoreState
public MutableRecordStoreState(@Nullable RecordMetaDataProto.DataStoreInfo storeHeader, @Nullable Map<String,IndexState> indexStateMap)
-
MutableRecordStoreState
@Deprecated public MutableRecordStoreState(@Nullable Map<String,IndexState> indexStateMap)
Deprecated.
-
-
Method Detail
-
beginRead
public void beginRead()
Begin using this record store state. UntilendRead()
is called, the state will not change.- Overrides:
beginRead
in classRecordStoreState
-
endRead
public void endRead()
End using this record store state.- Overrides:
endRead
in classRecordStoreState
- See Also:
beginRead()
-
beginWrite
public void beginWrite()
Begin modifying this record store state. UntilendWrite()
is called, the state will not change.
-
endWrite
public void endWrite()
End modifying this record store state.- See Also:
beginWrite()
-
setState
@Nonnull public IndexState setState(@Nonnull String indexName, @Nonnull IndexState state)
Modify the state of an index in this map. The caller should modify the database to match.- Parameters:
indexName
- the index namestate
- the new state for the given index- Returns:
- the previous state of the given index
-
withWriteOnlyIndexes
@Nonnull public MutableRecordStoreState withWriteOnlyIndexes(@Nonnull List<String> writeOnlyIndexNames)
Description copied from class:RecordStoreState
Create a new version of thisRecordStoreState
, but with additionalIndexState.WRITE_ONLY
indexes.- Overrides:
withWriteOnlyIndexes
in classRecordStoreState
- Parameters:
writeOnlyIndexNames
- the indexes to be marked as WRITE_ONLY. If the index is already DISABLED, it will stay disabled, but will otherwise be set to WRITE_ONLY.- Returns:
- a new version of this RecordStoreState, but with additional WRITE_ONLY indexes.
-
setStoreHeader
@Nonnull public RecordMetaDataProto.DataStoreInfo setStoreHeader(@Nonnull RecordMetaDataProto.DataStoreInfo storeHeader)
Update the store header in this record store state. The caller should modify the state in the database to match.- Parameters:
storeHeader
- the updated store header- Returns:
- the previous store header value
-
equals
public boolean equals(Object o)
Description copied from class:RecordStoreState
Checks if thisRecordStoreState
specifies identical state as the given object.- Overrides:
equals
in classRecordStoreState
- Parameters:
o
- the object to check for equality- Returns:
true
if the passed object is aRecordStoreState
instance and if the other state matches thisRecordStoreState
andfalse
otherwise
-
hashCode
public int hashCode()
Description copied from class:RecordStoreState
Creates a valid hash code of this state based on the hashes of its members.- Overrides:
hashCode
in classRecordStoreState
- Returns:
- a hash code based off of the state's members hashes
-
toImmutable
@Nonnull public RecordStoreState toImmutable()
Description copied from class:RecordStoreState
Create an immutable version of thisRecordStoreState
. If the state object is already immutable, this will returnthis
. This version of the record store state is safe to cache as none of its members can be mutated.- Overrides:
toImmutable
in classRecordStoreState
- Returns:
- an immutable version of this
RecordStoreState
-
-