public BackupSchemaStep( String daemon, CassandraState cassandraState, CassandraOfferRequirementProvider provider, BackupRestoreContext context) { super(daemon, BackupSchemaTask.nameForDaemon(daemon), cassandraState, provider); this.context = context; }
/** * Gets the name of a BackupSchemaTask for a CassandraDaemonTask. * * @param daemon The CassandraDaemonTask for which the schema will be * backed up. * @return The name of the BackupSchemaTask for daemon. */ public static final String nameForDaemon(final CassandraDaemonTask daemon) { return nameForDaemon(daemon.getName()); }
public BackupSchemaTask getOrCreateBackupSchema( CassandraDaemonTask daemon, BackupRestoreContext context) throws PersistenceException { String name = BackupSchemaTask.nameForDaemon(daemon); Map<String, BackupSchemaTask> schemas = getBackupSchemaTasks(); if (schemas.containsKey(name)) { return schemas.get(name); } else { return createBackupSchemaTask(daemon, context); } }
public static BackupSchemaTask create( final Protos.TaskInfo template, final CassandraDaemonTask daemon, final BackupRestoreContext context) { String name = nameForDaemon(daemon); CassandraData data = CassandraData.createBackupSchemaData( "", context .forNode(daemon.getName()) .withLocalLocation(daemon.getVolumePath() + "/data")); Protos.TaskInfo completedTemplate = Protos.TaskInfo.newBuilder(template) .setName(name) .setTaskId(TaskUtils.toTaskId(name)) .setData(data.getBytes()) .build(); completedTemplate = org.apache.mesos.offer.TaskUtils.clearTransient(completedTemplate); return new BackupSchemaTask(completedTemplate); }