Documentation ¶
Index ¶
- Constants
- Variables
- type Accuracy
- type Complexity
- type Counter
- type Exister
- type ExprType
- type Finder
- type Inclusion
- type IndexError
- type IndexInfo
- type IndexList
- type IndexMetaResponse
- type IndexRequest
- type IndexRow
- type IndexScanResponse
- type IndexSequenceMap
- type IndexType
- type Key
- type Keybytes
- type Looker
- type Mutation
- type NodeInfo
- type Persister
- type QueryParams
- type RangeCounter
- type Ranger
- type RequestType
- type ResponseStatus
- type ScanType
- type SequenceVector
- type SortOrder
- type TraitInfo
- type Uniqueness
- type UprEventName
- type Value
Constants ¶
const ( View IndexType = "view" Llrb = "llrb" LevelDB = "leveldb" RocksDB = "rocksdb" HyperDB = "hyperdb" RBTree = "rbtree" CBTree = "cbtree" )
const ( Unsorted SortOrder = "none" Asc = "asc" Desc = "desc" )
const ( Simple string = "simple" JavaScript = "javascript" N1QL = "n1ql" )
const MAX_VBUCKETS = 1024
Variables ¶
var ( DuplicateIndex = errors.New("Index by the specified name already exists") NoSuchIndex = errors.New("Index by the specified name does not exist") NoSuchType = errors.New("The specified index type is not defined") DDocChanged = errors.New("The design doc has been changed externally") DDocCreateFailed = errors.New("Unable to create design doc for index") ExprNotSupported = errors.New("Expression type is not supported") )
var DebugLog bool
var KEY_SEPARATOR []byte = []byte{0xff, 0xff, 0xff, 0xff}
Functions ¶
This section is empty.
Types ¶
type Accuracy ¶
type Accuracy float64
Accuracy characterizes if the results of the index is subject to probabilistic errors. When an algorithm that is not Perfect is used, the caller must verify the results.
const ( Useless Accuracy = 0.0 Perfect = 1.0 )
type Complexity ¶
type Complexity int
Complexity characterizes space and time characteristics of the algorithm
const ( O1 Complexity = iota Ologm Ologn Om Omlogm Omlogn On Onlogn Om2 On2 Ounknown )
type Exister ¶
type Exister interface { Finder Exists(key Key) bool // TODO: Should we have the `error` part of return ? }
Exister is a class of algorithms that allow testing if a key exists in the index
type ExprType ¶
type ExprType string
Expression to be applied on the document to get the secondary key.
type Inclusion ¶
type Inclusion int
Inclusion controls how the boundaries values of a range are treated
type IndexError ¶
type IndexInfo ¶
type IndexInfo struct { Name string `json:"name,omitempty"` // Name of the index Uuid string `json:"uuid,omitempty"` // unique id for every index Using IndexType `json:"using,omitempty"` // indexing algorithm OnExprList []string `json:"onExprList,omitempty"` // expression list Bucket string `json:"bucket,omitempty"` // bucket name IsPrimary bool `json:"isPrimary,omitempty"` Exprtype ExprType `json:"exprType,omitempty"` }
Every index ever created and maintained by this package will have an associated index-info structure.
type IndexMetaResponse ¶
type IndexMetaResponse struct { Status ResponseStatus `json:"status,omitempty"` Indexes []IndexInfo `json:"indexes,omitempty"` ServerUuid string `json:"serverUuid,omitempty"` Nodes []NodeInfo `json:"nodes,omitempty"` Errors []IndexError `json:"errors,omitempty"` }
type IndexRequest ¶
type IndexRequest struct { Type RequestType `json:"type,omitempty"` Index IndexInfo `json:"index,omitempty"` ServerUuid string `json:"serverUuid,omitempty"` Params QueryParams `json:"params,omitempty"` }
All API accept IndexRequest structure and returns IndexResponse structure. If application is written in Go, and compiled with `indexing` package then they can choose the access the underlying interfaces directly.
type IndexScanResponse ¶
type IndexScanResponse struct { Status ResponseStatus `json:"status,omitempty"` TotalRows uint64 `json:"totalrows,omitempty"` Rows []IndexRow `json:"rows,omitempty"` Errors []IndexError `json:"errors,omitempty"` }
type IndexSequenceMap ¶
type IndexSequenceMap map[string]SequenceVector // indexed with index-uuid
map of <Index, SequenceVector>
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key is an array of JSON objects, per encoding/json
func NewKeyFromEncodedBytes ¶
func (*Key) EncodedBytes ¶
type Looker ¶
type Looker interface { Exister Lookup(key Key) (chan Value, chan error) KeySet() (chan Key, chan error) ValueSet() (chan Value, chan error) }
Looker is a class of algorithms that allow looking up a key in an index. Usually, being able to look up a key means we can iterate through all keys too, and so that is introduced here as well.
TODO: Define the semantics of buffer size of channels that are returned by the following method receiver.
type Mutation ¶
type Mutation struct { Type UprEventName Indexid string SecondaryKey [][]byte Docid string Vbucket uint16 Seqno uint64 }
Mutations from projector to indexer.
type NodeInfo ¶
type NodeInfo struct {
IndexerURL string `json:"indexerURL,omitempty"`
}
Indexer Node Info
type Persister ¶
type Persister interface { //Persist a key/value pair InsertMutation(key Key, value Value) error //Persist meta key/value in back index InsertMeta(metaid string, metavalue string) error //Return meta value based on metaid from back index GetMeta(metaid string) (string, error) //Delete a key/value pair by docId DeleteMutation(docid string) error //Get an existing key/value pair by key GetBackIndexEntry(docid string) (Key, error) //Close the db. Should be able to reopen after this operation Close() error //Destroy/Wipe the DB completely Destroy() error }
type QueryParams ¶
type QueryParams struct { ScanType ScanType `json:"scanType,omitempty"` Low [][]byte `json:"low,omitempty"` High [][]byte `json:"high,omitempty"` Inclusion Inclusion `json:"inclusion,omitempty"` Limit int64 `json:"limit,omitempty"` }
URL encoded query params
type RangeCounter ¶
type RangeCounter interface { Finder CountRange(low Key, high Key, inclusion Inclusion) (uint64, error) }
RangeCounter is a class of algorithms that can count a range efficiently
type Ranger ¶
type Ranger interface { Looker KeyRange(low, high Key, inclusion Inclusion) (chan Key, chan error, SortOrder) ValueRange(low, high Key, inclusion Inclusion) (chan Value, chan error, SortOrder) }
Ranger is a class of algorithms that can extract a range of keys from the index.
type RequestType ¶
type RequestType string
const ( CREATE RequestType = "create" DROP RequestType = "drop" LIST RequestType = "list" NOTIFY RequestType = "notify" NODES RequestType = "nodes" SCAN RequestType = "scan" STATS RequestType = "stats" )
type ResponseStatus ¶
type ResponseStatus string
RESPONSE DATA FORMATS
const ( SUCCESS ResponseStatus = "success" ERROR ResponseStatus = "error" INVALID_CACHE ResponseStatus = "invalid_cache" )
type SortOrder ¶
type SortOrder string
SortOrder characterizes if the algorithm emits keys in a predictable order
type TraitInfo ¶
type TraitInfo struct { Unique Uniqueness Order SortOrder Accuracy Accuracy AvgTime Complexity AvgSpace Complexity WorstTime Complexity WorstSpace Complexity }
TraitInfo is collection of traits of an algorithm. One can query the traits of an entire indexing algorithm, or traits of a specific operation. May change soon.
type Uniqueness ¶
type Uniqueness bool
Uniqueness, characterizes if the algorithm demands unique keys
const ( Unique Uniqueness = true NonUnique = false )
type UprEventName ¶
type UprEventName string
const ( INSERT UprEventName = "UPR_MUTATION" DELETE = "UPR_DELETION" )
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is the primary key of the relavent document