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 ¶
Constants ¶
This section is empty.
Variables ¶
var Version = Semver{0, 5, 0}
Version of the wire protocol
Functions ¶
This section is empty.
Types ¶
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
}
DocumentReference corresponds to one document at one point in time
type DocumentRequest ¶
type DocumentRequest struct {
Space string
Wanted []DocumentID
}
DocumentRequest is a request for a list of documents. Returned documents are broadcasted to all workers.
type DocumentUpdate ¶
DocumentUpdate is sent in response to DocumentRequest
type IndexStatus ¶
type IndexStatus struct {
IndexID string
Version string
DocCount uint64
LastUpdate time.Time
ShardgroupSize uint16
Shardgroup 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 IndexStatusStartingUp IndexStatusSyncing 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
}
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 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
}
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