Documentation
¶
Index ¶
- Constants
- type AllocateEvent
- type BaseEvent
- type Client
- func (c *Client) OnPublish(_ *centrifuge.Subscription, e centrifuge.PublishEvent)
- func (c *Client) OnSubscribeError(_ *centrifuge.Subscription, _ centrifuge.SubscribeErrorEvent)
- func (c *Client) OnSubscribeSuccess(_ *centrifuge.Subscription, _ centrifuge.SubscribeSuccessEvent)
- func (c *Client) RegisterCallback(ev EventType, cb func(Event))
- func (c *Client) ReserveSelf(ctx context.Context, args *model.ReserveRequest) (*model.ReserveResponse, error)
- func (c *Client) Start() error
- func (c *Client) Stop() error
- func (c *Client) UnreserveSelf(ctx context.Context) error
- type DeallocateEvent
- type Event
- type EventType
- type UnexpectedResponseError
Constants ¶
const ( // AllocateEventType represents an event received by the server when it is allocated. AllocateEventType = EventType("AllocateEventType") // DeallocateEventType represents an event received by the server when it is deallocated. DeallocateEventType = EventType("DeallocateEventType") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllocateEvent ¶
AllocateEvent represents the data received on an allocation event.
type BaseEvent ¶
type BaseEvent struct { Typ EventType `json:"EventType"` EventID string `json:"EventID"` ServerID int64 `json:"ServerID"` }
BaseEvent represents the base structure of all events received by the subscriber.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a client to the local proxy.
func (*Client) OnPublish ¶
func (c *Client) OnPublish(_ *centrifuge.Subscription, e centrifuge.PublishEvent)
OnPublish implements centrifuge.PublishHandler and is triggered when a message is published to this subscriber.
func (*Client) OnSubscribeError ¶
func (c *Client) OnSubscribeError(_ *centrifuge.Subscription, _ centrifuge.SubscribeErrorEvent)
OnSubscribeError implements centrifuge.SubscribeErrorHandler and is triggered when an error is encountered with this subscriber.
func (*Client) OnSubscribeSuccess ¶
func (c *Client) OnSubscribeSuccess(_ *centrifuge.Subscription, _ centrifuge.SubscribeSuccessEvent)
OnSubscribeSuccess implements centrifuge.SubscribeSuccessHandler and is triggered when the client has successfully subscribed to the broker.
func (*Client) RegisterCallback ¶
RegisterCallback registers a callback function for the specified EventType.
func (*Client) ReserveSelf ¶ added in v0.3.0
func (c *Client) ReserveSelf(ctx context.Context, args *model.ReserveRequest) (*model.ReserveResponse, error)
ReserveSelf triggers the local proxy endpoint to reserve this server instance. Only applicable for reservation-based fleets.
type DeallocateEvent ¶
DeallocateEvent represents the data received on a deallocation event.
type Event ¶
type Event interface {
Type() EventType
}
Event represents the interface for any event received by the subscriber.
type EventType ¶
type EventType string
EventType is a type alias for an event received by the subscriber.
type UnexpectedResponseError ¶ added in v0.3.0
UnexpectedResponseError represents an unexpected response from the local proxy.
func NewUnexpectedResponseWithBody ¶ added in v0.3.0
func NewUnexpectedResponseWithBody(requestID string, statusCode int, responseBody []byte) *UnexpectedResponseError
NewUnexpectedResponseWithBody creates a new UnexpectedResponseError from a response body.
func NewUnexpectedResponseWithError ¶ added in v0.3.0
func NewUnexpectedResponseWithError(requestID string, statusCode int, err error) *UnexpectedResponseError
NewUnexpectedResponseWithError creates a new UnexpectedResponseError from an error.
func (*UnexpectedResponseError) Error ¶ added in v0.3.0
func (e *UnexpectedResponseError) Error() string
Error returns the string representation of the error.