Browse Source

refactor

pull/2063/head
Chris Lu 4 years ago
parent
commit
50be19d23e
  1. 8
      weed/filesys/dirty_pages.go
  2. 2
      weed/filesys/dirty_pages_continuous.go
  3. 4
      weed/filesys/filehandle.go

8
weed/filesys/dirty_pages.go

@ -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)
}

2
weed/filesys/dirty_page.go → weed/filesys/dirty_pages_continuous.go

@ -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,

4
weed/filesys/filehandle.go

@ -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…
Cancel
Save