updated dependencies and go 1.17
This commit is contained in:
parent
58caf0527e
commit
76360ddbc2
32 changed files with 434 additions and 174 deletions
12
vendor/github.com/blevesearch/bleve/go.mod
generated
vendored
12
vendor/github.com/blevesearch/bleve/go.mod
generated
vendored
|
|
@ -4,15 +4,15 @@ go 1.13
|
|||
|
||||
require (
|
||||
github.com/RoaringBitmap/roaring v0.4.23
|
||||
github.com/blevesearch/blevex v0.0.0-20190916190636-152f0fe5c040
|
||||
github.com/blevesearch/blevex v1.0.0
|
||||
github.com/blevesearch/go-porterstemmer v1.0.3
|
||||
github.com/blevesearch/segment v0.9.0
|
||||
github.com/blevesearch/snowballstem v0.9.0
|
||||
github.com/blevesearch/zap/v11 v11.0.12
|
||||
github.com/blevesearch/zap/v12 v12.0.12
|
||||
github.com/blevesearch/zap/v13 v13.0.4
|
||||
github.com/blevesearch/zap/v14 v14.0.3
|
||||
github.com/blevesearch/zap/v15 v15.0.1
|
||||
github.com/blevesearch/zap/v11 v11.0.14
|
||||
github.com/blevesearch/zap/v12 v12.0.14
|
||||
github.com/blevesearch/zap/v13 v13.0.6
|
||||
github.com/blevesearch/zap/v14 v14.0.5
|
||||
github.com/blevesearch/zap/v15 v15.0.3
|
||||
github.com/couchbase/moss v0.1.0
|
||||
github.com/couchbase/vellum v1.0.2
|
||||
github.com/golang/protobuf v1.3.2
|
||||
|
|
|
|||
41
vendor/github.com/blevesearch/bleve/mapping/document.go
generated
vendored
41
vendor/github.com/blevesearch/bleve/mapping/document.go
generated
vendored
|
|
@ -106,28 +106,31 @@ func (dm *DocumentMapping) fieldDescribedByPath(path string) *FieldMapping {
|
|||
return subDocMapping.fieldDescribedByPath(encodePath(pathElements[1:]))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// just 1 path elememnt
|
||||
// first look for property name with empty field
|
||||
for propName, subDocMapping := range dm.Properties {
|
||||
if propName == pathElements[0] {
|
||||
// found property name match, now look at its fields
|
||||
for _, field := range subDocMapping.Fields {
|
||||
if field.Name == "" || field.Name == pathElements[0] {
|
||||
// match
|
||||
return field
|
||||
}
|
||||
}
|
||||
|
||||
// either the path just had one element
|
||||
// or it had multiple, but no match for the first element at this level
|
||||
// look for match with full path
|
||||
|
||||
// first look for property name with empty field
|
||||
for propName, subDocMapping := range dm.Properties {
|
||||
if propName == path {
|
||||
// found property name match, now look at its fields
|
||||
for _, field := range subDocMapping.Fields {
|
||||
if field.Name == "" || field.Name == path {
|
||||
// match
|
||||
return field
|
||||
}
|
||||
}
|
||||
}
|
||||
// next, walk the properties again, looking for field overriding the name
|
||||
for propName, subDocMapping := range dm.Properties {
|
||||
if propName != pathElements[0] {
|
||||
// property name isn't a match, but field name could override it
|
||||
for _, field := range subDocMapping.Fields {
|
||||
if field.Name == pathElements[0] {
|
||||
return field
|
||||
}
|
||||
}
|
||||
// next, walk the properties again, looking for field overriding the name
|
||||
for propName, subDocMapping := range dm.Properties {
|
||||
if propName != path {
|
||||
// property name isn't a match, but field name could override it
|
||||
for _, field := range subDocMapping.Fields {
|
||||
if field.Name == path {
|
||||
return field
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
vendor/github.com/blevesearch/bleve/mapping/index.go
generated
vendored
2
vendor/github.com/blevesearch/bleve/mapping/index.go
generated
vendored
|
|
@ -50,7 +50,7 @@ type IndexMappingImpl struct {
|
|||
DefaultField string `json:"default_field"`
|
||||
StoreDynamic bool `json:"store_dynamic"`
|
||||
IndexDynamic bool `json:"index_dynamic"`
|
||||
DocValuesDynamic bool `json:"docvalues_dynamic,omitempty"`
|
||||
DocValuesDynamic bool `json:"docvalues_dynamic"`
|
||||
CustomAnalysis *customAnalysis `json:"analysis,omitempty"`
|
||||
cache *registry.Cache
|
||||
}
|
||||
|
|
|
|||
2
vendor/github.com/blevesearch/zap/v11/go.mod
generated
vendored
2
vendor/github.com/blevesearch/zap/v11/go.mod
generated
vendored
|
|
@ -4,7 +4,7 @@ go 1.12
|
|||
|
||||
require (
|
||||
github.com/RoaringBitmap/roaring v0.4.23
|
||||
github.com/blevesearch/bleve v1.0.12
|
||||
github.com/blevesearch/bleve v1.0.14
|
||||
github.com/blevesearch/mmap-go v1.0.2
|
||||
github.com/couchbase/vellum v1.0.2
|
||||
github.com/golang/snappy v0.0.1
|
||||
|
|
|
|||
2
vendor/github.com/blevesearch/zap/v12/go.mod
generated
vendored
2
vendor/github.com/blevesearch/zap/v12/go.mod
generated
vendored
|
|
@ -4,7 +4,7 @@ go 1.12
|
|||
|
||||
require (
|
||||
github.com/RoaringBitmap/roaring v0.4.23
|
||||
github.com/blevesearch/bleve v1.0.12
|
||||
github.com/blevesearch/bleve v1.0.14
|
||||
github.com/blevesearch/mmap-go v1.0.2
|
||||
github.com/couchbase/vellum v1.0.2
|
||||
github.com/golang/snappy v0.0.1
|
||||
|
|
|
|||
2
vendor/github.com/blevesearch/zap/v13/go.mod
generated
vendored
2
vendor/github.com/blevesearch/zap/v13/go.mod
generated
vendored
|
|
@ -4,7 +4,7 @@ go 1.12
|
|||
|
||||
require (
|
||||
github.com/RoaringBitmap/roaring v0.4.23
|
||||
github.com/blevesearch/bleve v1.0.12
|
||||
github.com/blevesearch/bleve v1.0.14
|
||||
github.com/blevesearch/mmap-go v1.0.2
|
||||
github.com/couchbase/vellum v1.0.2
|
||||
github.com/golang/snappy v0.0.1
|
||||
|
|
|
|||
2
vendor/github.com/blevesearch/zap/v14/go.mod
generated
vendored
2
vendor/github.com/blevesearch/zap/v14/go.mod
generated
vendored
|
|
@ -4,7 +4,7 @@ go 1.12
|
|||
|
||||
require (
|
||||
github.com/RoaringBitmap/roaring v0.4.23
|
||||
github.com/blevesearch/bleve v1.0.12
|
||||
github.com/blevesearch/bleve v1.0.14
|
||||
github.com/blevesearch/mmap-go v1.0.2
|
||||
github.com/couchbase/vellum v1.0.2
|
||||
github.com/golang/snappy v0.0.1
|
||||
|
|
|
|||
2
vendor/github.com/blevesearch/zap/v15/go.mod
generated
vendored
2
vendor/github.com/blevesearch/zap/v15/go.mod
generated
vendored
|
|
@ -4,7 +4,7 @@ go 1.12
|
|||
|
||||
require (
|
||||
github.com/RoaringBitmap/roaring v0.4.23
|
||||
github.com/blevesearch/bleve v1.0.12
|
||||
github.com/blevesearch/bleve v1.0.14
|
||||
github.com/blevesearch/mmap-go v1.0.2
|
||||
github.com/couchbase/vellum v1.0.2
|
||||
github.com/golang/snappy v0.0.1
|
||||
|
|
|
|||
8
vendor/github.com/blevesearch/zap/v15/intDecoder.go
generated
vendored
8
vendor/github.com/blevesearch/zap/v15/intDecoder.go
generated
vendored
|
|
@ -105,6 +105,10 @@ func (d *chunkedIntDecoder) readUvarint() (uint64, error) {
|
|||
return d.r.ReadUvarint()
|
||||
}
|
||||
|
||||
func (d *chunkedIntDecoder) readBytes(start, end int) []byte {
|
||||
return d.curChunkBytes[start:end]
|
||||
}
|
||||
|
||||
func (d *chunkedIntDecoder) SkipUvarint() {
|
||||
d.r.SkipUvarint()
|
||||
}
|
||||
|
|
@ -116,3 +120,7 @@ func (d *chunkedIntDecoder) SkipBytes(count int) {
|
|||
func (d *chunkedIntDecoder) Len() int {
|
||||
return d.r.Len()
|
||||
}
|
||||
|
||||
func (d *chunkedIntDecoder) remainingLen() int {
|
||||
return len(d.curChunkBytes) - d.r.Len()
|
||||
}
|
||||
|
|
|
|||
51
vendor/github.com/blevesearch/zap/v15/merge.go
generated
vendored
51
vendor/github.com/blevesearch/zap/v15/merge.go
generated
vendored
|
|
@ -341,11 +341,16 @@ func persistMergedRest(segments []*SegmentBase, dropsIn []*roaring.Bitmap,
|
|||
|
||||
postItr = postings.iterator(true, true, true, postItr)
|
||||
|
||||
// can no longer optimize by copying, since chunk factor could have changed
|
||||
lastDocNum, lastFreq, lastNorm, bufLoc, err = mergeTermFreqNormLocs(
|
||||
fieldsMap, term, postItr, newDocNums[itrI], newRoaring,
|
||||
tfEncoder, locEncoder, bufLoc)
|
||||
|
||||
if fieldsSame {
|
||||
// can optimize by copying freq/norm/loc bytes directly
|
||||
lastDocNum, lastFreq, lastNorm, err = mergeTermFreqNormLocsByCopying(
|
||||
term, postItr, newDocNums[itrI], newRoaring,
|
||||
tfEncoder, locEncoder)
|
||||
} else {
|
||||
lastDocNum, lastFreq, lastNorm, bufLoc, err = mergeTermFreqNormLocs(
|
||||
fieldsMap, term, postItr, newDocNums[itrI], newRoaring,
|
||||
tfEncoder, locEncoder, bufLoc)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
|
@ -473,6 +478,42 @@ func persistMergedRest(segments []*SegmentBase, dropsIn []*roaring.Bitmap,
|
|||
return rv, fieldDvLocsOffset, nil
|
||||
}
|
||||
|
||||
func mergeTermFreqNormLocsByCopying(term []byte, postItr *PostingsIterator,
|
||||
newDocNums []uint64, newRoaring *roaring.Bitmap,
|
||||
tfEncoder *chunkedIntCoder, locEncoder *chunkedIntCoder) (
|
||||
lastDocNum uint64, lastFreq uint64, lastNorm uint64, err error) {
|
||||
nextDocNum, nextFreq, nextNorm, nextFreqNormBytes, nextLocBytes, err :=
|
||||
postItr.nextBytes()
|
||||
for err == nil && len(nextFreqNormBytes) > 0 {
|
||||
hitNewDocNum := newDocNums[nextDocNum]
|
||||
if hitNewDocNum == docDropped {
|
||||
return 0, 0, 0, fmt.Errorf("see hit with dropped doc num")
|
||||
}
|
||||
|
||||
newRoaring.Add(uint32(hitNewDocNum))
|
||||
err = tfEncoder.AddBytes(hitNewDocNum, nextFreqNormBytes)
|
||||
if err != nil {
|
||||
return 0, 0, 0, err
|
||||
}
|
||||
|
||||
if len(nextLocBytes) > 0 {
|
||||
err = locEncoder.AddBytes(hitNewDocNum, nextLocBytes)
|
||||
if err != nil {
|
||||
return 0, 0, 0, err
|
||||
}
|
||||
}
|
||||
|
||||
lastDocNum = hitNewDocNum
|
||||
lastFreq = nextFreq
|
||||
lastNorm = nextNorm
|
||||
|
||||
nextDocNum, nextFreq, nextNorm, nextFreqNormBytes, nextLocBytes, err =
|
||||
postItr.nextBytes()
|
||||
}
|
||||
|
||||
return lastDocNum, lastFreq, lastNorm, err
|
||||
}
|
||||
|
||||
func mergeTermFreqNormLocs(fieldsMap map[string]uint16, term []byte, postItr *PostingsIterator,
|
||||
newDocNums []uint64, newRoaring *roaring.Bitmap,
|
||||
tfEncoder *chunkedIntCoder, locEncoder *chunkedIntCoder, bufLoc []uint64) (
|
||||
|
|
|
|||
52
vendor/github.com/blevesearch/zap/v15/posting.go
generated
vendored
52
vendor/github.com/blevesearch/zap/v15/posting.go
generated
vendored
|
|
@ -588,6 +588,58 @@ func (i *PostingsIterator) nextDocNumAtOrAfter(atOrAfter uint64) (uint64, bool,
|
|||
return uint64(n), true, nil
|
||||
}
|
||||
|
||||
var freqHasLocs1Hit = encodeFreqHasLocs(1, false)
|
||||
|
||||
// nextBytes returns the docNum and the encoded freq & loc bytes for
|
||||
// the next posting
|
||||
func (i *PostingsIterator) nextBytes() (
|
||||
docNumOut uint64, freq uint64, normBits uint64,
|
||||
bytesFreqNorm []byte, bytesLoc []byte, err error) {
|
||||
docNum, exists, err := i.nextDocNumAtOrAfter(0)
|
||||
if err != nil || !exists {
|
||||
return 0, 0, 0, nil, nil, err
|
||||
}
|
||||
|
||||
if i.normBits1Hit != 0 {
|
||||
if i.buf == nil {
|
||||
i.buf = make([]byte, binary.MaxVarintLen64*2)
|
||||
}
|
||||
n := binary.PutUvarint(i.buf, freqHasLocs1Hit)
|
||||
n += binary.PutUvarint(i.buf[n:], i.normBits1Hit)
|
||||
return docNum, uint64(1), i.normBits1Hit, i.buf[:n], nil, nil
|
||||
}
|
||||
|
||||
startFreqNorm := i.freqNormReader.remainingLen()
|
||||
|
||||
var hasLocs bool
|
||||
|
||||
freq, normBits, hasLocs, err = i.readFreqNormHasLocs()
|
||||
if err != nil {
|
||||
return 0, 0, 0, nil, nil, err
|
||||
}
|
||||
|
||||
endFreqNorm := i.freqNormReader.remainingLen()
|
||||
bytesFreqNorm = i.freqNormReader.readBytes(startFreqNorm, endFreqNorm)
|
||||
|
||||
if hasLocs {
|
||||
startLoc := i.locReader.remainingLen()
|
||||
|
||||
numLocsBytes, err := i.locReader.readUvarint()
|
||||
if err != nil {
|
||||
return 0, 0, 0, nil, nil,
|
||||
fmt.Errorf("error reading location nextBytes numLocs: %v", err)
|
||||
}
|
||||
|
||||
// skip over all the location bytes
|
||||
i.locReader.SkipBytes(int(numLocsBytes))
|
||||
|
||||
endLoc := i.locReader.remainingLen()
|
||||
bytesLoc = i.locReader.readBytes(startLoc, endLoc)
|
||||
}
|
||||
|
||||
return docNum, freq, normBits, bytesFreqNorm, bytesLoc, nil
|
||||
}
|
||||
|
||||
// optimization when the postings list is "clean" (e.g., no updates &
|
||||
// no deletions) where the all bitmap is the same as the actual bitmap
|
||||
func (i *PostingsIterator) nextDocNumAtOrAfterClean(
|
||||
|
|
|
|||
2
vendor/github.com/blevesearch/zap/v15/segment.go
generated
vendored
2
vendor/github.com/blevesearch/zap/v15/segment.go
generated
vendored
|
|
@ -194,7 +194,7 @@ func (s *Segment) loadConfig() error {
|
|||
verOffset := crcOffset - 4
|
||||
s.version = binary.BigEndian.Uint32(s.mm[verOffset : verOffset+4])
|
||||
if s.version != Version {
|
||||
return fmt.Errorf("unsupported version %d", s.version)
|
||||
return fmt.Errorf("unsupported version %d != %d", s.version, Version)
|
||||
}
|
||||
|
||||
chunkOffset := verOffset - 4
|
||||
|
|
|
|||
3
vendor/github.com/gorilla/mux/mux.go
generated
vendored
3
vendor/github.com/gorilla/mux/mux.go
generated
vendored
|
|
@ -435,8 +435,7 @@ func Vars(r *http.Request) map[string]string {
|
|||
// CurrentRoute returns the matched route for the current request, if any.
|
||||
// This only works when called inside the handler of the matched route
|
||||
// because the matched route is stored in the request context which is cleared
|
||||
// after the handler returns, unless the KeepContext option is set on the
|
||||
// Router.
|
||||
// after the handler returns.
|
||||
func CurrentRoute(r *http.Request) *Route {
|
||||
if rv := r.Context().Value(routeKey); rv != nil {
|
||||
return rv.(*Route)
|
||||
|
|
|
|||
6
vendor/github.com/gorilla/mux/regexp.go
generated
vendored
6
vendor/github.com/gorilla/mux/regexp.go
generated
vendored
|
|
@ -325,6 +325,12 @@ func (v routeRegexpGroup) setMatch(req *http.Request, m *RouteMatch, r *Route) {
|
|||
// Store host variables.
|
||||
if v.host != nil {
|
||||
host := getHost(req)
|
||||
if v.host.wildcardHostPort {
|
||||
// Don't be strict on the port match
|
||||
if i := strings.Index(host, ":"); i != -1 {
|
||||
host = host[:i]
|
||||
}
|
||||
}
|
||||
matches := v.host.regexp.FindStringSubmatchIndex(host)
|
||||
if len(matches) > 0 {
|
||||
extractVars(host, matches, v.host.varsN, m.Vars)
|
||||
|
|
|
|||
2
vendor/go.etcd.io/bbolt/.gitignore
generated
vendored
2
vendor/go.etcd.io/bbolt/.gitignore
generated
vendored
|
|
@ -3,3 +3,5 @@
|
|||
*.swp
|
||||
/bin/
|
||||
cover.out
|
||||
/.idea
|
||||
*.iml
|
||||
|
|
|
|||
3
vendor/go.etcd.io/bbolt/.travis.yml
generated
vendored
3
vendor/go.etcd.io/bbolt/.travis.yml
generated
vendored
|
|
@ -4,9 +4,10 @@ go_import_path: go.etcd.io/bbolt
|
|||
sudo: false
|
||||
|
||||
go:
|
||||
- 1.12
|
||||
- 1.15
|
||||
|
||||
before_install:
|
||||
- go get -v golang.org/x/sys/unix
|
||||
- go get -v honnef.co/go/tools/...
|
||||
- go get -v github.com/kisielk/errcheck
|
||||
|
||||
|
|
|
|||
2
vendor/go.etcd.io/bbolt/Makefile
generated
vendored
2
vendor/go.etcd.io/bbolt/Makefile
generated
vendored
|
|
@ -2,8 +2,6 @@ BRANCH=`git rev-parse --abbrev-ref HEAD`
|
|||
COMMIT=`git rev-parse --short HEAD`
|
||||
GOLDFLAGS="-X main.branch $(BRANCH) -X main.commit $(COMMIT)"
|
||||
|
||||
default: build
|
||||
|
||||
race:
|
||||
@TEST_FREELIST_TYPE=hashmap go test -v -race -test.run="TestSimulate_(100op|1000op)"
|
||||
@echo "array freelist test"
|
||||
|
|
|
|||
5
vendor/go.etcd.io/bbolt/README.md
generated
vendored
5
vendor/go.etcd.io/bbolt/README.md
generated
vendored
|
|
@ -908,12 +908,14 @@ Below is a list of public, open source projects that use Bolt:
|
|||
* [BoltStore](https://github.com/yosssi/boltstore) - Session store using Bolt.
|
||||
* [Boltdb Boilerplate](https://github.com/bobintornado/boltdb-boilerplate) - Boilerplate wrapper around bolt aiming to make simple calls one-liners.
|
||||
* [BoltDbWeb](https://github.com/evnix/boltdbweb) - A web based GUI for BoltDB files.
|
||||
* [BoltDB Viewer](https://github.com/zc310/rich_boltdb) - A BoltDB Viewer Can run on Windows、Linux、Android system.
|
||||
* [bleve](http://www.blevesearch.com/) - A pure Go search engine similar to ElasticSearch that uses Bolt as the default storage backend.
|
||||
* [btcwallet](https://github.com/btcsuite/btcwallet) - A bitcoin wallet.
|
||||
* [buckets](https://github.com/joyrexus/buckets) - a bolt wrapper streamlining
|
||||
simple tx and key scans.
|
||||
* [cayley](https://github.com/google/cayley) - Cayley is an open-source graph database using Bolt as optional backend.
|
||||
* [ChainStore](https://github.com/pressly/chainstore) - Simple key-value interface to a variety of storage engines organized as a chain of operations.
|
||||
* [🌰 Chestnut](https://github.com/jrapoport/chestnut) - Chestnut is encrypted storage for Go.
|
||||
* [Consul](https://github.com/hashicorp/consul) - Consul is service discovery and configuration made easy. Distributed, highly available, and datacenter-aware.
|
||||
* [DVID](https://github.com/janelia-flyem/dvid) - Added Bolt as optional storage engine and testing it against Basho-tuned leveldb.
|
||||
* [dcrwallet](https://github.com/decred/dcrwallet) - A wallet for the Decred cryptocurrency.
|
||||
|
|
@ -938,9 +940,8 @@ Below is a list of public, open source projects that use Bolt:
|
|||
* [MetricBase](https://github.com/msiebuhr/MetricBase) - Single-binary version of Graphite.
|
||||
* [MuLiFS](https://github.com/dankomiocevic/mulifs) - Music Library Filesystem creates a filesystem to organise your music files.
|
||||
* [NATS](https://github.com/nats-io/nats-streaming-server) - NATS Streaming uses bbolt for message and metadata storage.
|
||||
* [Operation Go: A Routine Mission](http://gocode.io) - An online programming game for Golang using Bolt for user accounts and a leaderboard.
|
||||
* [photosite/session](https://godoc.org/bitbucket.org/kardianos/photosite/session) - Sessions for a photo viewing site.
|
||||
* [Prometheus Annotation Server](https://github.com/oliver006/prom_annotation_server) - Annotation server for PromDash & Prometheus service monitoring system.
|
||||
* [Rain](https://github.com/cenkalti/rain) - BitTorrent client and library.
|
||||
* [reef-pi](https://github.com/reef-pi/reef-pi) - reef-pi is an award winning, modular, DIY reef tank controller using easy to learn electronics based on a Raspberry Pi.
|
||||
* [Request Baskets](https://github.com/darklynx/request-baskets) - A web service to collect arbitrary HTTP requests and inspect them via REST API or simple web UI, similar to [RequestBin](http://requestb.in/) service
|
||||
* [Seaweed File System](https://github.com/chrislusf/seaweedfs) - Highly scalable distributed key~file system with O(1) disk read.
|
||||
|
|
|
|||
17
vendor/go.etcd.io/bbolt/bolt_unix.go
generated
vendored
17
vendor/go.etcd.io/bbolt/bolt_unix.go
generated
vendored
|
|
@ -7,6 +7,8 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// flock acquires an advisory lock on a file descriptor.
|
||||
|
|
@ -49,13 +51,13 @@ func funlock(db *DB) error {
|
|||
// mmap memory maps a DB's data file.
|
||||
func mmap(db *DB, sz int) error {
|
||||
// Map the data file to memory.
|
||||
b, err := syscall.Mmap(int(db.file.Fd()), 0, sz, syscall.PROT_READ, syscall.MAP_SHARED|db.MmapFlags)
|
||||
b, err := unix.Mmap(int(db.file.Fd()), 0, sz, syscall.PROT_READ, syscall.MAP_SHARED|db.MmapFlags)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Advise the kernel that the mmap is accessed randomly.
|
||||
err = madvise(b, syscall.MADV_RANDOM)
|
||||
err = unix.Madvise(b, syscall.MADV_RANDOM)
|
||||
if err != nil && err != syscall.ENOSYS {
|
||||
// Ignore not implemented error in kernel because it still works.
|
||||
return fmt.Errorf("madvise: %s", err)
|
||||
|
|
@ -76,18 +78,9 @@ func munmap(db *DB) error {
|
|||
}
|
||||
|
||||
// Unmap using the original byte slice.
|
||||
err := syscall.Munmap(db.dataref)
|
||||
err := unix.Munmap(db.dataref)
|
||||
db.dataref = nil
|
||||
db.data = nil
|
||||
db.datasz = 0
|
||||
return err
|
||||
}
|
||||
|
||||
// NOTE: This function is copied from stdlib because it is not available on darwin.
|
||||
func madvise(b []byte, advice int) (err error) {
|
||||
_, _, e1 := syscall.Syscall(syscall.SYS_MADVISE, uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), uintptr(advice))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
114
vendor/go.etcd.io/bbolt/compact.go
generated
vendored
Normal file
114
vendor/go.etcd.io/bbolt/compact.go
generated
vendored
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
package bbolt
|
||||
|
||||
// Compact will create a copy of the source DB and in the destination DB. This may
|
||||
// reclaim space that the source database no longer has use for. txMaxSize can be
|
||||
// used to limit the transactions size of this process and may trigger intermittent
|
||||
// commits. A value of zero will ignore transaction sizes.
|
||||
// TODO: merge with: https://github.com/etcd-io/etcd/blob/b7f0f52a16dbf83f18ca1d803f7892d750366a94/mvcc/backend/backend.go#L349
|
||||
func Compact(dst, src *DB, txMaxSize int64) error {
|
||||
// commit regularly, or we'll run out of memory for large datasets if using one transaction.
|
||||
var size int64
|
||||
tx, err := dst.Begin(true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
|
||||
if err := walk(src, func(keys [][]byte, k, v []byte, seq uint64) error {
|
||||
// On each key/value, check if we have exceeded tx size.
|
||||
sz := int64(len(k) + len(v))
|
||||
if size+sz > txMaxSize && txMaxSize != 0 {
|
||||
// Commit previous transaction.
|
||||
if err := tx.Commit(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Start new transaction.
|
||||
tx, err = dst.Begin(true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
size = 0
|
||||
}
|
||||
size += sz
|
||||
|
||||
// Create bucket on the root transaction if this is the first level.
|
||||
nk := len(keys)
|
||||
if nk == 0 {
|
||||
bkt, err := tx.CreateBucket(k)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bkt.SetSequence(seq); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Create buckets on subsequent levels, if necessary.
|
||||
b := tx.Bucket(keys[0])
|
||||
if nk > 1 {
|
||||
for _, k := range keys[1:] {
|
||||
b = b.Bucket(k)
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the entire page for best compaction.
|
||||
b.FillPercent = 1.0
|
||||
|
||||
// If there is no value then this is a bucket call.
|
||||
if v == nil {
|
||||
bkt, err := b.CreateBucket(k)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bkt.SetSequence(seq); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Otherwise treat it as a key/value pair.
|
||||
return b.Put(k, v)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Commit()
|
||||
}
|
||||
|
||||
// walkFunc is the type of the function called for keys (buckets and "normal"
|
||||
// values) discovered by Walk. keys is the list of keys to descend to the bucket
|
||||
// owning the discovered key/value pair k/v.
|
||||
type walkFunc func(keys [][]byte, k, v []byte, seq uint64) error
|
||||
|
||||
// walk walks recursively the bolt database db, calling walkFn for each key it finds.
|
||||
func walk(db *DB, walkFn walkFunc) error {
|
||||
return db.View(func(tx *Tx) error {
|
||||
return tx.ForEach(func(name []byte, b *Bucket) error {
|
||||
return walkBucket(b, nil, name, nil, b.Sequence(), walkFn)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func walkBucket(b *Bucket, keypath [][]byte, k, v []byte, seq uint64, fn walkFunc) error {
|
||||
// Execute callback.
|
||||
if err := fn(keypath, k, v, seq); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// If this is not a bucket then stop.
|
||||
if v != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Iterate over each child key/value.
|
||||
keypath = append(keypath, k)
|
||||
return b.ForEach(func(k, v []byte) error {
|
||||
if v == nil {
|
||||
bkt := b.Bucket(k)
|
||||
return walkBucket(bkt, keypath, k, nil, bkt.Sequence(), fn)
|
||||
}
|
||||
return walkBucket(b, keypath, k, v, b.Sequence(), fn)
|
||||
})
|
||||
}
|
||||
66
vendor/go.etcd.io/bbolt/db.go
generated
vendored
66
vendor/go.etcd.io/bbolt/db.go
generated
vendored
|
|
@ -120,6 +120,12 @@ type DB struct {
|
|||
// of truncate() and fsync() when growing the data file.
|
||||
AllocSize int
|
||||
|
||||
// Mlock locks database file in memory when set to true.
|
||||
// It prevents major page faults, however used memory can't be reclaimed.
|
||||
//
|
||||
// Supported only on Unix via mlock/munlock syscalls.
|
||||
Mlock bool
|
||||
|
||||
path string
|
||||
openFile func(string, int, os.FileMode) (*os.File, error)
|
||||
file *os.File
|
||||
|
|
@ -188,6 +194,7 @@ func Open(path string, mode os.FileMode, options *Options) (*DB, error) {
|
|||
db.MmapFlags = options.MmapFlags
|
||||
db.NoFreelistSync = options.NoFreelistSync
|
||||
db.FreelistType = options.FreelistType
|
||||
db.Mlock = options.Mlock
|
||||
|
||||
// Set default values for later DB operations.
|
||||
db.MaxBatchSize = DefaultMaxBatchSize
|
||||
|
|
@ -337,7 +344,8 @@ func (db *DB) mmap(minsz int) error {
|
|||
}
|
||||
|
||||
// Ensure the size is at least the minimum size.
|
||||
var size = int(info.Size())
|
||||
fileSize := int(info.Size())
|
||||
var size = fileSize
|
||||
if size < minsz {
|
||||
size = minsz
|
||||
}
|
||||
|
|
@ -346,6 +354,13 @@ func (db *DB) mmap(minsz int) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if db.Mlock {
|
||||
// Unlock db memory
|
||||
if err := db.munlock(fileSize); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Dereference all mmap references before unmapping.
|
||||
if db.rwtx != nil {
|
||||
db.rwtx.root.dereference()
|
||||
|
|
@ -361,6 +376,13 @@ func (db *DB) mmap(minsz int) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if db.Mlock {
|
||||
// Don't allow swapping of data file
|
||||
if err := db.mlock(fileSize); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Save references to the meta pages.
|
||||
db.meta0 = db.page(0).meta()
|
||||
db.meta1 = db.page(1).meta()
|
||||
|
|
@ -422,12 +444,36 @@ func (db *DB) mmapSize(size int) (int, error) {
|
|||
return int(sz), nil
|
||||
}
|
||||
|
||||
func (db *DB) munlock(fileSize int) error {
|
||||
if err := munlock(db, fileSize); err != nil {
|
||||
return fmt.Errorf("munlock error: " + err.Error())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (db *DB) mlock(fileSize int) error {
|
||||
if err := mlock(db, fileSize); err != nil {
|
||||
return fmt.Errorf("mlock error: " + err.Error())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (db *DB) mrelock(fileSizeFrom, fileSizeTo int) error {
|
||||
if err := db.munlock(fileSizeFrom); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := db.mlock(fileSizeTo); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// init creates a new database file and initializes its meta pages.
|
||||
func (db *DB) init() error {
|
||||
// Create two meta pages on a buffer.
|
||||
buf := make([]byte, db.pageSize*4)
|
||||
for i := 0; i < 2; i++ {
|
||||
p := db.pageInBuffer(buf[:], pgid(i))
|
||||
p := db.pageInBuffer(buf, pgid(i))
|
||||
p.id = pgid(i)
|
||||
p.flags = metaPageFlag
|
||||
|
||||
|
|
@ -444,13 +490,13 @@ func (db *DB) init() error {
|
|||
}
|
||||
|
||||
// Write an empty freelist at page 3.
|
||||
p := db.pageInBuffer(buf[:], pgid(2))
|
||||
p := db.pageInBuffer(buf, pgid(2))
|
||||
p.id = pgid(2)
|
||||
p.flags = freelistPageFlag
|
||||
p.count = 0
|
||||
|
||||
// Write an empty leaf page at page 4.
|
||||
p = db.pageInBuffer(buf[:], pgid(3))
|
||||
p = db.pageInBuffer(buf, pgid(3))
|
||||
p.id = pgid(3)
|
||||
p.flags = leafPageFlag
|
||||
p.count = 0
|
||||
|
|
@ -462,6 +508,7 @@ func (db *DB) init() error {
|
|||
if err := fdatasync(db); err != nil {
|
||||
return err
|
||||
}
|
||||
db.filesz = len(buf)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -973,6 +1020,12 @@ func (db *DB) grow(sz int) error {
|
|||
if err := db.file.Sync(); err != nil {
|
||||
return fmt.Errorf("file sync error: %s", err)
|
||||
}
|
||||
if db.Mlock {
|
||||
// unlock old file and lock new one
|
||||
if err := db.mrelock(db.filesz, sz); err != nil {
|
||||
return fmt.Errorf("mlock/munlock error: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
db.filesz = sz
|
||||
|
|
@ -1064,6 +1117,11 @@ type Options struct {
|
|||
// OpenFile is used to open files. It defaults to os.OpenFile. This option
|
||||
// is useful for writing hermetic tests.
|
||||
OpenFile func(string, int, os.FileMode) (*os.File, error)
|
||||
|
||||
// Mlock locks database file in memory when set to true.
|
||||
// It prevents potential page faults, however
|
||||
// used memory can't be reclaimed. (UNIX only)
|
||||
Mlock bool
|
||||
}
|
||||
|
||||
// DefaultOptions represent the options used if nil options are passed into Open().
|
||||
|
|
|
|||
6
vendor/go.etcd.io/bbolt/freelist_hmap.go
generated
vendored
6
vendor/go.etcd.io/bbolt/freelist_hmap.go
generated
vendored
|
|
@ -4,7 +4,7 @@ import "sort"
|
|||
|
||||
// hashmapFreeCount returns count of free pages(hashmap version)
|
||||
func (f *freelist) hashmapFreeCount() int {
|
||||
// use the forwardmap to get the total count
|
||||
// use the forwardMap to get the total count
|
||||
count := 0
|
||||
for _, size := range f.forwardMap {
|
||||
count += int(size)
|
||||
|
|
@ -41,7 +41,7 @@ func (f *freelist) hashmapAllocate(txid txid, n int) pgid {
|
|||
|
||||
for pid := range bm {
|
||||
// remove the initial
|
||||
f.delSpan(pid, uint64(size))
|
||||
f.delSpan(pid, size)
|
||||
|
||||
f.allocs[pid] = txid
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ func (f *freelist) hashmapAllocate(txid txid, n int) pgid {
|
|||
f.addSpan(pid+pgid(n), remain)
|
||||
|
||||
for i := pgid(0); i < pgid(n); i++ {
|
||||
delete(f.cache, pid+pgid(i))
|
||||
delete(f.cache, pid+i)
|
||||
}
|
||||
return pid
|
||||
}
|
||||
|
|
|
|||
2
vendor/go.etcd.io/bbolt/go.mod
generated
vendored
2
vendor/go.etcd.io/bbolt/go.mod
generated
vendored
|
|
@ -2,4 +2,4 @@ module go.etcd.io/bbolt
|
|||
|
||||
go 1.12
|
||||
|
||||
require golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5
|
||||
require golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d
|
||||
|
|
|
|||
4
vendor/go.etcd.io/bbolt/go.sum
generated
vendored
4
vendor/go.etcd.io/bbolt/go.sum
generated
vendored
|
|
@ -1,2 +1,2 @@
|
|||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0=
|
||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d h1:L/IKR6COd7ubZrs2oTnTi73IhgqJ71c9s80WsQnh0Es=
|
||||
golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
|
|
|
|||
36
vendor/go.etcd.io/bbolt/mlock_unix.go
generated
vendored
Normal file
36
vendor/go.etcd.io/bbolt/mlock_unix.go
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// +build !windows
|
||||
|
||||
package bbolt
|
||||
|
||||
import "golang.org/x/sys/unix"
|
||||
|
||||
// mlock locks memory of db file
|
||||
func mlock(db *DB, fileSize int) error {
|
||||
sizeToLock := fileSize
|
||||
if sizeToLock > db.datasz {
|
||||
// Can't lock more than mmaped slice
|
||||
sizeToLock = db.datasz
|
||||
}
|
||||
if err := unix.Mlock(db.dataref[:sizeToLock]); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//munlock unlocks memory of db file
|
||||
func munlock(db *DB, fileSize int) error {
|
||||
if db.dataref == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
sizeToUnlock := fileSize
|
||||
if sizeToUnlock > db.datasz {
|
||||
// Can't unlock more than mmaped slice
|
||||
sizeToUnlock = db.datasz
|
||||
}
|
||||
|
||||
if err := unix.Munlock(db.dataref[:sizeToUnlock]); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
11
vendor/go.etcd.io/bbolt/mlock_windows.go
generated
vendored
Normal file
11
vendor/go.etcd.io/bbolt/mlock_windows.go
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package bbolt
|
||||
|
||||
// mlock locks memory of db file
|
||||
func mlock(_ *DB, _ int) error {
|
||||
panic("mlock is supported only on UNIX systems")
|
||||
}
|
||||
|
||||
//munlock unlocks memory of db file
|
||||
func munlock(_ *DB, _ int) error {
|
||||
panic("munlock is supported only on UNIX systems")
|
||||
}
|
||||
3
vendor/go.etcd.io/bbolt/tx.go
generated
vendored
3
vendor/go.etcd.io/bbolt/tx.go
generated
vendored
|
|
@ -188,7 +188,6 @@ func (tx *Tx) Commit() error {
|
|||
}
|
||||
|
||||
// If strict mode is enabled then perform a consistency check.
|
||||
// Only the first consistency error is reported in the panic.
|
||||
if tx.db.StrictMode {
|
||||
ch := tx.Check()
|
||||
var errs []string
|
||||
|
|
@ -393,7 +392,7 @@ func (tx *Tx) CopyFile(path string, mode os.FileMode) error {
|
|||
return err
|
||||
}
|
||||
|
||||
err = tx.Copy(f)
|
||||
_, err = tx.WriteTo(f)
|
||||
if err != nil {
|
||||
_ = f.Close()
|
||||
return err
|
||||
|
|
|
|||
36
vendor/modules.txt
vendored
36
vendor/modules.txt
vendored
|
|
@ -7,7 +7,7 @@ git.giftfish.de/ston1th/jwt/v3
|
|||
# github.com/RoaringBitmap/roaring v0.5.5
|
||||
## explicit
|
||||
github.com/RoaringBitmap/roaring
|
||||
# github.com/blevesearch/bleve v1.0.12
|
||||
# github.com/blevesearch/bleve v1.0.14
|
||||
## explicit
|
||||
github.com/blevesearch/bleve
|
||||
github.com/blevesearch/bleve/analysis
|
||||
|
|
@ -57,15 +57,15 @@ github.com/blevesearch/segment
|
|||
# github.com/blevesearch/snowballstem v0.9.0
|
||||
github.com/blevesearch/snowballstem
|
||||
github.com/blevesearch/snowballstem/english
|
||||
# github.com/blevesearch/zap/v11 v11.0.12
|
||||
# github.com/blevesearch/zap/v11 v11.0.14
|
||||
github.com/blevesearch/zap/v11
|
||||
# github.com/blevesearch/zap/v12 v12.0.12
|
||||
# github.com/blevesearch/zap/v12 v12.0.14
|
||||
github.com/blevesearch/zap/v12
|
||||
# github.com/blevesearch/zap/v13 v13.0.4
|
||||
# github.com/blevesearch/zap/v13 v13.0.6
|
||||
github.com/blevesearch/zap/v13
|
||||
# github.com/blevesearch/zap/v14 v14.0.3
|
||||
# github.com/blevesearch/zap/v14 v14.0.5
|
||||
github.com/blevesearch/zap/v14
|
||||
# github.com/blevesearch/zap/v15 v15.0.1
|
||||
# github.com/blevesearch/zap/v15 v15.0.3
|
||||
github.com/blevesearch/zap/v15
|
||||
# github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc
|
||||
github.com/boombuler/barcode
|
||||
|
|
@ -79,18 +79,6 @@ github.com/couchbase/vellum/utf8
|
|||
# github.com/cpuguy83/go-md2man/v2 v2.0.0
|
||||
## explicit
|
||||
github.com/cpuguy83/go-md2man/v2/md2man
|
||||
# github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d
|
||||
## explicit
|
||||
# github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548
|
||||
## explicit
|
||||
# github.com/cznic/strutil v0.0.0-20181122101858-275e90344537
|
||||
## explicit
|
||||
# github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51
|
||||
## explicit
|
||||
# github.com/facebookgo/stack v0.0.0-20160209184415-751773369052
|
||||
## explicit
|
||||
# github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870
|
||||
## explicit
|
||||
# github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a
|
||||
## explicit
|
||||
github.com/glycerine/go-unsnap-stream
|
||||
|
|
@ -100,11 +88,9 @@ github.com/golang/protobuf/proto
|
|||
# github.com/golang/snappy v0.0.2
|
||||
## explicit
|
||||
github.com/golang/snappy
|
||||
# github.com/gorilla/mux v1.7.4
|
||||
# github.com/gorilla/mux v1.8.0
|
||||
## explicit
|
||||
github.com/gorilla/mux
|
||||
# github.com/jmhodges/levigo v1.0.0
|
||||
## explicit
|
||||
# github.com/mschoch/smat v0.2.0
|
||||
github.com/mschoch/smat
|
||||
# github.com/philhofer/fwd v1.1.0
|
||||
|
|
@ -114,9 +100,7 @@ github.com/philhofer/fwd
|
|||
github.com/pquerna/otp
|
||||
github.com/pquerna/otp/hotp
|
||||
github.com/pquerna/otp/totp
|
||||
# github.com/remyoudompheng/bigfft v0.0.0-20190512091148-babf20351dd7
|
||||
## explicit
|
||||
# github.com/russross/blackfriday v1.6.0-pre.1
|
||||
# github.com/russross/blackfriday v1.6.0
|
||||
## explicit
|
||||
github.com/russross/blackfriday
|
||||
# github.com/russross/blackfriday/v2 v2.1.0
|
||||
|
|
@ -124,8 +108,6 @@ github.com/russross/blackfriday
|
|||
github.com/russross/blackfriday/v2
|
||||
# github.com/steveyen/gtreap v0.1.0
|
||||
github.com/steveyen/gtreap
|
||||
# github.com/tecbot/gorocksdb v0.0.0-20181010114359-8752a9433481
|
||||
## explicit
|
||||
# github.com/tinylib/msgp v1.1.4
|
||||
## explicit
|
||||
github.com/tinylib/msgp/msgp
|
||||
|
|
@ -135,7 +117,7 @@ github.com/urfave/cli
|
|||
# github.com/willf/bitset v1.1.11
|
||||
## explicit
|
||||
github.com/willf/bitset
|
||||
# go.etcd.io/bbolt v1.3.5
|
||||
# go.etcd.io/bbolt v1.3.6
|
||||
## explicit
|
||||
go.etcd.io/bbolt
|
||||
# golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue