cbft

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2015 License: Apache-2.0 Imports: 37 Imported by: 0

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.

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 BleveMetaExtra added in v0.1.0

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

func BlevePIndexImplInitRouter added in v0.1.0

func BlevePIndexImplInitRouter(r *mux.Router, phase string)

func BlevePIndexQuerySamples added in v0.2.0

func BlevePIndexQuerySamples() []cbgt.Documentation

func CountAlias added in v0.0.1

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

func CountBlevePIndexImpl added in v0.0.1

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

func HostsForIndex added in v0.3.0

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

func InitStaticRouter added in v0.3.0

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

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 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) (
	*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 OpenBlevePIndexImpl added in v0.0.1

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

func QueryAlias added in v0.0.1

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

func QueryBlevePIndexImpl added in v0.0.1

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

func RestoreAsset added in v0.0.1

func RestoreAsset(dir, name string) error

Restore an asset under the given directory

func RestoreAssets added in v0.0.1

func RestoreAssets(dir, name string) error

Restore assets under the given directory recursively

func ValidateAlias added in v0.0.1

func ValidateAlias(indexType, indexName, indexParams string) error

func ValidateBlevePIndexImpl added in v0.0.1

func ValidateBlevePIndexImpl(indexType, indexName, indexParams string) error

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 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()) *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) Query added in v0.0.1

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

func (*BleveDest) Rollback added in v0.0.1

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

func (*BleveDest) Stats added in v0.0.1

func (t *BleveDest) Stats(w io.Writer) (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) 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 BleveParams added in v0.0.1

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

func NewBleveParams added in v0.0.1

func NewBleveParams() *BleveParams

type IndexClient added in v0.0.1

type IndexClient struct {
	QueryURL    string
	CountURL    string
	Consistency *cbgt.ConsistencyParams
}

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 (*IndexClient) Advanced added in v0.0.1

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

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) GetInternal added in v0.0.1

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

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() *bleve.IndexMapping

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) SetInternal added in v0.0.1

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

func (*IndexClient) Stats added in v0.0.1

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

type JSONStatsWriter added in v0.0.1

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

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 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)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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