client

package
v3.2.5+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: Apache-2.0, MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HandlerType  = "type"
	UnaryHandler = "UnaryHandler"

	SearchHandler        = "SearchHandler"
	BulkSearchHandler    = "BulkSearchHandler"
	DeleteByQueryHandler = "DeleteByQueryHandler"
	MSearchHandler       = "MSearchHandler"
	MSearchIDsHandler    = "MSearchIDsHandler"
	MSearchForIDsHandler = "MSearchForIDsHandler"
	MSearchNewHandler    = "MSearchNewHandler"
	StreamSearchHandler  = "StreamSearchHandler"

	GetDocHandler     = "GetDocHandler"
	GetDocsHandler    = "GetDocsHandler"
	CreateDocHandler  = "CreateDocHandler"
	DeleteDocsHandler = "DeleteDocsHandler"
	ReplaceDocHandler = "ReplaceDocHandler"
	BatchHandler      = "BatchHandler"
	ForceMergeHandler = "ForceMergeHandler"
	FlushHandler      = "FlushHandler"

	CreatePartitionHandler = "CreatePartitionHandler"
	DeletePartitionHandler = "DeletePartitionHandler"
	DeleteReplicaHandler   = "DeleteReplicaHandler"
	UpdatePartitionHandler = "UpdatePartitionHandler"
	StatsHandler           = "StatsHandler"
	IsLiveHandler          = "IsLiveHandler"
	PartitionInfoHandler   = "PartitionInfoHandler"
	ChangeMemberHandler    = "ChangeMemberHandler"
)
View Source
const Authorization = "Authorization"

Authorization default Authorization

View Source
const (
	DefaultPsTimeOut = 5
)
View Source
const (
	// MessageID the key of message
	MessageID = "message_id"
)
View Source
const Root = "root"

Root default root

Variables

This section is empty.

Functions

func BulkMergeArrForField

func BulkMergeArrForField(dest []*vearchpb.SearchResult, src []*vearchpb.SearchResult, firstSortValue map[string][]sortorder.SortValue, soArr []sortorder.SortOrder, sizes []int32) error

func ChangeMember

func ChangeMember(addr string, changeMember *entity.ChangeMember) error

func Compare

func Compare(old float64, new float64) int

func CreatePartition

func CreatePartition(addr string, space *entity.Space, pid uint32) error

func DeletePartition

func DeletePartition(addr string, pid uint32) error

func DeleteReplica

func DeleteReplica(addr string, partitionId uint32) error

func Execute

func Execute(addr, servicePath string, args *vearchpb.PartitionData, reply *vearchpb.PartitionData) (err error)

Execute add retry to handle no leader and not leader situation

func GetMD5Encode

func GetMD5Encode(data string) string

GetMD5Encode return md5 value of given data

func GetNodeIdsByClientType

func GetNodeIdsByClientType(clientType string, partition *entity.Partition, servers *cache.Cache) entity.NodeID

func GetSource

func GetSource(doc *vearchpb.ResultItem, space *entity.Space, idIsLong bool, sortFieldMap map[string]string) (json.RawMessage, []sortorder.SortValue, string, error)

func HitsMergeForField

func HitsMergeForField(dh []*vearchpb.ResultItem, firstSortValue map[string][]sortorder.SortValue, spid, fpid uint32, sh []*vearchpb.ResultItem, sortOrder sortorder.SortOrder, from, size int32) []*vearchpb.ResultItem

func IsLive

func IsLive(addr string) bool

func MergeArrForField

func MergeArrForField(dest []*vearchpb.SearchResult, src []*vearchpb.SearchResult, firstSortValue map[string][]sortorder.SortValue, so sortorder.SortOrder, size int32) error

func MergeForField

func MergeForField(old *vearchpb.SearchResult, other *vearchpb.SearchResult, firstSortValue map[string][]sortorder.SortValue, sortOrder sortorder.SortOrder, from, size int32) (err error)

func NewRouterRequest

func NewRouterRequest(ctx context.Context, client *Client) *routerRequest

NewRouterRequest create a new request for router

func NewWatchServerCache

func NewWatchServerCache(serverCtx context.Context, cli *Client) error

NewWatchServerCache watch ps server put and delete status

func PartitionInfo

func PartitionInfo(addr string, pid entity.PartitionID) (value *entity.PartitionInfo, err error)

PartitionInfo get partition info about partitionID

func PartitionInfos

func PartitionInfos(addr string) (value []*entity.PartitionInfo, err error)

PartitionInfos get all partition info from server

func ServerStats

func ServerStats(addr string) *mserver.ServerStats

func UpdatePartition

func UpdatePartition(addr string, space *entity.Space, pid entity.PartitionID) error

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client include client of master and ps

func NewClient

func NewClient(conf *config.Config) (client *Client, err error)

NewClient create a new client by config

func (*Client) Master

func (client *Client) Master() *masterClient

Master return master client

func (*Client) PS

func (client *Client) PS() *psClient

PS return ps client

func (*Client) Space

func (client *Client) Space(ctx context.Context, dbName, spaceName string) (*entity.Space, error)

Space return space by dbname and space name

func (*Client) Stop

func (client *Client) Stop()

Stop stop client

type ClientType

type ClientType int

ClientType decide the method to choose raft

const (
	LEADER ClientType = iota
	NOTLEADER
	RANDOM
	ALL
)

type MasterServer

type MasterServer struct {
	// contains filtered or unexported fields
}

MasterServer the num of master

Jump to

Keyboard shortcuts

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