Documentation ¶
Overview ¶
Coordination between a collection of chunks.
Database is a collection of collections.
Query processor for embedded and HTTP API V2.
Index ¶
- Constants
- func Complement(subExprs interface{}, src *Col, result *map[uint64]struct{}) (err error)
- func EvalAllIDs(src *Col, result *map[uint64]struct{}) (err error)
- func EvalQuery(q interface{}, src *Col, result *map[uint64]struct{}) (err error)
- func EvalUnion(exprs []interface{}, src *Col, result *map[uint64]struct{}) (err error)
- func GetIn(doc interface{}, path []string) (ret []interface{})
- func IntRange(intFrom interface{}, expr map[string]interface{}, src *Col, ...) (err error)
- func Intersect(subExprs interface{}, src *Col, result *map[uint64]struct{}) (err error)
- func Lookup(lookupValue interface{}, expr map[string]interface{}, src *Col, ...) (err error)
- func ParameterizeJSON(q string, params ...string) string
- func PathExistence(hasPath interface{}, expr map[string]interface{}, src *Col, ...) (err error)
- func RegexpLookup(lookupRegexp interface{}, expr map[string]interface{}, src *Col, ...) (err error)
- type Col
- func (col *Col) Close()
- func (col *Col) Delete(id uint64)
- func (col *Col) DeserializeAll(template interface{}, fun func() bool)
- func (col *Col) Flush() error
- func (col *Col) ForAll(fun func(id uint64, doc map[string]interface{}) bool)
- func (col *Col) HashScan(htPath string, key, limit uint64) (keys, vals []uint64)
- func (col *Col) Index(indexPath []string) error
- func (col *Col) Insert(doc map[string]interface{}) (id uint64, err error)
- func (col *Col) InsertRecovery(knownID uint64, doc map[string]interface{}) (err error)
- func (col *Col) Read(id uint64, doc interface{}) (physID uint64, err error)
- func (col *Col) ReadNoLock(id uint64, doc interface{}) (physID uint64, err error)
- func (col *Col) Unindex(indexPath []string) (err error)
- func (col *Col) Update(id uint64, newDoc map[string]interface{}) (err error)
- type DB
- func (db *DB) Close()
- func (db *DB) Create(name string, numChunks int) (err error)
- func (db *DB) Drop(name string) (err error)
- func (db *DB) Flush()
- func (db *DB) Rename(oldName, newName string) (err error)
- func (db *DB) Repartition(name string, newNumber int) (counter uint64, err error)
- func (db *DB) Scrub(name string) (counter uint64, err error)
- func (db *DB) Use(name string) *Col
Constants ¶
const ( HASHTABLE_DIRNAME_MAGIC = "ht_" // Hash table directory name prefix CHUNK_DIRNAME_MAGIC = "chunk_" // Chunk directory name prefix INDEX_PATH_SEP = "," // Separator between index path segments )
const (
NUMCHUNKS_FILENAME = "numchunks"
)
Variables ¶
This section is empty.
Functions ¶
func Complement ¶
Calculate complement of sub query results.
func EvalAllIDs ¶
Put all document IDs into result.
func EvalQuery ¶
Main entrance to query processor - evaluate a query and put result into result map (as map keys).
func GetIn ¶
func GetIn(doc interface{}, path []string) (ret []interface{})
Resolve the attribute(s) in the document structure along the given path.
func IntRange ¶
func IntRange(intFrom interface{}, expr map[string]interface{}, src *Col, result *map[uint64]struct{}) (err error)
Scan hash table or collection documents using an integer range.
func Lookup ¶
func Lookup(lookupValue interface{}, expr map[string]interface{}, src *Col, result *map[uint64]struct{}) (err error)
Execute value equity check ("attribute == value") using hash lookup or collection scan.
func ParameterizeJSON ¶
Detect ? characters outside of an embedded string, and replace them with the appropriate parameter, which will be encoded as a string. Does not verify that the resulting JSON is valid, but should not allow injecting parameters that change the structure of the source JSON (a la SQL injection). Use this to derive final query strings from any user-supplied input.
ParameterizeJSON(`{"eq": "New Go release", "in": [?]}`, `"thing1","thing2"`) -> {"eq": "New Go release", "in": ["\"thing1\",\"thing2\""]}
Types ¶
type Col ¶
type Col struct { BaseDir string // Collection dir path Chunks []*chunk.ChunkCol ChunkMutexes []*sync.RWMutex // Synchronize access to chunks NumChunks int // Total number of chunks NumChunksI64 uint64 // Total number of chunks (uint64) // Secondary indexes (hashtables) SecIndexes map[string][]*chunkfile.HashTable }
func (*Col) DeserializeAll ¶
Sequentially deserialize all documents into the template (pointer to struct) and invoke the function on each document (Collection Scan).
The function must not write to this collection.
func (*Col) ForAll ¶
Sequentially deserialize all documents and invoke the function on each document (Collection Scan).
The function must not write to this collection.
func (*Col) InsertRecovery ¶
Insert a document without allocating a new ID to it. Only for collection recovery operation.
func (*Col) ReadNoLock ¶
Read a document given its unique ID (without placing any lock).