Documentation
¶
Index ¶
- Constants
- Variables
- type Member
- type Server
- func (s *Server) CheckDisplayName(ctx context.Context, req *chatpb.CheckDisplayNameRequest) (*chatpb.CheckDisplayNameResponse, error)
- func (s *Server) CloseChat(ctx context.Context, req *chatpb.CloseChatRequest) (*chatpb.CloseChatResponse, error)
- func (s *Server) DemoteUser(ctx context.Context, req *chatpb.DemoteUserRequest) (*chatpb.DemoteUserResponse, error)
- func (s *Server) GetChat(ctx context.Context, req *chatpb.GetChatRequest) (*chatpb.GetChatResponse, error)
- func (s *Server) GetChats(ctx context.Context, req *chatpb.GetChatsRequest) (*chatpb.GetChatsResponse, error)
- func (s *Server) GetMemberUpdates(ctx context.Context, req *chatpb.GetMemberUpdatesRequest) (*chatpb.GetMemberUpdatesResponse, error)
- func (s *Server) JoinChat(ctx context.Context, req *chatpb.JoinChatRequest) (*chatpb.JoinChatResponse, error)
- func (s *Server) LeaveChat(ctx context.Context, req *chatpb.LeaveChatRequest) (*chatpb.LeaveChatResponse, error)
- func (s *Server) MuteChat(ctx context.Context, req *chatpb.MuteChatRequest) (*chatpb.MuteChatResponse, error)
- func (s *Server) MuteUser(ctx context.Context, req *chatpb.MuteUserRequest) (*chatpb.MuteUserResponse, error)
- func (s *Server) OnChatEvent(chatID *commonpb.ChatId, e *event.ChatEvent)
- func (s *Server) OpenChat(ctx context.Context, req *chatpb.OpenChatRequest) (*chatpb.OpenChatResponse, error)
- func (s *Server) PromoteUser(ctx context.Context, req *chatpb.PromoteUserRequest) (*chatpb.PromoteUserResponse, error)
- func (s *Server) RemoveUser(ctx context.Context, req *chatpb.RemoveUserRequest) (*chatpb.RemoveUserResponse, error)
- func (s *Server) ReportUser(ctx context.Context, req *chatpb.ReportUserRequest) (*chatpb.ReportUserResponse, error)
- func (s *Server) SetDisplayName(ctx context.Context, req *chatpb.SetDisplayNameRequest) (*chatpb.SetDisplayNameResponse, error)
- func (s *Server) SetMessagingFee(ctx context.Context, req *chatpb.SetMessagingFeeRequest) (*chatpb.SetMessagingFeeResponse, error)
- func (s *Server) StartChat(ctx context.Context, req *chatpb.StartChatRequest) (*chatpb.StartChatResponse, error)
- func (s *Server) StreamChatEvents(...) error
- func (s *Server) UnmuteChat(ctx context.Context, req *chatpb.UnmuteChatRequest) (*chatpb.UnmuteChatResponse, error)
- type Store
Constants ¶
View Source
const ( StreamBufferSize = 64 StreamPingDelay = 5 * time.Second StreamTimeout = time.Second MaxChatEventBatchSize = 1024 FlushedChatBatchSize = 32 )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Member ¶
type Server ¶
type Server struct { chatpb.UnimplementedChatServer // contains filtered or unexported fields }
func NewServer ¶
func NewServer( log *zap.Logger, authz auth.Authorizer, accounts account.Store, chats Store, intents intent.Store, messages messaging.MessageStore, pointers messaging.PointerStore, profiles profile.Store, codeData codedata.Provider, messenger messaging.Messenger, moderationClient moderation.ModerationClient, eventBus *event.Bus[*commonpb.ChatId, *event.ChatEvent], ) *Server
func (*Server) CheckDisplayName ¶
func (s *Server) CheckDisplayName(ctx context.Context, req *chatpb.CheckDisplayNameRequest) (*chatpb.CheckDisplayNameResponse, error)
todo: this RPC needs tests
func (*Server) CloseChat ¶
func (s *Server) CloseChat(ctx context.Context, req *chatpb.CloseChatRequest) (*chatpb.CloseChatResponse, error)
func (*Server) DemoteUser ¶
func (s *Server) DemoteUser(ctx context.Context, req *chatpb.DemoteUserRequest) (*chatpb.DemoteUserResponse, error)
func (*Server) GetChat ¶
func (s *Server) GetChat(ctx context.Context, req *chatpb.GetChatRequest) (*chatpb.GetChatResponse, error)
func (*Server) GetChats ¶
func (s *Server) GetChats(ctx context.Context, req *chatpb.GetChatsRequest) (*chatpb.GetChatsResponse, error)
func (*Server) GetMemberUpdates ¶
func (s *Server) GetMemberUpdates(ctx context.Context, req *chatpb.GetMemberUpdatesRequest) (*chatpb.GetMemberUpdatesResponse, error)
todo: use a proper changelog system, but for now use a full refresh
func (*Server) JoinChat ¶
func (s *Server) JoinChat(ctx context.Context, req *chatpb.JoinChatRequest) (*chatpb.JoinChatResponse, error)
func (*Server) LeaveChat ¶
func (s *Server) LeaveChat(ctx context.Context, req *chatpb.LeaveChatRequest) (*chatpb.LeaveChatResponse, error)
func (*Server) MuteChat ¶
func (s *Server) MuteChat(ctx context.Context, req *chatpb.MuteChatRequest) (*chatpb.MuteChatResponse, error)
todo: this RPC needs tests
func (*Server) MuteUser ¶
func (s *Server) MuteUser(ctx context.Context, req *chatpb.MuteUserRequest) (*chatpb.MuteUserResponse, error)
func (*Server) OnChatEvent ¶
func (*Server) OpenChat ¶
func (s *Server) OpenChat(ctx context.Context, req *chatpb.OpenChatRequest) (*chatpb.OpenChatResponse, error)
func (*Server) PromoteUser ¶
func (s *Server) PromoteUser(ctx context.Context, req *chatpb.PromoteUserRequest) (*chatpb.PromoteUserResponse, error)
func (*Server) RemoveUser ¶
func (s *Server) RemoveUser(ctx context.Context, req *chatpb.RemoveUserRequest) (*chatpb.RemoveUserResponse, error)
func (*Server) ReportUser ¶
func (s *Server) ReportUser(ctx context.Context, req *chatpb.ReportUserRequest) (*chatpb.ReportUserResponse, error)
todo: implement me
func (*Server) SetDisplayName ¶
func (s *Server) SetDisplayName(ctx context.Context, req *chatpb.SetDisplayNameRequest) (*chatpb.SetDisplayNameResponse, error)
func (*Server) SetMessagingFee ¶
func (s *Server) SetMessagingFee(ctx context.Context, req *chatpb.SetMessagingFeeRequest) (*chatpb.SetMessagingFeeResponse, error)
func (*Server) StartChat ¶
func (s *Server) StartChat(ctx context.Context, req *chatpb.StartChatRequest) (*chatpb.StartChatResponse, error)
func (*Server) StreamChatEvents ¶
func (s *Server) StreamChatEvents(stream grpc.BidiStreamingServer[chatpb.StreamChatEventsRequest, chatpb.StreamChatEventsResponse]) error
func (*Server) UnmuteChat ¶
func (s *Server) UnmuteChat(ctx context.Context, req *chatpb.UnmuteChatRequest) (*chatpb.UnmuteChatResponse, error)
todo: this RPC needs tests
type Store ¶
type Store interface { GetChatID(ctx context.Context, roomID uint64) (*commonpb.ChatId, error) GetChatMetadata(ctx context.Context, chatID *commonpb.ChatId) (*chatpb.Metadata, error) GetChatMetadataBatched(ctx context.Context, chatIDs ...*commonpb.ChatId) ([]*chatpb.Metadata, error) // todo: add paging? GetChatsForUser(ctx context.Context, userID *commonpb.UserId, opts ...query.Option) ([]*commonpb.ChatId, error) GetMembers(ctx context.Context, chatID *commonpb.ChatId) ([]*Member, error) GetMember(ctx context.Context, chatID *commonpb.ChatId, userID *commonpb.UserId) (*Member, error) IsMember(_ context.Context, chatID *commonpb.ChatId, userID *commonpb.UserId) (bool, error) CreateChat(ctx context.Context, md *chatpb.Metadata) (*chatpb.Metadata, error) AddMember(ctx context.Context, chatID *commonpb.ChatId, member Member) error RemoveMember(ctx context.Context, chatID *commonpb.ChatId, member *commonpb.UserId) error SetMuteState(ctx context.Context, chatID *commonpb.ChatId, member *commonpb.UserId, isMuted bool) error IsUserMuted(ctx context.Context, chatID *commonpb.ChatId, member *commonpb.UserId) (bool, error) SetSendPermission(ctx context.Context, chatID *commonpb.ChatId, member *commonpb.UserId, hasSendPermission bool) error HasSendPermission(ctx context.Context, chatID *commonpb.ChatId, member *commonpb.UserId) (bool, error) SetPushState(ctx context.Context, chatID *commonpb.ChatId, member *commonpb.UserId, isPushEnabled bool) error IsPushEnabled(ctx context.Context, chatID *commonpb.ChatId, member *commonpb.UserId) (bool, error) SetDisplayName(ctx context.Context, chatID *commonpb.ChatId, displayName string) error SetMessagingFee(ctx context.Context, chatID *commonpb.ChatId, messagingFee *commonpb.PaymentAmount) error SetOpenStatus(ctx context.Context, chatID *commonpb.ChatId, isOpen bool) error AdvanceLastChatActivity(ctx context.Context, chatID *commonpb.ChatId, ts time.Time) error }
Click to show internal directories.
Click to hide internal directories.