handler

package
v0.7.506 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 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"
)
View Source
const MaxReportReasonLen = 256

Variables

View Source
var (
	ErrReportNoTargetUser = errors.New("report: empty target_user_id")
	ErrReportNoTargetNode = errors.New("report: empty target_node_id")
	ErrReportNoReason     = errors.New("report: empty reason")
	ErrReportReasonLong   = errors.New("report: reason too long")
	ErrReportNoObjectID   = errors.New("report: empty object_id for tweet")
	ErrReportBadType      = errors.New("report: unsupported moderation object type")
)

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 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 StreamDeleteTweetHandler

func StreamDeleteTweetHandler(
	broadcaster TweetBroadcaster,
	authRepo OwnerTweetStorer,
	repo TweetsStorer,
	timelineRepo TimelineUpdater,
	likeRepo LikeTweetStorer,
	userRepo TweetUserFetcher,
	streamer TweetStreamer,
) 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 StreamGetLikesHandler added in v0.7.403

func StreamGetLikesHandler(repo LikedTweetsLister) warpnet.WarpHandlerFunc

StreamGetLikesHandler returns one page of the local user's "tweets I liked" index, newest first. Same reference-only wire shape as bookmarks: clients hydrate each tweet via PUBLIC_GET_TWEET using OwnerUserId.

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 StreamGetNotificationSettingsHandler added in v0.7.483

func StreamGetNotificationSettingsHandler(
	repo SettingsStorer,
	authRepo SettingsAuthStorer,
) warpnet.WarpHandlerFunc

func StreamGetNotificationsHandler added in v0.5.30

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

func StreamGetPushesHandler added in v0.7.362

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

StreamGetPushesHandler returns notifications newer than the given cursor (delta pull) via ReverseList, keeping the response cursor as a high-water mark. The plain notifications route stays on List so the desktop UI's older-page pagination (cursor -> end) is unaffected.

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 StreamImportTweetHandler added in v0.7.206

func StreamImportTweetHandler(
	info MediaNodeInformer,
	tweetRepo ImportTweetStorer,
	mediaRepo MediaStorer,
	userRepo MediaUserFetcher,
) warpnet.WarpHandlerFunc

StreamImportTweetHandler stores one pre-parsed original tweet streamed from the client (business browser dashboard or desktop member node). The client unzips and filters the X archive itself — dropping retweets, replies, GIFs and videos — and streams only the kept tweets one by one, so the node never buffers the whole archive. Photos arrive as raw base64 and go through the same EXIF/ownership pipeline as a fresh upload.

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 StreamMarkAllNotificationsReadHandler added in v0.7.422

func StreamMarkAllNotificationsReadHandler(
	repo NotifierAllMarker,
	authRepo NotifierAuthStorer,
) warpnet.WarpHandlerFunc

StreamMarkAllNotificationsReadHandler flips every unread notification for the owner in one round-trip. The UI's "Mark all as read" (and the open-the-notifications-view auto-read) used to page through PRIVATE_GET_NOTIFICATIONS and post per-id reads, which only ever covered the first page — unread items beyond it kept the badge alive forever.

func StreamMarkNotificationReadHandler added in v0.7.26

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

func StreamModerationResultHandler added in v0.3.129

func StreamModerationResultHandler(
	notifier ModerationNotifier,
	tweetRepo ModerationTweetUpdater,
	userRepo ModerationUserUpdater,
	timelineRepo ModerationTimelelineDeleter,
	authRepo NotifierAuthStorer,
) 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, notifyRepo ModerationNotifier, 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 StreamNewTweetHandler

func StreamNewTweetHandler(
	broadcaster TweetBroadcaster,
	authRepo OwnerTweetStorer,
	tweetRepo TweetsStorer,
	timelineRepo TimelineUpdater,
	followRepo TweetFollowChecker,
	userRepo TweetUserFetcher,
	notifyRepo ModerationNotifier,
	streamer TweetStreamer,
) warpnet.WarpHandlerFunc

func StreamNodesPairingHandler

func StreamNodesPairingHandler(authRepo PairAuthStorer, 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

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 StreamUpdateNotificationSettingsHandler added in v0.7.483

func StreamUpdateNotificationSettingsHandler(
	repo SettingsStorer,
	authRepo SettingsAuthStorer,
) 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) ([]domain.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 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 ImportTweetStorer added in v0.7.194

type ImportTweetStorer interface {
	Create(_ string, tweet domain.Tweet) (domain.Tweet, 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, isTransitive bool) (likesNum uint64, err error)
	Unlike(tweetId, userId string, isTransitive bool) (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 LikedTweetsLister added in v0.7.403

type LikedTweetsLister interface {
	Liked(userId string, limit *uint64, cursor *string) ([]domain.LikedTweet, 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, isTransitive bool) (likesNum uint64, err error)
	Unlike(tweetId, userId string, isTransitive bool) (likesNum uint64, err error)
	LikesCount(tweetId string) (likesNum uint64, err error)
	Likers(tweetId string, limit *uint64, cursor *string) (likers []string, cur string, err error)
	SetLiked(userId, tweetId, ownerUserId string) error
	RemoveLiked(userId, tweetId string) 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 MetricsNodeInformer added in v0.7.392

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

type MetricsProvider added in v0.7.392

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

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 NotifierAllMarker added in v0.7.422

type NotifierAllMarker interface {
	MarkAllRead(userId string) error
}

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)
	ReverseList(userId string, cursor *string, limit *uint64) ([]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 PairAuthStorer added in v0.7.320

type PairAuthStorer interface {
	SessionToken() string
}

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, isTransitive bool) (_ domain.Tweet, err error)
	UnRetweet(retweetedByUserID, tweetId string, isTransitive bool) 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 ReportPublisher added in v0.7.59

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

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, isTransitive bool) (_ domain.Tweet, err error)
	UnRetweet(retweetedByUserID, tweetId string, isTransitive bool) error
	RetweetsCount(tweetId string) (uint64, error)
	Retweeters(tweetId string, limit *uint64, cursor *string) (_ []string, cur string, err error)
}

type SettingsAuthStorer added in v0.7.483

type SettingsAuthStorer interface {
	GetOwner() domain.Owner
}

SettingsAuthStorer resolves the local node owner.

type SettingsStorer added in v0.7.483

type SettingsStorer interface {
	GetNotificationSettings(userId string) (domain.NotificationSettings, error)
	SetNotificationSettings(userId string, s domain.NotificationSettings) error
}

SettingsStorer is the narrow surface the notification-settings handlers need.

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, isTransitive bool) 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)
	AddReply(reply domain.Tweet, isTransitive bool) (domain.Tweet, error)
	GetReply(parentID, replyID string) (domain.Tweet, error)
	DeleteReply(parentID, replyID string, isTransitive bool) (domain.Tweet, error)
	GetReplies(parentID string, limit *uint64, cursor *string) ([]domain.Tweet, string, 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