1 Star 0 Fork 0

micro-tools/wf

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gfpool.go 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
545403892 提交于 2023-09-27 22:16 +08:00 . 升级go-ole
// Package gfpool provides io-reusable pool for file pointer.
package gfpool
import (
"gitee.com/micro-tools/wf/container/gmap"
"gitee.com/micro-tools/wf/container/gpool"
"gitee.com/micro-tools/wf/container/gtype"
"os"
"time"
)
// File pointer pool.
type Pool struct {
id *gtype.Int // Pool id, which is used to mark this pool whether recreated.
pool *gpool.Pool // Underlying pool.
init *gtype.Bool // Whether initialized, used for marking this file added to fsnotify, and it can only be added just once.
ttl time.Duration // Time to live for file pointer items.
}
// File is an item in the pool.
type File struct {
*os.File // Underlying file pointer.
stat os.FileInfo // State of current file pointer.
pid int // Belonging pool id, which is set when file pointer created. It's used to check whether the pool is recreated.
pool *Pool // Belonging ool.
flag int // Flash for opening file.
perm os.FileMode // Permission for opening file.
path string // Absolute path of the file.
}
var (
// Global file pointer pool.
pools = gmap.NewStrAnyMap(true)
)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/micro-tools/wf.git
git@gitee.com:micro-tools/wf.git
micro-tools
wf
wf
v1.0.2

搜索帮助