morpheus

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultHBInterval = 2 * time.Second
View Source
const DefaultTTL = 5 * time.Second

Variables

This section is empty.

Functions

This section is empty.

Types

type Morpheus

type Morpheus struct {
	Services  Services // map[service_name]map[service_id]*Service
	Scheduler *tasks.Scheduler
	Options   Options
	// contains filtered or unexported fields
}

func Init

func Init(opts ...Options) (*Morpheus, error)

func (*Morpheus) Connect

func (m *Morpheus) Connect() error

func (*Morpheus) DeleteService

func (m *Morpheus) DeleteService(svc Service) error

func (*Morpheus) ListServices

func (m *Morpheus) ListServices() *[]micro.Info

func (*Morpheus) Publish added in v0.1.7

func (m *Morpheus) Publish(subject string, data []byte, headers nats.Header) error

func (*Morpheus) RPC

func (m *Morpheus) RPC(name string, data []byte, headers nats.Header) (*nats.Msg, error)

func (*Morpheus) RegisterService

func (m *Morpheus) RegisterService(svc *Service) (*Service, error)

type Options

type Options struct {
	Mock bool `json:"mock"` // if true, will not connect to redis
}

type Service

type Service struct {
	Name          string               `json:"name,omitempty"`
	Subscriptions []*nats.Subscription `json:"-"`
	Description   string               `json:"description,omitempty"`
	Handler       micro.HandlerFunc    `json:"-"`
	Metadata      map[string]string    `json:"metadata,omitempty"`
	MicroService  micro.Service        `json:"-"`
}

func (Service) Key

func (s Service) Key() string

type ServiceEndpoint added in v0.1.4

type ServiceEndpoint struct {
	Name     string             `json:"name"`
	Subject  string             `json:"subject"`
	Metadata *map[string]string `json:"metadata"`
}

type ServiceInfo added in v0.1.4

type ServiceInfo struct {
	Name        string             `json:"name"`
	ID          string             `json:"id"`
	Version     string             `json:"version"`
	Metadata    *map[string]string `json:"metadata"`
	Description string             `json:"description"`
	Endpoints   []ServiceEndpoint  `json:"endpoints"`
}

type Services

type Services map[string]*Service

func (Services) Add

func (s Services) Add(svc *Service)

func (Services) Remove

func (s Services) Remove(svc Service)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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