services

package
v0.12.8 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package services provides an Info and Service data structure that is used for two purposes: loading configuration information from disk and storing status information in the database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	Title    string     `json:"title" msgpack:"title"`
	Services []*Service `json:"services" msgpack:"services"`
}

type Info

type Info struct {
	Version string    `json:"version" msgpack:"version"`
	Groups  []*Group  `json:"groups" msgpack:"groups"`
	Updated time.Time `json:"-" msgpack:"updated"`
}

func Load

func Load(path string) (info *Info, err error)

Load services info from a path on disk.

func (*Info) Dump

func (i *Info) Dump(path string) (err error)

func (*Info) Key

func (i *Info) Key() ([]byte, error)

func (*Info) Len

func (i *Info) Len() (nServices int)

func (*Info) Marshal

func (i *Info) Marshal() ([]byte, error)

func (*Info) Services

func (i *Info) Services() []*Service

func (*Info) Unmarshal

func (i *Info) Unmarshal(data []byte) error

func (*Info) Validate

func (i *Info) Validate() (err error)

type Service

type Service struct {
	ID          uuid.UUID     `json:"id" msgpack:"id"`
	Title       string        `json:"title" msgpack:"title"`
	Description string        `json:"description,omitempty" msgpack:"description"`
	Type        ServiceType   `json:"type" msgpack:"-"`
	Endpoint    string        `json:"endpoint" msgpack:"-"`
	Status      health.Status `json:"-" msgpack:"status"`
	LastUpdate  time.Time     `json:"-" msgpack:"last_update"`
}

func (*Service) Validate

func (s *Service) Validate() (err error)

type ServiceType

type ServiceType string
const (
	UnknownServiceType ServiceType = "unknown"
	HTTPServiceType    ServiceType = "http"
	APIServiceType     ServiceType = "api"
	EnsignServiceType  ServiceType = "ensign"
)

Jump to

Keyboard shortcuts

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