Version: v0.0.0-...-54296da Latest Latest

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

Go to latest
Published: Jan 25, 2017 License: AGPL-3.0 Imports: 1 Imported by: 0



Package event provides some primitives that are used for message passing.



This section is empty.


This section is empty.


This section is empty.


type Event

type Event struct {
	Name EventName
	Resp Resp // channel to send an ack response on, nil to skip
	//Wg   *sync.WaitGroup // receiver barrier to Wait() for everyone else on
	Err error // store an error in our event

Event is the main struct that stores event information and responses.

func (*Event) ACK

func (event *Event) ACK()

ACK sends a single acknowledgement on the channel if one was requested.

func (*Event) ACKNACK

func (event *Event) ACKNACK(err error)

ACKNACK sends a custom ACK or NACK message on the channel if one was requested.

func (*Event) Error

func (event *Event) Error() error

Error returns the stored error value.

func (*Event) NACK

func (event *Event) NACK()

NACK sends a negative acknowledgement message on the channel if one was requested.

type EventName

type EventName int

EventName represents the type of event being passed.

const (
	EventNil EventName = iota

The different event names are used in different contexts.

type Resp

type Resp chan error

Resp is a channel to be used for boolean responses. A nil represents an ACK, and a non-nil represents a NACK (false). This also lets us use custom errors.

func NewResp

func NewResp() Resp

NewResp is just a helper to return the right type of response channel.

func (Resp) ACK

func (resp Resp) ACK()

ACK sends a true value to resp.

func (Resp) ACKNACK

func (resp Resp) ACKNACK(err error)

ACKNACK sends a custom ACK or NACK. The ACK value is always nil, the NACK can be any non-nil error value.

func (Resp) ACKWait

func (resp Resp) ACKWait()

ACKWait waits for a +ive Ack from a Resp channel.

func (Resp) NACK

func (resp Resp) NACK()

NACK sends a false value to resp.

func (Resp) Wait

func (resp Resp) Wait() error

Wait waits for any response from a Resp channel and returns it.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL