Documentation
¶
Overview ¶
Package feeds manages client synchronization to update feeds and provides a thread-safe interface for propagating messages to them and reassigning feeds to and from clients.
Index ¶
- Constants
- func All() []common.Client
- func BanPost(id, op uint64) error
- func Clear()
- func ClosePost(id, op uint64, msg []byte)
- func DeleteImage(id, op uint64) error
- func DeletePost(id, op uint64) error
- func GetByIPAndBoard(ip, board string) []common.Client
- func GetSync(cl common.Client) (synced bool, op uint64, board string)
- func InsertPostInto(post common.StandalonePost, msg []byte)
- func RemoveClient(cl common.Client)
- func SendTo(id uint64, msg []byte)
- func SpoilerImage(id, op uint64) error
- type ClientMap
- type Feed
- func (f *Feed) ClosePost(id uint64, msg []byte)
- func (f *Feed) InsertImage(id uint64, msg []byte)
- func (f *Feed) InsertPost(post common.StandalonePost, body, msg []byte)
- func (f *Feed) Send(msg []byte)
- func (f *Feed) SetOpenBody(id uint64, body, msg []byte)
- func (f *Feed) SpoilerImage(id uint64, msg []byte)
- func (f *Feed) Start() (err error)
Constants ¶
const TickerInterval = time.Millisecond * 100
TickerInterval sets the interval of ticker flushes
Variables ¶
This section is empty.
Functions ¶
func DeleteImage ¶
Propagate a message about an image being deleted from a post
func DeletePost ¶
Propagate a message about a post being deleted
func GetByIPAndBoard ¶
GetByIPAndBoard retrieves all Clients that match the passed IP on a board
func InsertPostInto ¶
func InsertPostInto(post common.StandalonePost, msg []byte)
InsertPostInto inserts a post into a tread feed, if it exists. Only use for already closed posts.
func RemoveClient ¶
RemoveClient removes a client from the global client map and any subscribed to feed
func SpoilerImage ¶
Propagate a message about an image being spoilered
Types ¶
type Feed ¶
type Feed struct {
// contains filtered or unexported fields
}
A feed with synchronization logic of a certain thread
func SyncClient ¶
SyncClient adds a client to a the global client map and synchronizes to an update feed, if any. If the client was already synced to another feed, it is automatically unsubscribed.
func (*Feed) InsertImage ¶
Insert an image into an already allocated post
func (*Feed) InsertPost ¶
func (f *Feed) InsertPost(post common.StandalonePost, body, msg []byte)
Insert a new post into the thread or reclaim an open post after disconnect and propagate to listeners
func (*Feed) SetOpenBody ¶
Set body of an open post and send update message to clients