api

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: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	stela.Client

	Hostname string
	// contains filtered or unexported fields
}

Client struct represents a connection client connection to a stela instance

func NewClient

func NewClient(ctx context.Context, stelaAddress string, opts []grpc.DialOption) (*Client, error)

NewClient returns a new Stela gRPC client for the given server address. The client's Close method should be called when the returned client is no longer needed.

func NewTLSClient

func NewTLSClient(ctx context.Context, serverAddress string, serverName string, cert string, privateKey string, certificateAuthority string) (*Client, error)

NewTLSClient returns a new Stela gRPC client for the given server address. You must provide paths to a certificate authority, client certificate, and client private key. You must also provide a value for server name that matches the common name in the certificate of the server you are connecting to. The client's Close method should be called when the returned client is no longer needed.

func (*Client) Close

func (c *Client) Close()

Close cancels the stream to the gRPC stream established by connect().

func (*Client) Deregister

func (c *Client) Deregister(ctx context.Context, s *stela.Service) error

Deregister deregisters a service to the stela instance the client is connected to.

func (*Client) Discover

func (c *Client) Discover(ctx context.Context, serviceName string) ([]*stela.Service, error)

Discover services registered with the same service name.

func (*Client) DiscoverAll

func (c *Client) DiscoverAll(ctx context.Context) ([]*stela.Service, error)

DiscoverAll finds all services registered.

func (*Client) DiscoverOne

func (c *Client) DiscoverOne(ctx context.Context, serviceName string) (*stela.Service, error)

DiscoverOne finds a single instance of a service based on name.

func (*Client) DiscoverRegex

func (c *Client) DiscoverRegex(ctx context.Context, reg string) ([]*stela.Service, error)

DiscoverRegex finds services by name based on a regular expression.

func (*Client) Register

func (c *Client) Register(ctx context.Context, s *stela.Service) error

Register registers a service to the stela instance the client is connected to.

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, serviceName string, callback func(s *stela.Service)) error

Subscribe stores a callback to the service name and notifies the stela instance to notify your client on changes.

func (*Client) Unsubscribe

func (c *Client) Unsubscribe(ctx context.Context, serviceName string) error

Unsubscribe removes the callback to the service name and let's the stela instance know the client doesn't want updates on that serviceName.

Jump to

Keyboard shortcuts

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