mapstore

package
v0.0.0-...-00593c4 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MapStore

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

MapStore implements the Store interface creating an in memory map of stela.Services

func (*MapStore) AddClient

func (m *MapStore) AddClient(c *stela.Client) error

AddClient adds to client slice m.clients and return the client id

func (*MapStore) Client

func (m *MapStore) Client(id string) (*stela.Client, error)

Client returns a client from m.clients based on id

func (*MapStore) Deregister

func (m *MapStore) Deregister(s *stela.Service) *stela.Service

Deregister removes a service from the map and returns the service it deregistered

func (*MapStore) Discover

func (m *MapStore) Discover(serviceName string) ([]*stela.Service, error)

Discover finds all services registered under a serviceName

func (*MapStore) DiscoverAll

func (m *MapStore) DiscoverAll() []*stela.Service

DiscoverAll returns all the services registered with the store

func (*MapStore) DiscoverOne

func (m *MapStore) DiscoverOne(serviceName string) (*stela.Service, error)

DiscoverOne returns only one of the services registered under a serviceName

func (*MapStore) DiscoverRegex

func (m *MapStore) DiscoverRegex(reg string) ([]*stela.Service, error)

DiscoverRegex finds all services registered from a regular expression https://golang.org/pkg/regexp/#MatchString

func (*MapStore) NotifyClients

func (m *MapStore) NotifyClients(s *stela.Service)

NotifyClients let's all locally subscribed clients, on this stela instance, know about service subscription changes

func (*MapStore) Register

func (m *MapStore) Register(s *stela.Service) error

Register takes a service adding it to the services map and let's all client subscriers know

func (*MapStore) RemoveClient

func (m *MapStore) RemoveClient(c *stela.Client)

RemoveClient removes client from the slice m.clients, services it registered and any subscriptions

func (*MapStore) ServicesByClient

func (m *MapStore) ServicesByClient(c *stela.Client) []*stela.Service

ServicesByClient returns all services a client has registered

func (*MapStore) Subscribe

func (m *MapStore) Subscribe(serviceName string, c *stela.Client) error

Subscribe allows a stela.Client to subscribe to a specific serviceName

func (*MapStore) Unsubscribe

func (m *MapStore) Unsubscribe(serviceName string, c *stela.Client) error

Unsubscribe quits sending service changes to the stela.Client

Jump to

Keyboard shortcuts

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