<commit_before>package koding

import (
	"fmt"
	"strconv"

	"koding/kites/kloud/machinestate"
	"koding/kites/kloud/protocol"

	"github.com/mitchellh/goamz/ec2"
)

// Resizes increases the current machines underling volume to a larger volume
// without affecting the or destroying the users data.
func (p *Provider) Resize(m *protocol.Machine) (resArtifact *protocol.Artifact, resErr error) {
	// Please read the steps before you dig into the code and try to change or
	// fix something. Intented lines are cleanup or self healing procedures
	// which should be called in a defer - arslan:
	//
	// 0. Check if size is eligible (not equal or less than the current size)
	// 1. Prepare/Get volumeId of current instance
	// 2. Prepare/Get availabilityZone of current instance
	// 3. Stop the instance so we can get the snapshot
	// 4. Create new snapshot from the current volumeId of that stopped instance
	//		4a. Delete snapshot after we are done with all following steps (not needed anymore)
	// 5. Create new volume with the desired size from the snapshot and same zone.
	//		5a. Delete volume if something goes wrong in following steps
	// 6. Detach the volume of current stopped instance.
	//    if something goes wrong:
	//		6a. Detach new volume, attach old volume. New volume will be
	//		    attached in the following step, so we are going to rewind it.
	//	  if everything is ok:
	//		6b. Delete old volume (not needed anymore)
	// 7. Attach new volume to current stopped instance
	// 8. Start the stopped instance with the new larger volume
	// 9. Update Default Domain record with the new IP (stopping/starting changes the IP)<commit_msg>kloud/resize: fix typo<commit_after>package koding

import (
	"fmt"
	"strconv"

	"koding/kites/kloud/machinestate"
	"koding/kites/kloud/protocol"

	"github.com/mitchellh/goamz/ec2"
)

// Resizes increases the current machines underling volume to a larger volume
// without affecting or destroying the users data.
func (p *Provider) Resize(m *protocol.Machine) (resArtifact *protocol.Artifact, resErr error) {
	// Please read the steps before you dig into the code and try to change or
	// fix something. Intented lines are cleanup or self healing procedures
	// which should be called in a defer - arslan:
	//
	// 0. Check if size is eligible (not equal or less than the current size)
	// 1. Prepare/Get volumeId of current instance
	// 2. Prepare/Get availabilityZone of current instance
	// 3. Stop the instance so we can get the snapshot
	// 4. Create new snapshot from the current volumeId of that stopped instance
	//		4a. Delete snapshot after we are done with all following steps (not needed anymore)
	// 5. Create new volume with the desired size from the snapshot and same zone.
	//		5a. Delete volume if something goes wrong in following steps
	// 6. Detach the volume of current stopped instance.
	//    if something goes wrong:
	//		6a. Detach new volume, attach old volume. New volume will be
	//		    attached in the following step, so we are going to rewind it.
	//	  if everything is ok:
	//		6b. Delete old volume (not needed anymore)
	// 7. Attach new volume to current stopped instance
	// 8. Start the stopped instance with the new larger volume
	// 9. Update Default Domain record with the new IP (stopping/starting changes the IP)
{'fraction_non_alphanumeric': 0.07396180660806305, 'fraction_numerical': 0.009093664746892998, 'mean_word_length': 3.280155642023346, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6948799', 'n_tokens_mistral': 967, 'n_tokens_neox': 935, 'n_words': 464}