server

package
v0.0.0-...-52087c1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddConnectRequest

func AddConnectRequest(req types.RequestConnect)

func AddContainer

func AddContainer(container_id string, client_id string, container *types.Container)

func AddService

func AddService(service_id string, client_id string, service *types.Service)

func DeleteContainer

func DeleteContainer(container_id string)

func DeleteService

func DeleteService(service_id string)

func Disconnect

func Disconnect(client_id string)

func FetchLowestDemandClient

func FetchLowestDemandClient() (types.Client, error)

func FlushContainer

func FlushContainer(client_id string)

func FlushService

func FlushService(client_id string)

func GetClient

func GetClient(client_id string) *types.Client

func GetClientStatus

func GetClientStatus(client_id string) (types.ClientStatus, error)

func GetConnectRequest

func GetConnectRequest() types.RequestConnect

func GetContainer

func GetContainer(container_id string) (*types.Container, string, error)

ret:

*container, client_id, error

func GetService

func GetService(service_id string) (*types.Service, string, error)

func RegisterOnNodeConnect

func RegisterOnNodeConnect(f KisaraOnNodeConnect)

func RegisterOnNodeDisconnect

func RegisterOnNodeDisconnect(f KisaraOnNodeDisconnect)

func RegisterOnNodeHeartBeat

func RegisterOnNodeHeartBeat(f KisaraOnNodeHeartBeat)

func RegisterOnNodeLaunchContainer

func RegisterOnNodeLaunchContainer(f KisaraOnNodeLaunchContainer)

func RegisterOnNodeStopContainer

func RegisterOnNodeStopContainer(f KisaraOnNodeStopContainer)

func RegisterOnServiceStart

func RegisterOnServiceStart(f KisaraOnServiceStart)

func RegisterOnServiceStop

func RegisterOnServiceStop(f KisaraOnServiceStop)

func Server

func Server(show_log ...bool)

Server is the main function of the synergy server, it's non-blocking, call it directly without goroutine

func UnsetOnNodeConnect

func UnsetOnNodeConnect()

func UnsetOnNodeDisconnect

func UnsetOnNodeDisconnect()

func UnsetOnNodeHeartBeat

func UnsetOnNodeHeartBeat()

func UnsetOnNodeLaunchContainer

func UnsetOnNodeLaunchContainer()

func UnsetOnNodeStopContainer

func UnsetOnNodeStopContainer()

func UnsetOnServiceStart

func UnsetOnServiceStart()

func UnsetOnServiceStop

func UnsetOnServiceStop()

func UpdateClientContainer

func UpdateClientContainer(client_id string) error

func UpdateClientStatus

func UpdateClientStatus(client_id string, status types.ClientStatus) error

func UpdateHeartBeat

func UpdateHeartBeat(client_id string) error

Types

type ClientItem

type ClientItem struct {
	ClientID      string
	Client        *types.Client
	ClientStatus  *types.ClientStatus
	LastHeartBeat time.Time
}

func GetNodes

func GetNodes() []ClientItem

func (*ClientItem) GetDemand

func (c *ClientItem) GetDemand() (float64, error)

TODO: currently, this function is too simple.

type ContainerItem

type ContainerItem struct {
	ClientId    string
	ContainerId string
	Container   *types.Container
}

type KisaraOnNodeConnect

type KisaraOnNodeConnect func(client_id string, client *types.Client)

type KisaraOnNodeDisconnect

type KisaraOnNodeDisconnect func(client_id string, client *types.Client)

type KisaraOnNodeHeartBeat

type KisaraOnNodeHeartBeat func(client_id string, client *types.Client, status *types.ClientStatus)

type KisaraOnNodeLaunchContainer

type KisaraOnNodeLaunchContainer func(client_id string, client *types.Client, container *types.Container)

type KisaraOnNodeStopContainer

type KisaraOnNodeStopContainer func(client_id string, client *types.Client, container *types.Container)

type KisaraOnServiceStart

type KisaraOnServiceStart func(service_id string, service *types.Service)

type KisaraOnServiceStop

type KisaraOnServiceStop func(service_id string, service *types.Service)

type ServiceItem

type ServiceItem struct {
	ClientId  string
	ServiceId string
	Service   *types.Service
}

Jump to

Keyboard shortcuts

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