discoveryclient

package
v0.0.0-...-228f33a Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: MIT Imports: 13 Imported by: 14

Documentation

Overview

Package discoveryclient is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var CacheExpiration = time.Minute

CacheExpiration indicates the time a cached item is valid

Functions

This section is empty.

Types

type Client

type Client interface {
	Announce(token string) error
	GetAll(serviceName string) ([]*discovery.Announcement, error)
	Get(serviceName, id string) (*discovery.Announcement, error)
	AddDevAddrPrefix(prefix types.DevAddrPrefix) error
	AddAppID(appID string, token string) error
	AddGatewayID(gatewayID string, token string) error
	RemoveDevAddrPrefix(prefix types.DevAddrPrefix) error
	RemoveAppID(appID string, token string) error
	RemoveGatewayID(gatewayID string, token string) error
	GetAllBrokersForDevAddr(devAddr types.DevAddr) ([]*discovery.Announcement, error)
	GetAllHandlersForAppID(appID string) ([]*discovery.Announcement, error)
	GetAllRoutersForGatewayID(gatewayID string) ([]*discovery.Announcement, error)
	Close() error
}

Client is used as the main client to the Discovery server

func NewClient

func NewClient(server string, announcement *discovery.Announcement, tokenFunc func() string) (Client, error)

NewClient returns a new Client

type DefaultClient

type DefaultClient struct {
	sync.Mutex
	// contains filtered or unexported fields
}

DefaultClient is a wrapper around DiscoveryClient

func (*DefaultClient) AddAppID

func (c *DefaultClient) AddAppID(appID string, token string) error

AddAppID adds an AppID to the current component

func (*DefaultClient) AddDevAddrPrefix

func (c *DefaultClient) AddDevAddrPrefix(prefix types.DevAddrPrefix) error

AddDevAddrPrefix adds a DevAddrPrefix to the current component

func (*DefaultClient) AddGatewayID

func (c *DefaultClient) AddGatewayID(gatewayID string, token string) error

AddGatewayID adds a GatewayID to the current component

func (*DefaultClient) Announce

func (c *DefaultClient) Announce(token string) error

Announce announces the configured announcement to the discovery server

func (*DefaultClient) Close

func (c *DefaultClient) Close() error

Close purges the cache and closes the connection with the Discovery server

func (*DefaultClient) Get

func (c *DefaultClient) Get(serviceName, id string) (*discovery.Announcement, error)

Get returns the (cached) service annoucement for the given service type and id

func (*DefaultClient) GetAll

func (c *DefaultClient) GetAll(serviceName string) ([]*discovery.Announcement, error)

GetAll returns all services of the given service type

func (*DefaultClient) GetAllBrokersForDevAddr

func (c *DefaultClient) GetAllBrokersForDevAddr(devAddr types.DevAddr) (announcements []*discovery.Announcement, err error)

GetAllBrokersForDevAddr returns all brokers that can handle the given DevAddr

func (*DefaultClient) GetAllHandlersForAppID

func (c *DefaultClient) GetAllHandlersForAppID(appID string) (announcements []*discovery.Announcement, err error)

GetAllHandlersForAppID returns all handlers that can handle the given AppID

func (*DefaultClient) GetAllRoutersForGatewayID

func (c *DefaultClient) GetAllRoutersForGatewayID(gatewayID string) (announcements []*discovery.Announcement, err error)

GetAllRoutersForGatewayID returns all routers that can handle the given GatewayID

func (*DefaultClient) RemoveAppID

func (c *DefaultClient) RemoveAppID(appID string, token string) error

RemoveAppID removes an AppID from the current component

func (*DefaultClient) RemoveDevAddrPrefix

func (c *DefaultClient) RemoveDevAddrPrefix(prefix types.DevAddrPrefix) error

RemoveDevAddrPrefix removes a DevAddrPrefix from the current component

func (*DefaultClient) RemoveGatewayID

func (c *DefaultClient) RemoveGatewayID(gatewayID string, token string) error

RemoveGatewayID removes a GatewayID from the current component

type MockClient

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

MockClient is a mock of Client interface

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance

func (*MockClient) AddAppID

func (m *MockClient) AddAppID(appID, token string) error

AddAppID mocks base method

func (*MockClient) AddDevAddrPrefix

func (m *MockClient) AddDevAddrPrefix(prefix types.DevAddrPrefix) error

AddDevAddrPrefix mocks base method

func (*MockClient) AddGatewayID

func (m *MockClient) AddGatewayID(gatewayID, token string) error

AddGatewayID mocks base method

func (*MockClient) Announce

func (m *MockClient) Announce(token string) error

Announce mocks base method

func (*MockClient) Close

func (m *MockClient) Close() error

Close mocks base method

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockClient) Get

func (m *MockClient) Get(serviceName, id string) (*discovery.Announcement, error)

Get mocks base method

func (*MockClient) GetAll

func (m *MockClient) GetAll(serviceName string) ([]*discovery.Announcement, error)

GetAll mocks base method

func (*MockClient) GetAllBrokersForDevAddr

func (m *MockClient) GetAllBrokersForDevAddr(devAddr types.DevAddr) ([]*discovery.Announcement, error)

GetAllBrokersForDevAddr mocks base method

func (*MockClient) GetAllHandlersForAppID

func (m *MockClient) GetAllHandlersForAppID(appID string) ([]*discovery.Announcement, error)

GetAllHandlersForAppID mocks base method

func (*MockClient) GetAllRoutersForGatewayID

func (m *MockClient) GetAllRoutersForGatewayID(gatewayID string) ([]*discovery.Announcement, error)

GetAllRoutersForGatewayID mocks base method

func (*MockClient) RemoveAppID

func (m *MockClient) RemoveAppID(appID, token string) error

RemoveAppID mocks base method

func (*MockClient) RemoveDevAddrPrefix

func (m *MockClient) RemoveDevAddrPrefix(prefix types.DevAddrPrefix) error

RemoveDevAddrPrefix mocks base method

func (*MockClient) RemoveGatewayID

func (m *MockClient) RemoveGatewayID(gatewayID, token string) error

RemoveGatewayID mocks base method

type MockClientMockRecorder

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

MockClientMockRecorder is the mock recorder for MockClient

func (*MockClientMockRecorder) AddAppID

func (mr *MockClientMockRecorder) AddAppID(appID, token interface{}) *gomock.Call

AddAppID indicates an expected call of AddAppID

func (*MockClientMockRecorder) AddDevAddrPrefix

func (mr *MockClientMockRecorder) AddDevAddrPrefix(prefix interface{}) *gomock.Call

AddDevAddrPrefix indicates an expected call of AddDevAddrPrefix

func (*MockClientMockRecorder) AddGatewayID

func (mr *MockClientMockRecorder) AddGatewayID(gatewayID, token interface{}) *gomock.Call

AddGatewayID indicates an expected call of AddGatewayID

func (*MockClientMockRecorder) Announce

func (mr *MockClientMockRecorder) Announce(token interface{}) *gomock.Call

Announce indicates an expected call of Announce

func (*MockClientMockRecorder) Close

func (mr *MockClientMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockClientMockRecorder) Get

func (mr *MockClientMockRecorder) Get(serviceName, id interface{}) *gomock.Call

Get indicates an expected call of Get

func (*MockClientMockRecorder) GetAll

func (mr *MockClientMockRecorder) GetAll(serviceName interface{}) *gomock.Call

GetAll indicates an expected call of GetAll

func (*MockClientMockRecorder) GetAllBrokersForDevAddr

func (mr *MockClientMockRecorder) GetAllBrokersForDevAddr(devAddr interface{}) *gomock.Call

GetAllBrokersForDevAddr indicates an expected call of GetAllBrokersForDevAddr

func (*MockClientMockRecorder) GetAllHandlersForAppID

func (mr *MockClientMockRecorder) GetAllHandlersForAppID(appID interface{}) *gomock.Call

GetAllHandlersForAppID indicates an expected call of GetAllHandlersForAppID

func (*MockClientMockRecorder) GetAllRoutersForGatewayID

func (mr *MockClientMockRecorder) GetAllRoutersForGatewayID(gatewayID interface{}) *gomock.Call

GetAllRoutersForGatewayID indicates an expected call of GetAllRoutersForGatewayID

func (*MockClientMockRecorder) RemoveAppID

func (mr *MockClientMockRecorder) RemoveAppID(appID, token interface{}) *gomock.Call

RemoveAppID indicates an expected call of RemoveAppID

func (*MockClientMockRecorder) RemoveDevAddrPrefix

func (mr *MockClientMockRecorder) RemoveDevAddrPrefix(prefix interface{}) *gomock.Call

RemoveDevAddrPrefix indicates an expected call of RemoveDevAddrPrefix

func (*MockClientMockRecorder) RemoveGatewayID

func (mr *MockClientMockRecorder) RemoveGatewayID(gatewayID, token interface{}) *gomock.Call

RemoveGatewayID indicates an expected call of RemoveGatewayID

Jump to

Keyboard shortcuts

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