public static BlockSnapshotDeleteCompleter createCompleter(DbClient dbClient,BlockSnapshot snapshot,String task){
  BlockSnapshotDeleteCompleter completer=new BlockSnapshotDeleteCompleter(snapshot,task);
  if (snapshot.getConsistencyGroup() != null) {
    List<URI> snapIds=new ArrayList<URI>();
    List<BlockSnapshot> snaps=ControllerUtils.getSnapshotsPartOfReplicationGroup(snapshot,dbClient);
    for (    BlockSnapshot snap : snaps) {
      snapIds.add(snap.getId());
    }
    completer.addIds(snapIds);
  }
  return completer;
}

public static BlockSnapshotDeleteCompleter createCompleter ( DbClient dbClient , BlockSnapshot snapshot , String task ) { BlockSnapshotDeleteCompleter completer = new BlockSnapshotDeleteCompleter ( snapshot , task ) ; if ( snapshot . getConsistencyGroup ( ) != null ) { List < URI > snapIds = new ArrayList < URI > ( ) ; List < BlockSnapshot > snaps = ControllerUtils . getSnapshotsPartOfReplicationGroup ( snapshot , dbClient ) ; for ( BlockSnapshot snap : snaps ) { snapIds . add ( snap . getId ( ) ) ; } completer . addIds ( snapIds ) ; } return completer ; }
this method is for creating the blocksnapshotdeletecompleter . this a bit unique from the other completers because of the way that we need to complete the task . for the case of cg snapshots , there will be multiple blocksnapshots associated , even though the request to delete the snapshot was against only one of the cg snaps . here we will make sure that the task completer has references to all the cg snaps , so that they can be referred to in the completer . main reason is that if a blocksnapshot is marked inactive , it can no longer be retrieved using altindex queries .
