mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
vendor: update tsdb and remove unused
This commit is contained in:
parent
a2e7b0b934
commit
581f69d755
3
vendor/github.com/bradfitz/slice/COPYING
generated
vendored
3
vendor/github.com/bradfitz/slice/COPYING
generated
vendored
|
@ -1,3 +0,0 @@
|
|||
This package is licensed under the same terms as Go itself and
|
||||
has the same contribution / CLA requirements.
|
||||
|
27
vendor/github.com/bradfitz/slice/LICENSE
generated
vendored
27
vendor/github.com/bradfitz/slice/LICENSE
generated
vendored
|
@ -1,27 +0,0 @@
|
|||
Copyright (c) 2012 The Go Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
1
vendor/github.com/bradfitz/slice/README
generated
vendored
1
vendor/github.com/bradfitz/slice/README
generated
vendored
|
@ -1 +0,0 @@
|
|||
See https://godoc.org/github.com/bradfitz/slice
|
44
vendor/github.com/bradfitz/slice/slice.go
generated
vendored
44
vendor/github.com/bradfitz/slice/slice.go
generated
vendored
|
@ -1,44 +0,0 @@
|
|||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package slice provides a slice sorting function.
|
||||
package slice
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sort"
|
||||
|
||||
"go4.org/reflectutil"
|
||||
)
|
||||
|
||||
// Sort sorts the provided slice using the function less.
|
||||
// If slice is not a slice, Sort panics.
|
||||
func Sort(slice interface{}, less func(i, j int) bool) {
|
||||
sort.Sort(SortInterface(slice, less))
|
||||
}
|
||||
|
||||
// SortInterface returns a sort.Interface to sort the provided slice
|
||||
// using the function less.
|
||||
func SortInterface(slice interface{}, less func(i, j int) bool) sort.Interface {
|
||||
sv := reflect.ValueOf(slice)
|
||||
if sv.Kind() != reflect.Slice {
|
||||
panic(fmt.Sprintf("slice.Sort called with non-slice value of type %T", slice))
|
||||
}
|
||||
return &funcs{
|
||||
length: sv.Len(),
|
||||
less: less,
|
||||
swap: reflectutil.Swapper(slice),
|
||||
}
|
||||
}
|
||||
|
||||
type funcs struct {
|
||||
length int
|
||||
less func(i, j int) bool
|
||||
swap func(i, j int)
|
||||
}
|
||||
|
||||
func (f *funcs) Len() int { return f.length }
|
||||
func (f *funcs) Less(i, j int) bool { return f.less(i, j) }
|
||||
func (f *funcs) Swap(i, j int) { f.swap(i, j) }
|
43
vendor/github.com/fabxc/tsdb/db.go
generated
vendored
43
vendor/github.com/fabxc/tsdb/db.go
generated
vendored
|
@ -462,18 +462,22 @@ func (db *DB) Appender() Appender {
|
|||
db.mtx.RLock()
|
||||
a := &dbAppender{db: db}
|
||||
|
||||
// Only instantiate appender after returning the headmtx to avoid
|
||||
// questionable locking order.
|
||||
db.headmtx.RLock()
|
||||
app := db.appendable()
|
||||
db.headmtx.RUnlock()
|
||||
// XXX(fabxc): turn off creating initial appender as it will happen on-demand
|
||||
// anyway. For now this, with combination of only having a single timestamp per batch,
|
||||
// prevents opening more than one appender and hitting an unresolved deadlock (#11).
|
||||
//
|
||||
// // Only instantiate appender after returning the headmtx to avoid
|
||||
// // questionable locking order.
|
||||
// db.headmtx.RLock()
|
||||
// app := db.appendable()
|
||||
// db.headmtx.RUnlock()
|
||||
|
||||
for _, b := range app {
|
||||
a.heads = append(a.heads, &metaAppender{
|
||||
meta: b.Meta(),
|
||||
app: b.Appender().(*headAppender),
|
||||
})
|
||||
}
|
||||
// for _, b := range app {
|
||||
// a.heads = append(a.heads, &metaAppender{
|
||||
// meta: b.Meta(),
|
||||
// app: b.Appender().(*headAppender),
|
||||
// })
|
||||
// }
|
||||
|
||||
return a
|
||||
}
|
||||
|
@ -551,14 +555,27 @@ func (a *dbAppender) appenderFor(t int64) (*metaAppender, error) {
|
|||
|
||||
a.db.headmtx.Unlock()
|
||||
|
||||
// Instantiate appenders after returning headmtx to avoid questionable
|
||||
// locking order.
|
||||
// XXX(fabxc): temporary workaround. See comment on instantiating DB.Appender.
|
||||
for _, b := range newHeads {
|
||||
// Only get appender for the block with the specific timestamp.
|
||||
if t >= b.Meta().MaxTime {
|
||||
continue
|
||||
}
|
||||
a.heads = append(a.heads, &metaAppender{
|
||||
app: b.Appender(),
|
||||
meta: b.Meta(),
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
// // Instantiate appenders after returning headmtx to avoid questionable
|
||||
// // locking order.
|
||||
// for _, b := range newHeads {
|
||||
// a.heads = append(a.heads, &metaAppender{
|
||||
// app: b.Appender(),
|
||||
// meta: b.Meta(),
|
||||
// })
|
||||
// }
|
||||
}
|
||||
for i := len(a.heads) - 1; i >= 0; i-- {
|
||||
if h := a.heads[i]; t >= h.meta.MinTime {
|
||||
|
|
9
vendor/github.com/fabxc/tsdb/head.go
generated
vendored
9
vendor/github.com/fabxc/tsdb/head.go
generated
vendored
|
@ -17,10 +17,6 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// func init() {
|
||||
// deadlock.Opts.OnPotentialDeadlock = func() { fmt.Println("found deadlock") }
|
||||
// }
|
||||
|
||||
var (
|
||||
// ErrNotFound is returned if a looked up resource was not found.
|
||||
ErrNotFound = errors.Errorf("not found")
|
||||
|
@ -591,6 +587,11 @@ func (h *headBlock) create(hash uint64, lset labels.Labels) *memSeries {
|
|||
return s
|
||||
}
|
||||
|
||||
type sample struct {
|
||||
t int64
|
||||
v float64
|
||||
}
|
||||
|
||||
type memSeries struct {
|
||||
mtx sync.RWMutex
|
||||
|
||||
|
|
21
vendor/github.com/fabxc/tsdb/index.go
generated
vendored
21
vendor/github.com/fabxc/tsdb/index.go
generated
vendored
|
@ -40,9 +40,10 @@ type IndexWriter interface {
|
|||
WriteLabelIndex(names []string, values []string) error
|
||||
|
||||
// WritePostings writes a postings list for a single label pair.
|
||||
// The Postings here contain refs to the series that were added.
|
||||
WritePostings(name, value string, it Postings) error
|
||||
|
||||
// Close writes any finalization and closes theresources associated with
|
||||
// Close writes any finalization and closes the resources associated with
|
||||
// the underlying writer.
|
||||
Close() error
|
||||
}
|
||||
|
@ -416,6 +417,7 @@ type IndexReader interface {
|
|||
LabelValues(names ...string) (StringTuples, error)
|
||||
|
||||
// Postings returns the postings list iterator for the label pair.
|
||||
// The Postings here contain the offsets to the series inside the index.
|
||||
Postings(name, value string) (Postings, error)
|
||||
|
||||
// Series returns the series for the given reference.
|
||||
|
@ -698,20 +700,11 @@ func (r *indexReader) Postings(name, value string) (Postings, error) {
|
|||
return nil, errors.Wrapf(errInvalidFlag, "section at %d", off)
|
||||
}
|
||||
|
||||
// TODO(fabxc): just read into memory as an intermediate solution.
|
||||
// Add iterator over serialized data.
|
||||
var l []uint32
|
||||
|
||||
for len(b) > 0 {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.Wrap(errInvalidSize, "plain postings entry")
|
||||
}
|
||||
l = append(l, binary.BigEndian.Uint32(b[:4]))
|
||||
|
||||
b = b[4:]
|
||||
// Add iterator over the bytes.
|
||||
if len(b)%4 != 0 {
|
||||
return nil, errors.Wrap(errInvalidSize, "plain postings entry")
|
||||
}
|
||||
|
||||
return &listPostings{list: l, idx: -1}, nil
|
||||
return newBigEndianPostings(b), nil
|
||||
}
|
||||
|
||||
type stringTuples struct {
|
||||
|
|
37
vendor/github.com/fabxc/tsdb/postings.go
generated
vendored
37
vendor/github.com/fabxc/tsdb/postings.go
generated
vendored
|
@ -1,6 +1,7 @@
|
|||
package tsdb
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
@ -240,6 +241,42 @@ func (it *listPostings) Err() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// bigEndianPostings implements the Postings interface over a byte stream of
|
||||
// big endian numbers.
|
||||
type bigEndianPostings struct {
|
||||
list []byte
|
||||
idx int
|
||||
}
|
||||
|
||||
func newBigEndianPostings(list []byte) *bigEndianPostings {
|
||||
return &bigEndianPostings{list: list, idx: -1}
|
||||
}
|
||||
|
||||
func (it *bigEndianPostings) At() uint32 {
|
||||
idx := 4 * it.idx
|
||||
return binary.BigEndian.Uint32(it.list[idx : idx+4])
|
||||
}
|
||||
|
||||
func (it *bigEndianPostings) Next() bool {
|
||||
it.idx++
|
||||
return it.idx*4 < len(it.list)
|
||||
}
|
||||
|
||||
func (it *bigEndianPostings) Seek(x uint32) bool {
|
||||
num := len(it.list) / 4
|
||||
// Do binary search between current position and end.
|
||||
it.idx += sort.Search(num-it.idx, func(i int) bool {
|
||||
idx := 4 * (it.idx + i)
|
||||
val := binary.BigEndian.Uint32(it.list[idx : idx+4])
|
||||
return val >= x
|
||||
})
|
||||
return it.idx*4 < len(it.list)
|
||||
}
|
||||
|
||||
func (it *bigEndianPostings) Err() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type stringset map[string]struct{}
|
||||
|
||||
func (ss stringset) set(s string) {
|
||||
|
|
197
vendor/github.com/fabxc/tsdb/querier.go
generated
vendored
197
vendor/github.com/fabxc/tsdb/querier.go
generated
vendored
|
@ -2,7 +2,6 @@ package tsdb
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
|
@ -605,202 +604,6 @@ func (it *chunkSeriesIterator) Err() error {
|
|||
return it.cur.Err()
|
||||
}
|
||||
|
||||
// BufferedSeriesIterator wraps an iterator with a look-back buffer.
|
||||
type BufferedSeriesIterator struct {
|
||||
it SeriesIterator
|
||||
buf *sampleRing
|
||||
|
||||
lastTime int64
|
||||
}
|
||||
|
||||
// NewBuffer returns a new iterator that buffers the values within the time range
|
||||
// of the current element and the duration of delta before.
|
||||
func NewBuffer(it SeriesIterator, delta int64) *BufferedSeriesIterator {
|
||||
return &BufferedSeriesIterator{
|
||||
it: it,
|
||||
buf: newSampleRing(delta, 16),
|
||||
lastTime: math.MinInt64,
|
||||
}
|
||||
}
|
||||
|
||||
// PeekBack returns the previous element of the iterator. If there is none buffered,
|
||||
// ok is false.
|
||||
func (b *BufferedSeriesIterator) PeekBack() (t int64, v float64, ok bool) {
|
||||
return b.buf.last()
|
||||
}
|
||||
|
||||
// Buffer returns an iterator over the buffered data.
|
||||
func (b *BufferedSeriesIterator) Buffer() SeriesIterator {
|
||||
return b.buf.iterator()
|
||||
}
|
||||
|
||||
// Seek advances the iterator to the element at time t or greater.
|
||||
func (b *BufferedSeriesIterator) Seek(t int64) bool {
|
||||
t0 := t - b.buf.delta
|
||||
|
||||
// If the delta would cause us to seek backwards, preserve the buffer
|
||||
// and just continue regular advancment while filling the buffer on the way.
|
||||
if t0 > b.lastTime {
|
||||
b.buf.reset()
|
||||
|
||||
ok := b.it.Seek(t0)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
b.lastTime, _ = b.At()
|
||||
}
|
||||
|
||||
if b.lastTime >= t {
|
||||
return true
|
||||
}
|
||||
for b.Next() {
|
||||
if b.lastTime >= t {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// Next advances the iterator to the next element.
|
||||
func (b *BufferedSeriesIterator) Next() bool {
|
||||
// Add current element to buffer before advancing.
|
||||
b.buf.add(b.it.At())
|
||||
|
||||
ok := b.it.Next()
|
||||
if ok {
|
||||
b.lastTime, _ = b.At()
|
||||
}
|
||||
return ok
|
||||
}
|
||||
|
||||
// At returns the current element of the iterator.
|
||||
func (b *BufferedSeriesIterator) At() (int64, float64) {
|
||||
return b.it.At()
|
||||
}
|
||||
|
||||
// Err returns the last encountered error.
|
||||
func (b *BufferedSeriesIterator) Err() error {
|
||||
return b.it.Err()
|
||||
}
|
||||
|
||||
type sample struct {
|
||||
t int64
|
||||
v float64
|
||||
}
|
||||
|
||||
type sampleRing struct {
|
||||
delta int64
|
||||
|
||||
buf []sample // lookback buffer
|
||||
i int // position of most recent element in ring buffer
|
||||
f int // position of first element in ring buffer
|
||||
l int // number of elements in buffer
|
||||
}
|
||||
|
||||
func newSampleRing(delta int64, sz int) *sampleRing {
|
||||
r := &sampleRing{delta: delta, buf: make([]sample, sz)}
|
||||
r.reset()
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
func (r *sampleRing) reset() {
|
||||
r.l = 0
|
||||
r.i = -1
|
||||
r.f = 0
|
||||
}
|
||||
|
||||
func (r *sampleRing) iterator() SeriesIterator {
|
||||
return &sampleRingIterator{r: r, i: -1}
|
||||
}
|
||||
|
||||
type sampleRingIterator struct {
|
||||
r *sampleRing
|
||||
i int
|
||||
}
|
||||
|
||||
func (it *sampleRingIterator) Next() bool {
|
||||
it.i++
|
||||
return it.i < it.r.l
|
||||
}
|
||||
|
||||
func (it *sampleRingIterator) Seek(int64) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (it *sampleRingIterator) Err() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (it *sampleRingIterator) At() (int64, float64) {
|
||||
return it.r.at(it.i)
|
||||
}
|
||||
|
||||
func (r *sampleRing) at(i int) (int64, float64) {
|
||||
j := (r.f + i) % len(r.buf)
|
||||
s := r.buf[j]
|
||||
return s.t, s.v
|
||||
}
|
||||
|
||||
// add adds a sample to the ring buffer and frees all samples that fall
|
||||
// out of the delta range.
|
||||
func (r *sampleRing) add(t int64, v float64) {
|
||||
l := len(r.buf)
|
||||
// Grow the ring buffer if it fits no more elements.
|
||||
if l == r.l {
|
||||
buf := make([]sample, 2*l)
|
||||
copy(buf[l+r.f:], r.buf[r.f:])
|
||||
copy(buf, r.buf[:r.f])
|
||||
|
||||
r.buf = buf
|
||||
r.i = r.f
|
||||
r.f += l
|
||||
} else {
|
||||
r.i++
|
||||
if r.i >= l {
|
||||
r.i -= l
|
||||
}
|
||||
}
|
||||
|
||||
r.buf[r.i] = sample{t: t, v: v}
|
||||
r.l++
|
||||
|
||||
// Free head of the buffer of samples that just fell out of the range.
|
||||
for r.buf[r.f].t < t-r.delta {
|
||||
r.f++
|
||||
if r.f >= l {
|
||||
r.f -= l
|
||||
}
|
||||
r.l--
|
||||
}
|
||||
}
|
||||
|
||||
// last returns the most recent element added to the ring.
|
||||
func (r *sampleRing) last() (int64, float64, bool) {
|
||||
if r.l == 0 {
|
||||
return 0, 0, false
|
||||
}
|
||||
s := r.buf[r.i]
|
||||
return s.t, s.v, true
|
||||
}
|
||||
|
||||
func (r *sampleRing) samples() []sample {
|
||||
res := make([]sample, r.l)
|
||||
|
||||
var k = r.f + r.l
|
||||
var j int
|
||||
if k > len(r.buf) {
|
||||
k = len(r.buf)
|
||||
j = r.l - k + r.f
|
||||
}
|
||||
|
||||
n := copy(res, r.buf[r.f:k])
|
||||
copy(res[n:], r.buf[:j])
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
type mockSeriesSet struct {
|
||||
next func() bool
|
||||
series func() Series
|
||||
|
|
202
vendor/go4.org/LICENSE
generated
vendored
202
vendor/go4.org/LICENSE
generated
vendored
|
@ -1,202 +0,0 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
17
vendor/go4.org/reflectutil/asm_b.s
generated
vendored
17
vendor/go4.org/reflectutil/asm_b.s
generated
vendored
|
@ -1,17 +0,0 @@
|
|||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build go1.6
|
||||
// +build arm
|
||||
|
||||
#include "textflag.h"
|
||||
#include "funcdata.h"
|
||||
|
||||
// func typedmemmove(reflect_rtype, src unsafe.Pointer, size uintptr)
|
||||
TEXT ·typedmemmove(SB),(NOSPLIT|WRAPPER),$0-24
|
||||
B runtime·typedmemmove(SB)
|
||||
|
||||
// func memmove(dst, src unsafe.Pointer, size uintptr)
|
||||
TEXT ·memmove(SB),(NOSPLIT|WRAPPER),$0-24
|
||||
B runtime·memmove(SB)
|
13
vendor/go4.org/reflectutil/asm_b_14.s
generated
vendored
13
vendor/go4.org/reflectutil/asm_b_14.s
generated
vendored
|
@ -1,13 +0,0 @@
|
|||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !go1.5
|
||||
// +build arm
|
||||
|
||||
#include "textflag.h"
|
||||
#include "funcdata.h"
|
||||
|
||||
// func memmove(dst, src unsafe.Pointer, size uintptr)
|
||||
TEXT ·memmove(SB),(NOSPLIT|WRAPPER),$0-24
|
||||
B runtime·memmove(SB)
|
17
vendor/go4.org/reflectutil/asm_jmp.s
generated
vendored
17
vendor/go4.org/reflectutil/asm_jmp.s
generated
vendored
|
@ -1,17 +0,0 @@
|
|||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build go1.5,!js,!safe,!appengine
|
||||
// +build amd64 386
|
||||
|
||||
#include "textflag.h"
|
||||
#include "funcdata.h"
|
||||
|
||||
// func typedmemmove(reflect_rtype, src unsafe.Pointer, size uintptr)
|
||||
TEXT ·typedmemmove(SB),(NOSPLIT|WRAPPER),$0-24
|
||||
JMP runtime·typedmemmove(SB)
|
||||
|
||||
// func memmove(dst, src unsafe.Pointer, size uintptr)
|
||||
TEXT ·memmove(SB),(NOSPLIT|WRAPPER),$0-24
|
||||
JMP runtime·memmove(SB)
|
13
vendor/go4.org/reflectutil/asm_jmp_14.s
generated
vendored
13
vendor/go4.org/reflectutil/asm_jmp_14.s
generated
vendored
|
@ -1,13 +0,0 @@
|
|||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !go1.5,!js,!safe,!appengine
|
||||
// +build amd64 386
|
||||
|
||||
#include "textflag.h"
|
||||
#include "funcdata.h"
|
||||
|
||||
// func memmove(dst, src unsafe.Pointer, size uintptr)
|
||||
TEXT ·memmove(SB),(NOSPLIT|WRAPPER),$0-24
|
||||
JMP runtime·memmove(SB)
|
40
vendor/go4.org/reflectutil/reflectutil.go
generated
vendored
40
vendor/go4.org/reflectutil/reflectutil.go
generated
vendored
|
@ -1,40 +0,0 @@
|
|||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package reflectutil contains reflect utilities.
|
||||
package reflectutil
|
||||
|
||||
import "reflect"
|
||||
|
||||
// hasPointers reports whether the given type contains any pointers,
|
||||
// including any internal pointers in slices, funcs, maps, channels,
|
||||
// etc.
|
||||
//
|
||||
// This function exists for Swapper's internal use, instead of reaching
|
||||
// into the runtime's *reflect._rtype kind&kindNoPointers flag.
|
||||
func hasPointers(t reflect.Type) bool {
|
||||
if t == nil {
|
||||
panic("nil Type")
|
||||
}
|
||||
k := t.Kind()
|
||||
if k <= reflect.Complex128 {
|
||||
return false
|
||||
}
|
||||
switch k {
|
||||
default:
|
||||
// chan, func, interface, map, ptr, slice, string, unsafepointer
|
||||
// And anything else. It's safer to err on the side of true.
|
||||
return true
|
||||
case reflect.Array:
|
||||
return hasPointers(t.Elem())
|
||||
case reflect.Struct:
|
||||
num := t.NumField()
|
||||
for i := 0; i < num; i++ {
|
||||
if hasPointers(t.Field(i).Type) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
21
vendor/go4.org/reflectutil/swapper.go
generated
vendored
21
vendor/go4.org/reflectutil/swapper.go
generated
vendored
|
@ -1,21 +0,0 @@
|
|||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package reflectutil
|
||||
|
||||
import "reflect"
|
||||
|
||||
// Swapper returns a function which swaps the elements in slice.
|
||||
// Swapper panics if the provided interface is not a slice.
|
||||
//
|
||||
// Its goal is to work safely and efficiently for all versions and
|
||||
// variants of Go: pre-Go1.5, Go1.5+, safe, unsafe, App Engine,
|
||||
// GopherJS, etc.
|
||||
func Swapper(slice interface{}) func(i, j int) {
|
||||
v := reflect.ValueOf(slice)
|
||||
if v.Kind() != reflect.Slice {
|
||||
panic(&reflect.ValueError{Method: "reflectutil.Swapper", Kind: v.Kind()})
|
||||
}
|
||||
return swapper(v)
|
||||
}
|
105
vendor/go4.org/reflectutil/swapper_unsafe.go
generated
vendored
105
vendor/go4.org/reflectutil/swapper_unsafe.go
generated
vendored
|
@ -1,105 +0,0 @@
|
|||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !js,!appengine,!safe
|
||||
|
||||
package reflectutil
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
const ptrSize = 4 << (^uintptr(0) >> 63) // unsafe.Sizeof(uintptr(0)) but an ideal const
|
||||
|
||||
// arrayAt returns the i-th element of p, a C-array whose elements are
|
||||
// eltSize wide (in bytes).
|
||||
func arrayAt(p unsafe.Pointer, i int, eltSize uintptr) unsafe.Pointer {
|
||||
return unsafe.Pointer(uintptr(p) + uintptr(i)*eltSize)
|
||||
}
|
||||
|
||||
type sliceHeader struct {
|
||||
Data unsafe.Pointer
|
||||
Len int
|
||||
Cap int
|
||||
}
|
||||
|
||||
func swapper(v reflect.Value) func(i, j int) {
|
||||
maxLen := uint(v.Len())
|
||||
|
||||
s := sliceHeader{unsafe.Pointer(v.Pointer()), int(maxLen), int(maxLen)}
|
||||
tt := v.Type()
|
||||
elemt := tt.Elem()
|
||||
typ := unsafe.Pointer(reflect.ValueOf(elemt).Pointer())
|
||||
|
||||
size := elemt.Size()
|
||||
hasPtr := hasPointers(elemt)
|
||||
|
||||
// Some common & small cases, without using memmove:
|
||||
if hasPtr {
|
||||
if size == ptrSize {
|
||||
var ps []unsafe.Pointer
|
||||
*(*sliceHeader)(unsafe.Pointer(&ps)) = s
|
||||
return func(i, j int) { ps[i], ps[j] = ps[j], ps[i] }
|
||||
}
|
||||
if elemt.Kind() == reflect.String {
|
||||
var ss []string
|
||||
*(*sliceHeader)(unsafe.Pointer(&ss)) = s
|
||||
return func(i, j int) { ss[i], ss[j] = ss[j], ss[i] }
|
||||
}
|
||||
} else {
|
||||
switch size {
|
||||
case 8:
|
||||
var is []int64
|
||||
*(*sliceHeader)(unsafe.Pointer(&is)) = s
|
||||
return func(i, j int) { is[i], is[j] = is[j], is[i] }
|
||||
case 4:
|
||||
var is []int32
|
||||
*(*sliceHeader)(unsafe.Pointer(&is)) = s
|
||||
return func(i, j int) { is[i], is[j] = is[j], is[i] }
|
||||
case 2:
|
||||
var is []int16
|
||||
*(*sliceHeader)(unsafe.Pointer(&is)) = s
|
||||
return func(i, j int) { is[i], is[j] = is[j], is[i] }
|
||||
case 1:
|
||||
var is []int8
|
||||
*(*sliceHeader)(unsafe.Pointer(&is)) = s
|
||||
return func(i, j int) { is[i], is[j] = is[j], is[i] }
|
||||
}
|
||||
}
|
||||
|
||||
// Allocate scratch space for swaps:
|
||||
tmpVal := reflect.New(elemt)
|
||||
tmp := unsafe.Pointer(tmpVal.Pointer())
|
||||
|
||||
// If no pointers (or Go 1.4 or below), we don't require typedmemmove:
|
||||
if !haveTypedMemmove || !hasPtr {
|
||||
return func(i, j int) {
|
||||
if uint(i) >= maxLen || uint(j) >= maxLen {
|
||||
panic("reflect: slice index out of range")
|
||||
}
|
||||
val1 := arrayAt(s.Data, i, size)
|
||||
val2 := arrayAt(s.Data, j, size)
|
||||
memmove(tmp, val1, size)
|
||||
memmove(val1, val2, size)
|
||||
memmove(val2, tmp, size)
|
||||
}
|
||||
}
|
||||
|
||||
return func(i, j int) {
|
||||
if uint(i) >= maxLen || uint(j) >= maxLen {
|
||||
panic("reflect: slice index out of range")
|
||||
}
|
||||
val1 := arrayAt(s.Data, i, size)
|
||||
val2 := arrayAt(s.Data, j, size)
|
||||
typedmemmove(typ, tmp, val1)
|
||||
typedmemmove(typ, val1, val2)
|
||||
typedmemmove(typ, val2, tmp)
|
||||
}
|
||||
}
|
||||
|
||||
// memmove copies size bytes from src to dst.
|
||||
// The memory must not contain any pointers.
|
||||
//go:noescape
|
||||
func memmove(dst, src unsafe.Pointer, size uintptr)
|
15
vendor/go4.org/reflectutil/swapper_unsafe_14.go
generated
vendored
15
vendor/go4.org/reflectutil/swapper_unsafe_14.go
generated
vendored
|
@ -1,15 +0,0 @@
|
|||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !go1.5,!js,!appengine,!safe
|
||||
|
||||
package reflectutil
|
||||
|
||||
import "unsafe"
|
||||
|
||||
const haveTypedMemmove = false
|
||||
|
||||
func typedmemmove(reflect_rtype, dst, src unsafe.Pointer) {
|
||||
panic("never called") // only here so swapper_unsafe.go compiles
|
||||
}
|
15
vendor/go4.org/reflectutil/swapper_unsafe_15.go
generated
vendored
15
vendor/go4.org/reflectutil/swapper_unsafe_15.go
generated
vendored
|
@ -1,15 +0,0 @@
|
|||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build go1.5,!js,!appengine,!safe
|
||||
|
||||
package reflectutil
|
||||
|
||||
import "unsafe"
|
||||
|
||||
const haveTypedMemmove = true
|
||||
|
||||
// typedmemmove copies a value of type t to dst from src.
|
||||
//go:noescape
|
||||
func typedmemmove(reflect_rtype, dst, src unsafe.Pointer)
|
18
vendor/vendor.json
vendored
18
vendor/vendor.json
vendored
|
@ -227,12 +227,6 @@
|
|||
"revision": "c589d0c9f0d81640c518354c7bcae77d99820aa3",
|
||||
"revisionTime": "2016-09-30T00:14:02Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "NHQfiS8m+veKimFRVXgomeNq5vo=",
|
||||
"path": "github.com/bradfitz/slice",
|
||||
"revision": "d9036e2120b5ddfa53f3ebccd618c4af275f47da",
|
||||
"revisionTime": "2016-08-23T17:19:49Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "ki4pYDh/uURZV90biC7in/HIBsc=",
|
||||
"path": "github.com/cespare/xxhash",
|
||||
|
@ -368,10 +362,10 @@
|
|||
"revisionTime": "2016-09-30T00:14:02Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "L4bnnz4uVgDueUvcTKkZJ+IqPbw=",
|
||||
"checksumSHA1": "bBLYUZL/ZfgLqOPlBCkA88QahFQ=",
|
||||
"path": "github.com/fabxc/tsdb",
|
||||
"revision": "70909ca8ad875aa6f01e1801d185b3f3bab2fda3",
|
||||
"revisionTime": "2017-03-21T11:21:02Z"
|
||||
"revision": "1afd8080f78b4925d2d6824eb8b6df333e549160",
|
||||
"revisionTime": "2017-03-31T11:53:02Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "uVzWuLvF646YjiKomsc2CR1ua58=",
|
||||
|
@ -685,12 +679,6 @@
|
|||
"revision": "c589d0c9f0d81640c518354c7bcae77d99820aa3",
|
||||
"revisionTime": "2016-09-30T00:14:02Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "yy0yzurpFpQZS31Tj1WjBxLVCSE=",
|
||||
"path": "go4.org/reflectutil",
|
||||
"revision": "09d86de304dc27e636298361bbfee4ac6ab04f21",
|
||||
"revisionTime": "2016-11-18T21:00:15Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "9jjO5GjLa0XF/nfWihF02RoH4qc=",
|
||||
"path": "golang.org/x/net/context",
|
||||
|
|
Loading…
Reference in a new issue