Advertisement
riking

Untitled

Oct 26th, 2015
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 2.53 KB | None | 0 0
  1. // this value is just docs right now
  2. var ServerInitiatedCommands = map[string]PushCommandCacheInfo{
  3.     /// Global updates & notices
  4.     "update_news": {CacheTypeTimestamps, MsgTargetTypeGlobal}, // timecache:global
  5.     "message":     {CacheTypeTimestamps, MsgTargetTypeGlobal}, // timecache:global
  6.     "reload_ff":   {CacheTypeTimestamps, MsgTargetTypeGlobal}, // timecache:global
  7.  
  8.     /// Emote updates
  9.     "reload_badges": {CacheTypeTimestamps, MsgTargetTypeGlobal},    // timecache:global
  10.     "set_badge":     {CacheTypeTimestamps, MsgTargetTypeMultichat}, // timecache:multichat
  11.     "reload_set":    {CacheTypeTimestamps, MsgTargetTypeMultichat}, // timecache:multichat
  12.     "load_set":      {},                                            // TODO what are the semantics of this?
  13.  
  14.     /// User auth
  15.     "do_authorize": {CacheTypeNever, MsgTargetTypeSingle}, // nocache:single
  16.  
  17.     /// Channel data
  18.     // follow_sets: extra emote sets included in the chat
  19.     // follow_buttons: extra follow buttons below the stream
  20.     "follow_sets":    {CacheTypePersistent, MsgTargetTypeChat},     // mustcache:chat
  21.     "follow_buttons": {CacheTypePersistent, MsgTargetTypeWatching}, // mustcache:watching
  22.     "srl_race":       {CacheTypeLastOnly, MsgTargetTypeWatching},   // cachelast:watching
  23.  
  24.     /// Chatter/viewer counts
  25.     "chatters": {CacheTypeLastOnly, MsgTargetTypeWatching}, // cachelast:watching
  26.     "viewers":  {CacheTypeLastOnly, MsgTargetTypeWatching}, // cachelast:watching
  27. }
  28.  
  29. type BacklogCacheType int
  30.  
  31. const (
  32.     // This is not a cache type.
  33.     CacheTypeInvalid BacklogCacheType = iota
  34.     // This message cannot be cached.
  35.     CacheTypeNever
  36.     // Save the last 24 hours of this message.
  37.     // If a client indicates that it has reconnected, replay the messages sent after the disconnect.
  38.     CacheTypeTimestamps
  39.     // Save only the last copy of this message, and always send it when the backlog is requested.
  40.     CacheTypeLastOnly
  41.     // Save this backlog data to disk with its timestamp.
  42.     // Send it when the backlog is requested, or after a reconnect if it was updated.
  43.     CacheTypePersistent
  44. )
  45.  
  46. type MessageTargetType int
  47.  
  48. const (
  49.     // This is not a message target.
  50.     MsgTargetTypeInvalid MessageTargetType = iota
  51.     // This message is targeted to a single TODO(user or connection)
  52.     MsgTargetTypeSingle
  53.     // This message is targeted to all users in a chat
  54.     MsgTargetTypeChat
  55.     // This message is targeted to all users in multiple chats
  56.     MsgTargetTypeMultichat
  57.     // This message is targeted to all users watching a stream
  58.     MsgTargetTypeWatching
  59.     // This message is sent to all FFZ users.
  60.     MsgTargetTypeGlobal
  61. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement