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

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

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

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

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

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

func CountBlevePIndexImpl

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

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

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

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

func QueryAlias

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

func QueryBlevePIndexImpl

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

func RestoreAsset

func RestoreAsset(dir, name string) error

Restore an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

Restore assets under the given directory recursively

func ValidateAlias

func ValidateAlias(indexType, indexName, indexParams string) error

func ValidateBlevePIndexImpl

func ValidateBlevePIndexImpl(indexType, indexName, indexParams string) error

Types

type AliasParams

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

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

type BleveDest

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

func NewBleveDest

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

func (*BleveDest) AddError

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

func (*BleveDest) Close

func (t *BleveDest) Close() error

func (*BleveDest) ConsistencyWait

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

func (*BleveDest) Count

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

func (*BleveDest) Dest

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

func (*BleveDest) Query

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

func (*BleveDest) Rollback

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

func (*BleveDest) Stats

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

type BleveDestPartition

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

Used to track state for a single partition.

func (*BleveDestPartition) Close

func (t *BleveDestPartition) Close() error

func (*BleveDestPartition) ConsistencyWait

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

func (*BleveDestPartition) Count

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

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

func (*BleveDestPartition) Rollback

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

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

type BleveParams

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

func NewBleveParams

func NewBleveParams() *BleveParams

type IndexClient

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

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

func (*IndexClient) Batch

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

func (*IndexClient) Close

func (r *IndexClient) Close() error

func (*IndexClient) Count

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

func (*IndexClient) Delete

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

func (*IndexClient) DeleteInternal

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

func (*IndexClient) DocCount

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

func (*IndexClient) Document

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

func (*IndexClient) DumpAll

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

func (*IndexClient) DumpDoc

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

func (*IndexClient) DumpFields

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

func (*IndexClient) FieldDict

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

func (*IndexClient) FieldDictPrefix

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

func (*IndexClient) FieldDictRange

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

func (*IndexClient) Fields

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

func (*IndexClient) GetInternal

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

func (*IndexClient) Index

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

func (*IndexClient) Mapping

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

func (*IndexClient) NewBatch

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

func (*IndexClient) Query

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

func (*IndexClient) Search

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

func (*IndexClient) SetInternal

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

func (*IndexClient) Stats

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

type JSONStatsWriter

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
cbft command
cbft_docs command

Jump to

Keyboard shortcuts

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