common

package
v0.0.0-...-b8e6cb6 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: MIT Imports: 4 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientProxy

type ClientProxy struct {
	Ip   string
	Port int
	// Todo Add protocol to AOR if there is more than one
	//protocol string
	ObjectId int
}

Absolute Object Reference (AOR) implementation.

type CloudFunctions

type CloudFunctions interface {
	Price(size float64) (price float64, err error)
	Availability() (available bool, err error)
}

type CloudService

type CloudService struct {
	Aor    NamingRecord
	Price  float64
	Status bool
	Rank   int
}

func (*CloudService) RefreshPrice

func (cs *CloudService) RefreshPrice()

Calls each of the cloud services using a generic proxy to get data to make the Rank based on a predefined sort method

func (*CloudService) RefreshStatus

func (cs *CloudService) RefreshStatus()

Calls each of the cloud services using a generic proxy to get status of them to make the Rank based on a predefined sort method

type ILookup

type ILookup interface {
	Bind(sn string, cp ClientProxy) (err error)
	Lookup(serviceName string) (cp ClientProxy, err error)
	List() (services []NamingRecord, err error)
	Close() (err error)
}

Lookup Remoting Pattern for location transparency

type Lookup

type Lookup struct {
	// contains filtered or unexported fields
}

func (*Lookup) Bind

func (l *Lookup) Bind(sn string, cp ClientProxy) (err error)

Binds the name to the AOR. If already exists a service with the same name it is updated

func (Lookup) Close

func (l Lookup) Close() (err error)

func (Lookup) List

func (l Lookup) List() (services []NamingRecord, err error)

func (Lookup) Lookup

func (l Lookup) Lookup(serviceName string) (cp ClientProxy, err error)

type Monitor

type Monitor struct {
	// contains filtered or unexported fields
}

func (*Monitor) Bind

func (mon *Monitor) Bind()

Binds the best cost-benefit cloud server to de name server

func (Monitor) RefreshCloudServices

func (mon Monitor) RefreshCloudServices()

Get the list of cloud services based on name server list of binded servers

func (*Monitor) RefreshRank

func (mon *Monitor) RefreshRank()

Uses the chosen sort method to generate a Rank of the best cost-efective cloud servers

func (*Monitor) Start

func (mon *Monitor) Start(lookupProxy ILookup, cloudFunctionName string, cloudFunctionsPattern string)

Starts monitoring the clouds available and caches the rank of their prices cloudFunctionName stands for the name that will be binded in the nameServer

monitor := common.Monitor{}
go monitor.Start(shared.NAME_SERVER_IP, shared.NAME_SERVER_PORT, "cloudFunctions", "CloudFunctions")

type NamingRecord

type NamingRecord struct {
	ServiceName string
	ClientProxy ClientProxy
}

A record for the name server

type SortByPriceAndAvailability

type SortByPriceAndAvailability []CloudService

Type used to sort []CloudService by Price and Availability. Implements sort.Interface

func (SortByPriceAndAvailability) Len

Len is the number of elements in the collection.

func (SortByPriceAndAvailability) Less

func (s SortByPriceAndAvailability) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (SortByPriceAndAvailability) Swap

func (s SortByPriceAndAvailability) Swap(i, j int)

Swap swaps the elements with indexes i and j.

Jump to

Keyboard shortcuts

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