handler

package
v0.7.156 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrTooLargeImage          warpnet.WarpError = "image is too large"
	ErrInvalidBase64Signature warpnet.WarpError = "invalid base64 image data"
	ErrEmptyImageKey          warpnet.WarpError = "empty image key"
	ErrNoImagesProvided       warpnet.WarpError = "at least one image must be provided"
	ErrInvalidEXIF            warpnet.WarpError = "invalid exif type: not a segment list"
)
View Source
const (
	ErrNoObjectID warpnet.WarpError = "no object id found"
	ErrNoUserID   warpnet.WarpError = "no user id found"
)

Variables

This section is empty.

Functions

func StreamAddFilterKeywordHandler added in v0.7.26

func StreamAddFilterKeywordHandler(repo FilterStorer) warpnet.WarpHandlerFunc

func StreamAuthorizeFollowRequestHandler added in v0.7.26

func StreamAuthorizeFollowRequestHandler(repo FollowingStorer) warpnet.WarpHandlerFunc

func StreamBlockHandler added in v0.7.26

func StreamBlockHandler(repo BlocksStorer, userRepo BlockUserFetcher, nodeRepo PeerBlocklister) warpnet.WarpHandlerFunc

func StreamBookmarkHandler added in v0.7.26

func StreamBookmarkHandler(repo BookmarkStorer) warpnet.WarpHandlerFunc

func StreamChallengeHandler added in v0.2.476

func StreamChallengeHandler(fs FileSystem, privateKey ed25519.PrivateKey) warpnet.WarpHandlerFunc

StreamChallengeHandler TODO nonce cache check

func StreamCreateChatHandler

func StreamCreateChatHandler(
	repo ChatStorer,
	userRepo ChatUserFetcher,
	streamer ChatStreamer,
) warpnet.WarpHandlerFunc

Handler for creating a new chat

func StreamDeleteChatHandler

func StreamDeleteChatHandler(repo ChatStorer, authRepo ChatAuthStorer) warpnet.WarpHandlerFunc

func StreamDeleteFilterHandler added in v0.7.26

func StreamDeleteFilterHandler(repo FilterStorer) warpnet.WarpHandlerFunc

func StreamDeleteFilterKeywordHandler added in v0.7.26

func StreamDeleteFilterKeywordHandler(repo FilterStorer) warpnet.WarpHandlerFunc

func StreamDeleteMessageHandler

func StreamDeleteMessageHandler(repo ChatStorer, authRepo OwnerChatsStorer) warpnet.WarpHandlerFunc

Handler for deleting a message

func StreamDeleteReplyHandler

func StreamDeleteReplyHandler(
	tweetRepo ReplyTweetStorer,
	userRepo ReplyUserFetcher,
	replyRepo ReplyStorer,
	streamer ReplyStreamer,
) warpnet.WarpHandlerFunc

func StreamDeleteTweetHandler

func StreamDeleteTweetHandler(
	broadcaster TweetBroadcaster,
	authRepo OwnerTweetStorer,
	repo TweetsStorer,
	timelineRepo TimelineUpdater,
	likeRepo LikeTweetStorer,
) warpnet.WarpHandlerFunc

func StreamEditTweetHandler added in v0.7.26

func StreamEditTweetHandler(repo TweetsStorer, timelineRepo TimelineUpdater) warpnet.WarpHandlerFunc

func StreamFollowHandler

func StreamFollowHandler(
	broadcaster FollowingBroadcaster,
	followRepo FollowingStorer,
	authRepo FollowingAuthStorer,
	userRepo FollowingUserStorer,
	notifyRepo ModerationNotifier,
	streamer FollowNodeStreamer,
) warpnet.WarpHandlerFunc

func StreamGetBlocksHandler added in v0.7.26

func StreamGetBlocksHandler(repo BlocksStorer) warpnet.WarpHandlerFunc

func StreamGetBookmarksHandler added in v0.7.26

func StreamGetBookmarksHandler(repo BookmarkStorer) warpnet.WarpHandlerFunc

func StreamGetFilterHandler added in v0.7.26

func StreamGetFilterHandler(repo FilterStorer) warpnet.WarpHandlerFunc

func StreamGetFiltersHandler added in v0.7.26

func StreamGetFiltersHandler(repo FilterStorer) warpnet.WarpHandlerFunc

func StreamGetFollowRequestsHandler added in v0.7.26

func StreamGetFollowRequestsHandler(repo FollowingStorer) warpnet.WarpHandlerFunc

func StreamGetFollowersHandler

func StreamGetFollowersHandler(
	authRepo FollowingAuthStorer,
	userRepo FollowingUserStorer,
	followRepo FollowingStorer,
	streamer FollowNodeStreamer,
) warpnet.WarpHandlerFunc

func StreamGetFollowingsHandler added in v0.5.83

func StreamGetFollowingsHandler(
	authRepo FollowingAuthStorer,
	userRepo FollowingUserStorer,
	followRepo FollowingStorer,
	streamer FollowNodeStreamer,
) warpnet.WarpHandlerFunc

func StreamGetImageHandler

func StreamGetImageHandler(
	streamer MediaStreamer,
	mediaRepo MediaStorer,
	userRepo MediaUserFetcher,
) warpnet.WarpHandlerFunc

func StreamGetInfoHandler

func StreamGetInfoHandler(
	i NodeInformer,
	discHandler discovery.DiscoveryHandler,
) warpnet.WarpHandlerFunc

func StreamGetMediaHandler added in v0.7.26

func StreamGetMediaHandler(repo MediaMetaStorer) warpnet.WarpHandlerFunc

func StreamGetMessageHandler

func StreamGetMessageHandler(repo ChatStorer, authRepo OwnerChatsStorer) warpnet.WarpHandlerFunc

StreamGetMessageHandler for retrieving a specific message

func StreamGetMessagesHandler

func StreamGetMessagesHandler(repo ChatStorer, authRepo OwnerChatsStorer) warpnet.WarpHandlerFunc

Handler for getting messages in a chat

func StreamGetMutesHandler added in v0.7.26

func StreamGetMutesHandler(repo MutesStorer) warpnet.WarpHandlerFunc

func StreamGetNotificationHandler added in v0.7.26

func StreamGetNotificationHandler(
	repo NotifierGetter,
	authRepo NotifierAuthStorer,
) warpnet.WarpHandlerFunc

func StreamGetNotificationsHandler added in v0.5.30

func StreamGetNotificationsHandler(
	repo NotifierFetcher,
	authRepo NotifierAuthStorer,
) warpnet.WarpHandlerFunc

func StreamGetRepliesHandler

func StreamGetRepliesHandler(repo ReplyStorer) warpnet.WarpHandlerFunc

StreamGetRepliesHandler answers /public/get/replies requests.

ev.RootId is the root tweet of the thread; ev.ParentId is the parent TWEET id selecting which subtree of replies to return (NOT a user id — it gets compared against tweet/reply ids in the repo). Clients send an empty ParentId for "give me the top-level replies of the thread", which we normalise to RootId so the repo lookup matches the first tier of replies. Replies are served straight from the local store: any reply we know about (because the author's node pushed it to us via gossip, or because we cached an earlier fetch) is returned; otherwise the response is empty.

Note on routing: this used to try to forward the request to the "parent user" by treating ParentId as a user id and looking it up in userRepo. That can't work — ParentId is a tweet id — so the lookup always returned ErrUserNotFound and we silently fell back to local storage anyway. The dead code is removed; proper remote-fetch routing would need a RootUserId in GetAllRepliesEvent to identify the author of the root tweet, which clients don't currently send.

func StreamGetReplyHandler

func StreamGetReplyHandler(
	repo ReplyStorer,
	authRepo OwnerTweetStorer,
	userRepo TweetUserFetcher,
	streamer TweetStreamer,
) warpnet.WarpHandlerFunc

func StreamGetTweetHandler

func StreamGetTweetHandler(
	repo TweetsStorer,
	authRepo OwnerTweetStorer,
	userRepo TweetUserFetcher,
	streamer TweetStreamer,
) warpnet.WarpHandlerFunc

func StreamGetTweetLikersHandler added in v0.7.26

func StreamGetTweetLikersHandler(
	repo LikersLister,
	userRepo LikedUserFetcher,
	streamer EngagementStreamer,
) warpnet.WarpHandlerFunc

func StreamGetTweetRetweetersHandler added in v0.7.26

func StreamGetTweetRetweetersHandler(
	repo RetweetersLister,
	userRepo LikedUserFetcher,
	streamer EngagementStreamer,
) warpnet.WarpHandlerFunc

func StreamGetTweetStatsHandler

func StreamGetTweetStatsHandler(
	tweetRepo TweetsStorer,
	likeRepo LikeTweetStorer,
	retweetRepo RetweetsTweetStorer,
	replyRepo RepliesTweetCounter,
	userRepo TweetUserFetcher,
	streamer TweetStreamer,
) warpnet.WarpHandlerFunc

func StreamGetTweetsHandler

func StreamGetTweetsHandler(
	repo TweetsStorer,
	userRepo TweetUserFetcher,
	streamer TweetStreamer,
) warpnet.WarpHandlerFunc

func StreamGetUserChatHandler

func StreamGetUserChatHandler(repo ChatStorer, authRepo ChatAuthStorer) warpnet.WarpHandlerFunc

func StreamGetUserChatsHandler

func StreamGetUserChatsHandler(repo ChatStorer, authRepo OwnerChatsStorer) warpnet.WarpHandlerFunc

func StreamGetUserHandler

func StreamGetUserHandler(
	tweetRepo UserTweetsCounter,
	followRepo UserFollowsCounter,
	repo UserFetcher,
	authRepo UserAuthStorer,
	streamer UserStreamer,
) warpnet.WarpHandlerFunc

func StreamGetUsersHandler

func StreamGetUsersHandler(
	userRepo UserFetcher,
	streamer UserStreamer,
) warpnet.WarpHandlerFunc

func StreamGetWhoToFollowHandler added in v0.3.75

func StreamGetWhoToFollowHandler(
	authRepo UserAuthStorer,
	userRepo UserFetcher,
	followRepo UserFollowsCounter,
) warpnet.WarpHandlerFunc

func StreamIsFollowerHandler added in v0.5.83

func StreamIsFollowerHandler(
	followRepo FollowingStorer,
	authRepo FollowingAuthStorer,
) warpnet.WarpHandlerFunc

func StreamIsFollowingHandler added in v0.5.83

func StreamIsFollowingHandler(
	followRepo FollowingStorer,
	authRepo FollowingAuthStorer,
) warpnet.WarpHandlerFunc

func StreamLikeHandler

func StreamLikeHandler(
	repo LikesStorer,
	userRepo LikedUserFetcher,
	notifyRepo ModerationNotifier,
	streamer LikeStreamer,
) warpnet.WarpHandlerFunc

func StreamMarkNotificationReadHandler added in v0.7.26

func StreamMarkNotificationReadHandler(
	repo NotifierMarker,
	authRepo NotifierAuthStorer,
) warpnet.WarpHandlerFunc

func StreamModerationResultHandler added in v0.3.129

func StreamModerationResultHandler(
	tweetRepo ModerationTweetUpdater,
	userRepo ModerationUserUpdater,
	timelineRepo ModerationTimelelineDeleter,
) warpnet.WarpHandlerFunc

StreamModerationResultHandler receives a verdict from a moderator and applies it locally so this node's view of the offending object is downgraded. Two design notes:

  • Isolation is shadow-style: the offender's own node never receives this stream (the moderator only publishes the verdict to the followers/observers pubsub topic, see IsolationProtocol). The previous "notify the owner" branch was deleted because that defeats the whole point — the offender would see a moderation notification.

  • ModerationUserType marks the user-level moderation flag so clients hide bio/displayName/url/website on the next render. The user row stays on disk, only the Moderation sidecar is set.

func StreamMuteHandler added in v0.7.26

func StreamMuteHandler(repo MutesStorer) warpnet.WarpHandlerFunc

func StreamNewFilterHandler added in v0.7.26

func StreamNewFilterHandler(repo FilterStorer) warpnet.WarpHandlerFunc

func StreamNewMessageHandler added in v0.5.87

func StreamNewMessageHandler(repo ChatStorer, userRepo ChatUserFetcher, streamer ChatStreamer) warpnet.WarpHandlerFunc

StreamNewMessageHandler is for sending a new message

func StreamNewReTweetHandler

func StreamNewReTweetHandler(
	userRepo RetweetedUserFetcher,
	tweetRepo ReTweetsStorer,
	timelineRepo RetweetTimelineUpdater,
	notifyRepo ModerationNotifier,
	streamer RetweetStreamer,
) warpnet.WarpHandlerFunc

func StreamNewReplyHandler

func StreamNewReplyHandler(
	replyRepo ReplyStorer,
	userRepo ReplyUserFetcher,
	notifyRepo ModerationNotifier,
	streamer ReplyStreamer,
) warpnet.WarpHandlerFunc

func StreamNewTweetHandler

func StreamNewTweetHandler(
	broadcaster TweetBroadcaster,
	authRepo OwnerTweetStorer,
	tweetRepo TweetsStorer,
	timelineRepo TimelineUpdater,
	followRepo TweetFollowChecker,
) warpnet.WarpHandlerFunc

func StreamNodesPairingHandler

func StreamNodesPairingHandler(serverToken string, deviceRepo DeviceStorer, n NodeAddresser) warpnet.WarpHandlerFunc

func StreamPinTweetHandler added in v0.7.26

func StreamPinTweetHandler(repo TweetsStorer) warpnet.WarpHandlerFunc

func StreamRejectFollowRequestHandler added in v0.7.26

func StreamRejectFollowRequestHandler(repo FollowingStorer) warpnet.WarpHandlerFunc

func StreamReportHandler added in v0.7.59

func StreamReportHandler(publisher ReportPublisher) warpnet.WarpHandlerFunc

StreamReportHandler receives a PUBLIC_POST_REPORT call from a logged-in user (via the local Vue UI or warpdroid) and forwards it to the global reports gossip topic so any moderator node picks it up.

The handler intentionally does not store reports locally — there's no audit log on the reporter's node. Trust comes from the libp2p signature on the envelope, which the auth middleware already verified before this code runs. Shape-level validation lives in event.ValidateReport so the moderator consumer can re-run the same check against the gossiped message.

func StreamSearchUsersHandler added in v0.7.26

func StreamSearchUsersHandler(userRepo UserFetcher) warpnet.WarpHandlerFunc

func StreamSubscribeUserHandler added in v0.7.26

func StreamSubscribeUserHandler(repo SubscriptionStorer) warpnet.WarpHandlerFunc

func StreamTimelineHandler

func StreamTimelineHandler(repo TimelineFetcher) warpnet.WarpHandlerFunc

func StreamUnblockHandler added in v0.7.26

func StreamUnblockHandler(repo BlocksStorer, userRepo BlockUserFetcher, nodeRepo PeerBlocklister) warpnet.WarpHandlerFunc

func StreamUnbookmarkHandler added in v0.7.26

func StreamUnbookmarkHandler(repo BookmarkStorer) warpnet.WarpHandlerFunc

func StreamUnfollowHandler

func StreamUnfollowHandler(
	broadcaster FollowingBroadcaster,
	followRepo FollowingStorer,
	authRepo FollowingAuthStorer,
	userRepo FollowingUserStorer,
	streamer FollowNodeStreamer,
) warpnet.WarpHandlerFunc

func StreamUnlikeHandler

func StreamUnlikeHandler(repo LikesStorer, userRepo LikedUserFetcher, streamer LikeStreamer) warpnet.WarpHandlerFunc

func StreamUnmuteHandler added in v0.7.26

func StreamUnmuteHandler(repo MutesStorer) warpnet.WarpHandlerFunc

func StreamUnpinTweetHandler added in v0.7.26

func StreamUnpinTweetHandler(repo TweetsStorer) warpnet.WarpHandlerFunc

func StreamUnretweetHandler

func StreamUnretweetHandler(
	tweetRepo ReTweetsStorer,
	userRepo RetweetedUserFetcher,
	streamer RetweetStreamer,
) warpnet.WarpHandlerFunc

func StreamUnsubscribeUserHandler added in v0.7.26

func StreamUnsubscribeUserHandler(repo SubscriptionStorer) warpnet.WarpHandlerFunc

func StreamUpdateFilterHandler added in v0.7.26

func StreamUpdateFilterHandler(repo FilterStorer) warpnet.WarpHandlerFunc

func StreamUpdateFilterKeywordHandler added in v0.7.26

func StreamUpdateFilterKeywordHandler(repo FilterStorer) warpnet.WarpHandlerFunc

func StreamUpdateMediaMetaHandler added in v0.7.26

func StreamUpdateMediaMetaHandler(repo MediaMetaStorer) warpnet.WarpHandlerFunc

func StreamUpdateProfileHandler

func StreamUpdateProfileHandler(authRepo UserAuthStorer, userRepo UserFetcher) warpnet.WarpHandlerFunc

func StreamUploadImageHandler

func StreamUploadImageHandler(
	info MediaNodeInformer,
	mediaRepo MediaStorer,
	userRepo MediaUserFetcher,
) warpnet.WarpHandlerFunc

func StreamViewHandler added in v0.6.316

func StreamViewHandler(repo ViewsStorer, userRepo LikedUserFetcher, streamer LikeStreamer) warpnet.WarpHandlerFunc

Types

type BlockUserFetcher added in v0.7.26

type BlockUserFetcher interface {
	Get(userId string) (user domain.User, err error)
}

BlockUserFetcher looks up the blockee so the handler can escalate the social block into a network-layer peer blocklist.

type BlocksStorer added in v0.7.26

type BlocksStorer interface {
	Block(blockerId, blockeeId string) error
	Unblock(blockerId, blockeeId string) error
	List(blockerId string, limit *uint64, cursor *string) ([]string, string, error)
}

BlocksStorer is the narrow surface block handlers need from BlocksRepo.

type BookmarkStorer added in v0.7.26

type BookmarkStorer interface {
	Bookmark(userId, tweetId, ownerUserId string) error
	Unbookmark(userId, tweetId string) error
	List(userId string, limit *uint64, cursor *string) ([]database.Bookmark, string, error)
}

type CRDTLikesCounter added in v0.5.158

type CRDTLikesCounter interface {
	GetLikesCount(tweetID string) (uint64, error)
}

CRDTLikesCounter provides CRDT-based likes counting

type CRDTRepliesCounter added in v0.5.158

type CRDTRepliesCounter interface {
	GetRepliesCount(tweetID string) (uint64, error)
}

CRDTRepliesCounter provides CRDT-based replies counting

type CRDTRetweetsCounter added in v0.5.158

type CRDTRetweetsCounter interface {
	GetRetweetsCount(tweetID string) (uint64, error)
}

CRDTRetweetsCounter provides CRDT-based retweets counting

type ChatAuthStorer

type ChatAuthStorer interface {
	GetOwner() domain.Owner
}

type ChatStorer

type ChatStorer interface {
	CreateChat(chatId *string, ownerId, otherUserId string) (domain.Chat, error)
	DeleteChat(chatId string) error
	GetUserChats(userId string, limit *uint64, cursor *string) ([]domain.Chat, string, error)
	CreateMessage(msg domain.ChatMessage) (domain.ChatMessage, error)
	ListMessages(chatId string, limit *uint64, cursor *string) ([]domain.ChatMessage, string, error)
	GetMessage(chatId, id string) (domain.ChatMessage, error)
	DeleteMessage(chatId, id string) error
	GetChat(chatId string) (chat domain.Chat, err error)
}

type ChatStreamer

type ChatStreamer interface {
	GenericStream(nodeId string, path stream.WarpRoute, data any) (_ []byte, err error)
	NodeInfo() warpnet.NodeInfo
}

type ChatUserFetcher

type ChatUserFetcher interface {
	GetByNodeID(nodeID string) (user domain.User, err error)
	Get(userId string) (user domain.User, err error)
}

type DeviceStorer added in v0.6.263

type DeviceStorer interface {
	SetDevice(ownerNodeId string, device domain.Device) error
}

type EngagementStreamer added in v0.7.26

type EngagementStreamer interface {
	GenericStream(nodeId string, path stream.WarpRoute, data any) (_ []byte, err error)
	NodeInfo() warpnet.NodeInfo
}

EngagementStreamer forwards the lookup to the tweet author's node when the canonical engagement record lives elsewhere — mirrors the like.go propagation pattern.

type FileSystem added in v0.2.476

type FileSystem interface {
	ReadDir(name string) ([]fs.DirEntry, error)
	ReadFile(name string) ([]byte, error)
	Open(name string) (fs.File, error)
}

type FilterStorer added in v0.7.26

type FilterStorer interface {
	Create(userId string, f domain.Filter) (domain.Filter, error)
	Get(userId, filterId string) (domain.Filter, error)
	Update(userId string, f domain.Filter) (domain.Filter, error)
	Delete(userId, filterId string) error
	List(userId string, limit *uint64, cursor *string) ([]domain.Filter, string, error)
	AddKeyword(userId, filterId string, kw domain.FilterKeyword) (domain.FilterKeyword, error)
	UpdateKeyword(userId string, kw domain.FilterKeyword) (domain.FilterKeyword, error)
	DeleteKeyword(userId, keywordId string) error
}

FilterStorer is the narrow surface filter handlers need.

type FollowNodeStreamer

type FollowNodeStreamer interface {
	GenericStream(nodeId string, path stream.WarpRoute, data any) ([]byte, error)
}

type FollowingAuthStorer

type FollowingAuthStorer interface {
	GetOwner() domain.Owner
}

type FollowingBroadcaster

type FollowingBroadcaster interface {
	SubscribeUserUpdate(userId string) (err error)
	UnsubscribeUserUpdate(userId string) (err error)
}

type FollowingStorer

type FollowingStorer interface {
	Follow(fromUserId, toUserId string) error
	Unfollow(fromUserId, toUserId string) error
	GetFollowers(userId string, limit *uint64, cursor *string) ([]string, string, error)
	GetFollowings(userId string, limit *uint64, cursor *string) ([]string, string, error)
	IsFollowing(ownerId, otherUserId string) bool
	IsFollower(ownerId, otherUserId string) bool
	AddFollowRequest(targetUserId, followerId string) error
	RemoveFollowRequest(targetUserId, followerId string) error
	ListFollowRequests(targetUserId string, limit *uint64, cursor *string) ([]string, string, error)
}

type FollowingUserStorer

type FollowingUserStorer interface {
	Get(userId string) (user domain.User, err error)
	List(limit *uint64, cursor *string) ([]domain.User, string, error)
	Create(user domain.User) (domain.User, error)
}

type LikeStreamer

type LikeStreamer interface {
	GenericStream(nodeId string, path stream.WarpRoute, data any) (_ []byte, err error)
	NodeInfo() warpnet.NodeInfo
}

type LikeTweetStorer

type LikeTweetStorer interface {
	Like(tweetId, userId string) (likesNum uint64, err error)
	Unlike(tweetId, userId string) (likesNum uint64, err error)
	LikesCount(tweetId string) (likesNum uint64, err error)
	Likers(tweetId string, limit *uint64, cursor *string) (likers []string, cur string, err error)
}

type LikeTweetsStorer

type LikeTweetsStorer interface {
	Get(userID, tweetID string) (tweet domain.Tweet, err error)
	List(string, *uint64, *string) ([]domain.Tweet, string, error)
	Create(_ string, tweet domain.Tweet) (domain.Tweet, error)
	Delete(userID, tweetID string) error
}

type LikedUserFetcher

type LikedUserFetcher interface {
	GetBatch(userIds ...string) (users []domain.User, err error)
	Get(userId string) (users domain.User, err error)
}

type LikersLister added in v0.7.26

type LikersLister interface {
	Likers(tweetId string, limit *uint64, cursor *string) ([]string, string, error)
}

LikersLister is the narrow surface the likers handler needs.

type LikesStorer

type LikesStorer interface {
	Like(tweetId, userId string) (likesNum uint64, err error)
	Unlike(tweetId, userId string) (likesNum uint64, err error)
	LikesCount(tweetId string) (likesNum uint64, err error)
	Likers(tweetId string, limit *uint64, cursor *string) (likers []string, cur string, err error)
}

type MediaMetaStorer added in v0.7.26

type MediaMetaStorer interface {
	SetImageMeta(userId, key string, meta database.MediaMeta) error
	GetImageMeta(userId, key string) (database.MediaMeta, error)
}

MediaMetaStorer is the slice of MediaRepo the alt-text / focal-point handlers need.

type MediaNodeInformer

type MediaNodeInformer interface {
	NodeInfo() warpnet.NodeInfo
}

type MediaStorer

type MediaStorer interface {
	GetImage(userId, key string) (database.Base64Image, error)
	SetImage(userId string, img database.Base64Image) (_ database.ImageKey, err error)
	SetForeignImageWithTTL(userId, key string, img database.Base64Image) error
}

type MediaStreamer

type MediaStreamer interface {
	GenericStream(nodeId string, path stream.WarpRoute, data any) (_ []byte, err error)
	NodeInfo() warpnet.NodeInfo
}

type MediaUserFetcher

type MediaUserFetcher interface {
	Get(userId string) (user domain.User, err error)
}

type ModerationNotifier added in v0.5.30

type ModerationNotifier interface {
	Add(not domain.Notification) error
}

type ModerationTimelelineDeleter added in v0.5.136

type ModerationTimelelineDeleter interface {
	DeleteTweetFromTimeline(userID, tweetID string) error
}

type ModerationTweetUpdater added in v0.5.134

type ModerationTweetUpdater interface {
	Update(tweet domain.Tweet) error
}

type ModerationUserUpdater added in v0.7.59

type ModerationUserUpdater interface {
	Get(userId string) (domain.User, error)
	Update(userId string, user domain.User) (domain.User, error)
}

type MutesStorer added in v0.7.26

type MutesStorer interface {
	Mute(muterId, muteeId string) error
	Unmute(muterId, muteeId string) error
	List(muterId string, limit *uint64, cursor *string) ([]string, string, error)
}

MutesStorer is the narrow surface mute handlers need from MutesRepo.

type NodeAddresser added in v0.7.26

type NodeAddresser interface {
	PublicAddrs() []warpnet.WarpAddress
}

type NodeInformer

type NodeInformer interface {
	NodeInfo() warpnet.NodeInfo
}

type NotifierAuthStorer added in v0.5.87

type NotifierAuthStorer interface {
	GetOwner() domain.Owner
}

type NotifierFetcher added in v0.5.30

type NotifierFetcher interface {
	List(userId string, limit *uint64, cursor *string) ([]domain.Notification, string, error)
	UnreadCount(userId string) (uint64, error)
}

type NotifierGetter added in v0.7.26

type NotifierGetter interface {
	Get(userId, notificationId string) (domain.Notification, error)
}

type NotifierMarker added in v0.7.26

type NotifierMarker interface {
	MarkRead(userId, notificationId string) error
}

type OwnerChatsStorer

type OwnerChatsStorer interface {
	GetOwner() domain.Owner
}

type OwnerReTweetStorer

type OwnerReTweetStorer interface {
	GetOwner() domain.Owner
}

type OwnerTweetStorer

type OwnerTweetStorer interface {
	GetOwner() domain.Owner
}

type PeerBlocklister added in v0.7.26

type PeerBlocklister interface {
	BlocklistPermanent(peerId string) error
	BlocklistRemove(peerId string) error
}

PeerBlocklister talks to NodeRepo's libp2p-level blocklist (database/node-repo.go) so blocking a user disconnects and refuses traffic from their node.

A social block is permanent until the user undoes it, so we go straight to BlocklistPermanent (no exponential escalation) on Block, and BlocklistRemove on Unblock.

type ReTweetsStorer

type ReTweetsStorer interface {
	Get(userID, tweetID string) (tweet domain.Tweet, err error)
	NewRetweet(tweet domain.Tweet) (_ domain.Tweet, err error)
	UnRetweet(retweetedByUserID, tweetId string) error
	RetweetsCount(tweetId string) (uint64, error)
	Retweeters(tweetId string, limit *uint64, cursor *string) (_ []string, cur string, err error)
}

type RepliesTweetCounter

type RepliesTweetCounter interface {
	RepliesCount(tweetId string) (likesNum uint64, err error)
}

type ReplyStorer

type ReplyStorer interface {
	GetReply(rootID, replyID string) (tweet domain.Tweet, err error)
	GetRepliesTree(rootID, parentId string, limit *uint64, cursor *string) ([]domain.ReplyNode, string, error)
	AddReply(reply domain.Tweet) (domain.Tweet, error)
	DeleteReply(rootID, parentID, replyID string) error
}

type ReplyStreamer

type ReplyStreamer interface {
	GenericStream(nodeId string, path stream.WarpRoute, data any) (_ []byte, err error)
	NodeInfo() warpnet.NodeInfo
}

type ReplyTweetStorer

type ReplyTweetStorer interface {
	Get(userID, tweetID string) (tweet domain.Tweet, err error)
}

type ReplyUserFetcher

type ReplyUserFetcher interface {
	Get(userId string) (user domain.User, err error)
}

type ReportPublisher added in v0.7.59

type ReportPublisher interface {
	PublishReport(ev event.ReportEvent) error
}

ReportPublisher is the slice of the member pubsub provider this handler needs — published reports land on the moderator-facing topic.

type RetweetStreamer

type RetweetStreamer interface {
	GenericStream(nodeId string, path stream.WarpRoute, data any) (_ []byte, err error)
	NodeInfo() warpnet.NodeInfo
}

type RetweetTimelineUpdater

type RetweetTimelineUpdater interface {
	AddTweetToTimeline(userId string, tweet domain.Tweet) error
}

type RetweetedUserFetcher

type RetweetedUserFetcher interface {
	GetBatch(retweetersIds ...string) (users []domain.User, err error)
	Get(userId string) (users domain.User, err error)
}

type RetweetersLister added in v0.7.26

type RetweetersLister interface {
	Retweeters(tweetId string, limit *uint64, cursor *string) ([]string, string, error)
}

RetweetersLister is the narrow surface the retweeters handler needs.

type RetweetsTweetStorer

type RetweetsTweetStorer interface {
	Get(userID, tweetID string) (tweet domain.Tweet, err error)
	NewRetweet(tweet domain.Tweet) (_ domain.Tweet, err error)
	UnRetweet(retweetedByUserID, tweetId string) error
	RetweetsCount(tweetId string) (uint64, error)
	Retweeters(tweetId string, limit *uint64, cursor *string) (_ []string, cur string, err error)
}

type StatsNodeInformer

type StatsNodeInformer interface {
	NodeInfo() warpnet.NodeInfo
	Peerstore() warpnet.WarpPeerstore
	Network() warpnet.WarpNetwork
}

type StatsProvider

type StatsProvider interface {
	Stats() map[string]string
}

type SubscriptionStorer added in v0.7.26

type SubscriptionStorer interface {
	Subscribe(selfId, targetUserId string) error
	Unsubscribe(selfId, targetUserId string) error
}

SubscriptionStorer is the slice of SubscriptionsRepo the subscribe handlers need. Subscribe = "tell me about new tweets from this user"; the local node uses this watchlist to elevate the corresponding incoming tweet to a notification.

type TimelineFetcher

type TimelineFetcher interface {
	GetTimeline(string, *uint64, *string) ([]domain.Tweet, string, error)
}

type TimelineUpdater

type TimelineUpdater interface {
	AddTweetToTimeline(userId string, tweet domain.Tweet) error
	DeleteTweetFromTimeline(userID, tweetID string) error
}

type TweetBroadcaster

type TweetBroadcaster interface {
	PublishUpdateToFollowers(ownerId, dest string, bt []byte) (err error)
}

type TweetFollowChecker added in v0.7.145

type TweetFollowChecker interface {
	IsFollowing(ownerId, authorId string) bool
}

TweetFollowChecker reports whether ownerId follows authorId. The new-tweet handler uses it to keep unsolicited tweets out of the local timeline: a tweet is only accepted when the owner authored it or follows its author.

type TweetStreamer

type TweetStreamer interface {
	GenericStream(nodeId string, path stream.WarpRoute, data any) (_ []byte, err error)
	NodeInfo() warpnet.NodeInfo
}

type TweetUserFetcher

type TweetUserFetcher interface {
	Get(userId string) (user domain.User, err error)
}

type TweetsStorer

type TweetsStorer interface {
	TweetsCount(userId string) (uint64, error)
	GetViewsCount(tweetId string) (uint64, error)
	IsBlocklisted(tweetId string) bool
	Blocklist(tweetId string) error
	Get(userID, tweetID string) (tweet domain.Tweet, err error)
	List(string, *uint64, *string) ([]domain.Tweet, string, error)
	Create(_ string, tweet domain.Tweet) (domain.Tweet, error)
	Delete(userID, tweetID string) error
	UnRetweet(retweetedByUserID, tweetId string) error
	Retweeters(tweetId string, limit *uint64, cursor *string) (_ []string, cur string, err error)
	CreateWithTTL(userId string, tweet domain.Tweet, duration time.Duration) (domain.Tweet, error)
	Update(tweet domain.Tweet) error
	Pin(userId, tweetId string) (domain.Tweet, error)
	Unpin(userId, tweetId string) (domain.Tweet, error)
	AppendEdit(edit domain.TweetEdit) (domain.TweetEdit, error)
}

type UserAuthStorer

type UserAuthStorer interface {
	GetOwner() domain.Owner
}

type UserFetcher

type UserFetcher interface {
	Create(user domain.User) (domain.User, error)
	Get(userId string) (user domain.User, err error)
	List(limit *uint64, cursor *string) ([]domain.User, string, error)
	Search(query string, limit *uint64, cursor *string) ([]domain.User, string, error)
	WhoToFollow(limit *uint64, cursor *string) ([]domain.User, string, error)
	Update(userId string, newUser domain.User) (updatedUser domain.User, err error)
	CreateWithTTL(user domain.User, ttl time.Duration) (domain.User, error)
}

type UserFollowsCounter

type UserFollowsCounter interface {
	GetFollowersCount(userId string) (uint64, error)
	GetFollowingsCount(userId string) (uint64, error)
	GetFollowers(userId string, limit *uint64, cursor *string) ([]string, string, error)
	GetFollowings(userId string, limit *uint64, cursor *string) ([]string, string, error)
}

type UserStreamer

type UserStreamer interface {
	GenericStream(nodeId string, path stream.WarpRoute, data any) (_ []byte, err error)
	NodeInfo() warpnet.NodeInfo
}

type UserTweetsCounter

type UserTweetsCounter interface {
	TweetsCount(userID string) (uint64, error)
}

type ViewsStorer added in v0.6.316

type ViewsStorer interface {
	RecordView(tweetId, viewerId string) (uint64, error)
	GetViewsCount(tweetId string) (uint64, error)
}

Jump to

Keyboard shortcuts

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