<commit_before>// Package controller implements a controller client providing basic operations against a
// controller endpoint through controller's HTTP API. Higher level scheduling and
// management should be built on top of that.
package controller

import (
	"github.com/giantswarm/formica/fleet"
)

type Config struct {
	Fleet fleet.Fleet
}

func DefaultConfig() Config {
	newFleetConfig := fleet.DefaultConfig()
	newFleet, err := fleet.NewFleet(newFleetConfig)
	if err != nil {
		panic(err)
	}

	newConfig := Config{
		Fleet: newFleet,
	}

	return newConfig
}

// Controller defines the interface a controller needs to implement to provide
// operations for groups of unit files against a fleet cluster.
type Controller interface {
	// Submit schedules a group on the configured fleet cluster. This is done by
	// setting the units target state to loaded.
	Submit(group string) error

	// Start starts a group on the configured fleet cluster. This is done by
	// setting the units target state to launched.
	Start(group string) error

	// Stop stops a group on the configured fleet cluster. This is done by
	// setting the unit's target state to loaded.
	Stop(group string) error

	// Destroy delets a group on the configured fleet cluster. This is done by
	// setting the unit's target state to inactive.
	Destroy(group string) error

	// GetStatus fetches the current status of a group. If the unit cannot be
	// found, an error that you can identify using IsUnitNotFound is returned.
	GetStatus(group string) (fleet.UnitStatus, error)
}

func NewController(config Config) Controller {
	newController := controller{
		Config: config,
	}<commit_msg>comments<commit_after>// Package controller implements a controller client providing basic operations against a
// controller endpoint through controller's HTTP API. Higher level scheduling and
// management should be built on top of that.
package controller

import (
	"github.com/giantswarm/formica/fleet"
)

type Config struct {
	Fleet fleet.Fleet
}

func DefaultConfig() Config {
	newFleetConfig := fleet.DefaultConfig()
	newFleet, err := fleet.NewFleet(newFleetConfig)
	if err != nil {
		panic(err)
	}

	newConfig := Config{
		Fleet: newFleet,
	}

	return newConfig
}

// Controller defines the interface a controller needs to implement to provide
// operations for groups of unit files against a fleet cluster.
type Controller interface {
	// Submit schedules a group on the configured fleet cluster. This is done by
	// setting the state of the units in the group to loaded.
	Submit(group string) error

	// Start starts a group on the configured fleet cluster. This is done by
	// setting the state of the units in the group to launched.
	Start(group string) error

	// Stop stops a group on the configured fleet cluster. This is done by
	// setting the state of the units in the group to loaded.
	Stop(group string) error

	// Destroy delets a group on the configured fleet cluster. This is done by
	// setting the state of the units in the group to inactive.
	Destroy(group string) error

	// GetStatus fetches the current status of a group. If the unit cannot be
	// found, an error that you can identify using IsUnitNotFound is returned.
	GetStatus(group string) (fleet.UnitStatus, error)
}

func NewController(config Config) Controller {
	newController := controller{
		Config: config,
	}
{'fraction_non_alphanumeric': 0.0667262436699434, 'fraction_numerical': 0.0, 'mean_word_length': 3.9021897810218977, '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': '3591699', 'n_tokens_mistral': 931, 'n_tokens_neox': 893, 'n_words': 436}