astrolib

package
v0.0.0-...-8da3b9b Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	QueueErrorTypeDoesNotExist = iota
)

Variables

This section is empty.

Functions

func QueueError

func QueueError(errType int) error

Types

type AQueue

type AQueue interface {
	QueueRequest(r *AReq) (*ARes, error)
	GetRequest(name string) (*AReq, error)
}

type AReq

type AReq struct {
	ID        string `json:"id"`
	QueueName string `json:"-"`
	Body      []byte `json:"originalRequest"`
	Response  *ARes  `json:"-"`
}

func NewReq

func NewReq(queueName string, body []byte) *AReq

type ARes

type ARes struct {
	ID           string
	ResponseChan chan ([]byte)
	ErrorChan    chan (error)
}

func (*ARes) Response

func (a *ARes) Response() ([]byte, error)

type RequestQueue

type RequestQueue struct {
	Queues map[string]chan (*AReq)
}

func SharedRequestQueue

func SharedRequestQueue() *RequestQueue

func (*RequestQueue) GetRequest

func (rq *RequestQueue) GetRequest(name string) (*AReq, error)

func (*RequestQueue) QueueRequest

func (rq *RequestQueue) QueueRequest(r *AReq) (*ARes, error)

type ResponseMap

type ResponseMap struct {
	Responses map[string]chan ([]byte)
	Errors    map[string]chan (error)
}

func SharedResponseMap

func SharedResponseMap() *ResponseMap

func (*ResponseMap) AddHandler

func (rm *ResponseMap) AddHandler(r *ARes) error

func (*ResponseMap) SendError

func (rm *ResponseMap) SendError(ID string, err error) error

func (*ResponseMap) SendErrorString

func (rm *ResponseMap) SendErrorString(ID string, err string) error

func (*ResponseMap) SendResponse

func (rm *ResponseMap) SendResponse(ID string, res []byte) error

Jump to

Keyboard shortcuts

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