1
0
mirror of https://github.com/openfaas/faasd.git synced 2025-06-19 12:36:38 +00:00
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (OpenFaaS Ltd)
2019-12-20 12:56:11 +00:00
parent 9a30ff517f
commit 5c45242b3d
1379 changed files with 633020 additions and 0 deletions
.gitignoreGopkg.lockGopkg.toml
cmd
main.go
pkg
vendor
github.com
Microsoft
go-winio
hcsshim
.gitignore.gometalinter.jsonLICENSEProtobuild.tomlREADME.mdappveyor.yml
cmd
container.goerrors.gofunctional_tests.ps1go.modgo.sumhcsshim.gohnsendpoint.gohnsglobals.gohnsnetwork.gohnspolicy.gohnspolicylist.gohnssupport.gointerface.go
internal
cow
hcs
hcserror
hns
interop
log
logfields
longpath
mergemaps
oc
safefile
schema1
schema2
timeout
vmcompute
wclayer
layer.gomksyscall_windows.go
pkg
go-runhcs
process.gozsyscall_windows.go
containerd
containerd
.appveyor.yml.gitignore.golangci.yml.mailmap.travis.yml.zuul.yamlADOPTERS.mdBUILDING.mdLICENSEMakefileMakefile.darwinMakefile.freebsdMakefile.linuxMakefile.windowsNOTICEPLUGINS.mdProtobuild.tomlREADME.mdRELEASES.mdROADMAP.mdRUNC.mdSCOPE.md
api
archive
cio
client.goclient_opts.gocode-of-conduct.mdcontainer.gocontainer_checkpoint_opts.gocontainer_opts.gocontainer_opts_unix.gocontainer_restore_opts.gocontainerd.service
containers
containerstore.go
content
defaults
diff.go
diff
errdefs
events.go
events
export.go
filters
grpc.go
identifiers
image.goimage_store.go
images
import.goinstall.goinstall_opts.go
labels
lease.go
leases
log
mount
namespaces.go
namespaces
oci
pkg
platforms
plugin
process.gopull.go
reference
remotes
rootfs
runtime
services.gosignals.gosignals_unix.gosignals_windows.go
snapshots
snapshotter_default_linux.gosnapshotter_default_unix.gosnapshotter_default_windows.go
sys
task.gotask_opts.gotask_opts_unix.gounpacker.govendor.conf
version
continuity
fifo
ttrpc
typeurl
docker
gogo
golang
inconshreveable
konsorten
morikuni
opencontainers
pkg
sirupsen
spf13
syndtr
go.opencensus.io
golang.org
x
net
sync
sys
AUTHORSCONTRIBUTORSLICENSEPATENTS
unix
.gitignoreREADME.mdaffinity_linux.goaliases.goasm_aix_ppc64.sasm_darwin_386.sasm_darwin_amd64.sasm_darwin_arm.sasm_darwin_arm64.sasm_dragonfly_amd64.sasm_freebsd_386.sasm_freebsd_amd64.sasm_freebsd_arm.sasm_freebsd_arm64.sasm_linux_386.sasm_linux_amd64.sasm_linux_arm.sasm_linux_arm64.sasm_linux_mips64x.sasm_linux_mipsx.sasm_linux_ppc64x.sasm_linux_riscv64.sasm_linux_s390x.sasm_netbsd_386.sasm_netbsd_amd64.sasm_netbsd_arm.sasm_netbsd_arm64.sasm_openbsd_386.sasm_openbsd_amd64.sasm_openbsd_arm.sasm_openbsd_arm64.sasm_solaris_amd64.sbluetooth_linux.gocap_freebsd.goconstants.godev_aix_ppc.godev_aix_ppc64.godev_darwin.godev_dragonfly.godev_freebsd.godev_linux.godev_netbsd.godev_openbsd.godirent.goendian_big.goendian_little.goenv_unix.goerrors_freebsd_386.goerrors_freebsd_amd64.goerrors_freebsd_arm.gofcntl.gofcntl_darwin.gofcntl_linux_32bit.gofdset.gogccgo.gogccgo_c.cgccgo_linux_amd64.goioctl.gomkall.shmkasm_darwin.gomkerrors.shmkpost.gomksyscall.gomksyscall_aix_ppc.gomksyscall_aix_ppc64.gomksyscall_solaris.gomksysctl_openbsd.gomksysnum.gopagesize_unix.gopledge_openbsd.gorace.gorace0.goreaddirent_getdents.goreaddirent_getdirentries.gosockcmsg_dragonfly.gosockcmsg_linux.gosockcmsg_unix.gosockcmsg_unix_other.gostr.gosyscall.gosyscall_aix.gosyscall_aix_ppc.gosyscall_aix_ppc64.gosyscall_bsd.gosyscall_darwin.1_12.gosyscall_darwin.1_13.gosyscall_darwin.gosyscall_darwin_386.1_11.gosyscall_darwin_386.gosyscall_darwin_amd64.1_11.gosyscall_darwin_amd64.gosyscall_darwin_arm.1_11.gosyscall_darwin_arm.gosyscall_darwin_arm64.1_11.gosyscall_darwin_arm64.gosyscall_darwin_libSystem.gosyscall_dragonfly.gosyscall_dragonfly_amd64.gosyscall_freebsd.gosyscall_freebsd_386.gosyscall_freebsd_amd64.gosyscall_freebsd_arm.gosyscall_freebsd_arm64.gosyscall_linux.gosyscall_linux_386.gosyscall_linux_amd64.gosyscall_linux_amd64_gc.gosyscall_linux_arm.gosyscall_linux_arm64.gosyscall_linux_gc.gosyscall_linux_gc_386.gosyscall_linux_gccgo_386.gosyscall_linux_gccgo_arm.gosyscall_linux_mips64x.gosyscall_linux_mipsx.gosyscall_linux_ppc64x.gosyscall_linux_riscv64.gosyscall_linux_s390x.gosyscall_linux_sparc64.gosyscall_netbsd.gosyscall_netbsd_386.gosyscall_netbsd_amd64.gosyscall_netbsd_arm.gosyscall_netbsd_arm64.gosyscall_openbsd.gosyscall_openbsd_386.gosyscall_openbsd_amd64.gosyscall_openbsd_arm.gosyscall_openbsd_arm64.gosyscall_solaris.gosyscall_solaris_amd64.gosyscall_unix.gosyscall_unix_gc.gosyscall_unix_gc_ppc64x.gotimestruct.gotypes_aix.gotypes_darwin.gotypes_dragonfly.gotypes_freebsd.gotypes_netbsd.gotypes_openbsd.gotypes_solaris.gounveil_openbsd.goxattr_bsd.gozerrors_aix_ppc.gozerrors_aix_ppc64.gozerrors_darwin_386.gozerrors_darwin_amd64.gozerrors_darwin_arm.gozerrors_darwin_arm64.gozerrors_dragonfly_amd64.gozerrors_freebsd_386.gozerrors_freebsd_amd64.gozerrors_freebsd_arm.gozerrors_freebsd_arm64.gozerrors_linux_386.gozerrors_linux_amd64.gozerrors_linux_arm.gozerrors_linux_arm64.gozerrors_linux_mips.gozerrors_linux_mips64.gozerrors_linux_mips64le.gozerrors_linux_mipsle.gozerrors_linux_ppc64.gozerrors_linux_ppc64le.gozerrors_linux_riscv64.gozerrors_linux_s390x.gozerrors_linux_sparc64.gozerrors_netbsd_386.gozerrors_netbsd_amd64.gozerrors_netbsd_arm.gozerrors_netbsd_arm64.gozerrors_openbsd_386.gozerrors_openbsd_amd64.gozerrors_openbsd_arm.gozerrors_openbsd_arm64.gozerrors_solaris_amd64.gozptrace_armnn_linux.gozptrace_linux_arm64.gozptrace_mipsnn_linux.gozptrace_mipsnnle_linux.gozptrace_x86_linux.gozsyscall_aix_ppc.gozsyscall_aix_ppc64.gozsyscall_aix_ppc64_gc.gozsyscall_aix_ppc64_gccgo.gozsyscall_darwin_386.1_11.gozsyscall_darwin_386.1_13.gozsyscall_darwin_386.1_13.szsyscall_darwin_386.gozsyscall_darwin_386.szsyscall_darwin_amd64.1_11.gozsyscall_darwin_amd64.1_13.gozsyscall_darwin_amd64.1_13.szsyscall_darwin_amd64.gozsyscall_darwin_amd64.szsyscall_darwin_arm.1_11.gozsyscall_darwin_arm.1_13.gozsyscall_darwin_arm.1_13.szsyscall_darwin_arm.gozsyscall_darwin_arm.szsyscall_darwin_arm64.1_11.gozsyscall_darwin_arm64.1_13.gozsyscall_darwin_arm64.1_13.szsyscall_darwin_arm64.gozsyscall_darwin_arm64.szsyscall_dragonfly_amd64.gozsyscall_freebsd_386.gozsyscall_freebsd_amd64.gozsyscall_freebsd_arm.gozsyscall_freebsd_arm64.gozsyscall_linux_386.gozsyscall_linux_amd64.gozsyscall_linux_arm.gozsyscall_linux_arm64.gozsyscall_linux_mips.gozsyscall_linux_mips64.gozsyscall_linux_mips64le.gozsyscall_linux_mipsle.gozsyscall_linux_ppc64.gozsyscall_linux_ppc64le.gozsyscall_linux_riscv64.gozsyscall_linux_s390x.gozsyscall_linux_sparc64.gozsyscall_netbsd_386.gozsyscall_netbsd_amd64.gozsyscall_netbsd_arm.gozsyscall_netbsd_arm64.gozsyscall_openbsd_386.gozsyscall_openbsd_amd64.gozsyscall_openbsd_arm.gozsyscall_openbsd_arm64.gozsyscall_solaris_amd64.gozsysctl_openbsd_386.gozsysctl_openbsd_amd64.gozsysctl_openbsd_arm.gozsysctl_openbsd_arm64.gozsysnum_darwin_386.gozsysnum_darwin_amd64.gozsysnum_darwin_arm.gozsysnum_darwin_arm64.gozsysnum_dragonfly_amd64.gozsysnum_freebsd_386.gozsysnum_freebsd_amd64.gozsysnum_freebsd_arm.gozsysnum_freebsd_arm64.gozsysnum_linux_386.gozsysnum_linux_amd64.gozsysnum_linux_arm.gozsysnum_linux_arm64.gozsysnum_linux_mips.gozsysnum_linux_mips64.gozsysnum_linux_mips64le.gozsysnum_linux_mipsle.gozsysnum_linux_ppc64.gozsysnum_linux_ppc64le.gozsysnum_linux_riscv64.gozsysnum_linux_s390x.gozsysnum_linux_sparc64.gozsysnum_netbsd_386.gozsysnum_netbsd_amd64.gozsysnum_netbsd_arm.gozsysnum_netbsd_arm64.gozsysnum_openbsd_386.gozsysnum_openbsd_amd64.gozsysnum_openbsd_arm.gozsysnum_openbsd_arm64.goztypes_aix_ppc.goztypes_aix_ppc64.goztypes_darwin_386.goztypes_darwin_amd64.goztypes_darwin_arm.goztypes_darwin_arm64.goztypes_dragonfly_amd64.goztypes_freebsd_386.goztypes_freebsd_amd64.goztypes_freebsd_arm.goztypes_freebsd_arm64.goztypes_linux_386.goztypes_linux_amd64.goztypes_linux_arm.goztypes_linux_arm64.goztypes_linux_mips.goztypes_linux_mips64.goztypes_linux_mips64le.goztypes_linux_mipsle.goztypes_linux_ppc64.goztypes_linux_ppc64le.goztypes_linux_riscv64.goztypes_linux_s390x.goztypes_linux_sparc64.goztypes_netbsd_386.goztypes_netbsd_amd64.goztypes_netbsd_arm.goztypes_netbsd_arm64.goztypes_openbsd_386.goztypes_openbsd_amd64.goztypes_openbsd_arm.goztypes_openbsd_arm64.goztypes_solaris_amd64.go
windows
text
google.golang.org

111
vendor/github.com/docker/go-events/queue.go generated vendored Normal file

@ -0,0 +1,111 @@
package events
import (
"container/list"
"sync"
"github.com/sirupsen/logrus"
)
// Queue accepts all messages into a queue for asynchronous consumption
// by a sink. It is unbounded and thread safe but the sink must be reliable or
// events will be dropped.
type Queue struct {
dst Sink
events *list.List
cond *sync.Cond
mu sync.Mutex
closed bool
}
// NewQueue returns a queue to the provided Sink dst.
func NewQueue(dst Sink) *Queue {
eq := Queue{
dst: dst,
events: list.New(),
}
eq.cond = sync.NewCond(&eq.mu)
go eq.run()
return &eq
}
// Write accepts the events into the queue, only failing if the queue has
// been closed.
func (eq *Queue) Write(event Event) error {
eq.mu.Lock()
defer eq.mu.Unlock()
if eq.closed {
return ErrSinkClosed
}
eq.events.PushBack(event)
eq.cond.Signal() // signal waiters
return nil
}
// Close shutsdown the event queue, flushing
func (eq *Queue) Close() error {
eq.mu.Lock()
defer eq.mu.Unlock()
if eq.closed {
return nil
}
// set closed flag
eq.closed = true
eq.cond.Signal() // signal flushes queue
eq.cond.Wait() // wait for signal from last flush
return eq.dst.Close()
}
// run is the main goroutine to flush events to the target sink.
func (eq *Queue) run() {
for {
event := eq.next()
if event == nil {
return // nil block means event queue is closed.
}
if err := eq.dst.Write(event); err != nil {
// TODO(aaronl): Dropping events could be bad depending
// on the application. We should have a way of
// communicating this condition. However, logging
// at a log level above debug may not be appropriate.
// Eventually, go-events should not use logrus at all,
// and should bubble up conditions like this through
// error values.
logrus.WithFields(logrus.Fields{
"event": event,
"sink": eq.dst,
}).WithError(err).Debug("eventqueue: dropped event")
}
}
}
// next encompasses the critical section of the run loop. When the queue is
// empty, it will block on the condition. If new data arrives, it will wake
// and return a block. When closed, a nil slice will be returned.
func (eq *Queue) next() Event {
eq.mu.Lock()
defer eq.mu.Unlock()
for eq.events.Len() < 1 {
if eq.closed {
eq.cond.Broadcast()
return nil
}
eq.cond.Wait()
}
front := eq.events.Front()
block := front.Value.(Event)
eq.events.Remove(front)
return block
}