Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker struct { // Events is a channel of type uuid.UUID that is used to send UUIDs to the goroutine that sends status updates. // The channel has a buffer size of 64. Events chan uuid.UUID // contains filtered or unexported fields }
Checker represents a struct that handles the logic for sending status updates to the state service.
The Checker struct has the following fields: - Events: A channel of type uuid.UUID that is used to send UUIDs to the goroutine that sends status updates. - state: A StateManager interface that is used to send status updates to the state service.
func NewChecker ¶
func NewChecker(client StateManager) *Checker
NewChecker creates a new instance of the Checker struct.
It takes a StateManager interface as a parameter and returns a pointer to a Checker struct. The Checker struct is used to handle the logic for sending status updates to the state service. It initializes the Events channel with a buffer size of 64, which is used to send UUIDs to the goroutine that sends status updates.
Parameters:
- client: A StateManager interface used to send events to the state service.
Returns:
- A pointer to a Checker struct.
func (*Checker) Handler ¶
Handler is a goroutine that processes events from the Events channel.
This function continuously listens for events on the Events channel. When an event is received, it sends a status update to the state service. If the context is canceled, the function returns.
Parameters: - ctx: The context.Context object that is used to cancel the goroutine.
type StateManager ¶
type StateManager interface { // Send sends a status update to the state service for a given UUID. // // Parameters: // - ctx: The context.Context used to cancel the operation if needed. // - id: The UUID of the service. // - status: The entities.Status to send. // // Returns: // - An error if the status update cannot be sent to the state service, // or nil if the status update was sent successfully. Send(ctx context.Context, id uuid.UUID, status entities.Status) error }
StateManager is an interface that defines the behavior for sending status updates to a state service.
This interface has a single method: - Send: sends a status update for a given UUID.
The Send method has the following parameters: - ctx: a context.Context used to cancel the operation if needed. - id: a UUID representing the ID of the service. - status: a entities.Status representing the status to send.
The Send method returns an error if the status update cannot be sent to the state service, and nil if the status update was sent successfully.
The Send method is used to send a status update for a given UUID to the state service. It takes a context.Context used to cancel the operation if needed, a UUID representing the ID of the service, and a entities.Status representing the status to send. It returns an error if the status update cannot be sent to the state service, and nil if the status update was sent successfully.