Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CreateDir = func(path string) { if !FileExists(path) { err := Root.MkdirAll(path, 0755) if err != nil { fmt.Println("Could not create", path) os.Exit(255) } } }
CreateDir takes a path and attempts to create it and all of its ancestors on the file system. If there are problems along the way, the program exits with code 255.
var Root = afero.NewOsFs()
Root is the abstracted file system used for all operations in this package.
Functions ¶
func DataDir ¶
func DataDir() string
DataDir is the file system location in which runtime data is stored.
func FileExists ¶
FileExists takes a path, checks to see if that file exists on the file system. If the file does exist, it returns true. Otherwise, it returns false.
func GroupConfigs ¶
func GroupConfigs() string
GroupConfigs is the file system location in which group definition files are stored.
Types ¶
type GroupService ¶
type GroupService struct{}
GroupService is a service that knows how to interact with groups on the file system.
func NewGroupService ¶
func NewGroupService() *GroupService
NewGroupService returns a new instance of GroupService.
func (*GroupService) Get ¶
func (s *GroupService) Get(name string) (*scaley.Group, error)
Get takes a group name, attempts to read that group's definition from the file system, and returns both a group and an error. If there are issues along the way, the error is populated and the group is nil. Otherwise, the group is populated from the values in the associated group file and the error is nil.
type LockService ¶
type LockService struct{}
LockService is a service that knows how to lock and unlock groups via the file system.
func NewLockService ¶
func NewLockService() *LockService
NewLockService returns a new instance of LockService.
func (LockService) Lock ¶
func (service LockService) Lock(group *scaley.Group) error
Lock attempts to lock the given group. If there are issues in doing so, an error is returned. Otherwise, nil is returned.
type ScalingScriptService ¶
type ScalingScriptService struct{}
ScalingScriptService is a service that knows how to interact with scaling scripts via the file system.
func NewScalingScriptService ¶
func NewScalingScriptService() *ScalingScriptService
NewScalingScriptService returns a new ScalingScriptService.
func (*ScalingScriptService) Exists ¶
func (service *ScalingScriptService) Exists(path string) bool
Exists takes a path and returns a boolean that expresses whether or not the scaling script at that location exists.