Documentation ¶
Index ¶
- Constants
- type AppIface
- type InviteOption
- type ServerIface
- type Service
- func (scs *Service) Active() bool
- func (scs *Service) ForceSyncForRemote(rc *model.RemoteCluster)
- func (scs *Service) NotifyChannelChanged(channelID string)
- func (scs *Service) NotifyUserProfileChanged(userID string)
- func (scs *Service) SendChannelInvite(channel *model.Channel, userId string, rc *model.RemoteCluster, ...) error
- func (scs *Service) Shutdown() error
- func (scs *Service) Start() error
- type SyncResponse
Constants ¶
const ( TopicSync = "sharedchannel_sync" TopicChannelInvite = "sharedchannel_invite" TopicUploadCreate = "sharedchannel_upload" MaxRetries = 3 MaxPostsPerSync = 12 // a bit more than one typical screenfull of posts MaxUsersPerSync = 25 NotifyRemoteOfflineThreshold = time.Second * 10 NotifyMinimumDelay = time.Second * 2 MaxUpsertRetries = 25 ProfileImageSyncTimeout = time.Second * 5 KeyRemoteUsername = "RemoteUsername" KeyRemoteEmail = "RemoteEmail" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppIface ¶
type AppIface interface { SendEphemeralPost(userId string, post *model.Post) *model.Post CreateChannelWithUser(c *request.Context, channel *model.Channel, userId string) (*model.Channel, *model.AppError) GetOrCreateDirectChannel(c *request.Context, userId, otherUserId string, channelOptions ...model.ChannelOption) (*model.Channel, *model.AppError) AddUserToChannel(user *model.User, channel *model.Channel, skipTeamMemberIntegrityCheck bool) (*model.ChannelMember, *model.AppError) AddUserToTeamByTeamId(c *request.Context, teamId string, user *model.User) *model.AppError PermanentDeleteChannel(channel *model.Channel) *model.AppError CreatePost(c *request.Context, post *model.Post, channel *model.Channel, triggerWebhooks bool, setOnline bool) (savedPost *model.Post, err *model.AppError) UpdatePost(c *request.Context, post *model.Post, safeUpdate bool) (*model.Post, *model.AppError) DeletePost(postID, deleteByID string) (*model.Post, *model.AppError) SaveReactionForPost(c *request.Context, reaction *model.Reaction) (*model.Reaction, *model.AppError) DeleteReactionForPost(c *request.Context, reaction *model.Reaction) *model.AppError PatchChannelModerationsForChannel(channel *model.Channel, channelModerationsPatch []*model.ChannelModerationPatch) ([]*model.ChannelModeration, *model.AppError) CreateUploadSession(us *model.UploadSession) (*model.UploadSession, *model.AppError) FileReader(path string) (filestore.ReadCloseSeeker, *model.AppError) MentionsToTeamMembers(message, teamID string) model.UserMentionMap GetProfileImage(user *model.User) ([]byte, bool, *model.AppError) InvalidateCacheForUser(userID string) }
type InviteOption ¶
type InviteOption func(msg *channelInviteMsg)
func WithDirectParticipantID ¶
func WithDirectParticipantID(participantID string) InviteOption
type ServerIface ¶
type ServerIface interface { Config() *model.Config IsLeader() bool AddClusterLeaderChangedListener(listener func()) string RemoveClusterLeaderChangedListener(id string) GetStore() store.Store GetLogger() mlog.LoggerIFace GetRemoteClusterService() remotecluster.RemoteClusterServiceIFace }
Mocks can be re-generated with `make sharedchannel-mocks`.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides shared channel synchronization.
func NewSharedChannelService ¶
func NewSharedChannelService(server ServerIface, app AppIface) (*Service, error)
NewSharedChannelService creates a RemoteClusterService instance.
func (*Service) ForceSyncForRemote ¶
func (scs *Service) ForceSyncForRemote(rc *model.RemoteCluster)
ForceSyncForRemote causes all channels shared with the remote to be synchronized.
func (*Service) NotifyChannelChanged ¶
NotifyChannelChanged is called to indicate that a shared channel has been modified, thus triggering an update to all remote clusters.
func (*Service) NotifyUserProfileChanged ¶
NotifyUserProfileChanged is called to indicate that a user belonging to at least one shared channel has modified their user profile (name, username, email, custom status, profile image)
func (*Service) SendChannelInvite ¶
func (scs *Service) SendChannelInvite(channel *model.Channel, userId string, rc *model.RemoteCluster, options ...InviteOption) error
SendChannelInvite asynchronously sends a channel invite to a remote cluster. The remote cluster is expected to create a new channel with the same channel id, and respond with status OK. If an error occurs on the remote cluster then an ephemeral message is posted to in the channel for userId.
type SyncResponse ¶
type SyncResponse struct { UsersLastUpdateAt int64 `json:"users_last_update_at"` UserErrors []string `json:"user_errors"` UsersSyncd []string `json:"users_syncd"` PostsLastUpdateAt int64 `json:"posts_last_update_at"` PostErrors []string `json:"post_errors"` ReactionsLastUpdateAt int64 `json:"reactions_last_update_at"` ReactionErrors []string `json:"reaction_errors"` }