mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Remote Cluster Service - provides ability for multiple Mattermost cluster instances to create a trusted connection with each other and exchange messages - trusted connections are managed via slash commands (for now) - facilitates features requiring inter-cluster communication, such as Shared Channels Shared Channels Service - provides ability to shared channels between one or more Mattermost cluster instances (using trusted connection) - sharing/unsharing of channels is managed via slash commands (for now)
31 lines
752 B
Go
31 lines
752 B
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package remotecluster
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
// Response represents the bytes replied from a remote server when a message is sent.
|
|
type Response struct {
|
|
Status string `json:"status"`
|
|
Err string `json:"err"`
|
|
Payload json.RawMessage `json:"payload"`
|
|
}
|
|
|
|
// IsSuccess returns true if the response status indicates success.
|
|
func (r *Response) IsSuccess() bool {
|
|
return r.Status == ResponseStatusOK
|
|
}
|
|
|
|
// SetPayload serializes an arbitrary struct as a RawMessage.
|
|
func (r *Response) SetPayload(v interface{}) error {
|
|
raw, err := json.Marshal(v)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
r.Payload = raw
|
|
return nil
|
|
}
|