Documentation
¶
Index ¶
- Constants
- Variables
- func IsRetryableErr(err error) bool
- type Client
- func (c *Client) AbortSession(sessionId string) (*Session, error)
- func (c *Client) CommitSession(sessionId string) (*Session, error)
- func (c *Client) JoinSession(sessionId string, body *ParticipantJoinBody) (*Participant, error)
- func (c *Client) PartialCommit(sessionId string, body *ParticipantCommit) (*Participant, error)
- func (c *Client) SessionFromId(sessionId string) (*Session, error)
- func (c *Client) StartSession() (*Session, error)
- type Connection
- type ErrResponse
- type OkResponse
- type Participant
- type ParticipantAction
- type ParticipantCommit
- type ParticipantJoinBody
- type RequestFunc
- type Rest
- type RestRequest
- type RetryableError
- type Session
Constants ¶
View Source
const ( SchemeHttp = "http" SchemeHttps = "https" DefaultPort = "8000" SysPrefixApiPath = "api/sys" MaxRetry = 10 )
Scheme constants
View Source
const ( DefaultUri = "http://transcoorditor:8000" V1PrefixApiPath = "api/v1" )
Variables ¶
View Source
var ( ErrNotLeader = NewRetryableError(errors.New("not leader")) ErrNoNodeAvailable = errors.New("no node available") )
Functions ¶
func IsRetryableErr ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) JoinSession ¶
func (c *Client) JoinSession(sessionId string, body *ParticipantJoinBody) (*Participant, error)
func (*Client) PartialCommit ¶
func (c *Client) PartialCommit(sessionId string, body *ParticipantCommit) (*Participant, error)
func (*Client) StartSession ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConn ¶
func NewConn(uri string) (*Connection, error)
func (*Connection) Connect ¶
func (c *Connection) Connect() error
func (*Connection) GetLeader ¶
func (c *Connection) GetLeader() *node
func (*Connection) GetNodes ¶
func (c *Connection) GetNodes() []*node
func (*Connection) GetRsConf ¶
func (c *Connection) GetRsConf() *rsConfiguration
func (*Connection) Leader ¶
func (c *Connection) Leader() *node
type ErrResponse ¶
type OkResponse ¶
type OkResponse struct {
Data interface{} `json:"data"`
}
type Participant ¶
type Participant struct { Id int64 `json:"id"` SessionId string `json:"sessionId"` ClientId string `json:"clientId"` RequestId string `json:"requestId"` State string `json:"state"` CompensateAction *ParticipantAction `json:"compensateAction,omitempty"` CompleteAction *ParticipantAction `json:"completeAction,omitempty"` UpdatedAt *time.Time `json:"updatedAt,omitempty"` CreatedAt *time.Time `json:"createdAt"` // contains filtered or unexported fields }
func (*Participant) PartialCommit ¶
func (p *Participant) PartialCommit(compensate *ParticipantAction, complete *ParticipantAction) error
type ParticipantAction ¶
type ParticipantCommit ¶
type ParticipantCommit struct { Id int64 `json:"participantId"` Compensate *ParticipantAction `json:"compensate"` Complete *ParticipantAction `json:"complete"` }
type ParticipantJoinBody ¶
type RequestFunc ¶
type RequestFunc func(req *RestRequest) (*resty.Response, error)
type RestRequest ¶
type RestRequest struct {
*resty.Request
}
func (*RestRequest) SetResult ¶
func (req *RestRequest) SetResult(result interface{}) *RestRequest
type RetryableError ¶
type RetryableError struct {
Err error
}
func NewRetryableError ¶
func NewRetryableError(err error) *RetryableError
func (*RetryableError) Error ¶
func (e *RetryableError) Error() string
type Session ¶
type Session struct { Id string `json:"id"` State string `json:"state"` Timeout int `json:"timeout"` UpdatedAt *time.Time `json:"updatedAt,omitempty"` StartedAt *time.Time `json:"startedAt,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty"` Errors []string `json:"errors,omitempty"` Retries int `json:"retries"` TerminateReason string `json:"terminateReason,omitempty"` // contains filtered or unexported fields }
func (*Session) AbortSession ¶
func (*Session) CommitSession ¶
func (*Session) JoinSession ¶
func (s *Session) JoinSession(body *ParticipantJoinBody) (*Participant, error)
Click to show internal directories.
Click to hide internal directories.