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, links []common.Link, commands []common.Command) (err error)
- func GetByIP(ip string) []common.Client
- func GetByIPAndBoard(ip, board string) []common.Client
- func GetByThread(id uint64) []common.Client
- func GetSync(cl common.Client) (synced bool, op uint64, board string)
- func IPCount() int
- func Init() (err error)
- func InsertPostInto(post common.StandalonePost, msg []byte)
- func RegisterIP(ip string) (err error)
- func RemoveClient(cl common.Client)
- func SendTo(id uint64, msg []byte)
- func SubscribeToMeguTV(c common.Client) (err error)
- func UnregisterIP(ip string)
- type Feed
- func (f *Feed) ClosePost(id uint64, msg []byte)
- func (f *Feed) InsertImage(id uint64, spoilered bool, msg []byte)
- func (f *Feed) InsertPost(p common.Post, msg []byte)
- func (f *Feed) Send(msg []byte)
- func (f *Feed) SetOpenBody(id uint64, body string, 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 GetByIPAndBoard ¶
GetByIPAndBoard retrieves all Clients that match the passed IP on a board
func GetByThread ¶
GetByThread gets all synced to a thread
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 SubscribeToMeguTV ¶
SubscribeToMeguTV subscribes to random video stream. Clients are automatically unsubscribed, when leaving their current sync feed.
Types ¶
type Feed ¶
type Feed struct {
// contains filtered or unexported fields
}
Feed is 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 ¶
InsertImage inserts an image into an already allocated post
func (*Feed) InsertPost ¶
InsertPost inserts a new post into the thread or reclaim an open post after disconnect and propagate to listeners
func (*Feed) SetOpenBody ¶
SetOpenBody sets the body of an open post and send update message to clients
func (*Feed) SpoilerImage ¶
SpoilerImage spoilers a feed's image