client

package
v0.0.0-...-e83778c Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

README

client

中文文档

Features

IndexBatch serialization
Construct network message header
Deserialize response scores returned from MindAlpha-Serving service

Test cases

  1. client/client_test.go:
    Construct IndexBatch from csv file and then access MindAlpha-Serving service, print scores

To be perfected

  1. dumpFBS()
    This function dump requests/responses to file.
    There has some problems with this function:
    1. Hard code the number of dumpped Request/Response and dumpped file path
    2. Users need moify code to use dumpFBS
    3. You should restart process if you want to re dump
    4. The format of dumpped file should be user self-defined

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpFBS

func DumpFBS(req_fbs []byte, rsp_fbs []byte) error

TODO for debug dump req_fbs and rsp_fbs to file. req_fbs is flatbuffer encoded data, rsp_fbs is flatbuffer encoded data returned from server side. User can read from dump file, get req_fbs and send it to server, then check if the response from server is equal to rsp_fbs.

func GenerateMindAlphaServingRequest

func GenerateMindAlphaServingRequest(batch *fe.IndexBatch, algoName string) (*flatbuffers.Builder, []byte, error)

encode IndexBatch to flatbufer.

func ParseMindAlphaServingRequest

func ParseMindAlphaServingRequest(rqstBuf []byte)

for debug. deserialize flatbuffered byte slice to IndexBatch, and print Indexbatch

func ParseMindAlphaServingResponse

func ParseMindAlphaServingResponse(rspBuf []byte) (*tensor.TensorScores, error)

func PutFBSBuilder

func PutFBSBuilder(builder *flatbuffers.Builder)

func Request

func Request(data []byte, connWrap *pool.ConnWrap, deadline time.Time) (<-chan []byte, error)

Request send flatbuffer encoded data to server, with the tcp connection represented by connWrap.. data: flatbufer encoded data connWrap: a wrapper of tcp connection, with some other informations deadline: timeout time

func WaitResponse

func WaitResponse(rspChan <-chan []byte, rspTimeout time.Duration) ([]byte, error)

WaitResponse wait response data from server side. rspChan: return value of connWrap.PutRequest(reqId).

Types

This section is empty.

Jump to

Keyboard shortcuts

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