structs

package
v0.4.20-rc7 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStreamIsNotOnline = errors.New("Stream is not Online")
View Source
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 OutResp

type OutResp struct {
	ID      uuid.UUID
	Type    string
	Payload interface{} // to be encoded
	Error   error
}

OutResp is enriched response format used internally in workers

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 TaskError

type TaskError struct {
	Msg string
}

TaskError is basic error format

type TaskRequest

type TaskRequest struct {
	Id      uuid.UUID
	Type    string
	Payload json.RawMessage
}

TaskRequest is the incoming request

type TaskResponse

type TaskResponse struct {
	Version string
	Id      uuid.UUID
	Type    string
	Order   uint64
	Final   bool
	Error   TaskError
	Payload json.RawMessage
}

TaskResponse is task ... response :)

Jump to

Keyboard shortcuts

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