Interface SnapshotHandler<T>
-
- Type Parameters:
T- Type of the local processing result.
- All Superinterfaces:
Extension
- All Known Implementing Classes:
DataStreamerUpdatesHandler,SnapshotPartitionsQuickVerifyHandler,SnapshotPartitionsVerifyHandler
public interface SnapshotHandler<T> extends Extension
Snapshot operation handler.The execution of the handler consists of two steps:
- Local call of
invoke(SnapshotHandlerContext)method on all nodes containing the snapshot data. - Processing the results of local invocations in the
complete(String, Collection)method on one of the nodes containing the snapshot data.
complete(String, Collection)method may not be called.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidcomplete(String name, Collection<SnapshotHandlerResult<T>> results)Processing the results of theinvoke(SnapshotHandlerContext)method received from all nodes.Tinvoke(SnapshotHandlerContext ctx)Local processing of a snapshot operation.SnapshotHandlerTypetype()Snapshot handler type.
-
-
-
Method Detail
-
type
SnapshotHandlerType type()
Snapshot handler type.
-
invoke
@Nullable T invoke(SnapshotHandlerContext ctx) throws Exception
Local processing of a snapshot operation. Called on every node that contains snapshot data.- Parameters:
ctx- Snapshot handler context.- Returns:
- Result of local processing. This result will be returned in
SnapshotHandlerResult.data()method passed intocomplete(String, Collection)handler method. - Throws:
Exception- If invocation caused an exception. This exception will be returned inSnapshotHandlerResult.error()} method passed intocomplete(String, Collection)handler method.
-
complete
default void complete(String name, Collection<SnapshotHandlerResult<T>> results) throws SnapshotWarningException, Exception
Processing the results of theinvoke(SnapshotHandlerContext)method received from all nodes. This method is called on coordinator node forSnapshotHandlerType.CREATEhandler type and on the random node containing the snapshot data forSnapshotHandlerType.RESTORE.Note: If this method fails, the entire cluster-wide snapshot operation will be aborted and the changes made by it will be rolled back.
- Parameters:
name- Snapshot name.results- Results from all nodes.- Throws:
SnapshotWarningException- If a warning of snapshot operation occurred.Exception- If the snapshot operation needs to be aborted.- See Also:
SnapshotHandlerResult
-
-