sharedchannel

package
v6.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2022 License: AGPL-3.0, Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
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)
	NotifySharedChannelUserUpdate(user *model.User)
}

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) Active

func (scs *Service) Active() bool

Active determines whether the service is active on the node or not.

func (*Service) ForceSyncForRemote

func (scs *Service) ForceSyncForRemote(rc *model.RemoteCluster)

ForceSyncForRemote causes all channels shared with the remote to be synchronized.

func (*Service) NotifyChannelChanged

func (scs *Service) NotifyChannelChanged(channelID string)

NotifyChannelChanged is called to indicate that a shared channel has been modified, thus triggering an update to all remote clusters.

func (*Service) NotifyUserProfileChanged

func (scs *Service) NotifyUserProfileChanged(userID string)

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.

func (*Service) Shutdown

func (scs *Service) Shutdown() error

Shutdown is called by the server on server shutdown.

func (*Service) Start

func (scs *Service) Start() error

Start is called by the server on server start-up.

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"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL