From 174c6275caafa5cd18e62c4dd809234e6579195a Mon Sep 17 00:00:00 2001 From: yukun Date: Sun, 26 Sep 2021 19:35:57 +0800 Subject: [PATCH] golint rocksmq client (#8604) Signed-off-by: fishpenguin --- internal/util/rocksmq/client/rocksmq/client.go | 4 ++++ internal/util/rocksmq/client/rocksmq/error.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/internal/util/rocksmq/client/rocksmq/client.go b/internal/util/rocksmq/client/rocksmq/client.go index 1da159d9eb..93ed083213 100644 --- a/internal/util/rocksmq/client/rocksmq/client.go +++ b/internal/util/rocksmq/client/rocksmq/client.go @@ -17,8 +17,10 @@ import ( server "github.com/milvus-io/milvus/internal/util/rocksmq/server/rocksmq" ) +// RocksMQ is the type server.RocksMQ type RocksMQ = server.RocksMQ +// NewClient returns a rocksmq client func NewClient(options ClientOptions) (Client, error) { if options.Server == nil { options.Server = server.Rmq @@ -26,12 +28,14 @@ func NewClient(options ClientOptions) (Client, error) { return newClient(options) } +// ClientOptions is the options of a client type ClientOptions struct { Server RocksMQ Ctx context.Context Cancel context.CancelFunc } +// Client is the interface rocksmq client type Client interface { // Create a producer instance CreateProducer(options ProducerOptions) (Producer, error) diff --git a/internal/util/rocksmq/client/rocksmq/error.go b/internal/util/rocksmq/client/rocksmq/error.go index 832a7cfcd2..ee66ae83de 100644 --- a/internal/util/rocksmq/client/rocksmq/error.go +++ b/internal/util/rocksmq/client/rocksmq/error.go @@ -13,19 +13,23 @@ package rocksmq import "fmt" +// Result is the type of int and represent error result type Result int +// constant value used in error struct const ( Ok Result = iota UnknownError InvalidConfiguration ) +// Error is a struct contains error msg and result type Error struct { msg string result Result } +// Result returns the error result func (e *Error) Result() Result { return e.result }