Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DON ¶
type DON interface {
// Thread-safe
SendToNode(ctx context.Context, nodeAddress string, msg *api.Message) error
}
Representation of a DON from a Handler's perspective.
type Handler ¶
type Handler interface {
job.ServiceCtx
// Each user request is processed by a separate goroutine, which:
// 1. calls HandleUserMessage
// 2. waits on callbackCh with a timeout
HandleUserMessage(ctx context.Context, msg *api.Message, callbackCh chan<- UserCallbackPayload) error
// Handlers should not make any assumptions about goroutines calling HandleNodeMessage
HandleNodeMessage(ctx context.Context, msg *api.Message, nodeAddr string) error
}
Handler implements service-specific logic for managing messages from users and nodes. There is one Handler object created for each DON.
The lifecycle of a Handler object is as follows:
- Start() call
- a series of HandleUserMessage/HandleNodeMessage calls, executed in parallel (Handler needs to guarantee thread safety)
- Close() call
Click to show internal directories.
Click to hide internal directories.