snapshot of https://github.com/cortezaproject/corteza.git (2024.9.x, 2026-09-18; blobs > 131072B omitted)
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s

This commit is contained in:
upstream-mirror
2026-09-18 01:22:23 +05:00
commit 7e385fc126
8391 changed files with 1766236 additions and 0 deletions

14
server/vendor/github.com/SentimensRG/ctx/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,14 @@
# Binaries for programs and plugins
*.exe
*.dll
*.so
*.dylib
# Test binary, build with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/

21
server/vendor/github.com/SentimensRG/ctx/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Sentimens Research Group
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

63
server/vendor/github.com/SentimensRG/ctx/README.md generated vendored Normal file
View File

@@ -0,0 +1,63 @@
# ctx
Composable utilities for Go contexts.
[![Godoc Reference](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/SentimensRG/ctx)
[![Go Report Card](https://goreportcard.com/badge/github.com/SentimensRG/ctx?style=flat-square)](https://goreportcard.com/report/github.com/SentimensRG/ctx)
## Installation
```bash
go get -u github.com/SentimensRG/ctx
```
## Overview
The `ctx` package provides utilites for working with data structures satisfying
the `ctx.Doner` interface, most notably `context.Context`:
```go
type Doner interface {
Done() <-chan struct{}
}
```
The functions in `ctx` are appropriate for operations that do not preserve the
values in a context, e.g.: joining several contexts together.
## Subpackages
- [sigctx](https://github.com/SentimensRG/ctx/tree/master/sigctx): contexts for graceful shutdown
- [refctx](https://github.com/SentimensRG/ctx/tree/master/refctx): contexts linked to a reference-counter
- [mergectx](https://github.com/SentimensRG/ctx/tree/master/mergectx): utilities for merging `context.Context` instances while preserving values, errors and deadlines.
## RFC
If you find this useful please let me know: <l.thibault@sentimens.com>
Seriously, even if you just used it in your weekend project, I'd like to hear
about it :)
## License
The MIT License
Copyright (c) 2017 Sentimens Research Group, LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

184
server/vendor/github.com/SentimensRG/ctx/ctx.go generated vendored Normal file
View File

@@ -0,0 +1,184 @@
package ctx
import (
"context"
"sync"
"time"
)
// Binder is the interface that wraps the basic Bind method.
// Bind executes logic until the Doner completes. Implementations of Bind must
// not return until the Doner has completed.
type Binder interface {
Bind(Doner)
}
// BindFunc is an adapter to allow the use of ordinary functions as Binders.
type BindFunc func(Doner)
// Bind executes logic until the Doner completes. It satisfies the Binder
// interface.
func (f BindFunc) Bind(d Doner) { f(d) }
// Doner can block until something is done
type Doner interface {
Done() <-chan struct{}
}
// C is a basic implementation of Doner
type C <-chan struct{}
// Background is the ctx analog to context.Background(). It never fires.
func Background() C {
return nil
}
// Done returns a channel that receives when an action is complete
func (dc C) Done() <-chan struct{} { return dc }
type ctx struct {
Doner
}
// Deadline returns the time when work done on behalf of this context
// should be canceled. Deadline returns ok==false when no deadline is
// set. Successive calls to Deadline return the same results.
func (ctx) Deadline() (deadline time.Time, ok bool) {
return
}
func (c ctx) Err() error {
select {
case <-c.Done():
return context.Canceled
default:
return nil
}
}
func (c ctx) Value(interface{}) (v interface{}) {
return
}
// AsContext creates a context that fires when the Doner fires
func AsContext(d Doner) context.Context {
return ctx{d}
}
// After time time has elapsed, the Doner fires
func After(d time.Duration) C {
ch := make(chan struct{})
go func() {
<-time.After(d)
close(ch)
}()
return ch
}
// WithCancel returns a new Doner that can be cancelled via the associated
// function
func WithCancel(d Doner) (C, func()) {
var closer sync.Once
cq := make(chan struct{})
cancel := func() { closer.Do(func() { close(cq) }) }
go func() {
select {
case <-cq:
case <-d.Done():
cancel()
}
}()
return cq, cancel
}
// Tick returns a <-chan whose range ends when the underlying context cancels
func Tick(d Doner) <-chan struct{} {
c := make(chan struct{})
cq := d.Done()
go func() {
for {
select {
case <-cq:
close(c)
return
default:
select {
case c <- struct{}{}:
case <-cq:
}
}
}
}()
return c
}
// Defer guarantees that a function will be called after a context has cancelled
func Defer(d Doner, cb func()) {
go func() {
<-d.Done()
cb()
}()
}
// Link returns a channel that fires if ANY of the constituent Doners have fired
func Link(doners ...Doner) C {
c := make(chan struct{})
cancel := func() { close(c) }
var once sync.Once
for _, d := range doners {
Defer(d, func() { once.Do(cancel) })
}
return c
}
// Join returns a channel that receives when all constituent Doners have fired
func Join(doners ...Doner) C {
var wg sync.WaitGroup
wg.Add(len(doners))
for _, d := range doners {
Defer(d, wg.Done)
}
cq := make(chan struct{})
go func() {
wg.Wait()
close(cq)
}()
return cq
}
// FTick calls a function in a loop until the Doner has fired
func FTick(d Doner, f func()) {
for range Tick(d) {
f()
}
}
// FTickInterval calls a function repeatedly at a given internval, until the Doner
// has fired. Note that FTickInterval ignores the time spent executing a function,
// and instead guarantees an interval of `t` between of return of the previous
// function call and the invocation of the next function call.
func FTickInterval(d Doner, t time.Duration, f func()) {
for {
select {
case <-d.Done():
return
case <-time.After(t):
f()
}
}
}
// FDone returns a doner that fires when the function returns or panics
func FDone(f func()) C {
ch := make(chan struct{})
go func() {
defer close(ch)
f()
}()
return ch
}

View File

@@ -0,0 +1,63 @@
# sigctx
Package `sigctx` provides contexts for graceful shutdown.
The `sigctx` package provides a context that terminates when it receives a
SIGINT or SIGTERM. This provides a convenient mechanism for triggering
graceful application shutdown.
`sigctx.New` returns a `ctx.C`, which implements the ubiquitous `ctx.Doner`
interface. It fires when either SIGINT or SIGTERM is caught.
## Examples
```go
import (
"log"
"github.com/SentimensRG/ctx/sigctx"
)
func main() {
ctx := sigctx.New() // returns a regular context.Context
<-ctx.Done() // will unblock on SIGINT and SIGTERM
log.Println("exiting.")
}
```
`sigctx.Tick` can be used to react to streams of signals. For example, you can
implement a graceful shutdown attempt, followed by a forced shutdown.
```go
import (
"log"
"github.com/SentimensRG/ctx/sigctx"
"github.com/SentimensRG/ctx"
)
func main() {
t := sigctx.Tick()
d, cancel := ctx.WithCancel(ctx.Background())
go func() {
defer cancel()
go func() {
// business logic goes here
}()
<-t
log.Println("attempting graceful shutdown - press Ctrl + c again to force quit")
go func() {
defer cancel()
// cleanup logic goes here
}()
<-t
log.Println("forcing close")
}()
<-d.Done()
}
```

View File

@@ -0,0 +1,60 @@
// Package sigctx provides a context that expires when a SIGINT or SIGTERM is
// received.
package sigctx
import (
"os"
"os/signal"
"sync"
"syscall"
"github.com/SentimensRG/ctx"
)
var (
c ctx.C
sigCh chan os.Signal
initC, initSig sync.Once
)
func initSigCh() {
sigCh = make(chan os.Signal, 1)
signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)
}
// New signal-bound ctx.C that terminates when either SIGINT or SIGTERM
// is caught.
func New() ctx.C {
initC.Do(func() {
initSig.Do(initSigCh)
dc := make(chan struct{})
c = dc
go func() {
select {
case <-sigCh:
close(dc)
case <-c.Done():
}
}()
})
return c
}
// Tick returns a channel that recvs each time a either SIGINT or SIGTERM are
// caught.
func Tick() <-chan struct{} {
initSig.Do(initSigCh)
dc := make(chan struct{})
go func() {
for {
<-sigCh
dc <- struct{}{}
}
}()
return dc
}