Documentation ¶
Index ¶
- type BarrierRequest
- type DefaultService
- func (s *DefaultService) Barrier(ctx context.Context, state string, target int) error
- func (s *DefaultService) Close() error
- func (s *DefaultService) Publish(ctx context.Context, topic string, payload interface{}) (int, error)
- func (s *DefaultService) SignalEntry(ctx context.Context, state string) (int, error)
- func (s *DefaultService) Subscribe(ctx context.Context, topic string) (*subscription, error)
- type PublishRequest
- type PublishResponse
- type Request
- type Response
- type Server
- type Service
- type SignalEntryRequest
- type SignalEntryResponse
- type SubscribeRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BarrierRequest ¶
BarrierRequest represents a barrier response.
type DefaultService ¶
type DefaultService struct {
// contains filtered or unexported fields
}
func NewDefaultService ¶
func NewDefaultService(ctx context.Context, log *zap.SugaredLogger) (*DefaultService, error)
func (*DefaultService) Close ¶
func (s *DefaultService) Close() error
func (*DefaultService) SignalEntry ¶
type PublishRequest ¶
type PublishRequest struct { Topic string `json:"topic"` Payload interface{} `json:"payload"` }
PublishRequest represents a publish request.
type PublishResponse ¶
type PublishResponse struct {
Seq int `json:"seq"`
}
PublishResponse represents a publish response.
type Request ¶
type Request struct { ID string `json:"id"` IsCancel bool `json:"is_cancel"` PublishRequest *PublishRequest `json:"publish,omitempty"` SubscribeRequest *SubscribeRequest `json:"subscribe,omitempty"` BarrierRequest *BarrierRequest `json:"barrier,omitempty"` SignalEntryRequest *SignalEntryRequest `json:"signal_entry,omitempty"` }
Request represents a request from the test instance to the sync service. The request ID must be present and one of the requests must be non-nil. The ID will be used on further responses.
type Response ¶
type Response struct { ID string `json:"id"` Error string `json:"error"` PublishResponse *PublishResponse `json:"publish"` SubscribeResponse string `json:"subscribe"` // JSON encoded subscribe response. SignalEntryResponse *SignalEntryResponse `json:"signal_entry"` }
Response represents a response from the sync service to a test instance. The response ID must be present and one of the response types of Error must be non-nil. The ID is the same as the request ID.
type Service ¶
type Service interface { io.Closer Publish(ctx context.Context, topic string, payload interface{}) (seq int, err error) Subscribe(ctx context.Context, topic string) (*subscription, error) Barrier(ctx context.Context, state string, target int) error SignalEntry(ctx context.Context, state string) (after int, err error) }
Service is the implementation of a sync service. This service must support synchronization actions such as pub-sub and barriers.
type SignalEntryRequest ¶
type SignalEntryRequest struct {
State string `json:"state"`
}
SignalEntryRequest represents a signal entry request.
type SignalEntryResponse ¶
type SignalEntryResponse struct {
Seq int `json:"seq"`
}
SignalEntryResponse represents a signal entry response.
type SubscribeRequest ¶
type SubscribeRequest struct {
Topic string `json:"topic"`
}
SubscribeRequest represents a subscribe request.