redis

package
v0.0.0-...-870cc59 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ApplicationKey is the key name for the HashMap containing application instances
	ApplicationKey string = "applications"

	// DatabaseKey is the key name for the HashMap containing database instances
	DatabaseKey string = "databases"

	// SSHKey is the key name for the Sorted Set containing ssh microservice instances
	SSHKey string = types.GenSSH

	// WorkerInstanceKey is the key name for Worker nodes
	WorkerInstanceKey string = types.AppMaker

	// ErrEmptySet is the error message when the redis set being queried is empty
	ErrEmptySet string = "Empty Set"
)

Variables

This section is empty.

Functions

func BulkRegisterApps

func BulkRegisterApps(data types.M) error

BulkRegisterApps registers multiple apps at once

func BulkRegisterDatabases

func BulkRegisterDatabases(data types.M) error

BulkRegisterDatabases registers multiple databases at once

func DecrementServiceLoad

func DecrementServiceLoad(service, url string) error

DecrementServiceLoad decrements the number of apps deployed on a service host by 1

func FetchAllApps

func FetchAllApps() (map[string]string, error)

FetchAllApps returns all applications along with their URLs (IP of the node and port)

func FetchAllDatabases

func FetchAllDatabases() (map[string]string, error)

FetchAllDatabases gets all the apps with their URL (IP of the node and port)

func FetchAppNode

func FetchAppNode(appName string) (string, error)

FetchAppNode returns the URL of the node where the application is deployed

func FetchAppServer

func FetchAppServer(appName string) (string, error)

FetchAppServer returns the URL of deployed application

func FetchDbNode

func FetchDbNode(dbName string) (string, error)

FetchDbNode returns the URL of the node where the database is deployed

func FetchDbServer

func FetchDbServer(dbName string) (string, error)

FetchDbServer returns the URL of the database's server

func FetchServiceInstances

func FetchServiceInstances(service string) ([]string, error)

FetchServiceInstances returns all instances of a given service

func FetchWorkerInstances

func FetchWorkerInstances() ([]string, error)

FetchWorkerInstances returns all worker service instances

func GetLeastLoadedInstance

func GetLeastLoadedInstance(service string) (string, error)

GetLeastLoadedInstance returns a single instance having least number of apps of a particular service deployed

func GetLeastLoadedInstances

func GetLeastLoadedInstances(service string, count int64) ([]string, error)

GetLeastLoadedInstances returns the URL of the host currently having the least number of apps of a particular service deployed

func GetLeastLoadedInstancesWithScores

func GetLeastLoadedInstancesWithScores(service string, count int64) ([]redis.Z, error)

GetLeastLoadedInstancesWithScores returns the n least loaded instances along with their scores

func GetLeastLoadedWorker

func GetLeastLoadedWorker() (string, error)

GetLeastLoadedWorker returns a single worker instance having least number of apps deployed

func GetSSHPort

func GetSSHPort(url string) (string, error)

GetSSHPort returns the port of an instance where its ssh service is deployed

func IncrementServiceLoad

func IncrementServiceLoad(service, url string) error

IncrementServiceLoad increments the number of apps deployed on a service host by 1

func RegisterApp

func RegisterApp(appName, nodeURL, serverURL string) error

RegisterApp registers the app in the applications HashMap with its server and node url

func RegisterDB

func RegisterDB(dbName, nodeURL, serverURL string) error

RegisterDB registers the database in the databases HashMap with its server and node url

func RegisterService

func RegisterService(service, url string, score float64) error

RegisterService puts a service URL in its respective sorted set

func RemoveApp

func RemoveApp(appName string) error

RemoveApp removes the application's entry from Redis

func RemoveDB

func RemoveDB(dbName string) error

RemoveDB removes the databases's entry from Redis

func RemoveServiceInstance

func RemoveServiceInstance(service, member string) error

RemoveServiceInstance removes an instance of a particular service

Types

This section is empty.

Jump to

Keyboard shortcuts

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