Package com.qfs.multiversion
Interface IEpochManager
-
- All Known Subinterfaces:
IAdvancedEpochManager
- All Known Implementing Classes:
AEpochManager,DistributedEpochManager,EpochManager
public interface IEpochManagerUser interface for versions management of all components.- Author:
- ActiveViam
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceIEpochManager.IVersionLifecycleHandler<V extends IVersion>Handler containing callbacks for the different events triggered during a version's lifecycle.
-
Field Summary
Fields Modifier and Type Field Description static StringIDENTIFIERStatistic identifier.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <V extends ISquashableVersion<V>>
IVersionHistory<V>createVersionHistory(boolean root, IHasId forComponent, IEpochManager.IVersionLifecycleHandler<V> historyLifecycle)Creates a version history that works accordingly to the epoch management policy of this epoch manager.voiddiscard()Cleans up resources that are only reachable by versions that do not exist anymore.voidforceDiscardEpochs(Predicate<IHistoryNode> predicate)Iterates over all the released epochs in each history of this epoch manager and forces the discard of the epochs for which thepredicatereturnstrue.Set<String>getBranches()Gets the names of the branches.Map<String,? extends IEpochHistory>getHistories()Gets the underlying histories indexed by theirids.IEpochHistorygetRootHistory()Gets the root history.voidreleaseBranch(String branch)Releases all the epochs of the given branch.voidreleaseEpochs(String branch, long from, long to)Releases a range of epochs.voidreleaseHistory(String id)Removes anIEpochHistoryfrom the existing list of histories stored by theepoch manager.
-
-
-
Field Detail
-
IDENTIFIER
static final String IDENTIFIER
Statistic identifier.- See Also:
- Constant Field Values
-
-
Method Detail
-
releaseHistory
void releaseHistory(String id)
Removes anIEpochHistoryfrom the existing list of histories stored by theepoch manager.- Parameters:
id- the component whose history should be removed- See Also:
IEpochHistory.getMultiVersionId()
-
releaseEpochs
void releaseEpochs(String branch, long from, long to) throws IllegalArgumentException
Releases a range of epochs.- Parameters:
branch- the branch of the versions to releasefrom- the lower bound of the range, included in the deletionto- the upper bound of the range, also included in the deletion- Throws:
IllegalArgumentException- if trying to release the latest epoch (i.e. whento >= currentEpoch, with currentEpoch =#getCurrentEpoch())- See Also:
IEpochHistory.releaseEpochs(String, long, long)
-
getBranches
Set<String> getBranches()
Gets the names of the branches.- Returns:
- the names of the branches
-
releaseBranch
void releaseBranch(String branch)
Releases all the epochs of the given branch.- Parameters:
branch- any branch but the main- See Also:
IEpoch.MASTER_BRANCH_NAME
-
getRootHistory
IEpochHistory getRootHistory()
Gets the root history. The root history is the single history whose versions are followed by other histories.- Returns:
- the root history
-
getHistories
Map<String,? extends IEpochHistory> getHistories()
Gets the underlying histories indexed by theirids.
-
createVersionHistory
<V extends ISquashableVersion<V>> IVersionHistory<V> createVersionHistory(boolean root, IHasId forComponent, IEpochManager.IVersionLifecycleHandler<V> historyLifecycle)
Creates a version history that works accordingly to the epoch management policy of this epoch manager.- Type Parameters:
V- the type of versions stored in this history- Parameters:
root- indicates if this history is the root version history among all histories created by this creator, the root history is the single history whose versions are followed by other historiesforComponent- the multiversion whose versions are managed by the new version historyhistoryLifecycle- lifecycle callbacks for this version history- Returns:
- version history
-
discard
void discard()
Cleans up resources that are only reachable by versions that do not exist anymore.
-
forceDiscardEpochs
void forceDiscardEpochs(Predicate<IHistoryNode> predicate)
Iterates over all the released epochs in each history of this epoch manager and forces the discard of the epochs for which thepredicatereturnstrue.This call will also perform a normal
discard().- Parameters:
predicate- the predicate that will select the epoch to discard
-
-