mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-29 23:15:28 +08:00
40 lines
738 B
Go
40 lines
738 B
Go
package components
|
|
|
|
import (
|
|
"context"
|
|
|
|
grpcqueryservice "github.com/zilliztech/milvus-distributed/internal/distributed/queryservice"
|
|
"github.com/zilliztech/milvus-distributed/internal/msgstream"
|
|
)
|
|
|
|
type QueryService struct {
|
|
ctx context.Context
|
|
svr *grpcqueryservice.Server
|
|
}
|
|
|
|
func NewQueryService(ctx context.Context, factory msgstream.Factory) (*QueryService, error) {
|
|
svr, err := grpcqueryservice.NewServer(ctx, factory)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
return &QueryService{
|
|
ctx: ctx,
|
|
svr: svr,
|
|
}, nil
|
|
}
|
|
|
|
func (qs *QueryService) Run() error {
|
|
if err := qs.svr.Run(); err != nil {
|
|
panic(err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (qs *QueryService) Stop() error {
|
|
if err := qs.svr.Stop(); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|