id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
158,200
syndtr/goleveldb
leveldb/cache/cache.go
Delete
func (r *Cache) Delete(ns, key uint64, onDel func()) bool { r.mu.RLock() defer r.mu.RUnlock() if r.closed { return false } hash := murmur32(ns, key, 0xf00) for { h, b := r.getBucket(hash) done, _, n := b.get(r, h, hash, ns, key, true) if done { if n != nil { if onDel != nil { n.mu.Lock() n.onDel = append(n.onDel, onDel) n.mu.Unlock() } if r.cacher != nil { r.cacher.Ban(n) } n.unref() return true } break } } if onDel != nil { onDel() } return false }
go
func (r *Cache) Delete(ns, key uint64, onDel func()) bool { r.mu.RLock() defer r.mu.RUnlock() if r.closed { return false } hash := murmur32(ns, key, 0xf00) for { h, b := r.getBucket(hash) done, _, n := b.get(r, h, hash, ns, key, true) if done { if n != nil { if onDel != nil { n.mu.Lock() n.onDel = append(n.onDel, onDel) n.mu.Unlock() } if r.cacher != nil { r.cacher.Ban(n) } n.unref() return true } break } } if onDel != nil { onDel() } return false }
[ "func", "(", "r", "*", "Cache", ")", "Delete", "(", "ns", ",", "key", "uint64", ",", "onDel", "func", "(", ")", ")", "bool", "{", "r", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "r", ".", "mu", ".", "RUnlock", "(", ")", "\n", "if", "...
// Delete removes and ban 'cache node' with the given namespace and key. // A banned 'cache node' will never inserted into the 'cache tree'. Ban // only attributed to the particular 'cache node', so when a 'cache node' // is recreated it will not be banned. // // If onDel is not nil, then it will be executed if such 'cache node' // doesn't exist or once the 'cache node' is released. // // Delete return true is such 'cache node' exist.
[ "Delete", "removes", "and", "ban", "cache", "node", "with", "the", "given", "namespace", "and", "key", ".", "A", "banned", "cache", "node", "will", "never", "inserted", "into", "the", "cache", "tree", ".", "Ban", "only", "attributed", "to", "the", "particu...
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/cache/cache.go#L419-L453
158,201
syndtr/goleveldb
leveldb/cache/cache.go
Evict
func (r *Cache) Evict(ns, key uint64) bool { r.mu.RLock() defer r.mu.RUnlock() if r.closed { return false } hash := murmur32(ns, key, 0xf00) for { h, b := r.getBucket(hash) done, _, n := b.get(r, h, hash, ns, key, true) if done { if n != nil { if r.cacher != nil { r.cacher.Evict(n) } n.unref() return true } break } } return false }
go
func (r *Cache) Evict(ns, key uint64) bool { r.mu.RLock() defer r.mu.RUnlock() if r.closed { return false } hash := murmur32(ns, key, 0xf00) for { h, b := r.getBucket(hash) done, _, n := b.get(r, h, hash, ns, key, true) if done { if n != nil { if r.cacher != nil { r.cacher.Evict(n) } n.unref() return true } break } } return false }
[ "func", "(", "r", "*", "Cache", ")", "Evict", "(", "ns", ",", "key", "uint64", ")", "bool", "{", "r", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "r", ".", "mu", ".", "RUnlock", "(", ")", "\n", "if", "r", ".", "closed", "{", "return", ...
// Evict evicts 'cache node' with the given namespace and key. This will // simply call Cacher.Evict. // // Evict return true is such 'cache node' exist.
[ "Evict", "evicts", "cache", "node", "with", "the", "given", "namespace", "and", "key", ".", "This", "will", "simply", "call", "Cacher", ".", "Evict", ".", "Evict", "return", "true", "is", "such", "cache", "node", "exist", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/cache/cache.go#L459-L484
158,202
syndtr/goleveldb
leveldb/cache/cache.go
EvictNS
func (r *Cache) EvictNS(ns uint64) { r.mu.RLock() defer r.mu.RUnlock() if r.closed { return } if r.cacher != nil { r.cacher.EvictNS(ns) } }
go
func (r *Cache) EvictNS(ns uint64) { r.mu.RLock() defer r.mu.RUnlock() if r.closed { return } if r.cacher != nil { r.cacher.EvictNS(ns) } }
[ "func", "(", "r", "*", "Cache", ")", "EvictNS", "(", "ns", "uint64", ")", "{", "r", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "r", ".", "mu", ".", "RUnlock", "(", ")", "\n", "if", "r", ".", "closed", "{", "return", "\n", "}", "\n\n", ...
// EvictNS evicts 'cache node' with the given namespace. This will // simply call Cacher.EvictNS.
[ "EvictNS", "evicts", "cache", "node", "with", "the", "given", "namespace", ".", "This", "will", "simply", "call", "Cacher", ".", "EvictNS", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/cache/cache.go#L488-L498
158,203
syndtr/goleveldb
leveldb/cache/cache.go
EvictAll
func (r *Cache) EvictAll() { r.mu.RLock() defer r.mu.RUnlock() if r.closed { return } if r.cacher != nil { r.cacher.EvictAll() } }
go
func (r *Cache) EvictAll() { r.mu.RLock() defer r.mu.RUnlock() if r.closed { return } if r.cacher != nil { r.cacher.EvictAll() } }
[ "func", "(", "r", "*", "Cache", ")", "EvictAll", "(", ")", "{", "r", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "r", ".", "mu", ".", "RUnlock", "(", ")", "\n", "if", "r", ".", "closed", "{", "return", "\n", "}", "\n\n", "if", "r", "....
// EvictAll evicts all 'cache node'. This will simply call Cacher.EvictAll.
[ "EvictAll", "evicts", "all", "cache", "node", ".", "This", "will", "simply", "call", "Cacher", ".", "EvictAll", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/cache/cache.go#L501-L511
158,204
syndtr/goleveldb
leveldb/cache/cache.go
Close
func (r *Cache) Close() error { r.mu.Lock() if !r.closed { r.closed = true h := (*mNode)(r.mHead) h.initBuckets() for i := range h.buckets { b := (*mBucket)(h.buckets[i]) for _, n := range b.node { // Call releaser. if n.value != nil { if r, ok := n.value.(util.Releaser); ok { r.Release() } n.value = nil } // Call OnDel. for _, f := range n.onDel { f() } n.onDel = nil } } } r.mu.Unlock() // Avoid deadlock. if r.cacher != nil { if err := r.cacher.Close(); err != nil { return err } } return nil }
go
func (r *Cache) Close() error { r.mu.Lock() if !r.closed { r.closed = true h := (*mNode)(r.mHead) h.initBuckets() for i := range h.buckets { b := (*mBucket)(h.buckets[i]) for _, n := range b.node { // Call releaser. if n.value != nil { if r, ok := n.value.(util.Releaser); ok { r.Release() } n.value = nil } // Call OnDel. for _, f := range n.onDel { f() } n.onDel = nil } } } r.mu.Unlock() // Avoid deadlock. if r.cacher != nil { if err := r.cacher.Close(); err != nil { return err } } return nil }
[ "func", "(", "r", "*", "Cache", ")", "Close", "(", ")", "error", "{", "r", ".", "mu", ".", "Lock", "(", ")", "\n", "if", "!", "r", ".", "closed", "{", "r", ".", "closed", "=", "true", "\n\n", "h", ":=", "(", "*", "mNode", ")", "(", "r", "...
// Close closes the 'cache map' and forcefully releases all 'cache node'.
[ "Close", "closes", "the", "cache", "map", "and", "forcefully", "releases", "all", "cache", "node", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/cache/cache.go#L514-L550
158,205
syndtr/goleveldb
leveldb/cache/cache.go
CloseWeak
func (r *Cache) CloseWeak() error { r.mu.Lock() if !r.closed { r.closed = true } r.mu.Unlock() // Avoid deadlock. if r.cacher != nil { r.cacher.EvictAll() if err := r.cacher.Close(); err != nil { return err } } return nil }
go
func (r *Cache) CloseWeak() error { r.mu.Lock() if !r.closed { r.closed = true } r.mu.Unlock() // Avoid deadlock. if r.cacher != nil { r.cacher.EvictAll() if err := r.cacher.Close(); err != nil { return err } } return nil }
[ "func", "(", "r", "*", "Cache", ")", "CloseWeak", "(", ")", "error", "{", "r", ".", "mu", ".", "Lock", "(", ")", "\n", "if", "!", "r", ".", "closed", "{", "r", ".", "closed", "=", "true", "\n", "}", "\n", "r", ".", "mu", ".", "Unlock", "(",...
// CloseWeak closes the 'cache map' and evict all 'cache node' from cacher, but // unlike Close it doesn't forcefully releases 'cache node'.
[ "CloseWeak", "closes", "the", "cache", "map", "and", "evict", "all", "cache", "node", "from", "cacher", "but", "unlike", "Close", "it", "doesn", "t", "forcefully", "releases", "cache", "node", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/cache/cache.go#L554-L569
158,206
syndtr/goleveldb
leveldb/cache/cache.go
GetHandle
func (n *Node) GetHandle() *Handle { if atomic.AddInt32(&n.ref, 1) <= 1 { panic("BUG: Node.GetHandle on zero ref") } return &Handle{unsafe.Pointer(n)} }
go
func (n *Node) GetHandle() *Handle { if atomic.AddInt32(&n.ref, 1) <= 1 { panic("BUG: Node.GetHandle on zero ref") } return &Handle{unsafe.Pointer(n)} }
[ "func", "(", "n", "*", "Node", ")", "GetHandle", "(", ")", "*", "Handle", "{", "if", "atomic", ".", "AddInt32", "(", "&", "n", ".", "ref", ",", "1", ")", "<=", "1", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "&", "Handle",...
// GetHandle returns an handle for this 'cache node'.
[ "GetHandle", "returns", "an", "handle", "for", "this", "cache", "node", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/cache/cache.go#L614-L619
158,207
syndtr/goleveldb
leveldb/cache/cache.go
Value
func (h *Handle) Value() Value { n := (*Node)(atomic.LoadPointer(&h.n)) if n != nil { return n.value } return nil }
go
func (h *Handle) Value() Value { n := (*Node)(atomic.LoadPointer(&h.n)) if n != nil { return n.value } return nil }
[ "func", "(", "h", "*", "Handle", ")", "Value", "(", ")", "Value", "{", "n", ":=", "(", "*", "Node", ")", "(", "atomic", ".", "LoadPointer", "(", "&", "h", ".", "n", ")", ")", "\n", "if", "n", "!=", "nil", "{", "return", "n", ".", "value", "...
// Value returns the value of the 'cache node'.
[ "Value", "returns", "the", "value", "of", "the", "cache", "node", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/cache/cache.go#L643-L649
158,208
syndtr/goleveldb
leveldb/cache/cache.go
Release
func (h *Handle) Release() { nPtr := atomic.LoadPointer(&h.n) if nPtr != nil && atomic.CompareAndSwapPointer(&h.n, nPtr, nil) { n := (*Node)(nPtr) n.unrefLocked() } }
go
func (h *Handle) Release() { nPtr := atomic.LoadPointer(&h.n) if nPtr != nil && atomic.CompareAndSwapPointer(&h.n, nPtr, nil) { n := (*Node)(nPtr) n.unrefLocked() } }
[ "func", "(", "h", "*", "Handle", ")", "Release", "(", ")", "{", "nPtr", ":=", "atomic", ".", "LoadPointer", "(", "&", "h", ".", "n", ")", "\n", "if", "nPtr", "!=", "nil", "&&", "atomic", ".", "CompareAndSwapPointer", "(", "&", "h", ".", "n", ",",...
// Release releases this 'cache handle'. // It is safe to call release multiple times.
[ "Release", "releases", "this", "cache", "handle", ".", "It", "is", "safe", "to", "call", "release", "multiple", "times", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/cache/cache.go#L653-L659
158,209
syndtr/goleveldb
leveldb/util/hash.go
Hash
func Hash(data []byte, seed uint32) uint32 { // Similar to murmur hash const ( m = uint32(0xc6a4a793) r = uint32(24) ) var ( h = seed ^ (uint32(len(data)) * m) i int ) for n := len(data) - len(data)%4; i < n; i += 4 { h += binary.LittleEndian.Uint32(data[i:]) h *= m h ^= (h >> 16) } switch len(data) - i { default: panic("not reached") case 3: h += uint32(data[i+2]) << 16 fallthrough case 2: h += uint32(data[i+1]) << 8 fallthrough case 1: h += uint32(data[i]) h *= m h ^= (h >> r) case 0: } return h }
go
func Hash(data []byte, seed uint32) uint32 { // Similar to murmur hash const ( m = uint32(0xc6a4a793) r = uint32(24) ) var ( h = seed ^ (uint32(len(data)) * m) i int ) for n := len(data) - len(data)%4; i < n; i += 4 { h += binary.LittleEndian.Uint32(data[i:]) h *= m h ^= (h >> 16) } switch len(data) - i { default: panic("not reached") case 3: h += uint32(data[i+2]) << 16 fallthrough case 2: h += uint32(data[i+1]) << 8 fallthrough case 1: h += uint32(data[i]) h *= m h ^= (h >> r) case 0: } return h }
[ "func", "Hash", "(", "data", "[", "]", "byte", ",", "seed", "uint32", ")", "uint32", "{", "// Similar to murmur hash", "const", "(", "m", "=", "uint32", "(", "0xc6a4a793", ")", "\n", "r", "=", "uint32", "(", "24", ")", "\n", ")", "\n", "var", "(", ...
// Hash return hash of the given data.
[ "Hash", "return", "hash", "of", "the", "given", "data", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/util/hash.go#L14-L48
158,210
syndtr/goleveldb
leveldb/db_write.go
writeLocked
func (db *DB) writeLocked(batch, ourBatch *Batch, merge, sync bool) error { // Try to flush memdb. This method would also trying to throttle writes // if it is too fast and compaction cannot catch-up. mdb, mdbFree, err := db.flush(batch.internalLen) if err != nil { db.unlockWrite(false, 0, err) return err } defer mdb.decref() var ( overflow bool merged int batches = []*Batch{batch} ) if merge { // Merge limit. var mergeLimit int if batch.internalLen > 128<<10 { mergeLimit = (1 << 20) - batch.internalLen } else { mergeLimit = 128 << 10 } mergeCap := mdbFree - batch.internalLen if mergeLimit > mergeCap { mergeLimit = mergeCap } merge: for mergeLimit > 0 { select { case incoming := <-db.writeMergeC: if incoming.batch != nil { // Merge batch. if incoming.batch.internalLen > mergeLimit { overflow = true break merge } batches = append(batches, incoming.batch) mergeLimit -= incoming.batch.internalLen } else { // Merge put. internalLen := len(incoming.key) + len(incoming.value) + 8 if internalLen > mergeLimit { overflow = true break merge } if ourBatch == nil { ourBatch = db.batchPool.Get().(*Batch) ourBatch.Reset() batches = append(batches, ourBatch) } // We can use same batch since concurrent write doesn't // guarantee write order. ourBatch.appendRec(incoming.keyType, incoming.key, incoming.value) mergeLimit -= internalLen } sync = sync || incoming.sync merged++ db.writeMergedC <- true default: break merge } } } // Release ourBatch if any. if ourBatch != nil { defer db.batchPool.Put(ourBatch) } // Seq number. seq := db.seq + 1 // Write journal. if err := db.writeJournal(batches, seq, sync); err != nil { db.unlockWrite(overflow, merged, err) return err } // Put batches. for _, batch := range batches { if err := batch.putMem(seq, mdb.DB); err != nil { panic(err) } seq += uint64(batch.Len()) } // Incr seq number. db.addSeq(uint64(batchesLen(batches))) // Rotate memdb if it's reach the threshold. if batch.internalLen >= mdbFree { db.rotateMem(0, false) } db.unlockWrite(overflow, merged, nil) return nil }
go
func (db *DB) writeLocked(batch, ourBatch *Batch, merge, sync bool) error { // Try to flush memdb. This method would also trying to throttle writes // if it is too fast and compaction cannot catch-up. mdb, mdbFree, err := db.flush(batch.internalLen) if err != nil { db.unlockWrite(false, 0, err) return err } defer mdb.decref() var ( overflow bool merged int batches = []*Batch{batch} ) if merge { // Merge limit. var mergeLimit int if batch.internalLen > 128<<10 { mergeLimit = (1 << 20) - batch.internalLen } else { mergeLimit = 128 << 10 } mergeCap := mdbFree - batch.internalLen if mergeLimit > mergeCap { mergeLimit = mergeCap } merge: for mergeLimit > 0 { select { case incoming := <-db.writeMergeC: if incoming.batch != nil { // Merge batch. if incoming.batch.internalLen > mergeLimit { overflow = true break merge } batches = append(batches, incoming.batch) mergeLimit -= incoming.batch.internalLen } else { // Merge put. internalLen := len(incoming.key) + len(incoming.value) + 8 if internalLen > mergeLimit { overflow = true break merge } if ourBatch == nil { ourBatch = db.batchPool.Get().(*Batch) ourBatch.Reset() batches = append(batches, ourBatch) } // We can use same batch since concurrent write doesn't // guarantee write order. ourBatch.appendRec(incoming.keyType, incoming.key, incoming.value) mergeLimit -= internalLen } sync = sync || incoming.sync merged++ db.writeMergedC <- true default: break merge } } } // Release ourBatch if any. if ourBatch != nil { defer db.batchPool.Put(ourBatch) } // Seq number. seq := db.seq + 1 // Write journal. if err := db.writeJournal(batches, seq, sync); err != nil { db.unlockWrite(overflow, merged, err) return err } // Put batches. for _, batch := range batches { if err := batch.putMem(seq, mdb.DB); err != nil { panic(err) } seq += uint64(batch.Len()) } // Incr seq number. db.addSeq(uint64(batchesLen(batches))) // Rotate memdb if it's reach the threshold. if batch.internalLen >= mdbFree { db.rotateMem(0, false) } db.unlockWrite(overflow, merged, nil) return nil }
[ "func", "(", "db", "*", "DB", ")", "writeLocked", "(", "batch", ",", "ourBatch", "*", "Batch", ",", "merge", ",", "sync", "bool", ")", "error", "{", "// Try to flush memdb. This method would also trying to throttle writes", "// if it is too fast and compaction cannot catc...
// ourBatch is batch that we can modify.
[ "ourBatch", "is", "batch", "that", "we", "can", "modify", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/db_write.go#L154-L254
158,211
syndtr/goleveldb
leveldb/db_write.go
Write
func (db *DB) Write(batch *Batch, wo *opt.WriteOptions) error { if err := db.ok(); err != nil || batch == nil || batch.Len() == 0 { return err } // If the batch size is larger than write buffer, it may justified to write // using transaction instead. Using transaction the batch will be written // into tables directly, skipping the journaling. if batch.internalLen > db.s.o.GetWriteBuffer() && !db.s.o.GetDisableLargeBatchTransaction() { tr, err := db.OpenTransaction() if err != nil { return err } if err := tr.Write(batch, wo); err != nil { tr.Discard() return err } return tr.Commit() } merge := !wo.GetNoWriteMerge() && !db.s.o.GetNoWriteMerge() sync := wo.GetSync() && !db.s.o.GetNoSync() // Acquire write lock. if merge { select { case db.writeMergeC <- writeMerge{sync: sync, batch: batch}: if <-db.writeMergedC { // Write is merged. return <-db.writeAckC } // Write is not merged, the write lock is handed to us. Continue. case db.writeLockC <- struct{}{}: // Write lock acquired. case err := <-db.compPerErrC: // Compaction error. return err case <-db.closeC: // Closed return ErrClosed } } else { select { case db.writeLockC <- struct{}{}: // Write lock acquired. case err := <-db.compPerErrC: // Compaction error. return err case <-db.closeC: // Closed return ErrClosed } } return db.writeLocked(batch, nil, merge, sync) }
go
func (db *DB) Write(batch *Batch, wo *opt.WriteOptions) error { if err := db.ok(); err != nil || batch == nil || batch.Len() == 0 { return err } // If the batch size is larger than write buffer, it may justified to write // using transaction instead. Using transaction the batch will be written // into tables directly, skipping the journaling. if batch.internalLen > db.s.o.GetWriteBuffer() && !db.s.o.GetDisableLargeBatchTransaction() { tr, err := db.OpenTransaction() if err != nil { return err } if err := tr.Write(batch, wo); err != nil { tr.Discard() return err } return tr.Commit() } merge := !wo.GetNoWriteMerge() && !db.s.o.GetNoWriteMerge() sync := wo.GetSync() && !db.s.o.GetNoSync() // Acquire write lock. if merge { select { case db.writeMergeC <- writeMerge{sync: sync, batch: batch}: if <-db.writeMergedC { // Write is merged. return <-db.writeAckC } // Write is not merged, the write lock is handed to us. Continue. case db.writeLockC <- struct{}{}: // Write lock acquired. case err := <-db.compPerErrC: // Compaction error. return err case <-db.closeC: // Closed return ErrClosed } } else { select { case db.writeLockC <- struct{}{}: // Write lock acquired. case err := <-db.compPerErrC: // Compaction error. return err case <-db.closeC: // Closed return ErrClosed } } return db.writeLocked(batch, nil, merge, sync) }
[ "func", "(", "db", "*", "DB", ")", "Write", "(", "batch", "*", "Batch", ",", "wo", "*", "opt", ".", "WriteOptions", ")", "error", "{", "if", "err", ":=", "db", ".", "ok", "(", ")", ";", "err", "!=", "nil", "||", "batch", "==", "nil", "||", "b...
// Write apply the given batch to the DB. The batch records will be applied // sequentially. Write might be used concurrently, when used concurrently and // batch is small enough, write will try to merge the batches. Set NoWriteMerge // option to true to disable write merge. // // It is safe to modify the contents of the arguments after Write returns but // not before. Write will not modify content of the batch.
[ "Write", "apply", "the", "given", "batch", "to", "the", "DB", ".", "The", "batch", "records", "will", "be", "applied", "sequentially", ".", "Write", "might", "be", "used", "concurrently", "when", "used", "concurrently", "and", "batch", "is", "small", "enough...
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/db_write.go#L263-L318
158,212
syndtr/goleveldb
leveldb/db_write.go
Put
func (db *DB) Put(key, value []byte, wo *opt.WriteOptions) error { return db.putRec(keyTypeVal, key, value, wo) }
go
func (db *DB) Put(key, value []byte, wo *opt.WriteOptions) error { return db.putRec(keyTypeVal, key, value, wo) }
[ "func", "(", "db", "*", "DB", ")", "Put", "(", "key", ",", "value", "[", "]", "byte", ",", "wo", "*", "opt", ".", "WriteOptions", ")", "error", "{", "return", "db", ".", "putRec", "(", "keyTypeVal", ",", "key", ",", "value", ",", "wo", ")", "\n...
// Put sets the value for the given key. It overwrites any previous value // for that key; a DB is not a multi-map. Write merge also applies for Put, see // Write. // // It is safe to modify the contents of the arguments after Put returns but not // before.
[ "Put", "sets", "the", "value", "for", "the", "given", "key", ".", "It", "overwrites", "any", "previous", "value", "for", "that", "key", ";", "a", "DB", "is", "not", "a", "multi", "-", "map", ".", "Write", "merge", "also", "applies", "for", "Put", "se...
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/db_write.go#L371-L373
158,213
syndtr/goleveldb
leveldb/db_write.go
Delete
func (db *DB) Delete(key []byte, wo *opt.WriteOptions) error { return db.putRec(keyTypeDel, key, nil, wo) }
go
func (db *DB) Delete(key []byte, wo *opt.WriteOptions) error { return db.putRec(keyTypeDel, key, nil, wo) }
[ "func", "(", "db", "*", "DB", ")", "Delete", "(", "key", "[", "]", "byte", ",", "wo", "*", "opt", ".", "WriteOptions", ")", "error", "{", "return", "db", ".", "putRec", "(", "keyTypeDel", ",", "key", ",", "nil", ",", "wo", ")", "\n", "}" ]
// Delete deletes the value for the given key. Delete will not returns error if // key doesn't exist. Write merge also applies for Delete, see Write. // // It is safe to modify the contents of the arguments after Delete returns but // not before.
[ "Delete", "deletes", "the", "value", "for", "the", "given", "key", ".", "Delete", "will", "not", "returns", "error", "if", "key", "doesn", "t", "exist", ".", "Write", "merge", "also", "applies", "for", "Delete", "see", "Write", ".", "It", "is", "safe", ...
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/db_write.go#L380-L382
158,214
syndtr/goleveldb
leveldb/db_write.go
CompactRange
func (db *DB) CompactRange(r util.Range) error { if err := db.ok(); err != nil { return err } // Lock writer. select { case db.writeLockC <- struct{}{}: case err := <-db.compPerErrC: return err case <-db.closeC: return ErrClosed } // Check for overlaps in memdb. mdb := db.getEffectiveMem() if mdb == nil { return ErrClosed } defer mdb.decref() if isMemOverlaps(db.s.icmp, mdb.DB, r.Start, r.Limit) { // Memdb compaction. if _, err := db.rotateMem(0, false); err != nil { <-db.writeLockC return err } <-db.writeLockC if err := db.compTriggerWait(db.mcompCmdC); err != nil { return err } } else { <-db.writeLockC } // Table compaction. return db.compTriggerRange(db.tcompCmdC, -1, r.Start, r.Limit) }
go
func (db *DB) CompactRange(r util.Range) error { if err := db.ok(); err != nil { return err } // Lock writer. select { case db.writeLockC <- struct{}{}: case err := <-db.compPerErrC: return err case <-db.closeC: return ErrClosed } // Check for overlaps in memdb. mdb := db.getEffectiveMem() if mdb == nil { return ErrClosed } defer mdb.decref() if isMemOverlaps(db.s.icmp, mdb.DB, r.Start, r.Limit) { // Memdb compaction. if _, err := db.rotateMem(0, false); err != nil { <-db.writeLockC return err } <-db.writeLockC if err := db.compTriggerWait(db.mcompCmdC); err != nil { return err } } else { <-db.writeLockC } // Table compaction. return db.compTriggerRange(db.tcompCmdC, -1, r.Start, r.Limit) }
[ "func", "(", "db", "*", "DB", ")", "CompactRange", "(", "r", "util", ".", "Range", ")", "error", "{", "if", "err", ":=", "db", ".", "ok", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Lock writer.", "select", "{"...
// CompactRange compacts the underlying DB for the given key range. // In particular, deleted and overwritten versions are discarded, // and the data is rearranged to reduce the cost of operations // needed to access the data. This operation should typically only // be invoked by users who understand the underlying implementation. // // A nil Range.Start is treated as a key before all keys in the DB. // And a nil Range.Limit is treated as a key after all keys in the DB. // Therefore if both is nil then it will compact entire DB.
[ "CompactRange", "compacts", "the", "underlying", "DB", "for", "the", "given", "key", "range", ".", "In", "particular", "deleted", "and", "overwritten", "versions", "are", "discarded", "and", "the", "data", "is", "rearranged", "to", "reduce", "the", "cost", "of...
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/db_write.go#L400-L436
158,215
syndtr/goleveldb
leveldb/db_write.go
SetReadOnly
func (db *DB) SetReadOnly() error { if err := db.ok(); err != nil { return err } // Lock writer. select { case db.writeLockC <- struct{}{}: db.compWriteLocking = true case err := <-db.compPerErrC: return err case <-db.closeC: return ErrClosed } // Set compaction read-only. select { case db.compErrSetC <- ErrReadOnly: case perr := <-db.compPerErrC: return perr case <-db.closeC: return ErrClosed } return nil }
go
func (db *DB) SetReadOnly() error { if err := db.ok(); err != nil { return err } // Lock writer. select { case db.writeLockC <- struct{}{}: db.compWriteLocking = true case err := <-db.compPerErrC: return err case <-db.closeC: return ErrClosed } // Set compaction read-only. select { case db.compErrSetC <- ErrReadOnly: case perr := <-db.compPerErrC: return perr case <-db.closeC: return ErrClosed } return nil }
[ "func", "(", "db", "*", "DB", ")", "SetReadOnly", "(", ")", "error", "{", "if", "err", ":=", "db", ".", "ok", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Lock writer.", "select", "{", "case", "db", ".", "writeL...
// SetReadOnly makes DB read-only. It will stay read-only until reopened.
[ "SetReadOnly", "makes", "DB", "read", "-", "only", ".", "It", "will", "stay", "read", "-", "only", "until", "reopened", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/db_write.go#L439-L464
158,216
syndtr/goleveldb
leveldb/util/util.go
Release
func (r *BasicReleaser) Release() { if !r.released { if r.releaser != nil { r.releaser.Release() r.releaser = nil } r.released = true } }
go
func (r *BasicReleaser) Release() { if !r.released { if r.releaser != nil { r.releaser.Release() r.releaser = nil } r.released = true } }
[ "func", "(", "r", "*", "BasicReleaser", ")", "Release", "(", ")", "{", "if", "!", "r", ".", "released", "{", "if", "r", ".", "releaser", "!=", "nil", "{", "r", ".", "releaser", ".", "Release", "(", ")", "\n", "r", ".", "releaser", "=", "nil", "...
// Release implements Releaser.Release.
[ "Release", "implements", "Releaser", ".", "Release", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/util/util.go#L50-L58
158,217
syndtr/goleveldb
leveldb/util/util.go
SetReleaser
func (r *BasicReleaser) SetReleaser(releaser Releaser) { if r.released { panic(ErrReleased) } if r.releaser != nil && releaser != nil { panic(ErrHasReleaser) } r.releaser = releaser }
go
func (r *BasicReleaser) SetReleaser(releaser Releaser) { if r.released { panic(ErrReleased) } if r.releaser != nil && releaser != nil { panic(ErrHasReleaser) } r.releaser = releaser }
[ "func", "(", "r", "*", "BasicReleaser", ")", "SetReleaser", "(", "releaser", "Releaser", ")", "{", "if", "r", ".", "released", "{", "panic", "(", "ErrReleased", ")", "\n", "}", "\n", "if", "r", ".", "releaser", "!=", "nil", "&&", "releaser", "!=", "n...
// SetReleaser implements ReleaseSetter.SetReleaser.
[ "SetReleaser", "implements", "ReleaseSetter", ".", "SetReleaser", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/util/util.go#L61-L69
158,218
syndtr/goleveldb
leveldb/errors/errors.go
NewErrCorrupted
func NewErrCorrupted(fd storage.FileDesc, err error) error { return &ErrCorrupted{fd, err} }
go
func NewErrCorrupted(fd storage.FileDesc, err error) error { return &ErrCorrupted{fd, err} }
[ "func", "NewErrCorrupted", "(", "fd", "storage", ".", "FileDesc", ",", "err", "error", ")", "error", "{", "return", "&", "ErrCorrupted", "{", "fd", ",", "err", "}", "\n", "}" ]
// NewErrCorrupted creates new ErrCorrupted error.
[ "NewErrCorrupted", "creates", "new", "ErrCorrupted", "error", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/errors/errors.go#L45-L47
158,219
syndtr/goleveldb
leveldb/errors/errors.go
IsCorrupted
func IsCorrupted(err error) bool { switch err.(type) { case *ErrCorrupted: return true case *storage.ErrCorrupted: return true } return false }
go
func IsCorrupted(err error) bool { switch err.(type) { case *ErrCorrupted: return true case *storage.ErrCorrupted: return true } return false }
[ "func", "IsCorrupted", "(", "err", "error", ")", "bool", "{", "switch", "err", ".", "(", "type", ")", "{", "case", "*", "ErrCorrupted", ":", "return", "true", "\n", "case", "*", "storage", ".", "ErrCorrupted", ":", "return", "true", "\n", "}", "\n", ...
// IsCorrupted returns a boolean indicating whether the error is indicating // a corruption.
[ "IsCorrupted", "returns", "a", "boolean", "indicating", "whether", "the", "error", "is", "indicating", "a", "corruption", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/errors/errors.go#L51-L59
158,220
syndtr/goleveldb
leveldb/errors/errors.go
SetFd
func SetFd(err error, fd storage.FileDesc) error { switch x := err.(type) { case *ErrCorrupted: x.Fd = fd return x } return err }
go
func SetFd(err error, fd storage.FileDesc) error { switch x := err.(type) { case *ErrCorrupted: x.Fd = fd return x } return err }
[ "func", "SetFd", "(", "err", "error", ",", "fd", "storage", ".", "FileDesc", ")", "error", "{", "switch", "x", ":=", "err", ".", "(", "type", ")", "{", "case", "*", "ErrCorrupted", ":", "x", ".", "Fd", "=", "fd", "\n", "return", "x", "\n", "}", ...
// SetFd sets 'file info' of the given error with the given file. // Currently only ErrCorrupted is supported, otherwise will do nothing.
[ "SetFd", "sets", "file", "info", "of", "the", "given", "error", "with", "the", "given", "file", ".", "Currently", "only", "ErrCorrupted", "is", "supported", "otherwise", "will", "do", "nothing", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/errors/errors.go#L71-L78
158,221
syndtr/goleveldb
leveldb/db_util.go
Sum
func (sizes Sizes) Sum() int64 { var sum int64 for _, size := range sizes { sum += size } return sum }
go
func (sizes Sizes) Sum() int64 { var sum int64 for _, size := range sizes { sum += size } return sum }
[ "func", "(", "sizes", "Sizes", ")", "Sum", "(", ")", "int64", "{", "var", "sum", "int64", "\n", "for", "_", ",", "size", ":=", "range", "sizes", "{", "sum", "+=", "size", "\n", "}", "\n", "return", "sum", "\n", "}" ]
// Sum returns sum of the sizes.
[ "Sum", "returns", "sum", "of", "the", "sizes", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/db_util.go#L28-L34
158,222
syndtr/goleveldb
leveldb/db_util.go
checkAndCleanFiles
func (db *DB) checkAndCleanFiles() error { v := db.s.version() defer v.release() tmap := make(map[int64]bool) for _, tables := range v.levels { for _, t := range tables { tmap[t.fd.Num] = false } } fds, err := db.s.stor.List(storage.TypeAll) if err != nil { return err } var nt int var rem []storage.FileDesc for _, fd := range fds { keep := true switch fd.Type { case storage.TypeManifest: keep = fd.Num >= db.s.manifestFd.Num case storage.TypeJournal: if !db.frozenJournalFd.Zero() { keep = fd.Num >= db.frozenJournalFd.Num } else { keep = fd.Num >= db.journalFd.Num } case storage.TypeTable: _, keep = tmap[fd.Num] if keep { tmap[fd.Num] = true nt++ } } if !keep { rem = append(rem, fd) } } if nt != len(tmap) { var mfds []storage.FileDesc for num, present := range tmap { if !present { mfds = append(mfds, storage.FileDesc{Type: storage.TypeTable, Num: num}) db.logf("db@janitor table missing @%d", num) } } return errors.NewErrCorrupted(storage.FileDesc{}, &errors.ErrMissingFiles{Fds: mfds}) } db.logf("db@janitor F·%d G·%d", len(fds), len(rem)) for _, fd := range rem { db.logf("db@janitor removing %s-%d", fd.Type, fd.Num) if err := db.s.stor.Remove(fd); err != nil { return err } } return nil }
go
func (db *DB) checkAndCleanFiles() error { v := db.s.version() defer v.release() tmap := make(map[int64]bool) for _, tables := range v.levels { for _, t := range tables { tmap[t.fd.Num] = false } } fds, err := db.s.stor.List(storage.TypeAll) if err != nil { return err } var nt int var rem []storage.FileDesc for _, fd := range fds { keep := true switch fd.Type { case storage.TypeManifest: keep = fd.Num >= db.s.manifestFd.Num case storage.TypeJournal: if !db.frozenJournalFd.Zero() { keep = fd.Num >= db.frozenJournalFd.Num } else { keep = fd.Num >= db.journalFd.Num } case storage.TypeTable: _, keep = tmap[fd.Num] if keep { tmap[fd.Num] = true nt++ } } if !keep { rem = append(rem, fd) } } if nt != len(tmap) { var mfds []storage.FileDesc for num, present := range tmap { if !present { mfds = append(mfds, storage.FileDesc{Type: storage.TypeTable, Num: num}) db.logf("db@janitor table missing @%d", num) } } return errors.NewErrCorrupted(storage.FileDesc{}, &errors.ErrMissingFiles{Fds: mfds}) } db.logf("db@janitor F·%d G·%d", len(fds), len(rem)) for _, fd := range rem { db.logf("db@janitor removing %s-%d", fd.Type, fd.Num) if err := db.s.stor.Remove(fd); err != nil { return err } } return nil }
[ "func", "(", "db", "*", "DB", ")", "checkAndCleanFiles", "(", ")", "error", "{", "v", ":=", "db", ".", "s", ".", "version", "(", ")", "\n", "defer", "v", ".", "release", "(", ")", "\n\n", "tmap", ":=", "make", "(", "map", "[", "int64", "]", "bo...
// Check and clean files.
[ "Check", "and", "clean", "files", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/db_util.go#L41-L102
158,223
syndtr/goleveldb
leveldb/batch.go
Delete
func (b *Batch) Delete(key []byte) { b.appendRec(keyTypeDel, key, nil) }
go
func (b *Batch) Delete(key []byte) { b.appendRec(keyTypeDel, key, nil) }
[ "func", "(", "b", "*", "Batch", ")", "Delete", "(", "key", "[", "]", "byte", ")", "{", "b", ".", "appendRec", "(", "keyTypeDel", ",", "key", ",", "nil", ")", "\n", "}" ]
// Delete appends 'delete operation' of the given key to the batch. // It is safe to modify the contents of the argument after Delete returns but // not before.
[ "Delete", "appends", "delete", "operation", "of", "the", "given", "key", "to", "the", "batch", ".", "It", "is", "safe", "to", "modify", "the", "contents", "of", "the", "argument", "after", "Delete", "returns", "but", "not", "before", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/batch.go#L124-L126
158,224
syndtr/goleveldb
leveldb/batch.go
Replay
func (b *Batch) Replay(r BatchReplay) error { for _, index := range b.index { switch index.keyType { case keyTypeVal: r.Put(index.k(b.data), index.v(b.data)) case keyTypeDel: r.Delete(index.k(b.data)) } } return nil }
go
func (b *Batch) Replay(r BatchReplay) error { for _, index := range b.index { switch index.keyType { case keyTypeVal: r.Put(index.k(b.data), index.v(b.data)) case keyTypeDel: r.Delete(index.k(b.data)) } } return nil }
[ "func", "(", "b", "*", "Batch", ")", "Replay", "(", "r", "BatchReplay", ")", "error", "{", "for", "_", ",", "index", ":=", "range", "b", ".", "index", "{", "switch", "index", ".", "keyType", "{", "case", "keyTypeVal", ":", "r", ".", "Put", "(", "...
// Replay replays batch contents.
[ "Replay", "replays", "batch", "contents", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/batch.go#L145-L155
158,225
syndtr/goleveldb
leveldb/batch.go
Reset
func (b *Batch) Reset() { b.data = b.data[:0] b.index = b.index[:0] b.internalLen = 0 }
go
func (b *Batch) Reset() { b.data = b.data[:0] b.index = b.index[:0] b.internalLen = 0 }
[ "func", "(", "b", "*", "Batch", ")", "Reset", "(", ")", "{", "b", ".", "data", "=", "b", ".", "data", "[", ":", "0", "]", "\n", "b", ".", "index", "=", "b", ".", "index", "[", ":", "0", "]", "\n", "b", ".", "internalLen", "=", "0", "\n", ...
// Reset resets the batch.
[ "Reset", "resets", "the", "batch", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/batch.go#L163-L167
158,226
syndtr/goleveldb
leveldb/db.go
Open
func Open(stor storage.Storage, o *opt.Options) (db *DB, err error) { s, err := newSession(stor, o) if err != nil { return } defer func() { if err != nil { s.close() s.release() } }() err = s.recover() if err != nil { if !os.IsNotExist(err) || s.o.GetErrorIfMissing() || s.o.GetReadOnly() { return } err = s.create() if err != nil { return } } else if s.o.GetErrorIfExist() { err = os.ErrExist return } return openDB(s) }
go
func Open(stor storage.Storage, o *opt.Options) (db *DB, err error) { s, err := newSession(stor, o) if err != nil { return } defer func() { if err != nil { s.close() s.release() } }() err = s.recover() if err != nil { if !os.IsNotExist(err) || s.o.GetErrorIfMissing() || s.o.GetReadOnly() { return } err = s.create() if err != nil { return } } else if s.o.GetErrorIfExist() { err = os.ErrExist return } return openDB(s) }
[ "func", "Open", "(", "stor", "storage", ".", "Storage", ",", "o", "*", "opt", ".", "Options", ")", "(", "db", "*", "DB", ",", "err", "error", ")", "{", "s", ",", "err", ":=", "newSession", "(", "stor", ",", "o", ")", "\n", "if", "err", "!=", ...
// Open opens or creates a DB for the given storage. // The DB will be created if not exist, unless ErrorIfMissing is true. // Also, if ErrorIfExist is true and the DB exist Open will returns // os.ErrExist error. // // Open will return an error with type of ErrCorrupted if corruption // detected in the DB. Use errors.IsCorrupted to test whether an error is // due to corruption. Corrupted DB can be recovered with Recover function. // // The returned DB instance is safe for concurrent use. // The DB must be closed after use, by calling Close method.
[ "Open", "opens", "or", "creates", "a", "DB", "for", "the", "given", "storage", ".", "The", "DB", "will", "be", "created", "if", "not", "exist", "unless", "ErrorIfMissing", "is", "true", ".", "Also", "if", "ErrorIfExist", "is", "true", "and", "the", "DB",...
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/db.go#L171-L198
158,227
syndtr/goleveldb
leveldb/db.go
Recover
func Recover(stor storage.Storage, o *opt.Options) (db *DB, err error) { s, err := newSession(stor, o) if err != nil { return } defer func() { if err != nil { s.close() s.release() } }() err = recoverTable(s, o) if err != nil { return } return openDB(s) }
go
func Recover(stor storage.Storage, o *opt.Options) (db *DB, err error) { s, err := newSession(stor, o) if err != nil { return } defer func() { if err != nil { s.close() s.release() } }() err = recoverTable(s, o) if err != nil { return } return openDB(s) }
[ "func", "Recover", "(", "stor", "storage", ".", "Storage", ",", "o", "*", "opt", ".", "Options", ")", "(", "db", "*", "DB", ",", "err", "error", ")", "{", "s", ",", "err", ":=", "newSession", "(", "stor", ",", "o", ")", "\n", "if", "err", "!=",...
// Recover recovers and opens a DB with missing or corrupted manifest files // for the given storage. It will ignore any manifest files, valid or not. // The DB must already exist or it will returns an error. // Also, Recover will ignore ErrorIfMissing and ErrorIfExist options. // // The returned DB instance is safe for concurrent use. // The DB must be closed after use, by calling Close method.
[ "Recover", "recovers", "and", "opens", "a", "DB", "with", "missing", "or", "corrupted", "manifest", "files", "for", "the", "given", "storage", ".", "It", "will", "ignore", "any", "manifest", "files", "valid", "or", "not", ".", "The", "DB", "must", "already...
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/db.go#L235-L252
158,228
syndtr/goleveldb
leveldb/db.go
GetSnapshot
func (db *DB) GetSnapshot() (*Snapshot, error) { if err := db.ok(); err != nil { return nil, err } return db.newSnapshot(), nil }
go
func (db *DB) GetSnapshot() (*Snapshot, error) { if err := db.ok(); err != nil { return nil, err } return db.newSnapshot(), nil }
[ "func", "(", "db", "*", "DB", ")", "GetSnapshot", "(", ")", "(", "*", "Snapshot", ",", "error", ")", "{", "if", "err", ":=", "db", ".", "ok", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "d...
// GetSnapshot returns a latest snapshot of the underlying DB. A snapshot // is a frozen snapshot of a DB state at a particular point in time. The // content of snapshot are guaranteed to be consistent. // // The snapshot must be released after use, by calling Release method.
[ "GetSnapshot", "returns", "a", "latest", "snapshot", "of", "the", "underlying", "DB", ".", "A", "snapshot", "is", "a", "frozen", "snapshot", "of", "a", "DB", "state", "at", "a", "particular", "point", "in", "time", ".", "The", "content", "of", "snapshot", ...
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/db.go#L899-L905
158,229
syndtr/goleveldb
leveldb/db.go
Stats
func (db *DB) Stats(s *DBStats) error { err := db.ok() if err != nil { return err } s.IORead = db.s.stor.reads() s.IOWrite = db.s.stor.writes() s.WriteDelayCount = atomic.LoadInt32(&db.cWriteDelayN) s.WriteDelayDuration = time.Duration(atomic.LoadInt64(&db.cWriteDelay)) s.WritePaused = atomic.LoadInt32(&db.inWritePaused) == 1 s.OpenedTablesCount = db.s.tops.cache.Size() if db.s.tops.bcache != nil { s.BlockCacheSize = db.s.tops.bcache.Size() } else { s.BlockCacheSize = 0 } s.AliveIterators = atomic.LoadInt32(&db.aliveIters) s.AliveSnapshots = atomic.LoadInt32(&db.aliveSnaps) s.LevelDurations = s.LevelDurations[:0] s.LevelRead = s.LevelRead[:0] s.LevelWrite = s.LevelWrite[:0] s.LevelSizes = s.LevelSizes[:0] s.LevelTablesCounts = s.LevelTablesCounts[:0] v := db.s.version() defer v.release() for level, tables := range v.levels { duration, read, write := db.compStats.getStat(level) if len(tables) == 0 && duration == 0 { continue } s.LevelDurations = append(s.LevelDurations, duration) s.LevelRead = append(s.LevelRead, read) s.LevelWrite = append(s.LevelWrite, write) s.LevelSizes = append(s.LevelSizes, tables.size()) s.LevelTablesCounts = append(s.LevelTablesCounts, len(tables)) } return nil }
go
func (db *DB) Stats(s *DBStats) error { err := db.ok() if err != nil { return err } s.IORead = db.s.stor.reads() s.IOWrite = db.s.stor.writes() s.WriteDelayCount = atomic.LoadInt32(&db.cWriteDelayN) s.WriteDelayDuration = time.Duration(atomic.LoadInt64(&db.cWriteDelay)) s.WritePaused = atomic.LoadInt32(&db.inWritePaused) == 1 s.OpenedTablesCount = db.s.tops.cache.Size() if db.s.tops.bcache != nil { s.BlockCacheSize = db.s.tops.bcache.Size() } else { s.BlockCacheSize = 0 } s.AliveIterators = atomic.LoadInt32(&db.aliveIters) s.AliveSnapshots = atomic.LoadInt32(&db.aliveSnaps) s.LevelDurations = s.LevelDurations[:0] s.LevelRead = s.LevelRead[:0] s.LevelWrite = s.LevelWrite[:0] s.LevelSizes = s.LevelSizes[:0] s.LevelTablesCounts = s.LevelTablesCounts[:0] v := db.s.version() defer v.release() for level, tables := range v.levels { duration, read, write := db.compStats.getStat(level) if len(tables) == 0 && duration == 0 { continue } s.LevelDurations = append(s.LevelDurations, duration) s.LevelRead = append(s.LevelRead, read) s.LevelWrite = append(s.LevelWrite, write) s.LevelSizes = append(s.LevelSizes, tables.size()) s.LevelTablesCounts = append(s.LevelTablesCounts, len(tables)) } return nil }
[ "func", "(", "db", "*", "DB", ")", "Stats", "(", "s", "*", "DBStats", ")", "error", "{", "err", ":=", "db", ".", "ok", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "s", ".", "IORead", "=", "db", ".", "s...
// Stats populates s with database statistics.
[ "Stats", "populates", "s", "with", "database", "statistics", "." ]
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/db.go#L1040-L1084
158,230
syndtr/goleveldb
leveldb/db.go
SizeOf
func (db *DB) SizeOf(ranges []util.Range) (Sizes, error) { if err := db.ok(); err != nil { return nil, err } v := db.s.version() defer v.release() sizes := make(Sizes, 0, len(ranges)) for _, r := range ranges { imin := makeInternalKey(nil, r.Start, keyMaxSeq, keyTypeSeek) imax := makeInternalKey(nil, r.Limit, keyMaxSeq, keyTypeSeek) start, err := v.offsetOf(imin) if err != nil { return nil, err } limit, err := v.offsetOf(imax) if err != nil { return nil, err } var size int64 if limit >= start { size = limit - start } sizes = append(sizes, size) } return sizes, nil }
go
func (db *DB) SizeOf(ranges []util.Range) (Sizes, error) { if err := db.ok(); err != nil { return nil, err } v := db.s.version() defer v.release() sizes := make(Sizes, 0, len(ranges)) for _, r := range ranges { imin := makeInternalKey(nil, r.Start, keyMaxSeq, keyTypeSeek) imax := makeInternalKey(nil, r.Limit, keyMaxSeq, keyTypeSeek) start, err := v.offsetOf(imin) if err != nil { return nil, err } limit, err := v.offsetOf(imax) if err != nil { return nil, err } var size int64 if limit >= start { size = limit - start } sizes = append(sizes, size) } return sizes, nil }
[ "func", "(", "db", "*", "DB", ")", "SizeOf", "(", "ranges", "[", "]", "util", ".", "Range", ")", "(", "Sizes", ",", "error", ")", "{", "if", "err", ":=", "db", ".", "ok", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", ...
// SizeOf calculates approximate sizes of the given key ranges. // The length of the returned sizes are equal with the length of the given // ranges. The returned sizes measure storage space usage, so if the user // data compresses by a factor of ten, the returned sizes will be one-tenth // the size of the corresponding user data size. // The results may not include the sizes of recently written data.
[ "SizeOf", "calculates", "approximate", "sizes", "of", "the", "given", "key", "ranges", ".", "The", "length", "of", "the", "returned", "sizes", "are", "equal", "with", "the", "length", "of", "the", "given", "ranges", ".", "The", "returned", "sizes", "measure"...
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/db.go#L1092-L1120
158,231
syndtr/goleveldb
leveldb/db.go
Close
func (db *DB) Close() error { if !db.setClosed() { return ErrClosed } start := time.Now() db.log("db@close closing") // Clear the finalizer. runtime.SetFinalizer(db, nil) // Get compaction error. var err error select { case err = <-db.compErrC: if err == ErrReadOnly { err = nil } default: } // Signal all goroutines. close(db.closeC) // Discard open transaction. if db.tr != nil { db.tr.Discard() } // Acquire writer lock. db.writeLockC <- struct{}{} // Wait for all gorotines to exit. db.closeW.Wait() // Closes journal. if db.journal != nil { db.journal.Close() db.journalWriter.Close() db.journal = nil db.journalWriter = nil } if db.writeDelayN > 0 { db.logf("db@write was delayed N·%d T·%v", db.writeDelayN, db.writeDelay) } // Close session. db.s.close() db.logf("db@close done T·%v", time.Since(start)) db.s.release() if db.closer != nil { if err1 := db.closer.Close(); err == nil { err = err1 } db.closer = nil } // Clear memdbs. db.clearMems() return err }
go
func (db *DB) Close() error { if !db.setClosed() { return ErrClosed } start := time.Now() db.log("db@close closing") // Clear the finalizer. runtime.SetFinalizer(db, nil) // Get compaction error. var err error select { case err = <-db.compErrC: if err == ErrReadOnly { err = nil } default: } // Signal all goroutines. close(db.closeC) // Discard open transaction. if db.tr != nil { db.tr.Discard() } // Acquire writer lock. db.writeLockC <- struct{}{} // Wait for all gorotines to exit. db.closeW.Wait() // Closes journal. if db.journal != nil { db.journal.Close() db.journalWriter.Close() db.journal = nil db.journalWriter = nil } if db.writeDelayN > 0 { db.logf("db@write was delayed N·%d T·%v", db.writeDelayN, db.writeDelay) } // Close session. db.s.close() db.logf("db@close done T·%v", time.Since(start)) db.s.release() if db.closer != nil { if err1 := db.closer.Close(); err == nil { err = err1 } db.closer = nil } // Clear memdbs. db.clearMems() return err }
[ "func", "(", "db", "*", "DB", ")", "Close", "(", ")", "error", "{", "if", "!", "db", ".", "setClosed", "(", ")", "{", "return", "ErrClosed", "\n", "}", "\n\n", "start", ":=", "time", ".", "Now", "(", ")", "\n", "db", ".", "log", "(", "\"", "\...
// Close closes the DB. This will also releases any outstanding snapshot, // abort any in-flight compaction and discard open transaction. // // It is not safe to close a DB until all outstanding iterators are released. // It is valid to call Close multiple times. Other methods should not be // called after the DB has been closed.
[ "Close", "closes", "the", "DB", ".", "This", "will", "also", "releases", "any", "outstanding", "snapshot", "abort", "any", "in", "-", "flight", "compaction", "and", "discard", "open", "transaction", ".", "It", "is", "not", "safe", "to", "close", "a", "DB",...
c3a204f8e96543bb0cc090385c001078f184fc46
https://github.com/syndtr/goleveldb/blob/c3a204f8e96543bb0cc090385c001078f184fc46/leveldb/db.go#L1128-L1191
158,232
olivere/elastic
search_queries_match_all.go
Source
func (q MatchAllQuery) Source() (interface{}, error) { // { // "match_all" : { ... } // } source := make(map[string]interface{}) params := make(map[string]interface{}) source["match_all"] = params if q.boost != nil { params["boost"] = *q.boost } if q.queryName != "" { params["_name"] = q.queryName } return source, nil }
go
func (q MatchAllQuery) Source() (interface{}, error) { // { // "match_all" : { ... } // } source := make(map[string]interface{}) params := make(map[string]interface{}) source["match_all"] = params if q.boost != nil { params["boost"] = *q.boost } if q.queryName != "" { params["_name"] = q.queryName } return source, nil }
[ "func", "(", "q", "MatchAllQuery", ")", "Source", "(", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "// {", "// \"match_all\" : { ... }", "// }", "source", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "p...
// Source returns JSON for the match all query.
[ "Source", "returns", "JSON", "for", "the", "match", "all", "query", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_match_all.go#L37-L51
158,233
olivere/elastic
search_aggs.go
UnmarshalJSON
func (a *AggregationValueMetric) UnmarshalJSON(data []byte) error { var aggs map[string]json.RawMessage if err := json.Unmarshal(data, &aggs); err != nil { return err } if v, ok := aggs["value"]; ok && v != nil { json.Unmarshal(v, &a.Value) } if v, ok := aggs["meta"]; ok && v != nil { json.Unmarshal(v, &a.Meta) } a.Aggregations = aggs return nil }
go
func (a *AggregationValueMetric) UnmarshalJSON(data []byte) error { var aggs map[string]json.RawMessage if err := json.Unmarshal(data, &aggs); err != nil { return err } if v, ok := aggs["value"]; ok && v != nil { json.Unmarshal(v, &a.Value) } if v, ok := aggs["meta"]; ok && v != nil { json.Unmarshal(v, &a.Meta) } a.Aggregations = aggs return nil }
[ "func", "(", "a", "*", "AggregationValueMetric", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "aggs", "map", "[", "string", "]", "json", ".", "RawMessage", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data"...
// UnmarshalJSON decodes JSON data and initializes an AggregationValueMetric structure.
[ "UnmarshalJSON", "decodes", "JSON", "data", "and", "initializes", "an", "AggregationValueMetric", "structure", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs.go#L778-L791
158,234
olivere/elastic
search_aggs.go
UnmarshalJSON
func (a *AggregationStatsMetric) UnmarshalJSON(data []byte) error { var aggs map[string]json.RawMessage if err := json.Unmarshal(data, &aggs); err != nil { return err } if v, ok := aggs["count"]; ok && v != nil { json.Unmarshal(v, &a.Count) } if v, ok := aggs["min"]; ok && v != nil { json.Unmarshal(v, &a.Min) } if v, ok := aggs["max"]; ok && v != nil { json.Unmarshal(v, &a.Max) } if v, ok := aggs["avg"]; ok && v != nil { json.Unmarshal(v, &a.Avg) } if v, ok := aggs["sum"]; ok && v != nil { json.Unmarshal(v, &a.Sum) } if v, ok := aggs["meta"]; ok && v != nil { json.Unmarshal(v, &a.Meta) } a.Aggregations = aggs return nil }
go
func (a *AggregationStatsMetric) UnmarshalJSON(data []byte) error { var aggs map[string]json.RawMessage if err := json.Unmarshal(data, &aggs); err != nil { return err } if v, ok := aggs["count"]; ok && v != nil { json.Unmarshal(v, &a.Count) } if v, ok := aggs["min"]; ok && v != nil { json.Unmarshal(v, &a.Min) } if v, ok := aggs["max"]; ok && v != nil { json.Unmarshal(v, &a.Max) } if v, ok := aggs["avg"]; ok && v != nil { json.Unmarshal(v, &a.Avg) } if v, ok := aggs["sum"]; ok && v != nil { json.Unmarshal(v, &a.Sum) } if v, ok := aggs["meta"]; ok && v != nil { json.Unmarshal(v, &a.Meta) } a.Aggregations = aggs return nil }
[ "func", "(", "a", "*", "AggregationStatsMetric", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "aggs", "map", "[", "string", "]", "json", ".", "RawMessage", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data"...
// UnmarshalJSON decodes JSON data and initializes an AggregationStatsMetric structure.
[ "UnmarshalJSON", "decodes", "JSON", "data", "and", "initializes", "an", "AggregationStatsMetric", "structure", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs.go#L808-L833
158,235
olivere/elastic
search_aggs.go
UnmarshalJSON
func (a *AggregationGeoCentroidMetric) UnmarshalJSON(data []byte) error { var aggs map[string]json.RawMessage if err := json.Unmarshal(data, &aggs); err != nil { return err } if v, ok := aggs["location"]; ok && v != nil { json.Unmarshal(v, &a.Location) } if v, ok := aggs["meta"]; ok && v != nil { json.Unmarshal(v, &a.Meta) } if v, ok := aggs["count"]; ok && v != nil { json.Unmarshal(v, &a.Count) } a.Aggregations = aggs return nil }
go
func (a *AggregationGeoCentroidMetric) UnmarshalJSON(data []byte) error { var aggs map[string]json.RawMessage if err := json.Unmarshal(data, &aggs); err != nil { return err } if v, ok := aggs["location"]; ok && v != nil { json.Unmarshal(v, &a.Location) } if v, ok := aggs["meta"]; ok && v != nil { json.Unmarshal(v, &a.Meta) } if v, ok := aggs["count"]; ok && v != nil { json.Unmarshal(v, &a.Count) } a.Aggregations = aggs return nil }
[ "func", "(", "a", "*", "AggregationGeoCentroidMetric", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "aggs", "map", "[", "string", "]", "json", ".", "RawMessage", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", ...
// UnmarshalJSON decodes JSON data and initializes an AggregationGeoCentroidMetric structure.
[ "UnmarshalJSON", "decodes", "JSON", "data", "and", "initializes", "an", "AggregationGeoCentroidMetric", "structure", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs.go#L1033-L1049
158,236
olivere/elastic
search_aggs.go
UnmarshalJSON
func (a *AggregationBucketRangeItem) UnmarshalJSON(data []byte) error { var aggs map[string]json.RawMessage if err := json.Unmarshal(data, &aggs); err != nil { return err } if v, ok := aggs["key"]; ok && v != nil { json.Unmarshal(v, &a.Key) } if v, ok := aggs["doc_count"]; ok && v != nil { json.Unmarshal(v, &a.DocCount) } if v, ok := aggs["from"]; ok && v != nil { json.Unmarshal(v, &a.From) } if v, ok := aggs["from_as_string"]; ok && v != nil { json.Unmarshal(v, &a.FromAsString) } if v, ok := aggs["to"]; ok && v != nil { json.Unmarshal(v, &a.To) } if v, ok := aggs["to_as_string"]; ok && v != nil { json.Unmarshal(v, &a.ToAsString) } a.Aggregations = aggs return nil }
go
func (a *AggregationBucketRangeItem) UnmarshalJSON(data []byte) error { var aggs map[string]json.RawMessage if err := json.Unmarshal(data, &aggs); err != nil { return err } if v, ok := aggs["key"]; ok && v != nil { json.Unmarshal(v, &a.Key) } if v, ok := aggs["doc_count"]; ok && v != nil { json.Unmarshal(v, &a.DocCount) } if v, ok := aggs["from"]; ok && v != nil { json.Unmarshal(v, &a.From) } if v, ok := aggs["from_as_string"]; ok && v != nil { json.Unmarshal(v, &a.FromAsString) } if v, ok := aggs["to"]; ok && v != nil { json.Unmarshal(v, &a.To) } if v, ok := aggs["to_as_string"]; ok && v != nil { json.Unmarshal(v, &a.ToAsString) } a.Aggregations = aggs return nil }
[ "func", "(", "a", "*", "AggregationBucketRangeItem", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "aggs", "map", "[", "string", "]", "json", ".", "RawMessage", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "d...
// UnmarshalJSON decodes JSON data and initializes an AggregationBucketRangeItem structure.
[ "UnmarshalJSON", "decodes", "JSON", "data", "and", "initializes", "an", "AggregationBucketRangeItem", "structure", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs.go#L1158-L1183
158,237
olivere/elastic
search_aggs.go
UnmarshalJSON
func (a *AggregationBucketHistogramItem) UnmarshalJSON(data []byte) error { var aggs map[string]json.RawMessage if err := json.Unmarshal(data, &aggs); err != nil { return err } if v, ok := aggs["key"]; ok && v != nil { json.Unmarshal(v, &a.Key) } if v, ok := aggs["key_as_string"]; ok && v != nil { json.Unmarshal(v, &a.KeyAsString) } if v, ok := aggs["doc_count"]; ok && v != nil { json.Unmarshal(v, &a.DocCount) } a.Aggregations = aggs return nil }
go
func (a *AggregationBucketHistogramItem) UnmarshalJSON(data []byte) error { var aggs map[string]json.RawMessage if err := json.Unmarshal(data, &aggs); err != nil { return err } if v, ok := aggs["key"]; ok && v != nil { json.Unmarshal(v, &a.Key) } if v, ok := aggs["key_as_string"]; ok && v != nil { json.Unmarshal(v, &a.KeyAsString) } if v, ok := aggs["doc_count"]; ok && v != nil { json.Unmarshal(v, &a.DocCount) } a.Aggregations = aggs return nil }
[ "func", "(", "a", "*", "AggregationBucketHistogramItem", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "aggs", "map", "[", "string", "]", "json", ".", "RawMessage", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", ...
// UnmarshalJSON decodes JSON data and initializes an AggregationBucketHistogramItem structure.
[ "UnmarshalJSON", "decodes", "JSON", "data", "and", "initializes", "an", "AggregationBucketHistogramItem", "structure", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs.go#L1433-L1449
158,238
olivere/elastic
search_aggs.go
UnmarshalJSON
func (a *AggregationPipelineDerivative) UnmarshalJSON(data []byte) error { var aggs map[string]json.RawMessage if err := json.Unmarshal(data, &aggs); err != nil { return err } if v, ok := aggs["value"]; ok && v != nil { json.Unmarshal(v, &a.Value) } if v, ok := aggs["value_as_string"]; ok && v != nil { json.Unmarshal(v, &a.ValueAsString) } if v, ok := aggs["normalized_value"]; ok && v != nil { json.Unmarshal(v, &a.NormalizedValue) } if v, ok := aggs["normalized_value_as_string"]; ok && v != nil { json.Unmarshal(v, &a.NormalizedValueAsString) } if v, ok := aggs["meta"]; ok && v != nil { json.Unmarshal(v, &a.Meta) } a.Aggregations = aggs return nil }
go
func (a *AggregationPipelineDerivative) UnmarshalJSON(data []byte) error { var aggs map[string]json.RawMessage if err := json.Unmarshal(data, &aggs); err != nil { return err } if v, ok := aggs["value"]; ok && v != nil { json.Unmarshal(v, &a.Value) } if v, ok := aggs["value_as_string"]; ok && v != nil { json.Unmarshal(v, &a.ValueAsString) } if v, ok := aggs["normalized_value"]; ok && v != nil { json.Unmarshal(v, &a.NormalizedValue) } if v, ok := aggs["normalized_value_as_string"]; ok && v != nil { json.Unmarshal(v, &a.NormalizedValueAsString) } if v, ok := aggs["meta"]; ok && v != nil { json.Unmarshal(v, &a.Meta) } a.Aggregations = aggs return nil }
[ "func", "(", "a", "*", "AggregationPipelineDerivative", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "aggs", "map", "[", "string", "]", "json", ".", "RawMessage", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", ...
// UnmarshalJSON decodes JSON data and initializes an AggregationPipelineDerivative structure.
[ "UnmarshalJSON", "decodes", "JSON", "data", "and", "initializes", "an", "AggregationPipelineDerivative", "structure", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs.go#L1532-L1554
158,239
olivere/elastic
search_aggs.go
UnmarshalJSON
func (a *AggregationPipelineStatsMetric) UnmarshalJSON(data []byte) error { var aggs map[string]json.RawMessage if err := json.Unmarshal(data, &aggs); err != nil { return err } if v, ok := aggs["count"]; ok && v != nil { json.Unmarshal(v, &a.Count) } if v, ok := aggs["count_as_string"]; ok && v != nil { json.Unmarshal(v, &a.CountAsString) } if v, ok := aggs["min"]; ok && v != nil { json.Unmarshal(v, &a.Min) } if v, ok := aggs["min_as_string"]; ok && v != nil { json.Unmarshal(v, &a.MinAsString) } if v, ok := aggs["max"]; ok && v != nil { json.Unmarshal(v, &a.Max) } if v, ok := aggs["max_as_string"]; ok && v != nil { json.Unmarshal(v, &a.MaxAsString) } if v, ok := aggs["avg"]; ok && v != nil { json.Unmarshal(v, &a.Avg) } if v, ok := aggs["avg_as_string"]; ok && v != nil { json.Unmarshal(v, &a.AvgAsString) } if v, ok := aggs["sum"]; ok && v != nil { json.Unmarshal(v, &a.Sum) } if v, ok := aggs["sum_as_string"]; ok && v != nil { json.Unmarshal(v, &a.SumAsString) } if v, ok := aggs["meta"]; ok && v != nil { json.Unmarshal(v, &a.Meta) } a.Aggregations = aggs return nil }
go
func (a *AggregationPipelineStatsMetric) UnmarshalJSON(data []byte) error { var aggs map[string]json.RawMessage if err := json.Unmarshal(data, &aggs); err != nil { return err } if v, ok := aggs["count"]; ok && v != nil { json.Unmarshal(v, &a.Count) } if v, ok := aggs["count_as_string"]; ok && v != nil { json.Unmarshal(v, &a.CountAsString) } if v, ok := aggs["min"]; ok && v != nil { json.Unmarshal(v, &a.Min) } if v, ok := aggs["min_as_string"]; ok && v != nil { json.Unmarshal(v, &a.MinAsString) } if v, ok := aggs["max"]; ok && v != nil { json.Unmarshal(v, &a.Max) } if v, ok := aggs["max_as_string"]; ok && v != nil { json.Unmarshal(v, &a.MaxAsString) } if v, ok := aggs["avg"]; ok && v != nil { json.Unmarshal(v, &a.Avg) } if v, ok := aggs["avg_as_string"]; ok && v != nil { json.Unmarshal(v, &a.AvgAsString) } if v, ok := aggs["sum"]; ok && v != nil { json.Unmarshal(v, &a.Sum) } if v, ok := aggs["sum_as_string"]; ok && v != nil { json.Unmarshal(v, &a.SumAsString) } if v, ok := aggs["meta"]; ok && v != nil { json.Unmarshal(v, &a.Meta) } a.Aggregations = aggs return nil }
[ "func", "(", "a", "*", "AggregationPipelineStatsMetric", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "aggs", "map", "[", "string", "]", "json", ".", "RawMessage", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", ...
// UnmarshalJSON decodes JSON data and initializes an AggregationPipelineStatsMetric structure.
[ "UnmarshalJSON", "decodes", "JSON", "data", "and", "initializes", "an", "AggregationPipelineStatsMetric", "structure", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs.go#L1578-L1618
158,240
olivere/elastic
ingest_get_pipeline.go
Id
func (s *IngestGetPipelineService) Id(id ...string) *IngestGetPipelineService { s.id = append(s.id, id...) return s }
go
func (s *IngestGetPipelineService) Id(id ...string) *IngestGetPipelineService { s.id = append(s.id, id...) return s }
[ "func", "(", "s", "*", "IngestGetPipelineService", ")", "Id", "(", "id", "...", "string", ")", "*", "IngestGetPipelineService", "{", "s", ".", "id", "=", "append", "(", "s", ".", "id", ",", "id", "...", ")", "\n", "return", "s", "\n", "}" ]
// Id is a list of pipeline ids. Wildcards supported.
[ "Id", "is", "a", "list", "of", "pipeline", "ids", ".", "Wildcards", "supported", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/ingest_get_pipeline.go#L34-L37
158,241
olivere/elastic
search_aggs_pipeline_percentiles_bucket.go
Format
func (p *PercentilesBucketAggregation) Format(format string) *PercentilesBucketAggregation { p.format = format return p }
go
func (p *PercentilesBucketAggregation) Format(format string) *PercentilesBucketAggregation { p.format = format return p }
[ "func", "(", "p", "*", "PercentilesBucketAggregation", ")", "Format", "(", "format", "string", ")", "*", "PercentilesBucketAggregation", "{", "p", ".", "format", "=", "format", "\n", "return", "p", "\n", "}" ]
// Format to apply the output value of this aggregation.
[ "Format", "to", "apply", "the", "output", "value", "of", "this", "aggregation", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_pipeline_percentiles_bucket.go#L29-L32
158,242
olivere/elastic
search_aggs_pipeline_percentiles_bucket.go
Percents
func (p *PercentilesBucketAggregation) Percents(percents ...float64) *PercentilesBucketAggregation { p.percents = percents return p }
go
func (p *PercentilesBucketAggregation) Percents(percents ...float64) *PercentilesBucketAggregation { p.percents = percents return p }
[ "func", "(", "p", "*", "PercentilesBucketAggregation", ")", "Percents", "(", "percents", "...", "float64", ")", "*", "PercentilesBucketAggregation", "{", "p", ".", "percents", "=", "percents", "\n", "return", "p", "\n", "}" ]
// Percents to calculate percentiles for in this aggregation.
[ "Percents", "to", "calculate", "percentiles", "for", "in", "this", "aggregation", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_aggs_pipeline_percentiles_bucket.go#L35-L38
158,243
olivere/elastic
search_queries_ids.go
Ids
func (q *IdsQuery) Ids(ids ...string) *IdsQuery { q.values = append(q.values, ids...) return q }
go
func (q *IdsQuery) Ids(ids ...string) *IdsQuery { q.values = append(q.values, ids...) return q }
[ "func", "(", "q", "*", "IdsQuery", ")", "Ids", "(", "ids", "...", "string", ")", "*", "IdsQuery", "{", "q", ".", "values", "=", "append", "(", "q", ".", "values", ",", "ids", "...", ")", "\n", "return", "q", "\n", "}" ]
// Ids adds ids to the filter.
[ "Ids", "adds", "ids", "to", "the", "filter", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_ids.go#L30-L33
158,244
olivere/elastic
search_queries_ids.go
QueryName
func (q *IdsQuery) QueryName(queryName string) *IdsQuery { q.queryName = queryName return q }
go
func (q *IdsQuery) QueryName(queryName string) *IdsQuery { q.queryName = queryName return q }
[ "func", "(", "q", "*", "IdsQuery", ")", "QueryName", "(", "queryName", "string", ")", "*", "IdsQuery", "{", "q", ".", "queryName", "=", "queryName", "\n", "return", "q", "\n", "}" ]
// QueryName sets the query name for the filter.
[ "QueryName", "sets", "the", "query", "name", "for", "the", "filter", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_ids.go#L42-L45
158,245
olivere/elastic
snapshot_create_repository.go
Verify
func (s *SnapshotCreateRepositoryService) Verify(verify bool) *SnapshotCreateRepositoryService { s.verify = &verify return s }
go
func (s *SnapshotCreateRepositoryService) Verify(verify bool) *SnapshotCreateRepositoryService { s.verify = &verify return s }
[ "func", "(", "s", "*", "SnapshotCreateRepositoryService", ")", "Verify", "(", "verify", "bool", ")", "*", "SnapshotCreateRepositoryService", "{", "s", ".", "verify", "=", "&", "verify", "\n", "return", "s", "\n", "}" ]
// Verify indicates whether to verify the repository after creation.
[ "Verify", "indicates", "whether", "to", "verify", "the", "repository", "after", "creation", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/snapshot_create_repository.go#L58-L61
158,246
olivere/elastic
snapshot_create_repository.go
Settings
func (s *SnapshotCreateRepositoryService) Settings(settings map[string]interface{}) *SnapshotCreateRepositoryService { s.settings = settings return s }
go
func (s *SnapshotCreateRepositoryService) Settings(settings map[string]interface{}) *SnapshotCreateRepositoryService { s.settings = settings return s }
[ "func", "(", "s", "*", "SnapshotCreateRepositoryService", ")", "Settings", "(", "settings", "map", "[", "string", "]", "interface", "{", "}", ")", "*", "SnapshotCreateRepositoryService", "{", "s", ".", "settings", "=", "settings", "\n", "return", "s", "\n", ...
// Settings sets all settings of the snapshot repository.
[ "Settings", "sets", "all", "settings", "of", "the", "snapshot", "repository", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/snapshot_create_repository.go#L76-L79
158,247
olivere/elastic
snapshot_create_repository.go
Setting
func (s *SnapshotCreateRepositoryService) Setting(name string, value interface{}) *SnapshotCreateRepositoryService { if s.settings == nil { s.settings = make(map[string]interface{}) } s.settings[name] = value return s }
go
func (s *SnapshotCreateRepositoryService) Setting(name string, value interface{}) *SnapshotCreateRepositoryService { if s.settings == nil { s.settings = make(map[string]interface{}) } s.settings[name] = value return s }
[ "func", "(", "s", "*", "SnapshotCreateRepositoryService", ")", "Setting", "(", "name", "string", ",", "value", "interface", "{", "}", ")", "*", "SnapshotCreateRepositoryService", "{", "if", "s", ".", "settings", "==", "nil", "{", "s", ".", "settings", "=", ...
// Setting sets a single settings of the snapshot repository.
[ "Setting", "sets", "a", "single", "settings", "of", "the", "snapshot", "repository", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/snapshot_create_repository.go#L82-L88
158,248
olivere/elastic
snapshot_create_repository.go
buildBody
func (s *SnapshotCreateRepositoryService) buildBody() (interface{}, error) { if s.bodyJson != nil { return s.bodyJson, nil } if s.bodyString != "" { return s.bodyString, nil } body := map[string]interface{}{ "type": s.typ, } if len(s.settings) > 0 { body["settings"] = s.settings } return body, nil }
go
func (s *SnapshotCreateRepositoryService) buildBody() (interface{}, error) { if s.bodyJson != nil { return s.bodyJson, nil } if s.bodyString != "" { return s.bodyString, nil } body := map[string]interface{}{ "type": s.typ, } if len(s.settings) > 0 { body["settings"] = s.settings } return body, nil }
[ "func", "(", "s", "*", "SnapshotCreateRepositoryService", ")", "buildBody", "(", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "if", "s", ".", "bodyJson", "!=", "nil", "{", "return", "s", ".", "bodyJson", ",", "nil", "\n", "}", "\n", "if",...
// buildBody builds the body for the operation.
[ "buildBody", "builds", "the", "body", "for", "the", "operation", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/snapshot_create_repository.go#L130-L145
158,249
olivere/elastic
indices_exists.go
NewIndicesExistsService
func NewIndicesExistsService(client *Client) *IndicesExistsService { return &IndicesExistsService{ client: client, index: make([]string, 0), } }
go
func NewIndicesExistsService(client *Client) *IndicesExistsService { return &IndicesExistsService{ client: client, index: make([]string, 0), } }
[ "func", "NewIndicesExistsService", "(", "client", "*", "Client", ")", "*", "IndicesExistsService", "{", "return", "&", "IndicesExistsService", "{", "client", ":", "client", ",", "index", ":", "make", "(", "[", "]", "string", ",", "0", ")", ",", "}", "\n", ...
// NewIndicesExistsService creates and initializes a new IndicesExistsService.
[ "NewIndicesExistsService", "creates", "and", "initializes", "a", "new", "IndicesExistsService", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_exists.go#L32-L37
158,250
olivere/elastic
indices_exists.go
Index
func (s *IndicesExistsService) Index(index []string) *IndicesExistsService { s.index = index return s }
go
func (s *IndicesExistsService) Index(index []string) *IndicesExistsService { s.index = index return s }
[ "func", "(", "s", "*", "IndicesExistsService", ")", "Index", "(", "index", "[", "]", "string", ")", "*", "IndicesExistsService", "{", "s", ".", "index", "=", "index", "\n", "return", "s", "\n", "}" ]
// Index is a list of one or more indices to check.
[ "Index", "is", "a", "list", "of", "one", "or", "more", "indices", "to", "check", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_exists.go#L40-L43
158,251
olivere/elastic
xpack_security_put_role.go
Name
func (s *XPackSecurityPutRoleService) Name(name string) *XPackSecurityPutRoleService { s.name = name return s }
go
func (s *XPackSecurityPutRoleService) Name(name string) *XPackSecurityPutRoleService { s.name = name return s }
[ "func", "(", "s", "*", "XPackSecurityPutRoleService", ")", "Name", "(", "name", "string", ")", "*", "XPackSecurityPutRoleService", "{", "s", ".", "name", "=", "name", "\n", "return", "s", "\n", "}" ]
// Name is name of the role to create.
[ "Name", "is", "name", "of", "the", "role", "to", "create", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/xpack_security_put_role.go#L33-L36
158,252
olivere/elastic
search_queries_range.go
Gt
func (q *RangeQuery) Gt(from interface{}) *RangeQuery { q.from = from q.includeLower = false return q }
go
func (q *RangeQuery) Gt(from interface{}) *RangeQuery { q.from = from q.includeLower = false return q }
[ "func", "(", "q", "*", "RangeQuery", ")", "Gt", "(", "from", "interface", "{", "}", ")", "*", "RangeQuery", "{", "q", ".", "from", "=", "from", "\n", "q", ".", "includeLower", "=", "false", "\n", "return", "q", "\n", "}" ]
// Gt indicates a greater-than value for the from part. // Use nil to indicate an unbounded from part.
[ "Gt", "indicates", "a", "greater", "-", "than", "value", "for", "the", "from", "part", ".", "Use", "nil", "to", "indicate", "an", "unbounded", "from", "part", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_range.go#L38-L42
158,253
olivere/elastic
search_queries_range.go
Gte
func (q *RangeQuery) Gte(from interface{}) *RangeQuery { q.from = from q.includeLower = true return q }
go
func (q *RangeQuery) Gte(from interface{}) *RangeQuery { q.from = from q.includeLower = true return q }
[ "func", "(", "q", "*", "RangeQuery", ")", "Gte", "(", "from", "interface", "{", "}", ")", "*", "RangeQuery", "{", "q", ".", "from", "=", "from", "\n", "q", ".", "includeLower", "=", "true", "\n", "return", "q", "\n", "}" ]
// Gte indicates a greater-than-or-equal value for the from part. // Use nil to indicate an unbounded from part.
[ "Gte", "indicates", "a", "greater", "-", "than", "-", "or", "-", "equal", "value", "for", "the", "from", "part", ".", "Use", "nil", "to", "indicate", "an", "unbounded", "from", "part", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_range.go#L46-L50
158,254
olivere/elastic
search_queries_range.go
Format
func (q *RangeQuery) Format(format string) *RangeQuery { q.format = format return q }
go
func (q *RangeQuery) Format(format string) *RangeQuery { q.format = format return q }
[ "func", "(", "q", "*", "RangeQuery", ")", "Format", "(", "format", "string", ")", "*", "RangeQuery", "{", "q", ".", "format", "=", "format", "\n", "return", "q", "\n", "}" ]
// Format is used for date fields. In that case, we can set the format // to be used instead of the mapper format.
[ "Format", "is", "used", "for", "date", "fields", ".", "In", "that", "case", "we", "can", "set", "the", "format", "to", "be", "used", "instead", "of", "the", "mapper", "format", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_range.go#L111-L114
158,255
olivere/elastic
nodes_stats.go
Metric
func (s *NodesStatsService) Metric(metric ...string) *NodesStatsService { s.metric = append(s.metric, metric...) return s }
go
func (s *NodesStatsService) Metric(metric ...string) *NodesStatsService { s.metric = append(s.metric, metric...) return s }
[ "func", "(", "s", "*", "NodesStatsService", ")", "Metric", "(", "metric", "...", "string", ")", "*", "NodesStatsService", "{", "s", ".", "metric", "=", "append", "(", "s", ".", "metric", ",", "metric", "...", ")", "\n", "return", "s", "\n", "}" ]
// Metric limits the information returned to the specified metrics.
[ "Metric", "limits", "the", "information", "returned", "to", "the", "specified", "metrics", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/nodes_stats.go#L44-L47
158,256
olivere/elastic
nodes_stats.go
Level
func (s *NodesStatsService) Level(level string) *NodesStatsService { s.level = level return s }
go
func (s *NodesStatsService) Level(level string) *NodesStatsService { s.level = level return s }
[ "func", "(", "s", "*", "NodesStatsService", ")", "Level", "(", "level", "string", ")", "*", "NodesStatsService", "{", "s", ".", "level", "=", "level", "\n", "return", "s", "\n", "}" ]
// Level specifies whether to return indices stats aggregated at node, index or shard level.
[ "Level", "specifies", "whether", "to", "return", "indices", "stats", "aggregated", "at", "node", "index", "or", "shard", "level", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/nodes_stats.go#L97-L100
158,257
olivere/elastic
nodes_stats.go
Types
func (s *NodesStatsService) Types(types ...string) *NodesStatsService { s.types = append(s.types, types...) return s }
go
func (s *NodesStatsService) Types(types ...string) *NodesStatsService { s.types = append(s.types, types...) return s }
[ "func", "(", "s", "*", "NodesStatsService", ")", "Types", "(", "types", "...", "string", ")", "*", "NodesStatsService", "{", "s", ".", "types", "=", "append", "(", "s", ".", "types", ",", "types", "...", ")", "\n", "return", "s", "\n", "}" ]
// Types a list of document types for the `indexing` index metric.
[ "Types", "a", "list", "of", "document", "types", "for", "the", "indexing", "index", "metric", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/nodes_stats.go#L109-L112
158,258
olivere/elastic
search_queries_raw_string.go
Source
func (q RawStringQuery) Source() (interface{}, error) { var f interface{} err := json.Unmarshal([]byte(q), &f) return f, err }
go
func (q RawStringQuery) Source() (interface{}, error) { var f interface{} err := json.Unmarshal([]byte(q), &f) return f, err }
[ "func", "(", "q", "RawStringQuery", ")", "Source", "(", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "var", "f", "interface", "{", "}", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "[", "]", "byte", "(", "q", ")", ",", "&", "f"...
// Source returns the JSON encoded body
[ "Source", "returns", "the", "JSON", "encoded", "body" ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_raw_string.go#L22-L26
158,259
olivere/elastic
search_queries_parent_id.go
NewParentIdQuery
func NewParentIdQuery(typ, id string) *ParentIdQuery { return &ParentIdQuery{ typ: typ, id: id, } }
go
func NewParentIdQuery(typ, id string) *ParentIdQuery { return &ParentIdQuery{ typ: typ, id: id, } }
[ "func", "NewParentIdQuery", "(", "typ", ",", "id", "string", ")", "*", "ParentIdQuery", "{", "return", "&", "ParentIdQuery", "{", "typ", ":", "typ", ",", "id", ":", "id", ",", "}", "\n", "}" ]
// NewParentIdQuery creates and initializes a new parent_id query.
[ "NewParentIdQuery", "creates", "and", "initializes", "a", "new", "parent_id", "query", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_parent_id.go#L22-L27
158,260
olivere/elastic
search_queries_parent_id.go
Type
func (q *ParentIdQuery) Type(typ string) *ParentIdQuery { q.typ = typ return q }
go
func (q *ParentIdQuery) Type(typ string) *ParentIdQuery { q.typ = typ return q }
[ "func", "(", "q", "*", "ParentIdQuery", ")", "Type", "(", "typ", "string", ")", "*", "ParentIdQuery", "{", "q", ".", "typ", "=", "typ", "\n", "return", "q", "\n", "}" ]
// Type sets the parent type.
[ "Type", "sets", "the", "parent", "type", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_parent_id.go#L30-L33
158,261
olivere/elastic
search_queries_parent_id.go
Id
func (q *ParentIdQuery) Id(id string) *ParentIdQuery { q.id = id return q }
go
func (q *ParentIdQuery) Id(id string) *ParentIdQuery { q.id = id return q }
[ "func", "(", "q", "*", "ParentIdQuery", ")", "Id", "(", "id", "string", ")", "*", "ParentIdQuery", "{", "q", ".", "id", "=", "id", "\n", "return", "q", "\n", "}" ]
// Id sets the id.
[ "Id", "sets", "the", "id", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_parent_id.go#L36-L39
158,262
olivere/elastic
search_queries_parent_id.go
QueryName
func (q *ParentIdQuery) QueryName(queryName string) *ParentIdQuery { q.queryName = queryName return q }
go
func (q *ParentIdQuery) QueryName(queryName string) *ParentIdQuery { q.queryName = queryName return q }
[ "func", "(", "q", "*", "ParentIdQuery", ")", "QueryName", "(", "queryName", "string", ")", "*", "ParentIdQuery", "{", "q", ".", "queryName", "=", "queryName", "\n", "return", "q", "\n", "}" ]
// QueryName specifies the query name for the filter that can be used when // searching for matched filters per hit.
[ "QueryName", "specifies", "the", "query", "name", "for", "the", "filter", "that", "can", "be", "used", "when", "searching", "for", "matched", "filters", "per", "hit", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_parent_id.go#L56-L59
158,263
olivere/elastic
search_queries_parent_id.go
InnerHit
func (q *ParentIdQuery) InnerHit(innerHit *InnerHit) *ParentIdQuery { q.innerHit = innerHit return q }
go
func (q *ParentIdQuery) InnerHit(innerHit *InnerHit) *ParentIdQuery { q.innerHit = innerHit return q }
[ "func", "(", "q", "*", "ParentIdQuery", ")", "InnerHit", "(", "innerHit", "*", "InnerHit", ")", "*", "ParentIdQuery", "{", "q", ".", "innerHit", "=", "innerHit", "\n", "return", "q", "\n", "}" ]
// InnerHit sets the inner hit definition in the scope of this query and // reusing the defined type and query.
[ "InnerHit", "sets", "the", "inner", "hit", "definition", "in", "the", "scope", "of", "this", "query", "and", "reusing", "the", "defined", "type", "and", "query", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_parent_id.go#L63-L66
158,264
olivere/elastic
search_queries_parent_id.go
Source
func (q *ParentIdQuery) Source() (interface{}, error) { // { // "parent_id" : { // "type" : "blog", // "id" : "1" // } // } source := make(map[string]interface{}) query := make(map[string]interface{}) source["parent_id"] = query query["type"] = q.typ query["id"] = q.id if q.boost != nil { query["boost"] = *q.boost } if q.ignoreUnmapped != nil { query["ignore_unmapped"] = *q.ignoreUnmapped } if q.queryName != "" { query["_name"] = q.queryName } if q.innerHit != nil { src, err := q.innerHit.Source() if err != nil { return nil, err } query["inner_hits"] = src } return source, nil }
go
func (q *ParentIdQuery) Source() (interface{}, error) { // { // "parent_id" : { // "type" : "blog", // "id" : "1" // } // } source := make(map[string]interface{}) query := make(map[string]interface{}) source["parent_id"] = query query["type"] = q.typ query["id"] = q.id if q.boost != nil { query["boost"] = *q.boost } if q.ignoreUnmapped != nil { query["ignore_unmapped"] = *q.ignoreUnmapped } if q.queryName != "" { query["_name"] = q.queryName } if q.innerHit != nil { src, err := q.innerHit.Source() if err != nil { return nil, err } query["inner_hits"] = src } return source, nil }
[ "func", "(", "q", "*", "ParentIdQuery", ")", "Source", "(", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "// {", "// \"parent_id\" : {", "// \"type\" : \"blog\",", "// \"id\" : \"1\"", "// }", "// }", "source", ":=", "make", "(", "map...
// Source returns JSON for the parent_id query.
[ "Source", "returns", "JSON", "for", "the", "parent_id", "query", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_parent_id.go#L69-L99
158,265
olivere/elastic
tasks_list.go
Actions
func (s *TasksListService) Actions(actions ...string) *TasksListService { s.actions = append(s.actions, actions...) return s }
go
func (s *TasksListService) Actions(actions ...string) *TasksListService { s.actions = append(s.actions, actions...) return s }
[ "func", "(", "s", "*", "TasksListService", ")", "Actions", "(", "actions", "...", "string", ")", "*", "TasksListService", "{", "s", ".", "actions", "=", "append", "(", "s", ".", "actions", ",", "actions", "...", ")", "\n", "return", "s", "\n", "}" ]
// Actions is a list of actions that should be returned. Leave empty to return all.
[ "Actions", "is", "a", "list", "of", "actions", "that", "should", "be", "returned", ".", "Leave", "empty", "to", "return", "all", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/tasks_list.go#L52-L55
158,266
olivere/elastic
mget.go
Add
func (s *MgetService) Add(items ...*MultiGetItem) *MgetService { s.items = append(s.items, items...) return s }
go
func (s *MgetService) Add(items ...*MultiGetItem) *MgetService { s.items = append(s.items, items...) return s }
[ "func", "(", "s", "*", "MgetService", ")", "Add", "(", "items", "...", "*", "MultiGetItem", ")", "*", "MgetService", "{", "s", ".", "items", "=", "append", "(", "s", ".", "items", ",", "items", "...", ")", "\n", "return", "s", "\n", "}" ]
// Add an item to the request.
[ "Add", "an", "item", "to", "the", "request", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/mget.go#L81-L84
158,267
olivere/elastic
mget.go
Source
func (s *MgetService) Source() (interface{}, error) { source := make(map[string]interface{}) items := make([]interface{}, len(s.items)) for i, item := range s.items { src, err := item.Source() if err != nil { return nil, err } items[i] = src } source["docs"] = items return source, nil }
go
func (s *MgetService) Source() (interface{}, error) { source := make(map[string]interface{}) items := make([]interface{}, len(s.items)) for i, item := range s.items { src, err := item.Source() if err != nil { return nil, err } items[i] = src } source["docs"] = items return source, nil }
[ "func", "(", "s", "*", "MgetService", ")", "Source", "(", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "source", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "items", ":=", "make", "(", "[", "]", "...
// Source returns the request body, which will be serialized into JSON.
[ "Source", "returns", "the", "request", "body", "which", "will", "be", "serialized", "into", "JSON", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/mget.go#L87-L99
158,268
olivere/elastic
mget.go
Do
func (s *MgetService) Do(ctx context.Context) (*MgetResponse, error) { // Build url path := "/_mget" params := make(url.Values) if s.realtime != nil { params.Add("realtime", fmt.Sprintf("%v", *s.realtime)) } if s.preference != "" { params.Add("preference", s.preference) } if s.refresh != "" { params.Add("refresh", s.refresh) } if s.routing != "" { params.Set("routing", s.routing) } if len(s.storedFields) > 0 { params.Set("stored_fields", strings.Join(s.storedFields, ",")) } // Set body body, err := s.Source() if err != nil { return nil, err } // Get response res, err := s.client.PerformRequest(ctx, PerformRequestOptions{ Method: "GET", Path: path, Params: params, Body: body, }) if err != nil { return nil, err } // Return result ret := new(MgetResponse) if err := s.client.decoder.Decode(res.Body, ret); err != nil { return nil, err } return ret, nil }
go
func (s *MgetService) Do(ctx context.Context) (*MgetResponse, error) { // Build url path := "/_mget" params := make(url.Values) if s.realtime != nil { params.Add("realtime", fmt.Sprintf("%v", *s.realtime)) } if s.preference != "" { params.Add("preference", s.preference) } if s.refresh != "" { params.Add("refresh", s.refresh) } if s.routing != "" { params.Set("routing", s.routing) } if len(s.storedFields) > 0 { params.Set("stored_fields", strings.Join(s.storedFields, ",")) } // Set body body, err := s.Source() if err != nil { return nil, err } // Get response res, err := s.client.PerformRequest(ctx, PerformRequestOptions{ Method: "GET", Path: path, Params: params, Body: body, }) if err != nil { return nil, err } // Return result ret := new(MgetResponse) if err := s.client.decoder.Decode(res.Body, ret); err != nil { return nil, err } return ret, nil }
[ "func", "(", "s", "*", "MgetService", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "*", "MgetResponse", ",", "error", ")", "{", "// Build url", "path", ":=", "\"", "\"", "\n\n", "params", ":=", "make", "(", "url", ".", "Values", ")", ...
// Do executes the request.
[ "Do", "executes", "the", "request", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/mget.go#L102-L146
158,269
olivere/elastic
mget.go
Index
func (item *MultiGetItem) Index(index string) *MultiGetItem { item.index = index return item }
go
func (item *MultiGetItem) Index(index string) *MultiGetItem { item.index = index return item }
[ "func", "(", "item", "*", "MultiGetItem", ")", "Index", "(", "index", "string", ")", "*", "MultiGetItem", "{", "item", ".", "index", "=", "index", "\n", "return", "item", "\n", "}" ]
// Index specifies the index name.
[ "Index", "specifies", "the", "index", "name", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/mget.go#L168-L171
158,270
olivere/elastic
mget.go
Type
func (item *MultiGetItem) Type(typ string) *MultiGetItem { item.typ = typ return item }
go
func (item *MultiGetItem) Type(typ string) *MultiGetItem { item.typ = typ return item }
[ "func", "(", "item", "*", "MultiGetItem", ")", "Type", "(", "typ", "string", ")", "*", "MultiGetItem", "{", "item", ".", "typ", "=", "typ", "\n", "return", "item", "\n", "}" ]
// Type specifies the type name.
[ "Type", "specifies", "the", "type", "name", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/mget.go#L174-L177
158,271
olivere/elastic
mget.go
Id
func (item *MultiGetItem) Id(id string) *MultiGetItem { item.id = id return item }
go
func (item *MultiGetItem) Id(id string) *MultiGetItem { item.id = id return item }
[ "func", "(", "item", "*", "MultiGetItem", ")", "Id", "(", "id", "string", ")", "*", "MultiGetItem", "{", "item", ".", "id", "=", "id", "\n", "return", "item", "\n", "}" ]
// Id specifies the identifier of the document.
[ "Id", "specifies", "the", "identifier", "of", "the", "document", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/mget.go#L180-L183
158,272
olivere/elastic
mget.go
VersionType
func (item *MultiGetItem) VersionType(versionType string) *MultiGetItem { item.versionType = versionType return item }
go
func (item *MultiGetItem) VersionType(versionType string) *MultiGetItem { item.versionType = versionType return item }
[ "func", "(", "item", "*", "MultiGetItem", ")", "VersionType", "(", "versionType", "string", ")", "*", "MultiGetItem", "{", "item", ".", "versionType", "=", "versionType", "\n", "return", "item", "\n", "}" ]
// VersionType can be "internal", "external", "external_gt", or "external_gte". // See org.elasticsearch.index.VersionType in Elasticsearch source. // It is "internal" by default.
[ "VersionType", "can", "be", "internal", "external", "external_gt", "or", "external_gte", ".", "See", "org", ".", "elasticsearch", ".", "index", ".", "VersionType", "in", "Elasticsearch", "source", ".", "It", "is", "internal", "by", "default", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/mget.go#L208-L211
158,273
olivere/elastic
mget.go
FetchSource
func (item *MultiGetItem) FetchSource(fetchSourceContext *FetchSourceContext) *MultiGetItem { item.fsc = fetchSourceContext return item }
go
func (item *MultiGetItem) FetchSource(fetchSourceContext *FetchSourceContext) *MultiGetItem { item.fsc = fetchSourceContext return item }
[ "func", "(", "item", "*", "MultiGetItem", ")", "FetchSource", "(", "fetchSourceContext", "*", "FetchSourceContext", ")", "*", "MultiGetItem", "{", "item", ".", "fsc", "=", "fetchSourceContext", "\n", "return", "item", "\n", "}" ]
// FetchSource allows to specify source filtering.
[ "FetchSource", "allows", "to", "specify", "source", "filtering", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/mget.go#L214-L217
158,274
olivere/elastic
docvalue_field.go
Source
func (d DocvalueField) Source() (interface{}, error) { if d.Format == "" { return d.Field, nil } return map[string]interface{}{ "field": d.Field, "format": d.Format, }, nil }
go
func (d DocvalueField) Source() (interface{}, error) { if d.Format == "" { return d.Field, nil } return map[string]interface{}{ "field": d.Field, "format": d.Format, }, nil }
[ "func", "(", "d", "DocvalueField", ")", "Source", "(", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "if", "d", ".", "Format", "==", "\"", "\"", "{", "return", "d", ".", "Field", ",", "nil", "\n", "}", "\n", "return", "map", "[", "st...
// Source serializes the DocvalueField into JSON.
[ "Source", "serializes", "the", "DocvalueField", "into", "JSON", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/docvalue_field.go#L15-L23
158,275
olivere/elastic
docvalue_field.go
Source
func (d DocvalueFields) Source() (interface{}, error) { if d == nil { return nil, nil } v := make([]interface{}, 0) for _, f := range d { src, err := f.Source() if err != nil { return nil, err } v = append(v, src) } return v, nil }
go
func (d DocvalueFields) Source() (interface{}, error) { if d == nil { return nil, nil } v := make([]interface{}, 0) for _, f := range d { src, err := f.Source() if err != nil { return nil, err } v = append(v, src) } return v, nil }
[ "func", "(", "d", "DocvalueFields", ")", "Source", "(", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "if", "d", "==", "nil", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "v", ":=", "make", "(", "[", "]", "interface", "{", "}",...
// Source serializes the DocvalueFields into JSON.
[ "Source", "serializes", "the", "DocvalueFields", "into", "JSON", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/docvalue_field.go#L29-L42
158,276
olivere/elastic
indices_forcemerge.go
NewIndicesForcemergeService
func NewIndicesForcemergeService(client *Client) *IndicesForcemergeService { return &IndicesForcemergeService{ client: client, index: make([]string, 0), } }
go
func NewIndicesForcemergeService(client *Client) *IndicesForcemergeService { return &IndicesForcemergeService{ client: client, index: make([]string, 0), } }
[ "func", "NewIndicesForcemergeService", "(", "client", "*", "Client", ")", "*", "IndicesForcemergeService", "{", "return", "&", "IndicesForcemergeService", "{", "client", ":", "client", ",", "index", ":", "make", "(", "[", "]", "string", ",", "0", ")", ",", "...
// NewIndicesForcemergeService creates a new IndicesForcemergeService.
[ "NewIndicesForcemergeService", "creates", "a", "new", "IndicesForcemergeService", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_forcemerge.go#L36-L41
158,277
olivere/elastic
indices_forcemerge.go
OnlyExpungeDeletes
func (s *IndicesForcemergeService) OnlyExpungeDeletes(onlyExpungeDeletes bool) *IndicesForcemergeService { s.onlyExpungeDeletes = &onlyExpungeDeletes return s }
go
func (s *IndicesForcemergeService) OnlyExpungeDeletes(onlyExpungeDeletes bool) *IndicesForcemergeService { s.onlyExpungeDeletes = &onlyExpungeDeletes return s }
[ "func", "(", "s", "*", "IndicesForcemergeService", ")", "OnlyExpungeDeletes", "(", "onlyExpungeDeletes", "bool", ")", "*", "IndicesForcemergeService", "{", "s", ".", "onlyExpungeDeletes", "=", "&", "onlyExpungeDeletes", "\n", "return", "s", "\n", "}" ]
// OnlyExpungeDeletes specifies whether the operation should only expunge // deleted documents.
[ "OnlyExpungeDeletes", "specifies", "whether", "the", "operation", "should", "only", "expunge", "deleted", "documents", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_forcemerge.go#L91-L94
158,278
olivere/elastic
search_queries_wildcard.go
NewWildcardQuery
func NewWildcardQuery(name, wildcard string) *WildcardQuery { return &WildcardQuery{ name: name, wildcard: wildcard, } }
go
func NewWildcardQuery(name, wildcard string) *WildcardQuery { return &WildcardQuery{ name: name, wildcard: wildcard, } }
[ "func", "NewWildcardQuery", "(", "name", ",", "wildcard", "string", ")", "*", "WildcardQuery", "{", "return", "&", "WildcardQuery", "{", "name", ":", "name", ",", "wildcard", ":", "wildcard", ",", "}", "\n", "}" ]
// NewWildcardQuery creates and initializes a new WildcardQuery.
[ "NewWildcardQuery", "creates", "and", "initializes", "a", "new", "WildcardQuery", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_queries_wildcard.go#L26-L31
158,279
olivere/elastic
tasks_cancel.go
Actions
func (s *TasksCancelService) Actions(actions ...string) *TasksCancelService { s.actions = append(s.actions, actions...) return s }
go
func (s *TasksCancelService) Actions(actions ...string) *TasksCancelService { s.actions = append(s.actions, actions...) return s }
[ "func", "(", "s", "*", "TasksCancelService", ")", "Actions", "(", "actions", "...", "string", ")", "*", "TasksCancelService", "{", "s", ".", "actions", "=", "append", "(", "s", ".", "actions", ",", "actions", "...", ")", "\n", "return", "s", "\n", "}" ...
// Actions is a list of actions that should be cancelled. Leave empty to cancel all.
[ "Actions", "is", "a", "list", "of", "actions", "that", "should", "be", "cancelled", ".", "Leave", "empty", "to", "cancel", "all", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/tasks_cancel.go#L54-L57
158,280
olivere/elastic
tasks_cancel.go
ParentTaskIdFromNodeAndId
func (s *TasksCancelService) ParentTaskIdFromNodeAndId(nodeId string, id int64) *TasksCancelService { if id != -1 { s.parentTaskId = fmt.Sprintf("%s:%d", nodeId, id) } return s }
go
func (s *TasksCancelService) ParentTaskIdFromNodeAndId(nodeId string, id int64) *TasksCancelService { if id != -1 { s.parentTaskId = fmt.Sprintf("%s:%d", nodeId, id) } return s }
[ "func", "(", "s", "*", "TasksCancelService", ")", "ParentTaskIdFromNodeAndId", "(", "nodeId", "string", ",", "id", "int64", ")", "*", "TasksCancelService", "{", "if", "id", "!=", "-", "1", "{", "s", ".", "parentTaskId", "=", "fmt", ".", "Sprintf", "(", "...
// ParentTaskIdFromNodeAndId specifies to cancel tasks with specified parent task id.
[ "ParentTaskIdFromNodeAndId", "specifies", "to", "cancel", "tasks", "with", "specified", "parent", "task", "id", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/tasks_cancel.go#L76-L81
158,281
olivere/elastic
search_source.go
Query
func (s *SearchSource) Query(query Query) *SearchSource { s.query = query return s }
go
func (s *SearchSource) Query(query Query) *SearchSource { s.query = query return s }
[ "func", "(", "s", "*", "SearchSource", ")", "Query", "(", "query", "Query", ")", "*", "SearchSource", "{", "s", ".", "query", "=", "query", "\n", "return", "s", "\n", "}" ]
// Query sets the query to use with this search source.
[ "Query", "sets", "the", "query", "to", "use", "with", "this", "search", "source", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_source.go#L58-L61
158,282
olivere/elastic
search_source.go
TimeoutInMillis
func (s *SearchSource) TimeoutInMillis(timeoutInMillis int) *SearchSource { s.timeout = fmt.Sprintf("%dms", timeoutInMillis) return s }
go
func (s *SearchSource) TimeoutInMillis(timeoutInMillis int) *SearchSource { s.timeout = fmt.Sprintf("%dms", timeoutInMillis) return s }
[ "func", "(", "s", "*", "SearchSource", ")", "TimeoutInMillis", "(", "timeoutInMillis", "int", ")", "*", "SearchSource", "{", "s", ".", "timeout", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "timeoutInMillis", ")", "\n", "return", "s", "\n", "}" ]
// TimeoutInMillis controls how many milliseconds a search is allowed // to take before it is canceled.
[ "TimeoutInMillis", "controls", "how", "many", "milliseconds", "a", "search", "is", "allowed", "to", "take", "before", "it", "is", "canceled", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_source.go#L128-L131
158,283
olivere/elastic
search_source.go
DefaultRescoreWindowSize
func (s *SearchSource) DefaultRescoreWindowSize(defaultRescoreWindowSize int) *SearchSource { s.defaultRescoreWindowSize = &defaultRescoreWindowSize return s }
go
func (s *SearchSource) DefaultRescoreWindowSize(defaultRescoreWindowSize int) *SearchSource { s.defaultRescoreWindowSize = &defaultRescoreWindowSize return s }
[ "func", "(", "s", "*", "SearchSource", ")", "DefaultRescoreWindowSize", "(", "defaultRescoreWindowSize", "int", ")", "*", "SearchSource", "{", "s", ".", "defaultRescoreWindowSize", "=", "&", "defaultRescoreWindowSize", "\n", "return", "s", "\n", "}" ]
// DefaultRescoreWindowSize sets the rescore window size for rescores // that don't specify their window.
[ "DefaultRescoreWindowSize", "sets", "the", "rescore", "window", "size", "for", "rescores", "that", "don", "t", "specify", "their", "window", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_source.go#L196-L199
158,284
olivere/elastic
search_source.go
Highlighter
func (s *SearchSource) Highlighter() *Highlight { if s.highlight == nil { s.highlight = NewHighlight() } return s.highlight }
go
func (s *SearchSource) Highlighter() *Highlight { if s.highlight == nil { s.highlight = NewHighlight() } return s.highlight }
[ "func", "(", "s", "*", "SearchSource", ")", "Highlighter", "(", ")", "*", "Highlight", "{", "if", "s", ".", "highlight", "==", "nil", "{", "s", ".", "highlight", "=", "NewHighlight", "(", ")", "\n", "}", "\n", "return", "s", ".", "highlight", "\n", ...
// Highlighter returns the highlighter.
[ "Highlighter", "returns", "the", "highlighter", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_source.go#L208-L213
158,285
olivere/elastic
search_source.go
DocvalueField
func (s *SearchSource) DocvalueField(fieldDataField string) *SearchSource { s.docvalueFields = append(s.docvalueFields, DocvalueField{Field: fieldDataField}) return s }
go
func (s *SearchSource) DocvalueField(fieldDataField string) *SearchSource { s.docvalueFields = append(s.docvalueFields, DocvalueField{Field: fieldDataField}) return s }
[ "func", "(", "s", "*", "SearchSource", ")", "DocvalueField", "(", "fieldDataField", "string", ")", "*", "SearchSource", "{", "s", ".", "docvalueFields", "=", "append", "(", "s", ".", "docvalueFields", ",", "DocvalueField", "{", "Field", ":", "fieldDataField", ...
// DocvalueField adds a single field to load from the field data cache // and return as part of the search request.
[ "DocvalueField", "adds", "a", "single", "field", "to", "load", "from", "the", "field", "data", "cache", "and", "return", "as", "part", "of", "the", "search", "request", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_source.go#L292-L295
158,286
olivere/elastic
search_source.go
DocvalueFieldWithFormat
func (s *SearchSource) DocvalueFieldWithFormat(fieldDataFieldWithFormat DocvalueField) *SearchSource { s.docvalueFields = append(s.docvalueFields, fieldDataFieldWithFormat) return s }
go
func (s *SearchSource) DocvalueFieldWithFormat(fieldDataFieldWithFormat DocvalueField) *SearchSource { s.docvalueFields = append(s.docvalueFields, fieldDataFieldWithFormat) return s }
[ "func", "(", "s", "*", "SearchSource", ")", "DocvalueFieldWithFormat", "(", "fieldDataFieldWithFormat", "DocvalueField", ")", "*", "SearchSource", "{", "s", ".", "docvalueFields", "=", "append", "(", "s", ".", "docvalueFields", ",", "fieldDataFieldWithFormat", ")", ...
// DocvalueField adds a single docvalue field to load from the field data cache // and return as part of the search request.
[ "DocvalueField", "adds", "a", "single", "docvalue", "field", "to", "load", "from", "the", "field", "data", "cache", "and", "return", "as", "part", "of", "the", "search", "request", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_source.go#L299-L302
158,287
olivere/elastic
search_source.go
DocvalueFields
func (s *SearchSource) DocvalueFields(docvalueFields ...string) *SearchSource { for _, f := range docvalueFields { s.docvalueFields = append(s.docvalueFields, DocvalueField{Field: f}) } return s }
go
func (s *SearchSource) DocvalueFields(docvalueFields ...string) *SearchSource { for _, f := range docvalueFields { s.docvalueFields = append(s.docvalueFields, DocvalueField{Field: f}) } return s }
[ "func", "(", "s", "*", "SearchSource", ")", "DocvalueFields", "(", "docvalueFields", "...", "string", ")", "*", "SearchSource", "{", "for", "_", ",", "f", ":=", "range", "docvalueFields", "{", "s", ".", "docvalueFields", "=", "append", "(", "s", ".", "do...
// DocvalueFields adds one or more fields to load from the field data cache // and return as part of the search request.
[ "DocvalueFields", "adds", "one", "or", "more", "fields", "to", "load", "from", "the", "field", "data", "cache", "and", "return", "as", "part", "of", "the", "search", "request", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_source.go#L306-L311
158,288
olivere/elastic
search_source.go
DocvalueFieldsWithFormat
func (s *SearchSource) DocvalueFieldsWithFormat(docvalueFields ...DocvalueField) *SearchSource { s.docvalueFields = append(s.docvalueFields, docvalueFields...) return s }
go
func (s *SearchSource) DocvalueFieldsWithFormat(docvalueFields ...DocvalueField) *SearchSource { s.docvalueFields = append(s.docvalueFields, docvalueFields...) return s }
[ "func", "(", "s", "*", "SearchSource", ")", "DocvalueFieldsWithFormat", "(", "docvalueFields", "...", "DocvalueField", ")", "*", "SearchSource", "{", "s", ".", "docvalueFields", "=", "append", "(", "s", ".", "docvalueFields", ",", "docvalueFields", "...", ")", ...
// DocvalueFields adds one or more docvalue fields to load from the field data cache // and return as part of the search request.
[ "DocvalueFields", "adds", "one", "or", "more", "docvalue", "fields", "to", "load", "from", "the", "field", "data", "cache", "and", "return", "as", "part", "of", "the", "search", "request", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_source.go#L315-L318
158,289
olivere/elastic
search_source.go
ScriptField
func (s *SearchSource) ScriptField(scriptField *ScriptField) *SearchSource { s.scriptFields = append(s.scriptFields, scriptField) return s }
go
func (s *SearchSource) ScriptField(scriptField *ScriptField) *SearchSource { s.scriptFields = append(s.scriptFields, scriptField) return s }
[ "func", "(", "s", "*", "SearchSource", ")", "ScriptField", "(", "scriptField", "*", "ScriptField", ")", "*", "SearchSource", "{", "s", ".", "scriptFields", "=", "append", "(", "s", ".", "scriptFields", ",", "scriptField", ")", "\n", "return", "s", "\n", ...
// ScriptField adds a single script field with the provided script.
[ "ScriptField", "adds", "a", "single", "script", "field", "with", "the", "provided", "script", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_source.go#L321-L324
158,290
olivere/elastic
search_source.go
ScriptFields
func (s *SearchSource) ScriptFields(scriptFields ...*ScriptField) *SearchSource { s.scriptFields = append(s.scriptFields, scriptFields...) return s }
go
func (s *SearchSource) ScriptFields(scriptFields ...*ScriptField) *SearchSource { s.scriptFields = append(s.scriptFields, scriptFields...) return s }
[ "func", "(", "s", "*", "SearchSource", ")", "ScriptFields", "(", "scriptFields", "...", "*", "ScriptField", ")", "*", "SearchSource", "{", "s", ".", "scriptFields", "=", "append", "(", "s", ".", "scriptFields", ",", "scriptFields", "...", ")", "\n", "retur...
// ScriptFields adds one or more script fields with the provided scripts.
[ "ScriptFields", "adds", "one", "or", "more", "script", "fields", "with", "the", "provided", "scripts", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_source.go#L327-L330
158,291
olivere/elastic
search_source.go
IndexBoost
func (s *SearchSource) IndexBoost(index string, boost float64) *SearchSource { s.indexBoosts[index] = boost return s }
go
func (s *SearchSource) IndexBoost(index string, boost float64) *SearchSource { s.indexBoosts[index] = boost return s }
[ "func", "(", "s", "*", "SearchSource", ")", "IndexBoost", "(", "index", "string", ",", "boost", "float64", ")", "*", "SearchSource", "{", "s", ".", "indexBoosts", "[", "index", "]", "=", "boost", "\n", "return", "s", "\n", "}" ]
// IndexBoost sets the boost that a specific index will receive when the // query is executed against it.
[ "IndexBoost", "sets", "the", "boost", "that", "a", "specific", "index", "will", "receive", "when", "the", "query", "is", "executed", "against", "it", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_source.go#L334-L337
158,292
olivere/elastic
search_source.go
Stats
func (s *SearchSource) Stats(statsGroup ...string) *SearchSource { s.stats = append(s.stats, statsGroup...) return s }
go
func (s *SearchSource) Stats(statsGroup ...string) *SearchSource { s.stats = append(s.stats, statsGroup...) return s }
[ "func", "(", "s", "*", "SearchSource", ")", "Stats", "(", "statsGroup", "...", "string", ")", "*", "SearchSource", "{", "s", ".", "stats", "=", "append", "(", "s", ".", "stats", ",", "statsGroup", "...", ")", "\n", "return", "s", "\n", "}" ]
// Stats group this request will be aggregated under.
[ "Stats", "group", "this", "request", "will", "be", "aggregated", "under", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_source.go#L340-L343
158,293
olivere/elastic
search_source.go
InnerHit
func (s *SearchSource) InnerHit(name string, innerHit *InnerHit) *SearchSource { s.innerHits[name] = innerHit return s }
go
func (s *SearchSource) InnerHit(name string, innerHit *InnerHit) *SearchSource { s.innerHits[name] = innerHit return s }
[ "func", "(", "s", "*", "SearchSource", ")", "InnerHit", "(", "name", "string", ",", "innerHit", "*", "InnerHit", ")", "*", "SearchSource", "{", "s", ".", "innerHits", "[", "name", "]", "=", "innerHit", "\n", "return", "s", "\n", "}" ]
// InnerHit adds an inner hit to return with the result.
[ "InnerHit", "adds", "an", "inner", "hit", "to", "return", "with", "the", "result", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/search_source.go#L346-L349
158,294
olivere/elastic
indices_analyze.go
NewIndicesAnalyzeService
func NewIndicesAnalyzeService(client *Client) *IndicesAnalyzeService { return &IndicesAnalyzeService{ client: client, request: new(IndicesAnalyzeRequest), } }
go
func NewIndicesAnalyzeService(client *Client) *IndicesAnalyzeService { return &IndicesAnalyzeService{ client: client, request: new(IndicesAnalyzeRequest), } }
[ "func", "NewIndicesAnalyzeService", "(", "client", "*", "Client", ")", "*", "IndicesAnalyzeService", "{", "return", "&", "IndicesAnalyzeService", "{", "client", ":", "client", ",", "request", ":", "new", "(", "IndicesAnalyzeRequest", ")", ",", "}", "\n", "}" ]
// NewIndicesAnalyzeService creates a new IndicesAnalyzeService.
[ "NewIndicesAnalyzeService", "creates", "a", "new", "IndicesAnalyzeService", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_analyze.go#L32-L37
158,295
olivere/elastic
indices_analyze.go
Index
func (s *IndicesAnalyzeService) Index(index string) *IndicesAnalyzeService { s.index = index return s }
go
func (s *IndicesAnalyzeService) Index(index string) *IndicesAnalyzeService { s.index = index return s }
[ "func", "(", "s", "*", "IndicesAnalyzeService", ")", "Index", "(", "index", "string", ")", "*", "IndicesAnalyzeService", "{", "s", ".", "index", "=", "index", "\n", "return", "s", "\n", "}" ]
// Index is the name of the index to scope the operation.
[ "Index", "is", "the", "name", "of", "the", "index", "to", "scope", "the", "operation", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_analyze.go#L40-L43
158,296
olivere/elastic
indices_analyze.go
Format
func (s *IndicesAnalyzeService) Format(format string) *IndicesAnalyzeService { s.format = format return s }
go
func (s *IndicesAnalyzeService) Format(format string) *IndicesAnalyzeService { s.format = format return s }
[ "func", "(", "s", "*", "IndicesAnalyzeService", ")", "Format", "(", "format", "string", ")", "*", "IndicesAnalyzeService", "{", "s", ".", "format", "=", "format", "\n", "return", "s", "\n", "}" ]
// Format of the output.
[ "Format", "of", "the", "output", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_analyze.go#L46-L49
158,297
olivere/elastic
indices_analyze.go
Request
func (s *IndicesAnalyzeService) Request(request *IndicesAnalyzeRequest) *IndicesAnalyzeService { if request == nil { s.request = new(IndicesAnalyzeRequest) } else { s.request = request } return s }
go
func (s *IndicesAnalyzeService) Request(request *IndicesAnalyzeRequest) *IndicesAnalyzeService { if request == nil { s.request = new(IndicesAnalyzeRequest) } else { s.request = request } return s }
[ "func", "(", "s", "*", "IndicesAnalyzeService", ")", "Request", "(", "request", "*", "IndicesAnalyzeRequest", ")", "*", "IndicesAnalyzeService", "{", "if", "request", "==", "nil", "{", "s", ".", "request", "=", "new", "(", "IndicesAnalyzeRequest", ")", "\n", ...
// Request passes the analyze request to use.
[ "Request", "passes", "the", "analyze", "request", "to", "use", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_analyze.go#L59-L66
158,298
olivere/elastic
indices_analyze.go
Analyzer
func (s *IndicesAnalyzeService) Analyzer(analyzer string) *IndicesAnalyzeService { s.request.Analyzer = analyzer return s }
go
func (s *IndicesAnalyzeService) Analyzer(analyzer string) *IndicesAnalyzeService { s.request.Analyzer = analyzer return s }
[ "func", "(", "s", "*", "IndicesAnalyzeService", ")", "Analyzer", "(", "analyzer", "string", ")", "*", "IndicesAnalyzeService", "{", "s", ".", "request", ".", "Analyzer", "=", "analyzer", "\n", "return", "s", "\n", "}" ]
// Analyzer is the name of the analyzer to use.
[ "Analyzer", "is", "the", "name", "of", "the", "analyzer", "to", "use", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_analyze.go#L69-L72
158,299
olivere/elastic
indices_analyze.go
Attributes
func (s *IndicesAnalyzeService) Attributes(attributes ...string) *IndicesAnalyzeService { s.request.Attributes = attributes return s }
go
func (s *IndicesAnalyzeService) Attributes(attributes ...string) *IndicesAnalyzeService { s.request.Attributes = attributes return s }
[ "func", "(", "s", "*", "IndicesAnalyzeService", ")", "Attributes", "(", "attributes", "...", "string", ")", "*", "IndicesAnalyzeService", "{", "s", ".", "request", ".", "Attributes", "=", "attributes", "\n", "return", "s", "\n", "}" ]
// Attributes is a list of token attributes to output; this parameter works // only with explain=true.
[ "Attributes", "is", "a", "list", "of", "token", "attributes", "to", "output", ";", "this", "parameter", "works", "only", "with", "explain", "=", "true", "." ]
0534a7b1bf47b1ccf57e905491a641709f8a623d
https://github.com/olivere/elastic/blob/0534a7b1bf47b1ccf57e905491a641709f8a623d/indices_analyze.go#L76-L79