message_handler

package
v0.0.0-...-e38b929 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2017 License: MIT Imports: 1 Imported by: 7

README

Message Handler

I'm confused by this code. I got too experimental and I'm passing channels of channels around so that I can do callbacks from (mostly) the receiver.

Essentially what happens is we receive a response in the receiver, look up the hash value in the the message receiver by using a channel, and we get a callback channel. We can send the response through the callback channel.

This allows us to send requests and eventually handle the response rather than wait. There's a high likelihood I rip this code out in the future, but at the same time, it's extremely useful for sending requests which I expect to take an indefinite amount of time.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyValPair

type KeyValPair struct {
	Key             string
	Value           chan string
	ResponseChannel chan (chan string)
	sync.RWMutex
}

func NewKeyValPair

func NewKeyValPair(key string, value chan string, callerResponseChan chan chan string) *KeyValPair

NewKeyValPair Handles initialization of a new KeyValPair object.

type MessageHandler

type MessageHandler struct {
	AddKeyChannel    chan *KeyValPair
	RemoveKeyChannel chan *KeyValPair

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewMessageHandler

func NewMessageHandler() *MessageHandler

Jump to

Keyboard shortcuts

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