response

package
v0.0.0-...-7b3ddb2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEngineErr

func NewEngineErr(err error) *pspb.EngineFailure

Types

type BulkItemResponse

type BulkItemResponse struct {
	OpType    pspb.OpType     `json:"-"`
	ItemValue *DocResultWrite `json:"-"`
}

func (*BulkItemResponse) HasError

func (this *BulkItemResponse) HasError() bool

func (*BulkItemResponse) KeyName

func (this *BulkItemResponse) KeyName() string

func (*BulkItemResponse) ToContent

func (this *BulkItemResponse) ToContent() ([]byte, error)

type BulkResponse

type BulkResponse struct {
	Took  uint64              `json:"took"`
	Items []*BulkItemResponse `json:"items"`
}

func (*BulkResponse) ToContent

func (sr *BulkResponse) ToContent(took int64) ([]byte, error)

type DocResult

type DocResult struct {
	Id         string               `json:"id,omitempty"`
	DB         entity.DBID          `json:"db"`
	Space      entity.SpaceID       `json:"space"`
	Partition  entity.PartitionID   `json:"pid"`
	Version    int64                `json:"version,omitempty"`
	Found      bool                 `json:"found,omitempty"`
	Replace    bool                 `json:"replace,omitempty"`
	Score      float64              `json:"score,omitempty"`
	SortValues sortorder.SortValues `json:"sort_value,omitempty"`
	SlotID     uint32               `json:"slot_id"`
	Source     json.RawMessage      `json:"source,omitempty"`
	Extra      json.RawMessage      `json:"extra,omitempty"`
	Failure    *pspb.EngineFailure  `json:"failure,omitempty"`
	Type       pspb.OpType          `json:"type"`
	Highlight  HighlightResult      `json:"highlight,omitempty"`
}

func NewErrDocResult

func NewErrDocResult(id string, err error) *DocResult

func NewErrDocResults

func NewErrDocResults(ids []string, err error) []*DocResult

func NewNotFoundDocResult

func NewNotFoundDocResult(id string) *DocResult

func TestResult

func TestResult() *DocResult

TODO to delete it

func (*DocResult) ToContent

func (this *DocResult) ToContent(dbName, spaceName string) ([]byte, error)

type DocResultWrite

type DocResultWrite struct {
	DocResult  *DocResult
	DbName     string
	SpaceName  string
	ReplicaNum int
}

func (*DocResultWrite) SuccessStatus

func (doc *DocResultWrite) SuccessStatus() int

func (*DocResultWrite) ToContent

func (this *DocResultWrite) ToContent() ([]byte, error)

func (*DocResultWrite) WriteResult

func (doc *DocResultWrite) WriteResult() string

type DocResults

type DocResults []*DocResult

func (*DocResults) ToContent

func (this *DocResults) ToContent(dbName, spaceName string) ([]byte, error)

type DocStreamResult

type DocStreamResult struct {
	Count int
	// contains filtered or unexported fields
}

func NewDocStreamResult

func NewDocStreamResult(ctx context.Context) *DocStreamResult

func (*DocStreamResult) AddDoc

func (sdr *DocStreamResult) AddDoc(result *DocResult)

func (*DocStreamResult) AddErr

func (sdr *DocStreamResult) AddErr(e error)

func (*DocStreamResult) Close

func (sdr *DocStreamResult) Close()

func (*DocStreamResult) Next

func (sdr *DocStreamResult) Next() (*DocResult, error)

type HighlightResult

type HighlightResult map[string][]string

type Hits

type Hits []*DocResult

func (Hits) Merge

func (dh Hits) Merge(spid, fpid uint32, sh Hits, so sort.SortOrder, from, size int) Hits

func (Hits) ToContent

func (dh Hits) ToContent(nameCache NameCache, from, size int) ([]byte, error)

type IndexErrMap

type IndexErrMap map[string]error

IndexErrMap tracks errors with the name of the index where it occurred

type NameCache

type NameCache map[[2]int64][]string

type ObjResponse

type ObjResponse struct {
	Value []byte `json:"value,omitempty"`
}

func NewObjResponse

func NewObjResponse(value interface{}) (*ObjResponse, error)

func (*ObjResponse) Decode

func (req *ObjResponse) Decode(i interface{}) error

this function will decoding or encoding value

type Response

type Response struct {
	Resp   interface{}
	Status int64
	Err    error
}

type Responses

type Responses []*Response

type SearchResponse

type SearchResponse struct {
	PID      uint32            `json:"-"`
	Timeout  bool              `json:"time_out"`
	Status   *SearchStatus     `json:"status"`
	Hits     Hits              `json:"hits"`
	Total    uint64            `json:"total_hits"`
	MaxScore float64           `json:"max_score"`
	Took     int64             `json:"took"`
	Explain  map[uint32]string `json:"explain,omitempty"`
}

func NewSearchResponseErr

func NewSearchResponseErr(err error) *SearchResponse

func (*SearchResponse) Merge

func (sr *SearchResponse) Merge(other *SearchResponse, so sort.SortOrder, from, size int) (err error)

Merge will merge together multiple SearchResults during a MultiSearch, two args :[sortOrder, size]

func (*SearchResponse) ToContent

func (sr *SearchResponse) ToContent(from, size int, nameCache NameCache, typedKeys bool, took time.Duration) ([]byte, error)

type SearchResponses

type SearchResponses []*SearchResponse

func (SearchResponses) ToContent

func (srs SearchResponses) ToContent(from, size int, nameCache NameCache, typedKeys bool, took time.Duration) ([]byte, error)

type SearchStatus

type SearchStatus struct {
	Total      int         `json:"total"`
	Failed     int         `json:"failed"`
	Successful int         `json:"successful"`
	Errors     IndexErrMap `json:"errors,omitempty"`
}

func (*SearchStatus) Merge

func (ss *SearchStatus) Merge(other *SearchStatus)

Merge will merge together multiple SearchStatuses during a MultiSearch

type Shards

type Shards struct {
	Total      int `json:"total"`
	Successful int `json:"successful"`
	Failed     int `json:"failed"`
}

func (*Shards) ToContent

func (sr *Shards) ToContent() ([]byte, error)

type WriteError

type WriteError struct {
	ErrorIndex     string `json:"index"`
	ErrorIndexUUID string `json:"index_uuid"`
	Shard          string `json:"shard"`
	ErrorType      string `json:"type"`
	ErrorReason    string `json:"reason"`
}

type WriteResponse

type WriteResponse []*DocResult

func (WriteResponse) Merge

func (this WriteResponse) Merge(src WriteResponse)

func (*WriteResponse) ToContent

func (this *WriteResponse) ToContent(dbName, spaceName string) ([]byte, error)

func (*WriteResponse) ToContentBluk

func (this *WriteResponse) ToContentBluk(nameCache NameCache) ([]byte, error)

Jump to

Keyboard shortcuts

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