Documentation ¶
Overview ¶
Package tsyncmap : a timeout based syncmap
Index ¶
- Variables
- func GetColorByLatency(latency float64) tablewriter.Colors
- func GetColorByLoss(loss float64) tablewriter.Colors
- func MetricProcessing(tx chan *Metric, rx chan *Metric, report chan *Report, stop chan interface{}, ...)
- func NewSessionDB(probeName string, probeList []string, maxPath int, maxTTL int, ...) *sync.Map
- func PrintDB(SessionDB *sync.Map, probeName string, probList []string, maxPath int)
- func ProcessRecord(ch chan *Report, g *geoip.GeoIPDB, SessionDB *sync.Map, DelayWinSize int)
- type LossBitMap
- type Metric
- type ProbeInfo
- type Report
- type RollingStatus
- func (r *RollingStatus) Get() (float64, float64, float64)
- func (r *RollingStatus) GetWeighted(N uint64) (float64, float64, float64)
- func (r *RollingStatus) Update(xN float64)
- func (r *RollingStatus) UpdateLatency(xN float64)
- func (r *RollingStatus) UpdateLoss()
- func (r *RollingStatus) UpdateWeighted(xN float64)
- func (r *RollingStatus) UpdateWeightedLoss()
- type ServerInfo
- type Session
- type SessionTable
- func (tmap *SessionTable) Delete(key interface{})
- func (tmap *SessionTable) GetRemainTime(key interface{}) (time.Duration, error)
- func (tmap *SessionTable) Load(key interface{}) (value interface{}, ok bool)
- func (tmap *SessionTable) LoadRestApi(w http.ResponseWriter, r *http.Request)
- func (tmap *SessionTable) Run()
- func (tmap *SessionTable) ShowData()
- func (tmap *SessionTable) ShowExpireTime()
- func (tmap *SessionTable) Stop()
- func (tmap *SessionTable) Store(key interface{}, value interface{}, currentTime time.Time)
- func (tmap *SessionTable) UpdateTime(key interface{}, currentTime time.Time)
Constants ¶
This section is empty.
Variables ¶
View Source
var EnrichmentCacheDB *tsyncmap.Map
Functions ¶
func GetColorByLatency ¶
func GetColorByLatency(latency float64) tablewriter.Colors
func GetColorByLoss ¶
func GetColorByLoss(loss float64) tablewriter.Colors
func MetricProcessing ¶
func NewSessionDB ¶
Types ¶
type LossBitMap ¶
type LossBitMap struct {
// contains filtered or unexported fields
}
func NewLossBitMap ¶
func NewLossBitMap(size uint64) *LossBitMap
func (*LossBitMap) BitCount ¶
func (b *LossBitMap) BitCount() uint64
func (*LossBitMap) Set ¶
func (b *LossBitMap) Set(pos uint64) bool
func (*LossBitMap) Unset ¶
func (b *LossBitMap) Unset(pos uint64) bool
func (*LossBitMap) UpdateLoss ¶
func (b *LossBitMap) UpdateLoss()
func (*LossBitMap) UpdatePass ¶
func (b *LossBitMap) UpdatePass()
func (*LossBitMap) UpdateWeightedLoss ¶
func (b *LossBitMap) UpdateWeightedLoss()
func (*LossBitMap) UpdateWeightedPass ¶
func (b *LossBitMap) UpdateWeightedPass()
type Metric ¶
type Report ¶
type RollingStatus ¶
func NewRollingStatus ¶
func NewRollingStatus(delayWinSize int, lossWinSize int) *RollingStatus
func (*RollingStatus) GetWeighted ¶
func (r *RollingStatus) GetWeighted(N uint64) (float64, float64, float64)
func (*RollingStatus) Update ¶
func (r *RollingStatus) Update(xN float64)
func (*RollingStatus) UpdateLatency ¶
func (r *RollingStatus) UpdateLatency(xN float64)
func (*RollingStatus) UpdateLoss ¶
func (r *RollingStatus) UpdateLoss()
func (*RollingStatus) UpdateWeighted ¶
func (r *RollingStatus) UpdateWeighted(xN float64)
func (*RollingStatus) UpdateWeightedLoss ¶
func (r *RollingStatus) UpdateWeightedLoss()
type ServerInfo ¶
type ServerInfo struct { Address string Name string City string Region string Country string ASN uint32 SPName string Lat float64 Long float64 }
func Enrichment ¶
func Enrichment(dst string, g *geoip.GeoIPDB) *ServerInfo
type Session ¶
type Session struct { DestAddr string RespAddr map[int]string ServerInfo []*ServerInfo Stats []*RollingStatus InitFlag []uint8 Lock *sync.RWMutex }
type SessionTable ¶
type SessionTable struct { Name string Data sync.Map Timeout int64 CheckFreq int64 ExpireTime sync.Map Verbose bool TimeOutChan chan *Metric // contains filtered or unexported fields }
Map is the base structure for tsyncmap.
func NewSessionTable ¶
NewMap is a construct function to create tsyncmap.
func (*SessionTable) Delete ¶
func (tmap *SessionTable) Delete(key interface{})
func (*SessionTable) GetRemainTime ¶
func (tmap *SessionTable) GetRemainTime(key interface{}) (time.Duration, error)
func (*SessionTable) Load ¶
func (tmap *SessionTable) Load(key interface{}) (value interface{}, ok bool)
Load returns the value from tsyncmap
func (*SessionTable) LoadRestApi ¶
func (tmap *SessionTable) LoadRestApi(w http.ResponseWriter, r *http.Request)
func (*SessionTable) Run ¶
func (tmap *SessionTable) Run()
Run is a coroutine to help tsyncmap manage the expire data.
func (*SessionTable) ShowData ¶
func (tmap *SessionTable) ShowData()
func (*SessionTable) ShowExpireTime ¶
func (tmap *SessionTable) ShowExpireTime()
func (*SessionTable) Stop ¶
func (tmap *SessionTable) Stop()
func (*SessionTable) Store ¶
func (tmap *SessionTable) Store(key interface{}, value interface{}, currentTime time.Time)
Store is used save the key,value pairs in tsyncmap
func (*SessionTable) UpdateTime ¶
func (tmap *SessionTable) UpdateTime(key interface{}, currentTime time.Time)
UpdateTime is used update specific key's expiretime.
Click to show internal directories.
Click to hide internal directories.