Documentation ¶
Index ¶
- Constants
- func GetMaxPanSize() uint64
- type MediaFlowInfo
- type MediaManager
- func (m *MediaManager) CalcMediaFlowLimit(info *MediaFlowInfo) int
- func (m *MediaManager) CleanFilesForUser(userId string, size int64) int64
- func (m *MediaManager) CleanMediaFlowInfo()
- func (m *MediaManager) CleanTimeoutFiles()
- func (m *MediaManager) CreateMediaFlowInfo(addr string) *MediaFlowInfo
- func (m *MediaManager) GetChainInfoByAddr(addr string) float64
- func (m *MediaManager) GetMediaFlowInfo(addr string) (*MediaFlowInfo, bool)
- func (m *MediaManager) MediaFlowInfoCount() int
- func (m *MediaManager) Run()
- func (m *MediaManager) UpdateAllMediaFlowInfo()
- func (m *MediaManager) UpdateMaxPanSize()
- func (m *MediaManager) UpdateMediaFlowInfo(addr string)
Constants ¶
View Source
const UserBasicSize = 1024 * 1024 * 60
Variables ¶
This section is empty.
Functions ¶
func GetMaxPanSize ¶
func GetMaxPanSize() uint64
Types ¶
type MediaFlowInfo ¶
type MediaFlowInfo struct { Username string `json:"username"` CurUsedFlow int64 `json:"cur_used_flow"` FlowLimit int64 `json:"flow_limit"` UserImprove float64 `json:"user_improve"` }
func NewMediaFlowInfo ¶
func NewMediaFlowInfo(username string, flowCouldPerDay int64) *MediaFlowInfo
func (*MediaFlowInfo) InPacket ¶
func (m *MediaFlowInfo) InPacket(packetLen int64)
type MediaManager ¶
type MediaManager struct { MediaFlowMap map[string]*MediaFlowInfo MaxPanSize uint64 CantAvailable bool CleanInterval int64 // clean the file timeout for several days // contains filtered or unexported fields }
func NewMediaManager ¶
func NewMediaManager(cleanInterval int64) *MediaManager
func (*MediaManager) CalcMediaFlowLimit ¶
func (m *MediaManager) CalcMediaFlowLimit(info *MediaFlowInfo) int
func (*MediaManager) CleanFilesForUser ¶
func (m *MediaManager) CleanFilesForUser(userId string, size int64) int64
func (*MediaManager) CleanMediaFlowInfo ¶
func (m *MediaManager) CleanMediaFlowInfo()
func (*MediaManager) CleanTimeoutFiles ¶
func (m *MediaManager) CleanTimeoutFiles()
func (*MediaManager) CreateMediaFlowInfo ¶
func (m *MediaManager) CreateMediaFlowInfo(addr string) *MediaFlowInfo
CreateMediaFlowInfo get or create a MediaFlowInfo user by username
func (*MediaManager) GetChainInfoByAddr ¶
func (m *MediaManager) GetChainInfoByAddr(addr string) float64
func (*MediaManager) GetMediaFlowInfo ¶
func (m *MediaManager) GetMediaFlowInfo(addr string) (*MediaFlowInfo, bool)
GetMediaFlowInfo fetches the NetflowInfo matching the addr
func (*MediaManager) MediaFlowInfoCount ¶
func (m *MediaManager) MediaFlowInfoCount() int
MediaFlowInfoCount returns the number of existing allocations
func (*MediaManager) Run ¶
func (m *MediaManager) Run()
func (*MediaManager) UpdateAllMediaFlowInfo ¶
func (m *MediaManager) UpdateAllMediaFlowInfo()
func (*MediaManager) UpdateMaxPanSize ¶
func (m *MediaManager) UpdateMaxPanSize()
func (*MediaManager) UpdateMediaFlowInfo ¶
func (m *MediaManager) UpdateMediaFlowInfo(addr string)
Click to show internal directories.
Click to hide internal directories.