THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
/**
* Snapshot lifecycle listener.
*/
public interface SnapshotLifecycleListener<T extends Serializable> extends Extension {
/** Listener name. */
public default String name() {
return getClass().getSimpleName();
}
/** Listener invocation priority (ascending order is used). */
public default int priority() {
return 0;
}
/**
* Called locally after the snapshot files have been created on the node.
*
* @param name Snapshot name.
* @param metadata Snapshot metadata file.
* @param binaryDir Snapshot binary metadata directory.
* @param marshallerDir Snapshot marshaller data directory.
* @param cacheDir Snapshot cache data directory.
* @throws IgniteCheckedException If failed.
*/
public default void afterCreate(
String name,
File metadata,
Path binaryDir,
Path marshallerDir,
Path cacheDir
) throws IgniteCheckedException {
// No-op.
}
/**
* Called locally before restore snapshot files.
*
* @param name Snapshot name.
* @param grps Cache groups to be restored ({@code null} if all cache groups are restored from the snapshot).
* @param metadata Snapshot metadata file.
* @param binaryDir Snapshot binary metadata directory.
* @param marshallerDir Snapshot marshaller data directory.
* @param cacheDir Snapshot cache data directory.
*
* @return Local node result, or {@code null} if cluster-wide aggregation is not required.
* @throws IgniteCheckedException If failed.
*/
@Nullable public default T beforeRestore(
String name,
@Nullable Collection<String> grps,
File metadata,
Path binaryDir,
Path marshallerDir,
Path cacheDir
) throws IgniteCheckedException {
return null;
}
/**
* Process the results of a pre-restore operation across the cluster.
*
* @param name Snapshot name.
* @param grps Cache groups to be restored ({@code null} if all cache groups are restored from the snapshot).
* @param res Results from all nodes.
* @param errs Errors from all nodes.
* @throws IgniteCheckedException If failed.
*/
public default void handlePreRestoreResults(
String name,
@Nullable Collection<String> grps,
Map<ClusterNode, T> res,
Map<ClusterNode, Exception> errs
) throws IgniteCheckedException {
Map.Entry<ClusterNode, Exception> errEntry = F.first(errs.entrySet());
if (errEntry == null)
return;
throw new IgniteCheckedException("Snapshot restore handler " + getClass().getSimpleName() +
" has failed on node " + errEntry.getKey().id() + '.', errEntry.getValue());
}
}
|
...