mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
refactor
This commit is contained in:
parent
55e060cf61
commit
50be19d23e
8
weed/filesys/dirty_pages.go
Normal file
8
weed/filesys/dirty_pages.go
Normal file
|
@ -0,0 +1,8 @@
|
|||
package filesys
|
||||
|
||||
type DirtyPages interface {
|
||||
AddPage(offset int64, data []byte)
|
||||
FlushData() error
|
||||
ReadDirtyDataAt(data []byte, startOffset int64) (maxStop int64)
|
||||
GetStorageOptions() (collection, replication string)
|
||||
}
|
|
@ -22,7 +22,7 @@ type ContinuousDirtyPages struct {
|
|||
replication string
|
||||
}
|
||||
|
||||
func newDirtyPages(file *File, writeOnly bool) *ContinuousDirtyPages {
|
||||
func newContinuousDirtyPages(file *File, writeOnly bool) *ContinuousDirtyPages {
|
||||
dirtyPages := &ContinuousDirtyPages{
|
||||
intervals: &ContinuousIntervals{},
|
||||
f: file,
|
|
@ -20,7 +20,7 @@ import (
|
|||
|
||||
type FileHandle struct {
|
||||
// cache file has been written to
|
||||
dirtyPages *ContinuousDirtyPages
|
||||
dirtyPages DirtyPages
|
||||
entryViewCache []filer.VisibleInterval
|
||||
reader io.ReaderAt
|
||||
contentType string
|
||||
|
@ -38,7 +38,7 @@ type FileHandle struct {
|
|||
func newFileHandle(file *File, uid, gid uint32, writeOnly bool) *FileHandle {
|
||||
fh := &FileHandle{
|
||||
f: file,
|
||||
dirtyPages: newDirtyPages(file, writeOnly),
|
||||
dirtyPages: newContinuousDirtyPages(file, writeOnly),
|
||||
Uid: uid,
|
||||
Gid: gid,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue