Documentation ¶
Index ¶
- Constants
- type Connection
- type ConnectionMock
- func (_m *ConnectionMock) Close() error
- func (_m *ConnectionMock) CloseHandler() func(int, string) error
- func (_m *ConnectionMock) NextReader() (int, io.Reader, error)
- func (_m *ConnectionMock) SetCloseHandler(handler func(int, string) error)
- func (_m *ConnectionMock) WriteMessage(messageType int, data []byte) error
- type WebSocketReader
- type WebSocketWriter
Constants ¶
const CodeOceanOutputWriterBufferSize = 64
CodeOceanOutputWriterBufferSize defines the number of messages.
const CodeOceanToRawReaderBufferSize = 1024
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection interface { WriteMessage(messageType int, data []byte) error Close() error NextReader() (messageType int, r io.Reader, err error) CloseHandler() func(code int, text string) error SetCloseHandler(handler func(code int, text string) error) }
Connection is an internal interface for websocket.Conn in order to mock it for unit tests.
type ConnectionMock ¶
ConnectionMock is an autogenerated mock type for the Connection type
func NewConnectionMock ¶
func NewConnectionMock(t mockConstructorTestingTNewConnectionMock) *ConnectionMock
NewConnectionMock creates a new instance of ConnectionMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*ConnectionMock) Close ¶
func (_m *ConnectionMock) Close() error
Close provides a mock function with given fields:
func (*ConnectionMock) CloseHandler ¶
func (_m *ConnectionMock) CloseHandler() func(int, string) error
CloseHandler provides a mock function with given fields:
func (*ConnectionMock) NextReader ¶
func (_m *ConnectionMock) NextReader() (int, io.Reader, error)
NextReader provides a mock function with given fields:
func (*ConnectionMock) SetCloseHandler ¶
func (_m *ConnectionMock) SetCloseHandler(handler func(int, string) error)
SetCloseHandler provides a mock function with given fields: handler
func (*ConnectionMock) WriteMessage ¶
func (_m *ConnectionMock) WriteMessage(messageType int, data []byte) error
WriteMessage provides a mock function with given fields: messageType, data
type WebSocketReader ¶
WebSocketReader is an interface that is intended for providing abstraction around reading from a WebSocket. Besides, io.Reader, it also implements io.Writer. The Write method is used to inject data into the WebSocket stream.
func NewCodeOceanToRawReader ¶
func NewCodeOceanToRawReader(wsCtx, executorCtx context.Context, connection Connection) WebSocketReader
type WebSocketWriter ¶
type WebSocketWriter interface { StdOut() io.Writer StdErr() io.Writer Close(info *runner.ExitInfo) }
WebSocketWriter is an interface that defines which data is required and which information can be passed.
func NewCodeOceanOutputWriter ¶
func NewCodeOceanOutputWriter(ctx context.Context, connection Connection, done context.CancelFunc) WebSocketWriter
NewCodeOceanOutputWriter provides an codeOceanOutputWriter for the time the context ctx is active. The codeOceanOutputWriter handles all the messages defined in the websocket.schema.json (start, timeout, stdout, ...).