Documentation ¶
Index ¶
- Constants
- func NewUnexpectedResponseWithBody(requestID string, statusCode int, responseBody []byte) *model.UnexpectedResponseError
- func NewUnexpectedResponseWithError(requestID string, statusCode int, err error) *model.UnexpectedResponseError
- type AllocateEvent
- type BaseEvent
- type Client
- func (c *Client) HoldSelf(ctx context.Context, args *model.HoldRequest) (*model.HoldStatus, error)
- func (c *Client) HoldStatus(ctx context.Context) (*model.HoldStatus, error)
- 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) PatchAllocation(ctx context.Context, allocationID string, args *model.PatchAllocationRequest) error
- func (c *Client) RegisterCallback(ev EventType, cb func(Event))
- func (c *Client) ReleaseSelf(ctx context.Context) error
- 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
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 ¶
func NewUnexpectedResponseWithBody ¶ added in v0.3.0
func NewUnexpectedResponseWithBody(requestID string, statusCode int, responseBody []byte) *model.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) *model.UnexpectedResponseError
NewUnexpectedResponseWithError creates a new UnexpectedResponseError from an error.
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) HoldSelf ¶ added in v0.4.0
func (c *Client) HoldSelf(ctx context.Context, args *model.HoldRequest) (*model.HoldStatus, error)
HoldSelf triggers the local proxy endpoint to hold this server instance.
func (*Client) HoldStatus ¶ added in v0.4.0
HoldStatus triggers the local proxy endpoint to get the status of the hold for this server instance.
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) PatchAllocation ¶ added in v0.5.0
func (c *Client) PatchAllocation(ctx context.Context, allocationID string, args *model.PatchAllocationRequest) error
PatchAllocation triggers the local proxy endpoint to patch this server allocation.
func (*Client) RegisterCallback ¶
RegisterCallback registers a callback function for the specified EventType.
func (*Client) ReleaseSelf ¶ added in v0.4.0
ReleaseSelf triggers the local proxy endpoint to release the hold on this server instance.
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.