cbft

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2020 License: Apache-2.0 Imports: 70 Imported by: 4

README

cbft

Couchbase Full Text server

The cbft project integrates the bleve full-text search engine and Couchbase Server.

GoDoc Build Status Coverage Status

A cbft process creates and maintains full-text indexes using the bleve full-text indexing engine.

Data sources for indexing include Couchbase 3.0+ and Couchbase 4.0+ buckets.

Full-text indexes can be optionally partitioned across multiple cbft processes.

Queries on a cbft index will be scatter/gather'ed across the relevant, distributed cbft processes.

See also

Full-text search

Licenses

Getting started and documentation

Please see the getting started guide for cbft, available at http://labs.couchbase.com/cbft.

For developers / contributors

Please see the README for developers

Documentation

Overview

Copyright (c) 2019 Couchbase, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	AuditDeleteIndexEvent       = 24576 // 0x6000
	AuditCreateUpdateIndexEvent = 24577 // 0x6001
	AuditControlEvent           = 24579 // 0x6003
	AuditConfigRefreshEvent     = 24580 // 0x6004
	AuditConfigReplanEvent      = 24581 // 0x6005
	AuditRunGCEvent             = 24582 // 0x6006
	AuditProfileCPUEvent        = 24583 // 0x6007
	AuditProfileMemoryEvent     = 24584 // 0x6008
)
View Source
const API_MAX_VERSION = "2.0.0"

cbft api versions, helps in controlling the service expectations during upgrades. See: MB-17990 on cbft API versioning.

View Source
const API_MIN_VERSION = "0.0.0"
View Source
const RESTIndexQueryPath = "/api/index/{indexName}/query"
View Source
const RemoteRequestOverhead = 500 * time.Millisecond
View Source
const VERSION = "v0.5.5"

cbft product version

View Source
const VersionTag = "version="

Variables

View Source
var API_MAX_VERSION_JSON = WithJSONVersion(API_MAX_VERSION)
View Source
var BatchBytesAdded uint64
View Source
var BatchBytesRemoved uint64
View Source
var BleveBatchFlushDuration = time.Duration(100 * time.Millisecond)
View Source
var BleveKVStoreMetricsAllow = false // Use metrics wrapper KVStore by default.
View Source
var BleveMaxOpsPerBatch = 200 // Unlimited when <= 0.
View Source
var BlevePIndexAllowMoss = false // Unit tests prefer no moss.
View Source
var BleveResultCacheMaxHits = 100

Only cache a bleve result whose size in number of hits isn't too large in order to avoid consuming too much memory for the cache.

View Source
var BleveRouteMethods map[string]string
View Source
var CBAuthIsAllowed = func(creds cbauth.Creds, permission string) (
	bool, error) {
	return creds.IsAllowed(permission)
}

CBAuthIsAllowed extra level-of-indirection allows for overrides and for more testability.

View Source
var CBAuthSendForbidden = func(w http.ResponseWriter, permission string) {
	cbauth.SendForbidden(w, permission)
}

CBAuthSendForbidden extra level-of-indirection allows for overrides and for more testability.

View Source
var CBAuthSendUnauthorized = func(w http.ResponseWriter) {
	cbauth.SendUnauthorized(w)
}

CBAuthSendUnauthorized extra level-of-indirection allows for overrides and for more testability.

View Source
var CBAuthWebCreds = cbauth.AuthWebCreds

CBAuthWebCreds extra level-of-indirection allows for overrides and for more testability.

View Source
var CollMetaFieldName = "_$scope_$collection"
View Source
var ConfigModeColPrefix = "scope.collection"
View Source
var ConfigModeColPrefixLen = len(ConfigModeColPrefix)
View Source
var DefaultGrpcConnectionHeartBeatInterval = time.Duration(60) * time.Second
View Source
var DefaultGrpcConnectionIdleTimeout = time.Duration(60) * time.Second

default values same as that for http/rest connections

View Source
var DefaultGrpcMaxBackOffDelay = time.Duration(10) * time.Second
View Source
var DefaultGrpcMaxConcurrentStreams = uint32(math.MaxInt32)

The number of concurrent streams/requests on a client connection can only be controlled by adjusting the server value. Set a very large value for the server config so that we have no fixed limit on the number of concurrent streams/requests on either the client or server.

View Source
var DefaultGrpcMaxRecvMsgSize = 1024 * 1024 * 50 // 50 MB
View Source
var DefaultGrpcMaxSendMsgSize = 1024 * 1024 * 50 // 50 MB
View Source
var DefaultStreamBatchSize = 100
View Source
var EventQueryEnd = QueryEventKind(2)

EventQueryEnd is fired upon the completion of a query.

View Source
var EventQueryStart = QueryEventKind(1)

EventQueryStart is fired before a query begins the search.

View Source
var FeatureCollections = cbgt.SOURCE_GOCBCORE + ":collections"
View Source
var FeatureGRPC = "protocol:gRPC"
View Source
var FeatureScorchIndex = featureIndexType + ":" + scorch.Name
View Source
var FeatureUpsidedownIndex = featureIndexType + ":" + upsidedown.Name
View Source
var FetchBleveTargets = func(mgr *cbgt.Manager, indexName, indexUUID string,
	planPIndexFilterName string, partitionSelection PartitionSelectionStrategy) (
	[]*cbgt.PIndex, []*cbgt.RemotePlanPIndex, []string, error) {
	if mgr == nil {
		return nil, nil, nil, fmt.Errorf("manager not defined")
	}

	return mgr.CoveringPIndexesEx(cbgt.CoveringPIndexesSpec{
		IndexName:            indexName,
		IndexUUID:            indexUUID,
		PlanPIndexFilterName: planPIndexFilterName,
	}, nil, false)
}
View Source
var GrpcPathStats = GRPCPathStats{
	// contains filtered or unexported fields
}

GrpcIndexQueryPath is keyed by path spec strings.

View Source
var GrpcPort = ":15000"

GrpcPort represents the port used with gRPC.

View Source
var HttpClient = http.DefaultClient // Overridable for testability / advanced needs.
View Source
var HttpGet = func(client *http.Client, url string) (*http.Response, error) {
	return client.Get(url)
}

Overridable for testability / advanced needs.

View Source
var HttpPost = func(client *http.Client,
	url string, bodyType string, body io.Reader) (*http.Response, error) {
	return client.Post(url, bodyType, body)
}

Overridable for testability / advanced needs.

View Source
var HttpTransportDialContextKeepAlive = 30 * time.Second // Go's default is 30 secs.
View Source
var HttpTransportDialContextTimeout = 30 * time.Second // Go's default is 30 secs.
View Source
var HttpTransportExpectContinueTimeout = 1 * time.Second // Go's default is 1 secs.
View Source
var HttpTransportIdleConnTimeout = 90 * time.Second // Go's default is 90 secs.
View Source
var HttpTransportMaxIdleConns = 300 // Go's default is 100 (0 means no limit).
View Source
var HttpTransportMaxIdleConnsPerHost = 100 // Go's default is 2.
View Source
var HttpTransportTLSHandshakeTimeout = 10 * time.Second // Go's default is 10 secs.
View Source
var LogEveryNStats = 300

Dump stats to log once every 5min. This stat is configurable through the ENV_OPTION: logStatsEvery

View Source
var LogLevels map[string]uint32

List of log levels that maps strings to integers. (Works with clog - https://github.com/couchbase/clog)

View Source
var MapRESTPathStats = map[string]*rest.RESTPathStats{
	RESTIndexQueryPath: {},
}

MapRESTPathStats is keyed by path spec strings.

View Source
var OnMemoryUsedDropped func(curMemoryUsed, prevMemoryUsed uint64)

Optional callback when current memory used has dropped since the last sampling.

View Source
var RESULT_CACHE_DEFAULT_MAX_BYTES_PER_ENTRY = 32 * 1024

Default maximum size in bytes of an entry result. Results larger than this are not cached.

View Source
var RESULT_CACHE_DEFAULT_MAX_LEN = 0

Default max number of entries in a result cache.

View Source
var RESULT_CACHE_DEFAULT_MIN_LOOKUPS = 3

Default number of lookups needed before we start caching a result. The idea is avoid using resources for rarely encountered lookups.

View Source
var RPCClientConn map[string][]*grpc.ClientConn

RPCClientConn represent the gRPC client connection cache.

View Source
var RegistryQueryEventCallback func(int, QueryEvent, uint64) error

RegistryQueryEventCallbacks should be treated as read-only after process init()'ialization.

View Source
var ResultCache = resultCache{
	// contains filtered or unexported fields
}

Global result cache per cbft process.

View Source
var SourcePartitionSeqsCacheTimeoutDefault = 60 * time.Second
View Source
var SourcePartitionSeqsSleepDefault = 10 * time.Second
View Source
var TotBatchesFlushedOnMaxOps uint64
View Source
var TotBatchesFlushedOnTimer uint64
View Source
var TotBleveDestClosed uint64
View Source
var TotBleveDestOpened uint64
View Source
var TotGRPCListenersClosed uint64
View Source
var TotGRPCListenersOpened uint64

Atomic counters to keep track of the number of active grpc and grpc-ssl listeners.

View Source
var TotGRPCSListenersClosed uint64
View Source
var TotGRPCSListenersOpened uint64
View Source
var TotHTTPLimitListenersClosed uint64
View Source
var TotHTTPLimitListenersOpened uint64

Atomic counters to keep track of the number of active http and https limit listeners.

View Source
var TotHTTPSLimitListenersClosed uint64
View Source
var TotHTTPSLimitListenersOpened uint64
View Source
var TotHerderOnBatchExecuteStartBeg uint64
View Source
var TotHerderOnBatchExecuteStartEnd uint64
View Source
var TotHerderQueriesRejected uint64
View Source
var TotHerderWaitingIn uint64

App-herder pertinent atomic stats.

View Source
var TotHerderWaitingOut uint64
View Source
var TotRollbackFull uint64
View Source
var TotRollbackPartial uint64
View Source
var UrlWithAuth = func(authType, urlStr string) (string, error) {
	if authType == "cbauth" {
		return cbgt.CBAuthURL(urlStr)
	}

	return urlStr, nil
}

UrlWithAuth extra level-of-indirection allows for overrides and for more testability.

Functions

func AddServerInterceptor added in v0.4.0

func AddServerInterceptor() grpc.ServerOption

func AggregateBleveDestPartitionStats added in v0.4.0

func AggregateBleveDestPartitionStats() map[string]interface{}

func AnalyzeDoc added in v0.4.0

func AnalyzeDoc(mgr *cbgt.Manager, indexName, indexUUID string,
	req []byte, res io.Writer) error

func Asset added in v0.0.1

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir added in v0.0.1

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo added in v0.0.1

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames added in v0.0.1

func AssetNames() []string

AssetNames returns the names of the assets.

func BleveInitRouter added in v0.4.0

func BleveInitRouter(r *mux.Router, phase string,
	mgr *cbgt.Manager)

func BleveMetaExtra added in v0.1.0

func BleveMetaExtra(m map[string]interface{})

func BleveQuerySamples added in v0.4.0

func BleveQuerySamples() []cbgt.Documentation

func CheckAPIAuth added in v0.4.0

func CheckAPIAuth(mgr *cbgt.Manager,
	w http.ResponseWriter, req *http.Request, path string) (allowed bool)

func CheckAPIVersion added in v0.4.0

func CheckAPIVersion(w http.ResponseWriter, req *http.Request) (err error)

func CountAlias added in v0.0.1

func CountAlias(mgr *cbgt.Manager,
	indexName, indexUUID string) (uint64, error)

func CountBleve added in v0.4.0

func CountBleve(mgr *cbgt.Manager, indexName, indexUUID string) (
	uint64, error)

func FetchCurMemoryUsed added in v0.4.0

func FetchCurMemoryUsed() uint64

func GetAuditEventData added in v0.4.0

func GetAuditEventData(eventId uint32, req *http.Request) interface{}

func GetSourcePartitionSeqs added in v0.4.0

func GetSourcePartitionSeqs(sourceSpec SourceSpec) map[string]cbgt.UUIDSeq

func HandleAPIVersion added in v0.4.0

func HandleAPIVersion(h string) (string, error)

func InitBleveResultCacheOptions added in v0.4.0

func InitBleveResultCacheOptions(options map[string]string) error

InitBleveResultCacheOptions initializes the bleve related result cache options.

func InitResultCacheOptions added in v0.4.0

func InitResultCacheOptions(options map[string]string) error

InitResultCacheOptions initializes the global result cache.

func InitStaticRouter added in v0.3.0

func InitStaticRouter(staticDir, staticETag string,
	mgr *cbgt.Manager) *mux.Router

func MarshalJSON added in v0.4.0

func MarshalJSON(v interface{}) ([]byte, error)

MarshalJSON abstracts the underlying json lib used

func MustAsset added in v0.0.1

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func MustEncodeWithParser added in v0.4.0

func MustEncodeWithParser(w io.Writer, i interface{})

MustEncodeWithParser encode with the registered parserType,

func NewBlevePIndexImpl added in v0.0.1

func NewBlevePIndexImpl(indexType, indexParams, path string,
	restart func()) (cbgt.PIndexImpl, cbgt.Dest, error)

func NewIndexStat added in v0.3.0

func NewIndexStat() map[string]interface{}

NewIndexStat ensures that all index stats have the same shape and 0 values to prevent seeing N/A in ns_server UI

func NewRESTRouter added in v0.3.0

func NewRESTRouter(versionMain string, mgr *cbgt.Manager,
	staticDir, staticETag string, mr *cbgt.MsgRing,
	adtSvc *audit.AuditSvc) (
	*mux.Router, map[string]rest.RESTMeta, error)

NewRESTRouter creates a mux.Router initialized with the REST API and web UI routes. See also InitStaticRouter if you need finer control of the router initialization.

func NsHostsForIndex added in v0.4.0

func NsHostsForIndex(name string, planPIndexes *cbgt.PlanPIndexes,
	nodeDefs *cbgt.NodeDefs) []string

func OpenBlevePIndexImpl added in v0.0.1

func OpenBlevePIndexImpl(indexType, path string,
	restart func()) (cbgt.PIndexImpl, cbgt.Dest, error)

func OpenBlevePIndexImplUsing added in v0.4.0

func OpenBlevePIndexImplUsing(indexType, path, indexParams string,
	restart func()) (cbgt.PIndexImpl, cbgt.Dest, error)

func ParseExtras added in v0.4.0

func ParseExtras(s string) (map[string]string, error)

func PrepareAlias added in v0.4.0

func PrepareAlias(indexDef *cbgt.IndexDef) (*cbgt.IndexDef, error)

func PrepareIndexDef added in v0.4.0

func PrepareIndexDef(indexDef *cbgt.IndexDef) (*cbgt.IndexDef, error)

func QueryAlias added in v0.0.1

func QueryAlias(mgr *cbgt.Manager, indexName, indexUUID string,
	req []byte, res io.Writer) error

func QueryBleve added in v0.4.0

func QueryBleve(mgr *cbgt.Manager, indexName, indexUUID string,
	req []byte, res io.Writer) error

func RegisterRemoteClientsForSecurity added in v0.4.0

func RegisterRemoteClientsForSecurity()

func RestartOnIndexDefChanges added in v0.4.0

func RestartOnIndexDefChanges(
	configRequest *cbgt.ConfigAnalyzeRequest) cbgt.ResultCode

RestartOnIndexDefChanges checks whether the changes in the indexDefns are quickly adoptable over a reboot of the pindex implementations. eg: kvstore configs updates like compaction percentage.

func RestoreAsset added in v0.0.1

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets added in v0.0.1

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func RunRecentInfoCache added in v0.4.0

func RunRecentInfoCache(mgr *cbgt.Manager)

func RunSourcePartitionSeqs added in v0.4.0

func RunSourcePartitionSeqs(options map[string]string, stopCh chan struct{})

func UnmarshalJSON added in v0.4.0

func UnmarshalJSON(b []byte, v interface{}) error

UnmarshalJSON abstracts the underlying json lib used

func UpdateCurMemoryUsed added in v0.4.0

func UpdateCurMemoryUsed() uint64

func ValidateAlias added in v0.0.1

func ValidateAlias(indexType, indexName, indexParams string) error

func ValidateBleve added in v0.4.0

func ValidateBleve(indexType, indexName, indexParams string) error

func ValidateConsistencyParams added in v0.4.0

func ValidateConsistencyParams(c *cbgt.ConsistencyParams) error

func WithJSONVersion added in v0.4.0

func WithJSONVersion(v string) string

Types

type AliasParams added in v0.0.1

type AliasParams struct {
	Targets map[string]*AliasParamsTarget `json:"targets"` // Keyed by indexName.
}

AliasParams holds the definition for a user-defined index alias. A user-defined index alias can be used as a level of indirection (the "LastQuartersSales" alias points currently to the "2014-Q3-Sales" index, but the administrator might repoint it in the future without changing the application) or to scatter-gather or fan-out a query across multiple real indexes (e.g., to query across customer records, product catalog, call-center records, etc, in one shot).

type AliasParamsTarget added in v0.0.1

type AliasParamsTarget struct {
	IndexUUID string `json:"indexUUID"` // Optional.
}

type AnalyzeDocHandler added in v0.4.0

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

AnalyzeDocHandler is a REST handler for analyzing documents against a given index.

func NewAnalyzeDocHandler added in v0.4.0

func NewAnalyzeDocHandler(mgr *cbgt.Manager) *AnalyzeDocHandler

func (*AnalyzeDocHandler) RESTOpts added in v0.4.0

func (h *AnalyzeDocHandler) RESTOpts(opts map[string]string)

func (*AnalyzeDocHandler) ServeHTTP added in v0.4.0

func (h *AnalyzeDocHandler) ServeHTTP(
	w http.ResponseWriter, req *http.Request)

type AuthVersionHandler added in v0.4.0

type AuthVersionHandler struct {
	H http.Handler
	// contains filtered or unexported fields
}

func NewAuthVersionHandler added in v0.4.0

func NewAuthVersionHandler(mgr *cbgt.Manager, adtSvc *audit.AuditSvc,
	h http.Handler) *AuthVersionHandler

func (*AuthVersionHandler) ServeHTTP added in v0.4.0

func (c *AuthVersionHandler) ServeHTTP(
	w http.ResponseWriter, req *http.Request)

type BleveDest added in v0.0.1

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

func NewBleveDest added in v0.0.1

func NewBleveDest(path string, bindex bleve.Index,
	restart func(), bleveDocConfig BleveDocumentConfig) *BleveDest

func (*BleveDest) AddError added in v0.0.1

func (t *BleveDest) AddError(op, partition string,
	key []byte, seq uint64, val []byte, err error)

func (*BleveDest) Close added in v0.0.1

func (t *BleveDest) Close() error

func (*BleveDest) ConsistencyWait added in v0.0.1

func (t *BleveDest) ConsistencyWait(partition, partitionUUID string,
	consistencyLevel string,
	consistencySeq uint64,
	cancelCh <-chan bool) error

func (*BleveDest) Count added in v0.0.1

func (t *BleveDest) Count(pindex *cbgt.PIndex, cancelCh <-chan bool) (
	uint64, error)

func (*BleveDest) Dest added in v0.0.1

func (t *BleveDest) Dest(partition string) (cbgt.Dest, error)

func (*BleveDest) PartitionSeqs added in v0.4.0

func (t *BleveDest) PartitionSeqs() (map[string]cbgt.UUIDSeq, error)

Implements the PartitionSeqProvider interface.

func (*BleveDest) Query added in v0.0.1

func (t *BleveDest) Query(pindex *cbgt.PIndex, req []byte, res io.Writer,
	parentCancelCh <-chan bool) error

func (*BleveDest) Rollback added in v0.0.1

func (t *BleveDest) Rollback(partition string, vBucketUUID uint64, rollbackSeq uint64) error

func (*BleveDest) Stats added in v0.0.1

func (t *BleveDest) Stats(w io.Writer) (err error)

func (*BleveDest) StatsMap added in v0.4.0

func (t *BleveDest) StatsMap() (rv map[string]interface{}, err error)

type BleveDestPartition added in v0.0.1

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

Used to track state for a single partition.

func (*BleveDestPartition) Close added in v0.0.1

func (t *BleveDestPartition) Close() error

func (*BleveDestPartition) ConsistencyWait added in v0.0.1

func (t *BleveDestPartition) ConsistencyWait(
	partition, partitionUUID string,
	consistencyLevel string,
	consistencySeq uint64,
	cancelCh <-chan bool) error

func (*BleveDestPartition) Count added in v0.0.1

func (t *BleveDestPartition) Count(pindex *cbgt.PIndex,
	cancelCh <-chan bool) (
	uint64, error)

func (*BleveDestPartition) DataDelete added in v0.0.3

func (t *BleveDestPartition) DataDelete(partition string,
	key []byte, seq uint64,
	cas uint64,
	extrasType cbgt.DestExtrasType, extras []byte) error

func (*BleveDestPartition) DataUpdate added in v0.0.3

func (t *BleveDestPartition) DataUpdate(partition string,
	key []byte, seq uint64, val []byte, cas uint64,
	extrasType cbgt.DestExtrasType, extras []byte) error

func (*BleveDestPartition) OpaqueGet added in v0.0.3

func (t *BleveDestPartition) OpaqueGet(partition string) ([]byte, uint64, error)

func (*BleveDestPartition) OpaqueSet added in v0.0.3

func (t *BleveDestPartition) OpaqueSet(partition string, value []byte) error

func (*BleveDestPartition) Query added in v0.0.1

func (t *BleveDestPartition) Query(pindex *cbgt.PIndex,
	req []byte, res io.Writer,
	cancelCh <-chan bool) error

func (*BleveDestPartition) Rollback added in v0.0.1

func (t *BleveDestPartition) Rollback(partition string,
	rollbackSeq uint64) error

func (*BleveDestPartition) RollbackEx added in v0.4.0

func (t *BleveDestPartition) RollbackEx(partition string,
	vBucketUUID uint64, rollbackSeq uint64) error

func (*BleveDestPartition) SnapshotStart added in v0.0.3

func (t *BleveDestPartition) SnapshotStart(partition string,
	snapStart, snapEnd uint64) error

func (*BleveDestPartition) Stats added in v0.0.1

func (t *BleveDestPartition) Stats(w io.Writer) error

type BleveDocument added in v0.4.0

type BleveDocument struct {
	BleveInterface `json:""`
	// contains filtered or unexported fields
}

func (*BleveDocument) Type added in v0.4.0

func (c *BleveDocument) Type() string

type BleveDocumentConfig added in v0.4.0

type BleveDocumentConfig struct {
	Mode             string         `json:"mode"`
	TypeField        string         `json:"type_field"`
	DocIDPrefixDelim string         `json:"docid_prefix_delim"`
	DocIDRegexp      *regexp.Regexp `json:"docid_regexp"`
	CollPrefixLookup map[uint32]collMetaField
	// contains filtered or unexported fields
}

func (*BleveDocumentConfig) BuildDocument added in v0.4.0

func (b *BleveDocumentConfig) BuildDocument(key, val []byte,
	defaultType string) (*BleveDocument, error)

BuildDocument returns a BleveDocument for the k/v pair NOTE: err may be non-nil AND a document is returned this allows the error to be logged, but a stub document to be indexed

func (*BleveDocumentConfig) BuildDocumentEx added in v0.4.0

func (b *BleveDocumentConfig) BuildDocumentEx(key, val []byte,
	defaultType string, extrasType cbgt.DestExtrasType,
	extras []byte) (*BleveDocument, error)

func (*BleveDocumentConfig) BuildDocumentFromObj added in v0.4.0

func (b *BleveDocumentConfig) BuildDocumentFromObj(key []byte, v interface{},
	defaultType string) *BleveDocument

func (*BleveDocumentConfig) DetermineType added in v0.4.0

func (b *BleveDocumentConfig) DetermineType(key []byte, v interface{}, defaultType string) string

func (*BleveDocumentConfig) MarshalJSON added in v0.4.0

func (b *BleveDocumentConfig) MarshalJSON() ([]byte, error)

func (*BleveDocumentConfig) UnmarshalJSON added in v0.4.0

func (b *BleveDocumentConfig) UnmarshalJSON(data []byte) error

type BleveIndexCollector added in v0.4.0

type BleveIndexCollector interface {
	Add(i ...bleve.Index)
}

BleveIndexCollector interface is a subset of the bleve.IndexAlias interface, with just the Add() method, allowing alternative implementations that need to collect "backend" bleve indexes based on a user defined index.

type BleveInterface added in v0.4.0

type BleveInterface interface{}

type BleveParams added in v0.0.1

type BleveParams struct {
	Mapping   mapping.IndexMapping   `json:"mapping"`
	Store     map[string]interface{} `json:"store"`
	DocConfig BleveDocumentConfig    `json:"doc_config"`
}

BleveParams represents the bleve index params. See also cbgt.IndexDef.Params. A JSON'ified BleveParams looks like...

{
   "mapping": {
      // See bleve.mapping.IndexMapping.
   },
   "store": {
      // See BleveParamsStore.
   },
   "doc_config": {
      // See BleveDocumentConfig.
   }
}

func NewBleveParams added in v0.0.1

func NewBleveParams() *BleveParams

type BleveParamsStore added in v0.4.0

type BleveParamsStore struct {
	// The indexType defaults to bleve.Config.DefaultIndexType.
	// Example: "upside_down".  See bleve.index.upsidedown.Name and
	// bleve.registry.RegisterIndexType().
	IndexType string `json:"indexType"`

	// The kvStoreName defaults to bleve.Config.DefaultKVStore.
	// See also bleve.registry.RegisterKVStore().
	KvStoreName string `json:"kvStoreName"`

	// The kvStoreMetricsAllow flag defaults to
	// cbft.BleveKVStoreMetricsAllow.  When true, an
	// interposing wrapper that captures additional metrics will be
	// initialized as part of a bleve index's KVStore.
	//
	// Note: the interposing metrics wrapper might introduce
	// additional performance costs.
	KvStoreMetricsAllow bool `json:"kvStoreMetricsAllow"`

	// The kvStoreMossAllow defaults to true.
	//
	// The moss cache will be used for a bleve index's KVStore when
	// both this kvStoreMossAllow flag and the
	// cbft.BlevePIndexAllowMoss global flag are true.
	//
	// A user can also explicitly specify a kvStoreName of "moss" to
	// force usage of the moss cache.
	KvStoreMossAllow bool `json:"kvStoreMossAllow"`

	// The mossCollectionOptions allows users to specify moss cache
	// collection options, with defaults coming from
	// moss.DefaultCollectionOptions.
	//
	// It only applies when a moss cache is in use for an index (see
	// kvStoreMossAllow).
	MossCollectionOptions moss.CollectionOptions `json:"mossCollectionOptions"`

	// The mossLowerLevelStoreName specifies which lower-level
	// bleve.index.store.KVStore to use underneath a moss cache.
	// See also bleve.registry.RegisterKVStore().
	//
	// It only applies when a moss cache is in use for an index (see
	// kvStoreMossAllow).
	//
	// As a special case, when moss cache is allowed, and the
	// kvStoreName is not "moss", and the mossLowerLevelStoreName is
	// unspecified or "", then the system will automatically
	// reconfigure as a convenience so that the
	// mossLowerLevelStoreName becomes the kvStoreName, and the
	// kvStoreName becomes "moss", hence injecting moss cache into
	// usage for an index.
	//
	// In another case, when the kvStoreName is "moss" and the
	// mossLowerLevelStoreName is "" (empty string), that means the
	// moss cache will run in memory-only mode with no lower-level
	// storage.
	MossLowerLevelStoreName string `json:"mossLowerLevelStoreName"`

	// The mossLowerLevelStoreConfig can be used to provide advanced
	// options to the lower-level KVStore that's used under a moss
	// cache.
	//
	// NOTE: when the mossLowerLevelStoreName is "mossStore", the
	// mossLowerLevelStoreConfig is not used; instead, please use
	// mossStoreOptions.
	MossLowerLevelStoreConfig map[string]interface{} `json:"mossLowerLevelStoreConfig"`

	// The mossStoreOptions allows the user to specify advanced
	// configuration options when moss cache is in use and when the
	// mossLowerLevelStoreName is "mossStore",
	MossStoreOptions moss.StoreOptions `json:"mossStoreOptions"`
}

BleveParamsStore represents some of the publically available options in the "store" part of a bleve index params. See also the BleveParams.Store field.

type CBAuthBasicLogin added in v0.4.0

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

func CBAuthBasicLoginHandler added in v0.4.0

func CBAuthBasicLoginHandler(mgr *cbgt.Manager) (*CBAuthBasicLogin, error)

func (*CBAuthBasicLogin) ServeHTTP added in v0.4.0

func (h *CBAuthBasicLogin) ServeHTTP(
	w http.ResponseWriter, req *http.Request)

type Collection added in v0.4.0

type Collection struct {
	Uid  string `json:"uid"`
	Name string `json:"name"`
}

type ConciseOptions added in v0.4.0

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

func NewConciseOptions added in v0.4.0

func NewConciseOptions(mgr *cbgt.Manager) *ConciseOptions

func (*ConciseOptions) ServeHTTP added in v0.4.0

func (h *ConciseOptions) ServeHTTP(
	w http.ResponseWriter, req *http.Request)

type CustomJSONImpl added in v0.4.0

type CustomJSONImpl struct {
	CustomJSONImplType string
	// contains filtered or unexported fields
}

CustomJSONImpl enables the custom json parser is an implementation of JSONParserImplType

var JSONImpl *CustomJSONImpl

JSONImpl holds the custom json parser impl

func (*CustomJSONImpl) Decode added in v0.4.0

func (p *CustomJSONImpl) Decode(r io.Reader, v interface{}) error

Decode abstracts the underlying json lib used

func (*CustomJSONImpl) Encode added in v0.4.0

func (p *CustomJSONImpl) Encode(w io.Writer, v interface{}) error

Encode abstracts the underlying json lib used

func (*CustomJSONImpl) GetManagerOptions added in v0.4.0

func (p *CustomJSONImpl) GetManagerOptions() map[string]string

GetManagerOptions gets the manager options

func (*CustomJSONImpl) GetParserType added in v0.4.0

func (p *CustomJSONImpl) GetParserType() string

GetParserType returns the custom parser type

func (*CustomJSONImpl) Marshal added in v0.4.0

func (p *CustomJSONImpl) Marshal(v interface{}) ([]byte, error)

Marshal abstracts the underlying json lib used

func (*CustomJSONImpl) SetManager added in v0.4.0

func (p *CustomJSONImpl) SetManager(mgr *cbgt.Manager)

SetManager sets the manager instance

func (*CustomJSONImpl) Unmarshal added in v0.4.0

func (p *CustomJSONImpl) Unmarshal(b []byte, v interface{}) error

Unmarshal abstracts the underlying json lib used

type FilteredListIndexHandler added in v0.4.0

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

FilteredListIndexHandler is a REST handler that lists indexes, similar to cbgt.rest.ListIndexHandler, but filters results based on cbauth permissions.

func NewFilteredListIndexHandler added in v0.4.0

func NewFilteredListIndexHandler(mgr *cbgt.Manager) *FilteredListIndexHandler

func (*FilteredListIndexHandler) ServeHTTP added in v0.4.0

func (h *FilteredListIndexHandler) ServeHTTP(
	w http.ResponseWriter, req *http.Request)

type GRPCPathStats added in v0.4.0

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

GRPCPathStats represents the stats for a gRPC path spec.

func (*GRPCPathStats) FocusStats added in v0.4.0

func (s *GRPCPathStats) FocusStats(focusVal string) *RPCFocusStats

FocusStats returns the RPCFocusStats for a given focus value like an indexName

func (*GRPCPathStats) FocusValues added in v0.4.0

func (s *GRPCPathStats) FocusValues() (rv []string)

FocusValues returns the focus value strings

type GrpcClient added in v0.4.0

type GrpcClient struct {
	Mgr *cbgt.Manager

	HostPort    string
	IndexName   string
	IndexUUID   string
	PIndexNames []string

	Consistency *cbgt.ConsistencyParams
	GrpcCli     pb.SearchServiceClient
	// contains filtered or unexported fields
}

GrpcClient implements the Search() and DocCount() subset of the bleve.Index interface by accessing a remote cbft server via grpc protocol. This allows callers to add a GrpcClient as a target of a bleve.IndexAlias, and implements cbft protocol features like query consistency and auth.

func GroupGrpcClientsByHostPort added in v0.4.0

func GroupGrpcClientsByHostPort(clients []*GrpcClient) (rv []*GrpcClient)

GroupGrpcClientsByHostPort groups the gRPC clients by their HostPort, merging the pindexNames. This is an enabler to allow scatter/gather to use fewer gRPC calls.

func (*GrpcClient) Advanced added in v0.4.0

func (g *GrpcClient) Advanced() (index.Index, store.KVStore, error)

func (*GrpcClient) AuthType added in v0.4.0

func (g *GrpcClient) AuthType() string

func (*GrpcClient) Batch added in v0.4.0

func (g *GrpcClient) Batch(b *bleve.Batch) error

func (*GrpcClient) Close added in v0.4.0

func (g *GrpcClient) Close() error

func (*GrpcClient) Count added in v0.4.0

func (g *GrpcClient) Count() (uint64, error)

func (*GrpcClient) Delete added in v0.4.0

func (g *GrpcClient) Delete(id string) error

func (*GrpcClient) DeleteInternal added in v0.4.0

func (g *GrpcClient) DeleteInternal(key []byte) error

func (*GrpcClient) DocCount added in v0.4.0

func (g *GrpcClient) DocCount() (uint64, error)

func (*GrpcClient) Document added in v0.4.0

func (g *GrpcClient) Document(id string) (*document.Document, error)

func (*GrpcClient) DumpAll added in v0.4.0

func (g *GrpcClient) DumpAll() chan interface{}

func (*GrpcClient) DumpDoc added in v0.4.0

func (g *GrpcClient) DumpDoc(id string) chan interface{}

func (*GrpcClient) DumpFields added in v0.4.0

func (g *GrpcClient) DumpFields() chan interface{}

func (*GrpcClient) FieldDict added in v0.4.0

func (g *GrpcClient) FieldDict(field string) (index.FieldDict, error)

func (*GrpcClient) FieldDictPrefix added in v0.4.0

func (g *GrpcClient) FieldDictPrefix(field string,
	termPrefix []byte) (index.FieldDict, error)

func (*GrpcClient) FieldDictRange added in v0.4.0

func (g *GrpcClient) FieldDictRange(field string,
	startTerm []byte, endTerm []byte) (index.FieldDict, error)

func (*GrpcClient) Fields added in v0.4.0

func (g *GrpcClient) Fields() ([]string, error)

func (*GrpcClient) GetHostPort added in v0.4.0

func (g *GrpcClient) GetHostPort() string

func (*GrpcClient) GetInternal added in v0.4.0

func (g *GrpcClient) GetInternal(key []byte) ([]byte, error)

func (*GrpcClient) GetLast added in v0.4.0

func (g *GrpcClient) GetLast() (int, []byte)

func (*GrpcClient) Index added in v0.4.0

func (g *GrpcClient) Index(id string, data interface{}) error

func (*GrpcClient) Mapping added in v0.4.0

func (g *GrpcClient) Mapping() mapping.IndexMapping

func (*GrpcClient) Name added in v0.4.0

func (g *GrpcClient) Name() string

func (*GrpcClient) NewBatch added in v0.4.0

func (g *GrpcClient) NewBatch() *bleve.Batch

func (*GrpcClient) Query added in v0.4.0

func (g *GrpcClient) Query(ctx context.Context,
	req *scatterRequest) (*bleve.SearchResult, error)

func (*GrpcClient) Search added in v0.4.0

func (g *GrpcClient) Search(req *bleve.SearchRequest) (
	*bleve.SearchResult, error)

func (*GrpcClient) SearchInContext added in v0.4.0

func (g *GrpcClient) SearchInContext(ctx context.Context,
	req *bleve.SearchRequest) (*bleve.SearchResult, error)

func (*GrpcClient) SearchRPC added in v0.4.0

func (g *GrpcClient) SearchRPC(ctx context.Context, req *scatterRequest,
	pbReq *pb.SearchRequest) (*bleve.SearchResult, error)

func (*GrpcClient) SetInternal added in v0.4.0

func (g *GrpcClient) SetInternal(key, val []byte) error

func (*GrpcClient) SetName added in v0.4.0

func (g *GrpcClient) SetName(name string)

func (*GrpcClient) SetStreamHandler added in v0.4.0

func (g *GrpcClient) SetStreamHandler(sc streamHandler)

func (*GrpcClient) Stats added in v0.4.0

func (g *GrpcClient) Stats() *bleve.IndexStat

func (*GrpcClient) StatsMap added in v0.4.0

func (g *GrpcClient) StatsMap() map[string]interface{}

type IndexAuditLog added in v0.4.0

type IndexAuditLog struct {
	audit.GenericFields
	IndexName string `json:"index_name"`
}

type IndexClient added in v0.0.1

type IndexClient struct {
	HostPort    string
	IndexName   string
	IndexUUID   string
	PIndexNames []string
	QueryURL    string
	CountURL    string
	Consistency *cbgt.ConsistencyParams
	// contains filtered or unexported fields
}

IndexClient implements the Search() and DocCount() subset of the bleve.Index interface by accessing a remote cbft server via REST protocol. This allows callers to add a IndexClient as a target of a bleve.IndexAlias, and implements cbft protocol features like query consistency and auth.

TODO: Implement propagating auth info in IndexClient.

func GroupIndexClientsByHostPort added in v0.4.0

func GroupIndexClientsByHostPort(clients []*IndexClient) (rv []*IndexClient, err error)

GroupIndexClientsByHostPort groups the index clients by their HostPort, merging the pindexNames. This is an enabler to allow scatter/gather to use fewer REST requests/connections.

func (*IndexClient) Advanced added in v0.0.1

func (r *IndexClient) Advanced() (index.Index, store.KVStore, error)

func (*IndexClient) AuthType added in v0.4.0

func (r *IndexClient) AuthType() string

func (*IndexClient) Batch added in v0.0.1

func (r *IndexClient) Batch(b *bleve.Batch) error

func (*IndexClient) Close added in v0.0.1

func (r *IndexClient) Close() error

func (*IndexClient) Count added in v0.0.1

func (r *IndexClient) Count() (uint64, error)

func (*IndexClient) Delete added in v0.0.1

func (r *IndexClient) Delete(id string) error

func (*IndexClient) DeleteInternal added in v0.0.1

func (r *IndexClient) DeleteInternal(key []byte) error

func (*IndexClient) DocCount added in v0.0.1

func (r *IndexClient) DocCount() (uint64, error)

func (*IndexClient) Document added in v0.0.1

func (r *IndexClient) Document(id string) (*document.Document, error)

func (*IndexClient) DumpAll added in v0.0.1

func (r *IndexClient) DumpAll() chan interface{}

func (*IndexClient) DumpDoc added in v0.0.1

func (r *IndexClient) DumpDoc(id string) chan interface{}

func (*IndexClient) DumpFields added in v0.0.1

func (r *IndexClient) DumpFields() chan interface{}

func (*IndexClient) FieldDict added in v0.0.1

func (r *IndexClient) FieldDict(field string) (index.FieldDict, error)

func (*IndexClient) FieldDictPrefix added in v0.0.1

func (r *IndexClient) FieldDictPrefix(field string,
	termPrefix []byte) (index.FieldDict, error)

func (*IndexClient) FieldDictRange added in v0.0.1

func (r *IndexClient) FieldDictRange(field string,
	startTerm []byte, endTerm []byte) (index.FieldDict, error)

func (*IndexClient) Fields added in v0.0.1

func (r *IndexClient) Fields() ([]string, error)

func (*IndexClient) GetHostPort added in v0.4.0

func (r *IndexClient) GetHostPort() string

func (*IndexClient) GetInternal added in v0.0.1

func (r *IndexClient) GetInternal(key []byte) ([]byte, error)

func (*IndexClient) GetLast added in v0.4.0

func (r *IndexClient) GetLast() (int, []byte)

func (*IndexClient) Index added in v0.0.1

func (r *IndexClient) Index(id string, data interface{}) error

func (*IndexClient) Mapping added in v0.0.1

func (r *IndexClient) Mapping() mapping.IndexMapping

func (*IndexClient) Name added in v0.4.0

func (r *IndexClient) Name() string

func (*IndexClient) NewBatch added in v0.0.1

func (r *IndexClient) NewBatch() *bleve.Batch

func (*IndexClient) Query added in v0.0.1

func (r *IndexClient) Query(buf []byte) ([]byte, error)

func (*IndexClient) Search added in v0.0.1

func (r *IndexClient) Search(req *bleve.SearchRequest) (
	*bleve.SearchResult, error)

func (*IndexClient) SearchInContext added in v0.4.0

func (r *IndexClient) SearchInContext(ctx context.Context,
	req *bleve.SearchRequest) (*bleve.SearchResult, error)

func (*IndexClient) SetInternal added in v0.0.1

func (r *IndexClient) SetInternal(key, val []byte) error

func (*IndexClient) SetName added in v0.4.0

func (r *IndexClient) SetName(name string)

func (*IndexClient) SetStreamHandler added in v0.4.0

func (r *IndexClient) SetStreamHandler(s streamHandler)

func (*IndexClient) Stats added in v0.0.1

func (r *IndexClient) Stats() *bleve.IndexStat

func (*IndexClient) StatsMap added in v0.4.0

func (r *IndexClient) StatsMap() map[string]interface{}

type IndexControlAuditLog added in v0.4.0

type IndexControlAuditLog struct {
	audit.GenericFields
	IndexName string `json:"index_name"`
	Control   string `json:"control_name"`
}

type JSONStatsWriter added in v0.0.1

type JSONStatsWriter interface {
	WriteJSON(w io.Writer) error
}

type LowerLevelStoreHolder added in v0.4.0

type LowerLevelStoreHolder interface {
	LowerLevelStore() store.KVStore
}

type ManagerOptionsExt added in v0.4.0

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

ManagerOptionsExt is a REST handler that serves as a wrapper for ManagerOptions - where it sets the manager options, and updates the logLevel upon request.

func NewManagerOptionsExt added in v0.4.0

func NewManagerOptionsExt(mgr *cbgt.Manager) *ManagerOptionsExt

func (*ManagerOptionsExt) ServeHTTP added in v0.4.0

func (h *ManagerOptionsExt) ServeHTTP(
	w http.ResponseWriter, req *http.Request)

type Manifest added in v0.4.0

type Manifest struct {
	Uid    string  `json:"uid"`
	Scopes []Scope `json:"scopes"`
}

func GetBucketManifest added in v0.4.0

func GetBucketManifest(bucketName string) (*Manifest, error)

type MissingPIndex added in v0.4.0

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

func (*MissingPIndex) Advanced added in v0.4.0

func (m *MissingPIndex) Advanced() (index.Index, store.KVStore, error)

func (*MissingPIndex) Batch added in v0.4.0

func (m *MissingPIndex) Batch(b *bleve.Batch) error

func (*MissingPIndex) Close added in v0.4.0

func (m *MissingPIndex) Close() error

func (*MissingPIndex) Delete added in v0.4.0

func (m *MissingPIndex) Delete(id string) error

func (*MissingPIndex) DeleteInternal added in v0.4.0

func (m *MissingPIndex) DeleteInternal(key []byte) error

func (*MissingPIndex) DocCount added in v0.4.0

func (m *MissingPIndex) DocCount() (uint64, error)

func (*MissingPIndex) Document added in v0.4.0

func (m *MissingPIndex) Document(id string) (*document.Document, error)

func (*MissingPIndex) DumpAll added in v0.4.0

func (m *MissingPIndex) DumpAll() chan interface{}

func (*MissingPIndex) DumpDoc added in v0.4.0

func (m *MissingPIndex) DumpDoc(id string) chan interface{}

func (*MissingPIndex) DumpFields added in v0.4.0

func (m *MissingPIndex) DumpFields() chan interface{}

func (*MissingPIndex) FieldDict added in v0.4.0

func (m *MissingPIndex) FieldDict(field string) (index.FieldDict, error)

func (*MissingPIndex) FieldDictPrefix added in v0.4.0

func (m *MissingPIndex) FieldDictPrefix(field string,
	termPrefix []byte) (index.FieldDict, error)

func (*MissingPIndex) FieldDictRange added in v0.4.0

func (m *MissingPIndex) FieldDictRange(field string,
	startTerm []byte, endTerm []byte) (index.FieldDict, error)

func (*MissingPIndex) Fields added in v0.4.0

func (m *MissingPIndex) Fields() ([]string, error)

func (*MissingPIndex) GetInternal added in v0.4.0

func (m *MissingPIndex) GetInternal(key []byte) ([]byte, error)

func (*MissingPIndex) Index added in v0.4.0

func (m *MissingPIndex) Index(id string, data interface{}) error

func (*MissingPIndex) Mapping added in v0.4.0

func (m *MissingPIndex) Mapping() mapping.IndexMapping

func (*MissingPIndex) Name added in v0.4.0

func (m *MissingPIndex) Name() string

func (*MissingPIndex) NewBatch added in v0.4.0

func (m *MissingPIndex) NewBatch() *bleve.Batch

func (*MissingPIndex) Search added in v0.4.0

func (*MissingPIndex) SearchInContext added in v0.4.0

func (m *MissingPIndex) SearchInContext(ctx context.Context,
	req *bleve.SearchRequest) (*bleve.SearchResult, error)

func (*MissingPIndex) SetInternal added in v0.4.0

func (m *MissingPIndex) SetInternal(key, val []byte) error

func (*MissingPIndex) SetName added in v0.4.0

func (m *MissingPIndex) SetName(name string)

func (*MissingPIndex) Stats added in v0.4.0

func (m *MissingPIndex) Stats() *bleve.IndexStat

func (*MissingPIndex) StatsMap added in v0.4.0

func (m *MissingPIndex) StatsMap() map[string]interface{}

type MossStoreActualHolder added in v0.4.0

type MossStoreActualHolder interface {
	Actual() *moss.Store
}

type NSIndexStats added in v0.3.0

type NSIndexStats map[string]map[string]interface{}

func (NSIndexStats) MarshalJSON added in v0.3.0

func (n NSIndexStats) MarshalJSON() ([]byte, error)

MarshalJSON formats the index stats using the colon separated convention found in other stats consumed by ns_server

type NodeDefsFetcher added in v0.4.0

type NodeDefsFetcher struct {
	// contains filtered or unexported fields
}
var CurrentNodeDefsFetcher *NodeDefsFetcher

func (*NodeDefsFetcher) Get added in v0.4.0

func (ndf *NodeDefsFetcher) Get() (*cbgt.NodeDefs, error)

func (*NodeDefsFetcher) GetManager added in v0.4.0

func (ndf *NodeDefsFetcher) GetManager() *cbgt.Manager

func (*NodeDefsFetcher) SetManager added in v0.4.0

func (ndf *NodeDefsFetcher) SetManager(mgr *cbgt.Manager)

type NsSearchResultRedirct added in v0.4.0

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

func NsSearchResultRedirctHandler added in v0.4.0

func NsSearchResultRedirctHandler(mgr *cbgt.Manager) (*NsSearchResultRedirct, error)

func (*NsSearchResultRedirct) ServeHTTP added in v0.4.0

func (h *NsSearchResultRedirct) ServeHTTP(
	w http.ResponseWriter, req *http.Request)

type NsStatsHandler added in v0.3.0

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

NsStatsHandler is a REST handler that provides stats/metrics for consumption by ns_server

func NewNsStatsHandler added in v0.3.0

func NewNsStatsHandler(mgr *cbgt.Manager) *NsStatsHandler

func (*NsStatsHandler) ServeHTTP added in v0.3.0

func (h *NsStatsHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

type NsStatusHandler added in v0.3.0

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

NsStatusHandler is a REST handler that provides status for consumption by ns_server

func NewNsStatusHandler added in v0.3.0

func NewNsStatusHandler(mgr *cbgt.Manager, server string) (*NsStatusHandler, error)

func (*NsStatusHandler) ServeHTTP added in v0.3.0

func (h *NsStatusHandler) ServeHTTP(
	w http.ResponseWriter, req *http.Request)

type PartitionSelectionStrategy added in v0.4.0

type PartitionSelectionStrategy string

PartitionSelectionStrategy lets clients specify any selection preferences for the query serving index partitions spread across the cluster. PartitionSelectionStrategy recognized options are,

  • "" : primary partitions are selected
  • local : local partitions are favored, pseudorandom selection from remote
  • random : pseudorandom selection from available local and remote
  • random_balanced : pseudorandom selection from available local and remote nodes by equally distributing the query load across all nodes.

type PartitionSeqsProvider added in v0.4.0

type PartitionSeqsProvider interface {
	// Returned map is keyed by partition id.
	PartitionSeqs() (map[string]cbgt.UUIDSeq, error)
}

PartitionSeqsProvider represents source object that can provide partition seqs, such as some pindex or dest implementations.

type QueryEvent added in v0.4.0

type QueryEvent struct {
	Kind     QueryEventKind
	Duration time.Duration
}

type QueryEventKind added in v0.4.0

type QueryEventKind int

QueryEventKind represents an event code for OnEvent() callbacks.

type QueryKiller added in v0.4.0

type QueryKiller struct{}

func NewQueryKiller added in v0.4.0

func NewQueryKiller() *QueryKiller

func (*QueryKiller) ServeHTTP added in v0.4.0

func (qk *QueryKiller) ServeHTTP(
	w http.ResponseWriter, req *http.Request)

type QueryPIndexes added in v0.4.0

type QueryPIndexes struct {
	// An empty or nil PIndexNames means the query should use all
	// the pindexes of the index.
	PIndexNames []string `json:"pindexNames,omitempty"`
}

QueryPIndexes defines the part of the JSON query request that allows the client to specify which pindexes the server should consider during query processing.

type QuerySupervisor added in v0.4.0

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

func (*QuerySupervisor) AddEntry added in v0.4.0

func (qs *QuerySupervisor) AddEntry(qsc *QuerySupervisorContext) uint64

func (*QuerySupervisor) Count added in v0.4.0

func (qs *QuerySupervisor) Count() uint64

func (*QuerySupervisor) DeleteEntry added in v0.4.0

func (qs *QuerySupervisor) DeleteEntry(id uint64)

func (*QuerySupervisor) ExecutionTime added in v0.4.0

func (qs *QuerySupervisor) ExecutionTime(id uint64) (time.Duration, bool)

func (*QuerySupervisor) GetLastAccessTimeForIndex added in v0.4.0

func (qs *QuerySupervisor) GetLastAccessTimeForIndex(name string) string

func (*QuerySupervisor) KillQuery added in v0.4.0

func (qs *QuerySupervisor) KillQuery(id uint64) bool

func (*QuerySupervisor) ListLongerThan added in v0.4.0

func (qs *QuerySupervisor) ListLongerThan(longerThan time.Duration) map[uint64]*RunningQueryDetails

type QuerySupervisorContext added in v0.4.0

type QuerySupervisorContext struct {
	Query     query.Query
	Cancel    context.CancelFunc
	Size      int
	From      int
	Timeout   int64
	IndexName string
	// contains filtered or unexported fields
}

type QuerySupervisorDetails added in v0.4.0

type QuerySupervisorDetails struct{}

func NewQuerySupervisorDetails added in v0.4.0

func NewQuerySupervisorDetails() *QuerySupervisorDetails

func (*QuerySupervisorDetails) ServeHTTP added in v0.4.0

func (qss *QuerySupervisorDetails) ServeHTTP(
	w http.ResponseWriter, req *http.Request)

type RPCFocusStats added in v0.4.0

type RPCFocusStats struct {
	TotGrpcRequest               uint64
	TotGrpcRequestTimeNS         uint64
	TotGrpcRequestErr            uint64 `json:"TotGrpcRequestErr,omitempty"`
	TotGrpcRequestSlow           uint64 `json:"TotGrpcRequestSlow,omitempty"`
	TotGrpcRequestTimeout        uint64 `json:"TotGrpcRequestTimeout,omitempty"`
	TotGrpcResponseBytes         uint64 `json:"TotGrpcResponseBytes,omitempty"`
	TotGrpcInternalRequest       uint64
	TotGrpcInternalRequestTimeNS uint64
}

RPCFocusStats represents stats for a targeted or "focused" gRPC endpoint.

type RemoteClient added in v0.4.0

type RemoteClient interface {
	bleve.Index

	GetHostPort() string
	GetLast() (int, []byte)
	SetStreamHandler(streamHandler)
}

RemoteClient represents a generic interface to be implemented by all remote clients like IndexClient/GrpcClient.

type RunningQueryDetails added in v0.4.0

type RunningQueryDetails struct {
	Query         query.Query `json:"query"`
	Size          int         `json:"size"`
	From          int         `json:"from"`
	Timeout       int64       `json:"timeout"`
	ExecutionTime string      `json:"execution_time"`
	IndexName     string      `json:"index"`
}

type Scope added in v0.4.0

type Scope struct {
	Name        string       `json:"name"`
	Uid         string       `json:"uid"`
	Collections []Collection `json:"collections"`
}

type SearchRequest added in v0.4.0

type SearchRequest struct {
	Q                json.RawMessage         `json:"query"`
	Size             *int                    `json:"size"`
	From             *int                    `json:"from"`
	Highlight        *bleve.HighlightRequest `json:"highlight"`
	Fields           []string                `json:"fields"`
	Facets           bleve.FacetsRequest     `json:"facets"`
	Explain          bool                    `json:"explain"`
	Sort             []json.RawMessage       `json:"sort"`
	IncludeLocations bool                    `json:"includeLocations"`
	Score            string                  `json:"score,omitempty"`
	SearchAfter      []string                `json:"search_after,omitempty"`
	SearchBefore     []string                `json:"search_before,omitempty"`
	Limit            *int                    `json:"limit,omitempty"`
	Offset           *int                    `json:"offset,omitempty"`
}

func (*SearchRequest) ConvertToBleveSearchRequest added in v0.4.0

func (sr *SearchRequest) ConvertToBleveSearchRequest() (*bleve.SearchRequest, error)

type SearchService added in v0.4.0

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

SearchService is an implementation for the SearchSrvServer gRPC search interface

func (*SearchService) Check added in v0.4.0

func (*SearchService) DocCount added in v0.4.0

func (*SearchService) Search added in v0.4.0

func (s *SearchService) Search(req *pb.SearchRequest,
	stream pb.SearchService_SearchServer) (err error)

func (*SearchService) SetManager added in v0.4.0

func (s *SearchService) SetManager(mgr *cbgt.Manager)

type SourcePartitionSeqs added in v0.4.0

type SourcePartitionSeqs struct {
	PartitionSeqs map[string]cbgt.UUIDSeq
	LastUpdated   time.Time
	LastUsed      time.Time
}

type SourceSpec added in v0.4.0

type SourceSpec struct {
	SourceType   string
	SourceName   string
	SourceUUID   string
	SourceParams string
	Server       string
}

Directories

Path Synopsis
cmd
cbft command
cbft-bleve command
cbft_docs command

Jump to

Keyboard shortcuts

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