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 Clear()
- func ClosePost(id, op uint64, msg []byte)
- func GetByIP(ip string) (cls []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)
- type ClientMap
- type Feed
Constants ¶
const TickerInterval = time.Millisecond * 100
TickerInterval sets the interval of ticker flushes
Variables ¶
This section is empty.
Functions ¶
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
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