sites

package
v0.0.0-...-2dfe69b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package sites contains types, functions and methods for reading and interpreting data about sites contained in data files sites.json and machines.json

This data can be accessed through the global variable "Data".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(loc string)

Init initializes our Data given the data location. Call from main().

Types

type Machine

type Machine struct {
	// Name is the name of the machine.
	Name string
	// Site is the site the machine is located at.
	Site string
}

Machine represents a physical machine located in a site.

func (Machine) FullName

func (m Machine) FullName() string

FullName retrieves the globally unique name for the machine.

func (Machine) Validate

func (m Machine) Validate() error

Validate validates a Machine's fields.

type Site

type Site struct {
	// Name is the name of the site.
	Name string
	// Type is the type of site.
	Type string
	// Status is the status of the site.
	Status string
	// Machines are a list of machines in the site.
	Machines []Machine
}

Site represents an individual site where we have machines located.

func (Site) Validate

func (s Site) Validate() error

Validate validates Site's fields are valid.

type SiteData

type SiteData struct {
	// Sites is mapping of all sites by name.
	Sites map[string]Site
	// Machines is a mapping of all machines by their full name (aa01.aaa).
	Machines map[string]Machine
}

SiteData contains information on our sites and the machines that are located in those sites.

var Data SiteData

Data holds the site data and is how to access the data. Note: in a real system, the data here would always be a copy. That way different things accessing it could not change it for others.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL