api

package
v0.0.3-0...-5866088 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2020 License: GPL-3.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	PrefixPath = "/archimedes"

	ServicesPath        = "/services"
	ServicePath         = "/services/%s"
	ServiceInstancePath = "/services/%s/%s"
	InstancePath        = "/instances/%s"
	DiscoverPath        = "/discover"
	WhoAreYouPath       = "/who"
	TablePath           = "/table"
	ResolvePath         = "/resolve"
)

Paths

View Source
const (
	StatusQueryVar = "status"

	StatusOutOfService = "OUT_OF_SERVICE"
	StatusUp           = "UP"
)
View Source
const (
	ArchimedesServiceName = "archimedes"
	Port                  = 50000
)

Variables

View Source
var (
	DefaultHostPort = ArchimedesServiceName + ":" + strconv.Itoa(Port)
)

Functions

func GetDiscoverPath

func GetDiscoverPath() string

func GetInstancePath

func GetInstancePath(instanceId string) string

func GetResolvePath

func GetResolvePath() string

func GetServiceInstancePath

func GetServiceInstancePath(serviceId, instanceId string) string

func GetServicePath

func GetServicePath(serviceId string) string

func GetServicesPath

func GetServicesPath() string

func GetTablePath

func GetTablePath() string

func GetWhoAreYouPath

func GetWhoAreYouPath() string

func ResolveServiceInArchimedes

func ResolveServiceInArchimedes(httpClient *http.Client, hostPort string) (string, error)

Types

type DiscoverMsg

type DiscoverMsg struct {
	MessageId    uuid.UUID
	Origin       string
	NeighborSent string
	Entries      map[string]*ServicesTableEntryDTO
}

type Instance

type Instance struct {
	Id              string
	ServiceId       string
	Ip              string
	PortTranslation nat.PortMap
	Initialized     bool
	Static          bool
	Local           bool
}

func FromTransfarableInstance

func FromTransfarableInstance(i *Instance, originIp string) *Instance

func (*Instance) ToTransfarable

func (i *Instance) ToTransfarable() *Instance

type NeighborDTO

type NeighborDTO struct {
	Addr string
}

type ResolvedDTO

type ResolvedDTO struct {
	Host string
	Port string
}

type Service

type Service struct {
	Id    string
	Ports nat.PortSet
}

func (*Service) ToTransfarable

func (s *Service) ToTransfarable() *Service

type ServiceDTO

type ServiceDTO struct {
	Ports nat.PortSet
}

type ServicesTableEntryDTO

type ServicesTableEntryDTO struct {
	Host, HostAddr string
	Service        *Service
	Instances      map[string]*Instance
	NumberOfHops   int
	MaxHops        int
	Version        int
}

type ToResolveDTO

type ToResolveDTO struct {
	Host string
	Port nat.Port
}

type TypeInstancesMapKey

type TypeInstancesMapKey = string

type TypeInstancesMapValue

type TypeInstancesMapValue = *Instance

Jump to

Keyboard shortcuts

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