media_manage

package
v0.0.0-...-bef77f0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL