Interface IMultiVersionLongArray
-
- All Superinterfaces:
IDroppableComponent,IMultiVersion,IMultiVersionOperations,ITransactionalMultiVersion
- All Known Implementing Classes:
MultiVersionLongArray
public interface IMultiVersionLongArray extends ITransactionalMultiVersion, IDroppableComponent
Multiversion long array.- Author:
- ActiveViam
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceIMultiVersionLongArray.IDiscardProcedure
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ILongArrayVersioncommit(IEpoch epoch)Commits the pending transient state at the specified epoch.Runnabledestroy()Frees all resources held by this data structure.voiddrop()Notifies the component that it has been definitively dropped.ISquashableLongArrayVersiongetMostRecentVersion()Retrieves the latest (i.e.ILongArrayTransactiongetOrCreateTransaction()Returns the current transaction.
The result is nevernullcontrary toITransactionalMultiVersion.getTransaction().ILongArrayTransactiongetTransaction()Returns the current transaction.booleanisTransient()Returns whether this array is transient.voidsetDiscardProcedure(IMultiVersionLongArray.IDiscardProcedure procedure)Sets the discardprocedure.-
Methods inherited from interface com.qfs.multiversion.ITransactionalMultiVersion
rollback
-
-
-
-
Method Detail
-
getMostRecentVersion
ISquashableLongArrayVersion getMostRecentVersion()
Description copied from interface:IMultiVersionRetrieves the latest (i.e. current) version of the object.- Specified by:
getMostRecentVersionin interfaceIMultiVersion- Returns:
- the latest version of the object
-
commit
ILongArrayVersion commit(IEpoch epoch)
Description copied from interface:IMultiVersionOperationsCommits the pending transient state at the specified epoch.This automatically creates a new transient, writable state.
Thread-safety: unless specific otherwise by the implementing class, it is not thread-safe to call
IMultiVersionOperations.commit(IEpoch)andIMultiVersionOperations.rollback()concurrently.- Specified by:
commitin interfaceIMultiVersionOperations- Parameters:
epoch- the epoch associated with this commit- Returns:
- the version that prevails after this commit (possibly an untouched current version if the commit had absolutely no impact on the state)
-
getTransaction
ILongArrayTransaction getTransaction()
Description copied from interface:ITransactionalMultiVersionReturns the current transaction.- Specified by:
getTransactionin interfaceITransactionalMultiVersion- Returns:
- the current transaction or
nullwhen there is no transaction - See Also:
ITransactionalMultiVersion.getOrCreateTransaction()
-
getOrCreateTransaction
ILongArrayTransaction getOrCreateTransaction()
Description copied from interface:ITransactionalMultiVersionReturns the current transaction.
The result is nevernullcontrary toITransactionalMultiVersion.getTransaction().THIS METHOD SHOULD BE CALLED ONLY IF
IMultiVersionOperations.commit(IEpoch)(orITransactionalMultiVersion.rollback()) IS GUARANTEED TO BE CALLED otherwise this could cause a memory leak if the transaction holds a version (because the multiversion will keep the transaction).- Specified by:
getOrCreateTransactionin interfaceITransactionalMultiVersion- Returns:
- the current transaction
- See Also:
ITransactionalMultiVersion.getTransaction()
-
destroy
Runnable destroy()
Frees all resources held by this data structure.- Returns:
- the
Runnableto run to actually destroy the data structure
-
isTransient
boolean isTransient()
Returns whether this array is transient.- Returns:
trueif this array is transient,falseotherwise
-
drop
void drop()
Notifies the component that it has been definitively dropped.No more roll back is possible.
The component should nullify the references it does not need anymore (example: latest, transaction) to avoid memory leak.
-
setDiscardProcedure
void setDiscardProcedure(IMultiVersionLongArray.IDiscardProcedure procedure)
Sets the discardprocedure.The procedure will be invoked whenever the garbage stored in a
versionof thisarrayiscollected.- Parameters:
procedure- the discard procedure
-
-