mirror of https://github.com/milvus-io/milvus.git
parent
8091e76666
commit
174c6275ca
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue