Documentation ¶
Index ¶
- type CacheEvent
- type CacheUnsubscribeFunc
- type EventType
- type SOCache
- func (c *SOCache) GetContainerForTypeID(id uint32) (*SOCacheContainer, error)
- func (c *SOCache) HandleDestroy(msg *gcsdkm.CMsgSOSingleObject) error
- func (c *SOCache) HandleSubscribed(msg *gcsdkm.CMsgSOCacheSubscribed) error
- func (c *SOCache) HandleUnsubscribed(msg *gcsdkm.CMsgSOCacheUnsubscribed) error
- func (c *SOCache) HandleUpdateMultiple(msg *gcsdkm.CMsgSOMultipleObjects) error
- func (c *SOCache) SubscribeType(id cso.CSOType) (<-chan *CacheEvent, CacheUnsubscribeFunc, error)
- type SOCacheContainer
- func (c *SOCacheContainer) Get(id uint64) (proto.Message, bool)
- func (c *SOCacheContainer) GetOne() (obj proto.Message)
- func (c *SOCacheContainer) GetTypeID() uint32
- func (c *SOCacheContainer) HandleDestroy(msg *gcsdkm.CMsgSOSingleObject) error
- func (c *SOCacheContainer) HandleSubscribed(msg *gcsdkm.CMsgSOCacheSubscribed, ...) error
- func (c *SOCacheContainer) HandleUnsubscribed(msg *gcsdkm.CMsgSOCacheUnsubscribed) error
- func (c *SOCacheContainer) Range(cb func(id uint64, obj proto.Message) error) error
- func (c *SOCacheContainer) Subscribe() (<-chan *CacheEvent, CacheUnsubscribeFunc, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheEvent ¶
type CacheEvent struct { // EventType marks the type of event. EventType EventType // Object contains the affected object. Object proto.Message }
CacheEvent is a cache event.
type CacheUnsubscribeFunc ¶
type CacheUnsubscribeFunc func()
CacheUnsubscribeFunc is called to unsubscribe a subscription.
type SOCache ¶
type SOCache struct {
// contains filtered or unexported fields
}
SOCache implements the shared-object cache from DOTA.
func (*SOCache) GetContainerForTypeID ¶
func (c *SOCache) GetContainerForTypeID(id uint32) (*SOCacheContainer, error)
GetContainerForTypeID returns the container for the type id.
func (*SOCache) HandleDestroy ¶
func (c *SOCache) HandleDestroy(msg *gcsdkm.CMsgSOSingleObject) error
HandleDestroy handles a object destroy message.
func (*SOCache) HandleSubscribed ¶
func (c *SOCache) HandleSubscribed(msg *gcsdkm.CMsgSOCacheSubscribed) error
HandleSubscribed handles a subscribed message.
func (*SOCache) HandleUnsubscribed ¶
func (c *SOCache) HandleUnsubscribed(msg *gcsdkm.CMsgSOCacheUnsubscribed) error
HandleUnsubscribed handles a subscribed message.
func (*SOCache) HandleUpdateMultiple ¶
func (c *SOCache) HandleUpdateMultiple(msg *gcsdkm.CMsgSOMultipleObjects) error
HandleUpdateMultiple handles a update multiple message.
func (*SOCache) SubscribeType ¶
func (c *SOCache) SubscribeType(id cso.CSOType) (<-chan *CacheEvent, CacheUnsubscribeFunc, error)
SubscribeType subscribes to events for an object type.
type SOCacheContainer ¶
type SOCacheContainer struct {
// contains filtered or unexported fields
}
SOCacheContainer contains a type of object in the cache.
func NewSOCacheContainer ¶
func NewSOCacheContainer(le *logrus.Entry, typeID uint32) (*SOCacheContainer, error)
NewSOCacheContainer builds a new container for a type id.
func (*SOCacheContainer) Get ¶
func (c *SOCacheContainer) Get(id uint64) (proto.Message, bool)
Get tries to look up an object by ID.
func (*SOCacheContainer) GetOne ¶
func (c *SOCacheContainer) GetOne() (obj proto.Message)
GetOne returns an object assuming there is only one.
func (*SOCacheContainer) GetTypeID ¶
func (c *SOCacheContainer) GetTypeID() uint32
GetTypeID returns the type id the container contains.
func (*SOCacheContainer) HandleDestroy ¶
func (c *SOCacheContainer) HandleDestroy(msg *gcsdkm.CMsgSOSingleObject) error
HandleDestroy handles a cache object destroy packet.
func (*SOCacheContainer) HandleSubscribed ¶
func (c *SOCacheContainer) HandleSubscribed(msg *gcsdkm.CMsgSOCacheSubscribed, obj *gcsdkm.CMsgSOCacheSubscribed_SubscribedType) error
HandleSubscribed handles an incoming object from a Subscribed event.
func (*SOCacheContainer) HandleUnsubscribed ¶
func (c *SOCacheContainer) HandleUnsubscribed(msg *gcsdkm.CMsgSOCacheUnsubscribed) error
HandleUnsubscribed handles a cache unsubscribe packet.
func (*SOCacheContainer) Subscribe ¶
func (c *SOCacheContainer) Subscribe() (<-chan *CacheEvent, CacheUnsubscribeFunc, error)
Subscribe subscribes to events for the object type.