MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / Save

Method Save

internal/stats/bandwidth_stat_manager.go:290–305  ·  view source on GitHub ↗

Save 保存到本地磁盘

()

Source from the content-addressed store, hash-verified

288
289// Save 保存到本地磁盘
290func (this *BandwidthStatManager) Save() error {
291 this.locker.Lock()
292 defer this.locker.Unlock()
293
294 if len(this.m) == 0 {
295 return nil
296 }
297
298 data, err := json.Marshal(this.m)
299 if err != nil {
300 return err
301 }
302
303 _ = os.Remove(this.cacheFile)
304 return os.WriteFile(this.cacheFile, data, 0666)
305}
306
307// Cancel 取消上传
308func (this *BandwidthStatManager) Cancel() {

Callers 1

initFunction · 0.45

Calls 4

WriteFileMethod · 0.80
RemoveMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected