1/3 Updated Makefile to allow VENDOR flag (adds -vendor to version string)

2/3 Added vendor/ dir to lock down dependent pkg versions.
The author of git.schwanenlied.me/yawning/{chacha20,newhope,kyber}.git has copied
their repos to gitlab.com/yawning/ but some imports of chacha20 from newhope still
inconsistently refer to git.schwanenlied.me/, breaking build.
Licenses for chacha20 also changed from CC0 to AGPL, which may or may not be an
issue. Until the two aforementioned issues are resolved, locking to last-good
versions is probably the best way forward for now.

To build with vendored deps, use make VENDOR=1 clean all

3/3 Moved body of CI push script into bacillus/
This commit is contained in:
Russ Magee 2020-01-29 13:25:14 -08:00
parent 7fe915450b
commit f5be3578a8
854 changed files with 287417 additions and 7 deletions

82
vendor/gopkg.in/hlandau/measurable.v1/README.md generated vendored Normal file
View file

@ -0,0 +1,82 @@
Measurable: The useless Go metric registration package that doesn't do anything
===============================================================================
[![GoDoc](https://godoc.org/gopkg.in/hlandau/measurable.v1?status.svg)](https://godoc.org/gopkg.in/hlandau/measurable.v1)
Measurable is a Go library for managing the registration of metrics such as
counters and gauges, no matter how that metric data is eventually consumed.
The most noteworthy feature of measurable is that it doesn't do anything. It
contains no functionality for providing metric data to any external service,
and it contains no actual metric implementations.
The purpose of measurable is to act as an [integration
nexus](https://www.devever.net/~hl/nexuses), essentially a matchmaker between
metric sources and metric consumers. This creates the important feature that
your application's metrics can be expressed completely independently of *how*
those metrics are exported.
Measurable doesn't implement any metric or metric export logic because it
strives to be a neutral intermediary, which abstracts the interface between
metrics and metric exporters.
**Import as:** `gopkg.in/hlandau/measurable.v1`
Measurable
----------
A Measurable is an object that represents some metric. It is obliged only to
implement the following interface:
```go
type Measurable interface {
MsName() string
MsType() Type
}
```
Measurable is designed around interface upgrades. If you want to actually
do anything with a Measurable, you must attempt to cast it to an interface
with the methods you need. A Measurable is not obliged to implement any
interface besides Measurable, but almost always will.
Here are some common interfaces implemented by Measurables, in descending order
of importance:
- `MsName() string` — get the Measurable name.
- `MsType() Type` — get the Measurable type.
- `MsInt64() int64` — get the Measurable as an int64.
- `String() string` — the standard Go `String()` interface.
All Measurables should implement `MsName() string` and `MsType() Type`.
Measurable-specific methods should always be prefixed by `Ms` so it is clear
they are intended for consumption by Measurable consumers.
`MsName`, `MsType` and `MsInt64` should suffice for most consumers of Counter
and Gauge metric types.
Metrics should be named in lowercase using dots to create a hierarchy and
dashes to separate words, e.g. `someserver.http.request-count`. These metric
names may be transmuted by consumers as necessary for some graphing systems,
such as Prometheus (which allows only underscores).
Standard Bindings
-----------------
For a package which makes it easy to register and consume measurables, see the
[easymetric](https://github.com/hlandau/easymetric) package.
Of course, nothing requires you to use the easymetric package. You are free to escew it and make your own.
Background Reading
------------------
- [On Nexuses](https://www.devever.net/~hl/nexuses)
- See also: [Configurable](https://github.com/hlandau/configurable)
Licence
-------
© 2015 Hugo Landau <hlandau@devever.net> MIT License

189
vendor/gopkg.in/hlandau/measurable.v1/measurable.go generated vendored Normal file
View file

@ -0,0 +1,189 @@
// Package measurable provides a functionality-free integration nexus for
// metric registration.
//
// Measurable is a Go package for connecting service metrics and metric consumers.
//
// The most noteworthy feature of measurable is that it doesn't do anything.
// It contains no functionality for defining or exporting metrics.
//
// The purpose of measurable is to act as an integration nexus
// (https://www.devever.net/~hl/nexuses), essentially a matchmaker between
// application metrics and metric consumers. This creates the important feature
// that your application's metrics can be defined completely independently of
// *how* those metrics are defined.
//
// Measurable doesn't implement any metric definition or export logic because it
// strives to be a neutral intermediary, which abstracts the interface between
// measurables and measurable consumers
//
// Pursuant to this, package measurable is this and only this: an interface
// Measurable which all metrics must implement, and a facility for registering
// Measurables and visiting them.
package measurable // import "gopkg.in/hlandau/measurable.v1"
import "sync"
import "fmt"
// Measurable is the interface which must be implemented by any metric item to
// be used with package measurable. In the current version, v1, it contains
// only the MsName() and MsType() methods. All other functionality must be
// obtained by interface upgrades.
type Measurable interface {
// Returns the name of the metric. Names should be in the style
// "alpha.beta.gamma-delta", for example "foo.http.requests.count". That is,
// names should be lowercase, should express a hierarchy separated by dots,
// and have words separated by dashes.
//
// Some Measurable consumers may mutate these names to satisfy naming
// restrictions applied by some graphing systems.
MsName() string
// Return the Measurable type. You can, of course, invent your own Measurable
// types, though consumers won't necessarily know what to do with them.
MsType() Type
}
var measurablesMutex sync.RWMutex
var measurables = map[string]Measurable{}
// Registers a top-level Configurable.
func Register(measurable Measurable) {
measurablesMutex.Lock()
defer measurablesMutex.Unlock()
if measurable == nil {
panic("cannot register nil measurable")
}
name := measurable.MsName()
if name == "" {
panic("measurable cannot have empty name")
}
_, exists := measurables[name]
if exists {
panic(fmt.Sprintf("A measurable with the same name already exists: %s", name))
}
measurables[name] = measurable
callRegistrationHooks(measurable, RegisterEvent)
}
func Unregister(measurableName string) {
measurablesMutex.Lock()
defer measurablesMutex.Unlock()
measurable, ok := measurables[measurableName]
if !ok {
return
}
callRegistrationHooks(measurable, UnregisterEvent)
delete(measurables, measurableName)
}
func Get(measurableName string) Measurable {
measurablesMutex.RLock()
defer measurablesMutex.RUnlock()
return measurables[measurableName]
}
// Visits all registered top-level Measurables.
//
// Returning a non-nil error short-circuits the iteration process and returns
// that error.
func Visit(do func(measurable Measurable) error) error {
measurablesMutex.Lock()
defer measurablesMutex.Unlock()
for _, measurable := range measurables {
err := do(measurable)
if err != nil {
return err
}
}
return nil
}
// Represents a measurable type.
type Type uint32
const (
// A CounterType Measurable represents a non-negative integral value
// that monotonously increases. It must implement `MsInt64() int64`.
CounterType Type = 0x436E7472
// A GaugeType Measurable represents an integral value that varies over
// time. It must implement `MsInt64() int64`.
GaugeType = 0x47617567
)
// Registration hooks.
type HookEvent int
const (
// This event is issued when a measurable is registered.
RegisterEvent HookEvent = iota
// This event is issued when a registration hook is registered. It is issued
// for every measurable which has already been registered.
RegisterCatchupEvent
// This event is issued when a measurable is unregistered.
UnregisterEvent
)
type HookFunc func(measurable Measurable, hookEvent HookEvent)
var hooksMutex sync.RWMutex
var hooks = map[interface{}]HookFunc{}
// Register for notifications on metric registration. The key must be usable as
// a key in a map and identifies the hook. No other hook with the same key must
// already exist.
//
// NOTE: The hook will be called for all registrations which already exist.
// This ensures that no registrations are missed in a threadsafe manner.
// For these calls, the event will be EventRegisterCatchup.
//
// The hook must not register or unregister registration hooks or metrics.
func RegisterHook(key interface{}, hook HookFunc) {
measurablesMutex.RLock()
defer measurablesMutex.RUnlock()
registerHook(key, hook)
for _, m := range measurables {
hook(m, RegisterCatchupEvent)
}
}
func registerHook(key interface{}, hook HookFunc) {
hooksMutex.Lock()
defer hooksMutex.Unlock()
_, exists := hooks[key]
if exists {
panic(fmt.Sprintf("A metric registration hook with the same key already exists: %+v", key))
}
hooks[key] = hook
}
// Unregister an existing hook.
func UnregisterHook(key interface{}) {
hooksMutex.Lock()
defer hooksMutex.Unlock()
delete(hooks, key)
}
func callRegistrationHooks(measurable Measurable, event HookEvent) {
hooksMutex.RLock()
defer hooksMutex.RUnlock()
for _, v := range hooks {
v(measurable, event)
}
}