refactor: remove NoCopy struct; move RefCounter struct to goutils and update usage; remove internal/utils entirely

This commit is contained in:
yusing
2026-01-07 17:17:12 +08:00
parent 04dd963535
commit cc406921cb
8 changed files with 4 additions and 152 deletions

View File

@@ -8,7 +8,7 @@ import (
"sync"
"github.com/rs/zerolog/log"
"github.com/yusing/godoxy/internal/utils"
"github.com/yusing/goutils/synk"
)
type File struct {
@@ -18,7 +18,7 @@ type File struct {
// Store it for later delete from `openedFiles`.
path string
refCount *utils.RefCount
refCount *synk.RefCount
}
var (
@@ -55,7 +55,7 @@ func NewFileIO(path string) (Writer, error) {
if _, err := f.Seek(0, io.SeekEnd); err != nil {
return nil, fmt.Errorf("access log seek error: %w", err)
}
file = &File{f: f, path: path, refCount: utils.NewRefCounter()}
file = &File{f: f, path: path, refCount: synk.NewRefCounter()}
openedFiles[path] = file
go file.closeOnZero()
return file, nil