Documentation
¶
Index ¶
- Constants
- func ChatChannelReceiver(uid, name string) (string, error)
- type AutocompleteService
- type ChatStore
- type PresenceStore
- type S3Uploader
- type SocializeService
- func (ss *SocializeService) AddBlock(ctx context.Context, req *pb.AddBlockRequest) (*pb.OKResponse, error)
- func (ss *SocializeService) AddFollow(ctx context.Context, req *pb.AddFollowRequest) (*pb.OKResponse, error)
- func (ss *SocializeService) GetActiveChatChannels(ctx context.Context, req *pb.GetActiveChatChannelsRequest) (*pb.ActiveChatChannels, error)
- func (ss *SocializeService) GetBlocks(ctx context.Context, req *pb.GetBlocksRequest) (*pb.GetBlocksResponse, error)
- func (ss *SocializeService) GetChatsForChannel(ctx context.Context, req *pb.GetChatsRequest) (*ipc.ChatMessages, error)
- func (ss *SocializeService) GetFollows(ctx context.Context, req *pb.GetFollowsRequest) (*pb.GetFollowsResponse, error)
- func (ss *SocializeService) GetFullBlocks(ctx context.Context, req *pb.GetFullBlocksRequest) (*pb.GetFullBlocksResponse, error)
- func (ss *SocializeService) GetModList(ctx context.Context, req *pb.GetModListRequest) (*pb.GetModListResponse, error)
- func (ss *SocializeService) RemoveBlock(ctx context.Context, req *pb.RemoveBlockRequest) (*pb.OKResponse, error)
- func (ss *SocializeService) RemoveFollow(ctx context.Context, req *pb.RemoveFollowRequest) (*pb.OKResponse, error)
- type Store
- type UploadResult
- type UploadService
- type XTUploadService
Constants ¶
View Source
const (
MaxFilesize = 1024 * 1024
)
Variables ¶
This section is empty.
Functions ¶
func ChatChannelReceiver ¶ added in v0.1.3
Types ¶
type AutocompleteService ¶ added in v0.1.2
type AutocompleteService struct {
// contains filtered or unexported fields
}
func NewAutocompleteService ¶ added in v0.1.2
func NewAutocompleteService(u Store) *AutocompleteService
func (*AutocompleteService) GetCompletion ¶ added in v0.1.2
func (as *AutocompleteService) GetCompletion(ctx context.Context, req *pb.UsernameSearchRequest) (*pb.UsernameSearchResponse, error)
type ChatStore ¶ added in v0.1.3
type ChatStore interface { AddChat(ctx context.Context, senderUsername, senderUID, msg, channel, channelFriendly string, regulateChat bool) (*pb.ChatMessage, error) OldChats(ctx context.Context, channel string, n int) ([]*pb.ChatMessage, error) LatestChannels(ctx context.Context, count, offset int, uid, tid string) (*upb.ActiveChatChannels, error) GetChat(ctx context.Context, channel string, msgID string) (*pb.ChatMessage, error) DeleteChat(ctx context.Context, channel string, msgID string) error SetEventChan(chan *entity.EventWrapper) EventChan() chan *entity.EventWrapper }
ChatStore stores user and channel chats and messages
type PresenceStore ¶
type PresenceStore interface { // SetPresence sets the presence. If channel is the string NULL this is // equivalent to saying the user logged off. SetPresence(ctx context.Context, uuid, username string, anon bool, channel string, connID string) ([]string, []string, error) ClearPresence(ctx context.Context, uuid, username string, anon bool, connID string) ([]string, []string, []string, error) GetPresence(ctx context.Context, uuid string) ([]string, error) // RenewPresence prevents the presence store from expiring the relevant keys. // Basically, we're telling the presence store "this user and connection are still here". // Otherwise, missing a few of these events will destroy the relevant presences. RenewPresence(ctx context.Context, uuid, username string, anon bool, connID string) ([]string, []string, error) CountInChannel(ctx context.Context, channel string) (int, error) GetInChannel(ctx context.Context, channel string) ([]*entity.User, error) // BatchGetPresence returns a list of the users with their presence. // Can use for buddy/follower lists. BatchGetPresence(ctx context.Context, users []*entity.User) ([]*entity.User, error) LastSeen(ctx context.Context, uuid string) (int64, error) SetEventChan(chan *entity.EventWrapper) EventChan() chan *entity.EventWrapper BatchGetChannels(ctx context.Context, uuids []string) ([][]string, error) UpdateFollower(ctx context.Context, followee, follower *entity.User, following bool) error UpdateActiveGame(ctx context.Context, activeGameEntry *pb.ActiveGameEntry) ([][][]string, error) }
PresenceStore stores user presence. Since it is meant to be easily user-visible, we deal with unique usernames in addition to UUIDs. Presence applies to chat channels, as well as an overall site-wide presence. For example, we'd like to see who's online, as well as who's in our given channel (i.e. who's watching a certain game with us?)
type S3Uploader ¶ added in v0.1.3
type S3Uploader struct {
// contains filtered or unexported fields
}
func NewS3Uploader ¶ added in v0.1.3
func NewS3Uploader(bucket string) *S3Uploader
type SocializeService ¶ added in v0.1.2
type SocializeService struct {
// contains filtered or unexported fields
}
func NewSocializeService ¶ added in v0.1.2
func NewSocializeService(u Store, c ChatStore, p PresenceStore) *SocializeService
func (*SocializeService) AddBlock ¶ added in v0.1.2
func (ss *SocializeService) AddBlock(ctx context.Context, req *pb.AddBlockRequest) (*pb.OKResponse, error)
blocks
func (*SocializeService) AddFollow ¶ added in v0.1.2
func (ss *SocializeService) AddFollow(ctx context.Context, req *pb.AddFollowRequest) (*pb.OKResponse, error)
func (*SocializeService) GetActiveChatChannels ¶ added in v0.1.3
func (ss *SocializeService) GetActiveChatChannels(ctx context.Context, req *pb.GetActiveChatChannelsRequest) (*pb.ActiveChatChannels, error)
func (*SocializeService) GetBlocks ¶ added in v0.1.2
func (ss *SocializeService) GetBlocks(ctx context.Context, req *pb.GetBlocksRequest) (*pb.GetBlocksResponse, error)
func (*SocializeService) GetChatsForChannel ¶ added in v0.1.3
func (ss *SocializeService) GetChatsForChannel(ctx context.Context, req *pb.GetChatsRequest) (*ipc.ChatMessages, error)
func (*SocializeService) GetFollows ¶ added in v0.1.2
func (ss *SocializeService) GetFollows(ctx context.Context, req *pb.GetFollowsRequest) (*pb.GetFollowsResponse, error)
func (*SocializeService) GetFullBlocks ¶ added in v0.1.2
func (ss *SocializeService) GetFullBlocks(ctx context.Context, req *pb.GetFullBlocksRequest) (*pb.GetFullBlocksResponse, error)
func (*SocializeService) GetModList ¶ added in v0.1.3
func (ss *SocializeService) GetModList(ctx context.Context, req *pb.GetModListRequest) (*pb.GetModListResponse, error)
func (*SocializeService) RemoveBlock ¶ added in v0.1.2
func (ss *SocializeService) RemoveBlock(ctx context.Context, req *pb.RemoveBlockRequest) (*pb.OKResponse, error)
func (*SocializeService) RemoveFollow ¶ added in v0.1.2
func (ss *SocializeService) RemoveFollow(ctx context.Context, req *pb.RemoveFollowRequest) (*pb.OKResponse, error)
type Store ¶
type Store interface { Get(ctx context.Context, username string) (*entity.User, error) GetByUUID(ctx context.Context, uuid string) (*entity.User, error) GetByEmail(ctx context.Context, email string) (*entity.User, error) GetByAPIKey(ctx context.Context, apiKey string) (*entity.User, error) // Username by UUID. Good for fast lookups. Username(ctx context.Context, uuid string) (string, bool, error) New(ctx context.Context, user *entity.User) error SetPassword(ctx context.Context, uuid string, hashpass string) error SetAvatarUrl(ctx context.Context, uuid string, avatarUrl string) error GetBriefProfiles(ctx context.Context, uuids []string) (map[string]*upb.BriefProfile, error) SetPersonalInfo(ctx context.Context, uuid string, email string, firstName string, lastName string, birthDate string, countryCode string, about string) error SetRatings(ctx context.Context, p0uuid string, p1uuid string, variant entity.VariantKey, p1Rating entity.SingleRating, p2Rating entity.SingleRating) error SetStats(ctx context.Context, p0uuid string, p1uuid string, variant entity.VariantKey, p0stats *entity.Stats, p1stats *entity.Stats) error SetNotoriety(ctx context.Context, u *entity.User, notoriety int) error ResetRatings(ctx context.Context, uuid string) error ResetStats(ctx context.Context, uuid string) error ResetProfile(ctx context.Context, uuid string) error ResetPersonalInfo(ctx context.Context, uuid string) error GetBot(ctx context.Context, botType macondopb.BotRequest_BotCode) (*entity.User, error) AddFollower(ctx context.Context, targetUser, follower uint) error RemoveFollower(ctx context.Context, targetUser, follower uint) error // GetFollows gets all the users that the passed-in DB ID is following. GetFollows(ctx context.Context, uid uint) ([]*entity.User, error) GetFollowedBy(ctx context.Context, uid uint) ([]*entity.User, error) AddBlock(ctx context.Context, targetUser, blocker uint) error RemoveBlock(ctx context.Context, targetUser, blocker uint) error // GetBlocks gets all the users that the passed-in DB ID is blocking GetBlocks(ctx context.Context, uid uint) ([]*entity.User, error) GetBlockedBy(ctx context.Context, uid uint) ([]*entity.User, error) GetFullBlocks(ctx context.Context, uid uint) ([]*entity.User, error) UsersByPrefix(ctx context.Context, prefix string) ([]*upb.BasicUser, error) CachedCount(ctx context.Context) int Set(ctx context.Context, u *entity.User) error SetPermissions(ctx context.Context, req *cpb.PermissionsRequest) error GetModList(ctx context.Context) (*upb.GetModListResponse, error) }
Store is an interface that user stores should implement.
type UploadResult ¶ added in v0.1.3
type UploadResult struct {
AvatarUrl string `json:"avatar_url,omitempty"`
}
type UploadService ¶ added in v0.1.3
type XTUploadService ¶ added in v0.1.3
type XTUploadService struct { }
XTUploadService is a test service for uploading to cross-tables. Do not use in prod!
func NewXTUploadService ¶ added in v0.1.3
func NewXTUploadService() *XTUploadService
Click to show internal directories.
Click to hide internal directories.