pushcli

package
v0.0.0-...-2aa8555 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAleradyClosed pushcli close
	ErrAleradyClosed = errors.New("pushcli already close")

	// ErrNoEndpoints there is no the endpoint of push
	ErrNoEndpoints = errors.New("no the endpoints of push")
)

Functions

This section is empty.

Types

type MockPushCli

type MockPushCli struct {
	*PushCli
	ServerAddr string
	// contains filtered or unexported fields
}

MockPushCli it is used of unit testing provide a complete pushd service

func NewMockPushCli

func NewMockPushCli(t *testing.T, etcdAddrs []string) *MockPushCli

NewMockPushCli new a pushcli object

func (*MockPushCli) Close

func (cli *MockPushCli) Close()

Close close mockcli

type PushCli

type PushCli struct {
	pb.PushServiceClient
	// contains filtered or unexported fields
}

PushCli a grpc connection It completed the interaction with the push service When there is no the push service ,the status is pushStarting If pushcli is close ,status is pushClosed

func NewClient

func NewClient(conf *conf.PushClient) (*PushCli, error)

NewClient new a pushcli object by configuration and the access logger is used of the recording of log Support for two ways to connect to push services 1. Specify fixed cluster address 2. Through discovery services Grpc connection mode is non-blocking mode , the connection will modify state successfully

func (*PushCli) AddRoute

func (p *PushCli) AddRoute(ctx context.Context, req *pb.AddRouteReq) (*pb.AddRouteResp, error)

AddRoute complete the client addroute operation

func (*PushCli) Close

func (p *PushCli) Close() error

Close the connection to release resources

func (*PushCli) Connect

func (p *PushCli) Connect(ctx context.Context, req *pb.ConnectReq) (*pb.ConnectResp, error)

Connect complete the client connection operation

func (*PushCli) DelUnack

func (p *PushCli) DelUnack(ctx context.Context, req *pb.DelUnackReq) (*pb.DelUnackResp, error)

DelUnack complete the client delunack operation

func (*PushCli) Disconnect

func (p *PushCli) Disconnect(ctx context.Context, req *pb.DisconnectReq) (*pb.DisconnectResp, error)

Disconnect complete the client disconnection operation

func (*PushCli) GrpcOptions

func (p *PushCli) GrpcOptions() []grpc.CallOption

func (*PushCli) PostSubscribe

func (p *PushCli) PostSubscribe(ctx context.Context, req *pb.PostSubscribeReq) (*pb.PostSubscribeResp, error)

PostSubscribe complete the client postsubscribe operation

func (*PushCli) Pubcomp

func (p *PushCli) Pubcomp(ctx context.Context, req *pb.PubcompReq) (*pb.PubcompResp, error)

Pubcomp complete the client pubcomp operation

func (*PushCli) Publish

func (p *PushCli) Publish(ctx context.Context, req *pb.PublishReq) (*pb.PublishResp, error)

Publish complete the client publish operation

func (*PushCli) Pubrec

func (p *PushCli) Pubrec(ctx context.Context, req *pb.PubrecReq) (*pb.PubrecResp, error)

Pubrec complete the client pubrec operation

func (*PushCli) Pubrel

func (p *PushCli) Pubrel(ctx context.Context, req *pb.PubrelReq) (*pb.PubrelResp, error)

Pubrel complete the client pubrel operation

func (*PushCli) Pull

func (p *PushCli) Pull(ctx context.Context, req *pb.PullReq) (*pb.PullResp, error)

Pull complete the client pull operation

func (*PushCli) PutUnack

func (p *PushCli) PutUnack(ctx context.Context, req *pb.PutUnackReq) (*pb.PutUnackResp, error)

PutUnack complete the client putunack operation

func (*PushCli) RangeUnack

func (p *PushCli) RangeUnack(ctx context.Context, req *pb.RangeUnackReq) (*pb.RangeUnackResp, error)

RangeUnack complete the client rangeunack operation

func (*PushCli) Ready

func (p *PushCli) Ready() bool

Ready if the push service node exists return true otherwise return false

func (*PushCli) RemoveRoute

func (p *PushCli) RemoveRoute(ctx context.Context, req *pb.RemoveRouteReq) (*pb.RemoveRouteResp, error)

RemoveRoute complete the client removeroute operation

func (*PushCli) String

func (p *PushCli) String() string

String() return json the addresses of the push service cluster

func (*PushCli) Subscribe

func (p *PushCli) Subscribe(ctx context.Context, req *pb.SubscribeReq) (*pb.SubscribeResp, error)

Subscribe complete the client subscribe operation

func (*PushCli) Unsubscribe

func (p *PushCli) Unsubscribe(ctx context.Context, req *pb.UnsubscribeReq) (*pb.UnsubscribeResp, error)

Unsubscribe complete the client unsubscribe operation

Jump to

Keyboard shortcuts

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