Skip to content

Instantly share code, notes, and snippets.

@yaronp68
Created February 5, 2012 19:01
Show Gist options
  • Select an option

  • Save yaronp68/1747267 to your computer and use it in GitHub Desktop.

Select an option

Save yaronp68/1747267 to your computer and use it in GitHub Desktop.
public interface ProvisioningDriver {
/**************
* Called once on startup of the cloud driver, passing the cloud configuration to it.
*
* @param cloudTemplate
* @param cloud
*
* @param config The configuration settings.
*/
void setConfig(Cloud cloud, String cloudTemplate, boolean management);
/**************
* Passes an Admin API object that can be used to query the current cluster state.
* IMPORTANT: do not perform any blocking operations on this Admin instance,
*
* @param config The configuration settings.
*/
void setAdmin(Admin admin);
/***************
* Starts an additional machine on the cloud to scale out this specific service.
*
* @param duration Time duration to wait for the instance.
* @param unit Time unit to wait for the instance.
* @return The details of the started instance.
* @throws TimeoutException In case the instance was not started in the allotted time.
* @throws CloudProvisioningException If a problem was encountered while starting the machine.
*/
MachineDetails startMachine(long duration, TimeUnit unit) throws TimeoutException, CloudProvisioningException;
/******************
* Start the management machines for this cluster.
*
* @param duration timeout duration.
* @param unit timeout unit.
* @return The created machine details.
* @throws TimeoutException If creating the new machines exceeded the given timeout.
* @throws CloudProvisioningException If the machines needed for management could not be provisioned.
*/
MachineDetails[] startManagementMachines(long duration, TimeUnit unit) throws TimeoutException, CloudProvisioningException;
/****************
* Stops a specific machine for scaling in or shutting down a specific service.
* @throws CloudProvisioningException
*/
boolean stopMachine(final String machineIp, final long duration, final TimeUnit unit) throws InterruptedException, TimeoutException, CloudProvisioningException;
/*************
* Stops the management machines.
*
* @throws TimeoutException in case the stop operation exceeded the given timeout.
* @throws CloudProvisioningException If the stop operation failed.
*/
void stopManagementMachines() throws TimeoutException, CloudProvisioningException;
/************
* Returns the name of this cloud.
* @return the name of the cloud.
*/
String getCloudName();
/*************
* Called when the service that this provisioning implementation is responsible for scaling
* is undeployed. The implementation is expected to release/close all relevant resources,
* such as thread pools, sockets, files, etc.
*/
void close();
/**************
* Adds a new ProvisioningDriverListner to the ProvisioningDriver.
*
* @param pdl A class that implements ProvisioningDriverListner.
*/
void addListener(ProvisioningDriverListener listener);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment