updateallowedcontext

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2020 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Overview

Package updateallowedcontext stores and accesses the update allowed in context.Context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) (chan struct{}, bool)

FromContext returns the update allowed channel, if any.

func IsUpdateAllowed

func IsUpdateAllowed(ctx context.Context) bool

IsUpdateAllowed checks whether the given context obtains information about the update allowed channel as defined in this package, if any update allowed channel is present.

NOTE that the update allowed channel, if any found, is only used to be closed to signal updates are allowed. It is not guaranteed that the channel is buffered or read from. Clients must not write to it. Otherwise the update allowed channel will block eventually. It is safe to signal updates are allowed via SetUpdateAllowed.

func NewContext

func NewContext(ctx context.Context, v chan struct{}) context.Context

NewContext returns a new context.Context that carries value v.

func SetUpdateAllowed

func SetUpdateAllowed(ctx context.Context)

SetUpdateAllowed is a safe way to signal updates are allowed.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL