Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrStreamIsNotOnline = errors.New("Stream is not Online")
var TaskResponseChanPool = NewTaskResponsePool(40)
TaskResponseChanPool is default pool of channels TaskResponse
Functions ¶
func NewTaskResponsePool ¶
func NewTaskResponsePool(size int) *taskResponsePool
NewtaskResponsePool is taskResponsePool constructor
Types ¶
type IndexerClienter ¶
type IndexerClienter interface { RegisterStream(ctx context.Context, stream *StreamAccess) error CloseStream(ctx context.Context, streamID uuid.UUID) error }
IndexerClienter is a client interface
type StreamAccess ¶
type StreamAccess struct { Finish chan bool State StreamState StreamID uuid.UUID ResponseListener chan TaskResponse RequestListener chan TaskRequest // contains filtered or unexported fields }
StreamAccess creates a proxy between code and transport level. The extra layer serves a function of access manager. Requests and Responses are processed by different goroutines, that doesn't need to know about connection state. This code prevents sending messages on closed channels after connection breakage.
func NewStreamAccess ¶
func NewStreamAccess() *StreamAccess
NewStreamAccess is StreamAccess constructor
func (*StreamAccess) Close ¶
func (sa *StreamAccess) Close() error
Close is closing access stream (thread safe)
func (*StreamAccess) Req ¶
func (sa *StreamAccess) Req(tr TaskRequest) error
Req receive TaskRequest (thread safe)
func (*StreamAccess) Send ¶
func (sa *StreamAccess) Send(tr TaskResponse) error
Send sends TaskResponse back to manager (thread safe)
type StreamState ¶
type StreamState int
StreamState the state of stream ;D
const ( StreamUnknown StreamState = iota StreamOnline StreamOffline )
type TaskRequest ¶
type TaskRequest struct { Id uuid.UUID Type string Payload json.RawMessage }
TaskRequest is the incoming request