interactortest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingOperatorFunc = errors.New("missing operator function")

Functions

This section is empty.

Types

type Initiator

type Initiator struct {
	// contains filtered or unexported fields
}

Initiator is a mock implementation of the orbital.Initiator interface.

func NewInitiator

func NewInitiator(f OperatorFunc, opts *Opts) (*Initiator, error)

NewInitiator creates a new Initiator instance. It expects an OperatorFunc which is used to simulate the behavior of an operator. It allows options to configure the buffer size of the link channel.

func (*Initiator) Close

func (r *Initiator) Close()

Close closes the link channel.

func (*Initiator) ReceiveTaskResponse

func (r *Initiator) ReceiveTaskResponse(ctx context.Context) (orbital.TaskResponse, error)

ReceiveTaskResponse waits for a task response from the link channel and returns it.

func (*Initiator) SendTaskRequest

func (r *Initiator) SendTaskRequest(ctx context.Context, request orbital.TaskRequest) error

SendTaskRequest passes a task request to the operator function and sends the response to the link channel.

type OperatorFunc

OperatorFunc is a function type that simulates the behavior of an operator.

type Option

type Option func(*config)

Option is a function that modifies the config parameter of the Responder.

func WithInputBufferSize

func WithInputBufferSize(size int) Option

WithInputBufferSize sets the input buffer size for the Responder.

func WithOutputBufferSize

func WithOutputBufferSize(size int) Option

WithOutputBufferSize sets the output buffer size for the Responder.

type Opts

type Opts struct {
	BufferSize int
}

Opts contains options to configure the Initiator.

type Responder

type Responder struct {
	// contains filtered or unexported fields
}

Responder is a mock implementation of the operator.Responder interface.

func NewResponder

func NewResponder(opts ...Option) *Responder

NewResponder creates a new Responder instance. It allows options to configure the buffer size of the input and output channel.

func (*Responder) NewRequest

func (r *Responder) NewRequest(req orbital.TaskRequest)

NewRequest sends the task request to the input channel.

func (*Responder) NewResponse

func (r *Responder) NewResponse() orbital.TaskResponse

NewResponse receives the task response from the output channel.

func (*Responder) ReceiveTaskRequest

func (r *Responder) ReceiveTaskRequest(ctx context.Context) (orbital.TaskRequest, error)

ReceiveTaskRequest receives a task request from the input channel.

func (*Responder) SendTaskResponse

func (r *Responder) SendTaskResponse(ctx context.Context, resp orbital.TaskResponse) error

SendTaskResponse sends a task response to the output channel.

Jump to

Keyboard shortcuts

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