push

package
v1.0.6-1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Dial establishes a connection with the push backend
	Dial() error
	// ActivateSubscription provides the push backend
	// with all the necessary information to start the push functionality for the respective subscription
	ActivateSubscription(ctx context.Context, fullSub, fullTopic, pushEndpoint, retryType string, retryPeriod uint32, maxMessages int64) ClientStatus
	// DeactivateSubscription asks the push backend to stop the push functionality for the respective subscription
	DeactivateSubscription(ctx context.Context, fullSub string) ClientStatus
	// SubscriptionStatus returns the current push status oif the given subscription
	SubscriptionStatus(ctx context.Context, fullSub string) ClientStatus
	// HealthCheck performs the grpc health check call
	HealthCheck(ctx context.Context) ClientStatus
	// Target returns the endpoint the client has been connected to
	Target() string
	// Close closes the connection with the push backend
	Close()
}

Client help us interface with any push backend mechanism

type ClientStatus

type ClientStatus interface {
	// Result returns the string representation for the response from a push backend
	Result() string
}

ClientStatus represents responses from a push backend

type GrpcClient

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

GrpcClient is used to interface with ams push server

func NewGrpcClient

func NewGrpcClient(cfg *config.APICfg) *GrpcClient

NewGrpcClient returns a new client configured based on the provided api cfg

func (*GrpcClient) ActivateSubscription

func (c *GrpcClient) ActivateSubscription(ctx context.Context, fullSub, fullTopic, pushEndpoint, retryType string, retryPeriod uint32, maxMessages int64) ClientStatus

ActivateSubscription is a wrapper over the grpc ActivateSubscription call

func (*GrpcClient) Close

func (c *GrpcClient) Close()

Close terminates the underlying grpc connection

func (*GrpcClient) DeactivateSubscription

func (c *GrpcClient) DeactivateSubscription(ctx context.Context, fullSub string) ClientStatus

DeactivateSubscription is a wrapper over the grpc DeactivateSubscription call

func (*GrpcClient) Dial

func (c *GrpcClient) Dial() error

Dial connects to the specified grpc endpoint from the api config

func (*GrpcClient) HealthCheck

func (c *GrpcClient) HealthCheck(ctx context.Context) ClientStatus

func (*GrpcClient) SubscriptionStatus

func (c *GrpcClient) SubscriptionStatus(ctx context.Context, fullSub string) ClientStatus

func (*GrpcClient) Target

func (c *GrpcClient) Target() string

Target returns the grpc endpoint that the client is connected to

type GrpcClientStatus

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

GrpcClientStatus holds the outcome of a grpc request

func (*GrpcClientStatus) Result

func (st *GrpcClientStatus) Result() string

Result prints the result of an grpc request

type MockClient

type MockClient struct{}

func (*MockClient) ActivateSubscription

func (*MockClient) ActivateSubscription(ctx context.Context, fullSub, fullTopic, pushEndpoint, retryType string, retryPeriod uint32, maxMessages int64) ClientStatus

func (*MockClient) Close

func (*MockClient) Close()

func (*MockClient) DeactivateSubscription

func (*MockClient) DeactivateSubscription(ctx context.Context, fullSub string) ClientStatus

func (*MockClient) Dial

func (*MockClient) Dial() error

func (*MockClient) HealthCheck

func (*MockClient) HealthCheck(ctx context.Context) ClientStatus

func (*MockClient) SubscriptionStatus

func (*MockClient) SubscriptionStatus(ctx context.Context, fullSub string) ClientStatus

func (*MockClient) Target

func (*MockClient) Target() string

type MockClientStatus

type MockClientStatus struct {
	Status string
}

func (*MockClientStatus) Result

func (m *MockClientStatus) Result() string

Jump to

Keyboard shortcuts

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