gotocol

package
v0.0.0-...-a13a725 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2015 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package gotocol provides protocol support to send a variety of commands listener channels and types over a single channel type

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Send

func Send(to chan<- Message, msg Message)

Send a synchronous message

Types

type Impositions

type Impositions int

Impositions is the promise theory term for requests made to a service

const (
	// Hello ChanToParent NameForPirate // initial noodly touch
	Hello Impositions = iota
	// NameDrop ChanToBuddy NameOfBuddy // here's someone to talk to
	NameDrop
	// Chat - ThisOften // chat to buddies time interval
	Chat
	// GoldCoin FromChan HowMuch
	GoldCoin
	// Inform loggerChan text message
	Inform
	// GetRequest FromChan key // simulate http inbound request
	GetRequest
	// GetResponse FromChan value // simulate http outbound response
	GetResponse
	// Put - "key value" // save the key and value
	Put
	// Goodbye - - // tell FSM and exit
	Goodbye // test assumes this is the last and exits

)

Constant definitions for message types to be imposed on the receiver

func (Impositions) String

func (imps Impositions) String() string

String handler to make imposition types printable

type Message

type Message struct {
	Imposition   Impositions  // request type
	ResponseChan chan Message // place to send response messages
	Sent         time.Time    // time at which message was sent
	Intention    string       // payload
}

Message structure used for all messages, includes a channel of itself

func (Message) GoSend

func (msg Message) GoSend(to chan Message)

GoSend asynchronous message send, parks it on a new goroutine until it completes

func (Message) String

func (msg Message) String() string

Jump to

Keyboard shortcuts

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