Files

13 KiB

client

import "github.com/Akilan1999/p2p-rendering-computation/client"

Index

func AddTrackContainer

func AddTrackContainer(d *docker.DockerVM, ipAddress string) error

AddTrackContainer Adds new container which has been added to the track container

func CheckID

func CheckID(ID string) (string, error)

CheckID Checks if the ID belongs to a group or a single container

func GetServerPort

func GetServerPort(IpAddress string) (string, error)

GetServerPort Helper function to do find out server port information

func GetSpecs

func GetSpecs(IP string) (*server.SysInfo, error)

GetSpecs Gets Specs from the server such CPU, GPU usage and other basic information which helps set a cluster of computer

func PrettyPrint

func PrettyPrint(data interface{})

PrettyPrint print the contents of the obj ( Reference: https://stackoverflow.com/questions/24512112/how-to-print-struct-variables-in-console

func RemoveContainerGroups

func RemoveContainerGroups(ContainerID string) error

RemoveContainerGroups Remove Container from groups (i.e which ever groups has information about that container). This is mostly called when a container is deleted or removed from the tracked container list

func RemoveContianer

func RemoveContianer(IP string, ID string) error

RemoveContianer Stops and removes container from the server

func RemoveGroup

func RemoveGroup(GroupID string) error

RemoveGroup Removes group based on the group ID provided

func RemoveTrackedContainer

func RemoveTrackedContainer(id string) error

RemoveTrackedContainer This function removos tracked container from the trackcontainer JSON file

func StartContainer

func StartContainer(IP string, NumPorts int, GPU bool, ContainerName string, baseImage string) (*docker.DockerVM, error)

StartContainer Start container using REST api Implementation From the selected server IP address TODO: Test cases for this function Calls URL ex: http://0.0.0.0:8088/startcontainer?ports=0&GPU=false&ContainerName=docker-ubuntu-sshd

func ViewContainers

func ViewContainers(IP string) (*docker.DockerContainers, error)

ViewContainers This function displays all containers available on server side

type Group

Group Information about a single group

type Group struct {
    ID                 string            `json:"ID"`
    TrackContainerList []*TrackContainer `json:"TrackContainer"`
    // contains filtered or unexported fields
}

func AddContainerToGroup

func AddContainerToGroup(ContainerID string, GroupID string) (*Group, error)

AddContainerToGroup Adds container information to the Group based on the Group ID

func CreateGroup

func CreateGroup() (*Group, error)

CreateGroup Creates a new group to add a set of track containers

func GetGroup

func GetGroup(GroupID string) (*Group, error)

GetGroup Gets group information based on group id provided

func RemoveContainerGroup

func RemoveContainerGroup(ContainerID string, GroupID string) (*Group, error)

RemoveContainerGroup Remove Container from the group ID specified

func (*Group) AddContainer

func (grp *Group) AddContainer(Container *TrackContainer) error

AddContainer Adds a container to the Tracked container list of the group

func (*Group) AddGroupToFile

func (grp *Group) AddGroupToFile() error

AddGroupToFile Adds Group struct to the GroupTrackContainer File

func (*Group) RemoveContainerGroup

func (grp *Group) RemoveContainerGroup(Container *TrackContainer) error

RemoveContainerGroup Removes container information from the group

type Groups

Groups Data Structure type

type Groups struct {
    GroupList []*Group `json:"Groups"`
}

func ReadGroup

func ReadGroup() (*Groups, error)

ReadGroup Function reads grouptrackcontainers.json and converts result to Groups

func (*Groups) RemoveContainerGroups

func (grp *Groups) RemoveContainerGroups(Container *TrackContainer) error

RemoveContainerGroups removes container found in all groups

func (*Groups) WriteGroup

func (grp *Groups) WriteGroup() error

WriteGroup Function to write type Groups to the grouptrackcontainers.json file

type ResponseMAPPort

type ResponseMAPPort struct {
    IPAddress string
}

func MAPPort

func MAPPort(port string, domainName string) (*ResponseMAPPort, error)

type TrackContainer

TrackContainer Stores information of current containers

type TrackContainer struct {
    Id        string           `json:"ID"`
    Container *docker.DockerVM `json:"Container"`
    IpAddress string           `json:"IpAddress"`
}

func GetContainerInformation

func GetContainerInformation(ID string) (*TrackContainer, error)

GetContainerInformation gets information about container based on container ID provided

func (*TrackContainer) ModifyContainerGroups

func (TC *TrackContainer) ModifyContainerGroups() error

ModifyContainerGroups Modifies container information is all groups available

func (*TrackContainer) ModifyContainerInformation

func (TC *TrackContainer) ModifyContainerInformation() error

ModifyContainerInformation Modifies information inside the container

type TrackContainers

TrackContainers This struct stores arrays of current containers running

type TrackContainers struct {
    TrackContainerList []TrackContainer `json:"TrackContainer"`
}

func ReadTrackContainers

func ReadTrackContainers(filename string) (*TrackContainers, error)

ReadTrackContainers Reads containers which are currently tracked

func ViewTrackedContainers

func ViewTrackedContainers() (error, *TrackContainers)

ViewTrackedContainers View Containers currently tracked

func (*TrackContainers) WriteContainers

func (TC *TrackContainers) WriteContainers() error

WriteContainers Write information back to the config file

Generated by gomarkdoc