contextack

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2017 License: BSD-3-Clause Imports: 1 Imported by: 0

README

Documentation

Overview

Package contextack extends context.Context with cancellation acknowledgement.

API implementations should provide context value keys for functions which support context. A group of functions may share the same key if only one of them will be called with a given context (including any parent context which was created via WithAck). The functions should call Ack with the key just before exiting.

API clients should call WithAck with the key which represents the function they are about to call. When it's important to wait until the function has finished, the receive channel returned by WithAck can be used.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ack

func Ack(ctx context.Context, key interface{})

Ack notifies all subscribers that the operation represented by the key has finished. It's ok to call this even when there are no subscribers.

func WithAck

func WithAck(ctx context.Context, key interface{}) (context.Context, <-chan struct{})

WithAck returns ctx or a copy of it, and a channel which will be closed when the operation represented by the key has finished.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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