mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-03 11:38:23 -05:00
* bump dependencies Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * bump reva and add config options Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> --------- Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
30 lines
490 B
Go
30 lines
490 B
Go
package server
|
|
|
|
import (
|
|
"context"
|
|
"sync"
|
|
)
|
|
|
|
type serverKey struct{}
|
|
type wgKey struct{}
|
|
|
|
func wait(ctx context.Context) *sync.WaitGroup {
|
|
if ctx == nil {
|
|
return nil
|
|
}
|
|
wg, ok := ctx.Value(wgKey{}).(*sync.WaitGroup)
|
|
if !ok {
|
|
return nil
|
|
}
|
|
return wg
|
|
}
|
|
|
|
func FromContext(ctx context.Context) (Server, bool) {
|
|
c, ok := ctx.Value(serverKey{}).(Server)
|
|
return c, ok
|
|
}
|
|
|
|
func NewContext(ctx context.Context, s Server) context.Context {
|
|
return context.WithValue(ctx, serverKey{}, s)
|
|
}
|