hub

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPayload

func NewPayload(data interface{}) *payload

Types

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

Hub acts as the messaging hub between components -- that is, it controls how the communication that goes through channels are handled.

func New

func New(bufsiz int) *Hub

NewHub creates a new Hub struct

func (*Hub) Batch

func (h *Hub) Batch(f func(), shouldLock bool)

Batch allows you to synchronously send messages during the scope of f() being executed.

func (*Hub) DrawCh

func (h *Hub) DrawCh() chan Payload

DrawCh returns the channel to redraw the terminal display

func (*Hub) PagingCh

func (h *Hub) PagingCh() chan Payload

PagingCh returns the channel to page through the results

func (*Hub) QueryCh

func (h *Hub) QueryCh() chan Payload

QueryCh returns the underlying channel for queries

func (*Hub) SendDraw

func (h *Hub) SendDraw(options interface{})

SendDraw sends a request to redraw the terminal display

func (*Hub) SendDrawPrompt

func (h *Hub) SendDrawPrompt()

SendDrawPrompt sends a request to redraw the prompt only

func (*Hub) SendPaging

func (h *Hub) SendPaging(x interface{})

SendPaging sends a request to move the cursor around

func (*Hub) SendPurgeDisplayCache

func (h *Hub) SendPurgeDisplayCache()

func (*Hub) SendQuery

func (h *Hub) SendQuery(q string)

SendQuery sends the query string to be processed by the Filter

func (*Hub) SendStatusMsg

func (h *Hub) SendStatusMsg(q string)

SendStatusMsg sends a string to be displayed in the status message

func (*Hub) SendStatusMsgAndClear

func (h *Hub) SendStatusMsgAndClear(q string, clearDelay time.Duration)

SendStatusMsgAndClear sends a string to be displayed in the status message, as well as a delay until the message should be cleared

func (*Hub) StatusMsgCh

func (h *Hub) StatusMsgCh() chan Payload

StatusMsgCh returns the channel to update the status message

type Payload

type Payload interface {
	// Data allows you to retrieve the data that's embedded in the payload.
	Data() interface{}

	// Done is called when the payload has been processed. There are cases
	// where the payload processing is expected to be synchronized with the
	// caller, and this method signals the caller that it is safe to proceed
	// to whatever next action it was expecting
	Done()
}

Payload is a wrapper around the actual request value that needs to be passed. It contains an optional channel field which can be filled to force synchronous communication between the sender and receiver

Jump to

Keyboard shortcuts

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