golint rocksmq client (#8604)

Signed-off-by: fishpenguin <kun.yu@zilliz.com>
pull/8617/head
yukun 2021-09-26 19:35:57 +08:00 committed by GitHub
parent 8091e76666
commit 174c6275ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -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)

View File

@ -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
}