Documentation
¶
Index ¶
- type EntityCache
- func (c *EntityCache) AddSoldier(s model.Soldier)
- func (c *EntityCache) AddVehicle(v model.Vehicle)
- func (c *EntityCache) GetSoldier(id uint16) (model.Soldier, bool)
- func (c *EntityCache) GetVehicle(id uint16) (model.Vehicle, bool)
- func (c *EntityCache) Lock()
- func (c *EntityCache) Reset()
- func (c *EntityCache) Unlock()
- type MarkerCache
- type SafeCounter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EntityCache ¶
type EntityCache struct {
Soldiers map[uint16]model.Soldier
Vehicles map[uint16]model.Vehicle
// contains filtered or unexported fields
}
EntityCache caches soldiers and vehicles when they are created to avoid subsequent db reads. Latency in these calls is critical to quickly process incoming data.
func NewEntityCache ¶
func NewEntityCache() *EntityCache
func (*EntityCache) AddSoldier ¶
func (c *EntityCache) AddSoldier(s model.Soldier)
func (*EntityCache) AddVehicle ¶
func (c *EntityCache) AddVehicle(v model.Vehicle)
func (*EntityCache) GetSoldier ¶
func (c *EntityCache) GetSoldier(id uint16) (model.Soldier, bool)
func (*EntityCache) GetVehicle ¶
func (c *EntityCache) GetVehicle(id uint16) (model.Vehicle, bool)
func (*EntityCache) Lock ¶
func (c *EntityCache) Lock()
func (*EntityCache) Reset ¶
func (c *EntityCache) Reset()
func (*EntityCache) Unlock ¶
func (c *EntityCache) Unlock()
type MarkerCache ¶
type MarkerCache struct {
// contains filtered or unexported fields
}
MarkerCache maps marker names to their database IDs for the current mission
func (*MarkerCache) Delete ¶
func (c *MarkerCache) Delete(name string)
Delete removes a marker by name
func (*MarkerCache) Get ¶
func (c *MarkerCache) Get(name string) (uint, bool)
Get retrieves a marker ID by name
func (*MarkerCache) Set ¶
func (c *MarkerCache) Set(name string, id uint)
Set stores a marker ID by name
type SafeCounter ¶
type SafeCounter struct {
// contains filtered or unexported fields
}
SafeCounter is a thread-safe counter
func (*SafeCounter) Inc ¶
func (c *SafeCounter) Inc()
func (*SafeCounter) Set ¶
func (c *SafeCounter) Set(v int)
func (*SafeCounter) Value ¶
func (c *SafeCounter) Value() int
Click to show internal directories.
Click to hide internal directories.