Documentation ¶
Overview ¶
Package protocol describes the wire protocol between workers, document managers and search agents. The actual NATS messages are JSON-encoded versions of the types defined here.
Index ¶
- Variables
- type CloneRequest
- type CloneStream
- type Document
- type DocumentID
- type DocumentReference
- type DocumentRequest
- type DocumentUpdate
- type IndexStatus
- type IndexStatusCode
- type IndexUpdate
- type IndexUpdateRequest
- type Metrics
- type MetricsRequest
- type SearchHit
- type SearchRequest
- type SearchResponse
- type SearchResult
- type SearchStatusCode
- type Semver
Constants ¶
This section is empty.
Variables ¶
var Version = Semver{0, 5, 0}
Version of the wire protocol
Functions ¶
This section is empty.
Types ¶
type CloneRequest ¶ added in v0.2.0
A CloneRequest is sent by freshly started workers that want to initialize by cloning another index.
type CloneStream ¶ added in v0.2.0
type CloneStream struct {
URL string
}
CloneStream is sent in response to a CloneRequest. The returned URL can be read only once and is valid for a limited time.
type DocumentID ¶
type DocumentID string
DocumentID is just a string, could be uuid, hash, numeric, et.c.
type DocumentReference ¶
type DocumentReference struct { ID DocumentID Updated time.Time }
A DocumentReference corresponds to one document at one point in time
type DocumentRequest ¶
type DocumentRequest struct { Space string Wanted []DocumentID }
A DocumentRequest is a request for a list of documents. Returned documents are broadcasted to all workers.
type DocumentUpdate ¶
A DocumentUpdate is sent in response to DocumentRequest
type IndexStatus ¶
type IndexStatus struct { IndexID string Version string DocCount uint64 LastUpdate time.Time ShardgroupSize uint16 ShardIndex uint16 Status IndexStatusCode }
IndexStatus is regularly broadcast from all workers
func (IndexStatus) String ¶
func (status IndexStatus) String() string
type IndexStatusCode ¶
type IndexStatusCode uint8
IndexStatusCode is what is says
const ( IndexStatusInSync IndexStatusCode = iota + 72 IndexStatusSyncing IndexStatusStartingUp IndexStatusIncompleteShardgroup IndexStatusIncompatible )
Codes returned in index status updates. There is only one status level at any given time, with higher valued codes overriding lower valued codes.
func (IndexStatusCode) String ¶
func (isc IndexStatusCode) String() string
type IndexUpdate ¶
type IndexUpdate struct { Space string Updates []DocumentReference }
A IndexUpdate is a list of updated documents, sent in response to the IndexUpdateRequest above.
type IndexUpdateRequest ¶
type IndexUpdateRequest struct { Space string FromTime time.Time AfterDocument DocumentID Limit uint16 }
IndexUpdateRequest is a request for available updates. Returns up to 'Limit' document IDs, updated at or later than the specified document or timestamp.
type Metrics ¶ added in v0.2.0
Metrics holds a metrics response from one service instance. The RequestID field contains the ID provided in the corresponding request. The PackedJSON field contains Base64 encoded, zlib compressed JSON of all exported metrics.
type MetricsRequest ¶ added in v0.2.0
type MetricsRequest struct {
RequestID string
}
MetricsRequest asks for a metrics dump from all service instances
type SearchHit ¶
type SearchHit struct { Space string ID DocumentID Snippet string Rank float32 }
SearchHit represents one search hit
type SearchRequest ¶
type SearchRequest struct { // Spaces to search Spaces []string // Query string in letarette syntax Query string // Maximum number of hits returned in one page PageLimit uint16 // Zero-indexed page of hits to retrieve PageOffset uint16 // When true, spelling mistakes are "fixed" // and the resulting query is automatically performed. // In either case, spell-fixed queries are returned // in the SearchResult Respelt field. Autocorrect bool }
A SearchRequest is sent from a search handler to search the index.
type SearchResponse ¶
type SearchResponse struct { Result SearchResult Duration float32 Status SearchStatusCode }
SearchResponse is sent in response to SearchRequest
type SearchResult ¶
type SearchResult struct { Hits []SearchHit // When true, the search was truncated // Capped results are only locally sorted by rank Capped bool // When not empty, the original query had no matches, // and this is a respelt version of the query Respelt string // The summed Levenshtein distance for all respelt terms RespeltDistance float32 // The total number of hits to the given query TotalHits int }
SearchResult is a collection of search hits
type SearchStatusCode ¶
type SearchStatusCode uint8
SearchStatusCode is what is says
const ( SearchStatusNoHit SearchStatusCode = iota + 42 SearchStatusCacheHit SearchStatusIndexHit SearchStatusTimeout SearchStatusQueryError SearchStatusServerError )
Codes returned in search responses
func (SearchStatusCode) String ¶
func (ssc SearchStatusCode) String() string
type Semver ¶
type Semver struct {
// contains filtered or unexported fields
}
Semver is used for protocol versioning
func ParseSemver ¶
ParseSemver creates a Semver struct from a string
func (Semver) CompatibleWith ¶
CompatibleWith returns true when major versions match