mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-10 12:00:28 +08:00
初步实现bfs原型(仅用于实验)
This commit is contained in:
34
internal/utils/bfs/fs_options.go
Normal file
34
internal/utils/bfs/fs_options.go
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package bfs
|
||||
|
||||
import "time"
|
||||
|
||||
type FSOptions struct {
|
||||
MaxOpenFiles int // TODO 需要实现
|
||||
BytesPerSync int64
|
||||
SyncTimeout time.Duration
|
||||
MaxSyncFiles int
|
||||
}
|
||||
|
||||
func (this *FSOptions) EnsureDefaults() {
|
||||
if this.MaxOpenFiles <= 0 {
|
||||
this.MaxOpenFiles = 4 << 10
|
||||
}
|
||||
if this.BytesPerSync <= 0 {
|
||||
this.BytesPerSync = 1 << 20 // TODO 根据硬盘实际写入速度进行调整
|
||||
}
|
||||
if this.SyncTimeout <= 0 {
|
||||
this.SyncTimeout = 1 * time.Second
|
||||
}
|
||||
if this.MaxSyncFiles <= 0 {
|
||||
this.MaxSyncFiles = 32
|
||||
}
|
||||
}
|
||||
|
||||
var DefaultFSOptions = &FSOptions{
|
||||
MaxOpenFiles: 4 << 10,
|
||||
BytesPerSync: 1 << 20, // TODO 根据硬盘实际写入速度进行调整
|
||||
SyncTimeout: 1 * time.Second,
|
||||
MaxSyncFiles: 32,
|
||||
}
|
||||
Reference in New Issue
Block a user