2015-09-12 16:11:54 -04:00
|
|
|
package core
|
|
|
|
|
2015-09-14 07:51:30 -04:00
|
|
|
const (
|
2015-09-14 12:19:17 -04:00
|
|
|
bufferSize = 16
|
2015-09-14 07:51:30 -04:00
|
|
|
)
|
|
|
|
|
2015-09-12 16:11:54 -04:00
|
|
|
type Ray struct {
|
|
|
|
Input chan []byte
|
|
|
|
Output chan []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewRay() Ray {
|
2015-09-16 11:07:05 -04:00
|
|
|
return Ray{
|
|
|
|
Input: make(chan []byte, bufferSize),
|
|
|
|
Output: make(chan []byte, bufferSize),
|
|
|
|
}
|
2015-09-12 16:11:54 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type OutboundRay interface {
|
|
|
|
OutboundInput() <-chan []byte
|
|
|
|
OutboundOutput() chan<- []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
type InboundRay interface {
|
|
|
|
InboundInput() chan<- []byte
|
|
|
|
InboundOutput() <-chan []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ray Ray) OutboundInput() <-chan []byte {
|
|
|
|
return ray.Input
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ray Ray) OutboundOutput() chan<- []byte {
|
|
|
|
return ray.Output
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ray Ray) InboundInput() chan<- []byte {
|
|
|
|
return ray.Input
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ray Ray) InboundOutput() <-chan []byte {
|
|
|
|
return ray.Output
|
|
|
|
}
|