diff options
| author | Chris Lu <chris.lu@gmail.com> | 2018-11-23 00:26:15 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2018-11-23 00:26:15 -0800 |
| commit | 86dd93359604938e0ed37a4a6c2a82923887df3d (patch) | |
| tree | 2f7b2bdafc1ddd6e6b207c2d5a2e2df9f52c5f8b /weed/filer2 | |
| parent | 444dfded84696eb2d67876e228939ca3f9e7819f (diff) | |
| download | seaweedfs-86dd93359604938e0ed37a4a6c2a82923887df3d.tar.xz seaweedfs-86dd93359604938e0ed37a4a6c2a82923887df3d.zip | |
go fmt
Diffstat (limited to 'weed/filer2')
| -rw-r--r-- | weed/filer2/filechunks.go | 10 | ||||
| -rw-r--r-- | weed/filer2/filechunks_test.go | 19 | ||||
| -rw-r--r-- | weed/filer2/filer_deletion.go | 2 |
3 files changed, 15 insertions, 16 deletions
diff --git a/weed/filer2/filechunks.go b/weed/filer2/filechunks.go index 3d540cc84..8f9746324 100644 --- a/weed/filer2/filechunks.go +++ b/weed/filer2/filechunks.go @@ -96,10 +96,10 @@ func ViewFromChunks(chunks []*filer_pb.FileChunk, offset int64, size int) (views func logPrintf(name string, visibles []*visibleInterval) { /* - log.Printf("%s len %d", name, len(visibles)) - for _, v := range visibles { - log.Printf("%s: => %+v", name, v) - } + log.Printf("%s len %d", name, len(visibles)) + for _, v := range visibles { + log.Printf("%s: => %+v", name, v) + } */ } @@ -109,7 +109,7 @@ var bufPool = sync.Pool{ }, } -func mergeIntoVisibles(visibles, newVisibles []*visibleInterval, chunk *filer_pb.FileChunk, ) ([]*visibleInterval) { +func mergeIntoVisibles(visibles, newVisibles []*visibleInterval, chunk *filer_pb.FileChunk) []*visibleInterval { newV := newVisibleInterval( chunk.Offset, diff --git a/weed/filer2/filechunks_test.go b/weed/filer2/filechunks_test.go index e886702ff..c2dd18515 100644 --- a/weed/filer2/filechunks_test.go +++ b/weed/filer2/filechunks_test.go @@ -4,8 +4,8 @@ import ( "log" "testing" - "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "fmt" + "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" ) func TestCompactFileChunks(t *testing.T) { @@ -27,7 +27,6 @@ func TestCompactFileChunks(t *testing.T) { } - func TestCompactFileChunks2(t *testing.T) { chunks := []*filer_pb.FileChunk{ @@ -43,10 +42,10 @@ func TestCompactFileChunks2(t *testing.T) { for n := 0; n < k; n++ { chunks = append(chunks, &filer_pb.FileChunk{ - Offset: int64(n * 100), Size: 100, FileId: fmt.Sprintf("fileId%d",n), Mtime: int64(n), + Offset: int64(n * 100), Size: 100, FileId: fmt.Sprintf("fileId%d", n), Mtime: int64(n), }) chunks = append(chunks, &filer_pb.FileChunk{ - Offset: int64(n * 50), Size: 100, FileId: fmt.Sprintf("fileId%d",n+k), Mtime: int64(n + k), + Offset: int64(n * 50), Size: 100, FileId: fmt.Sprintf("fileId%d", n+k), Mtime: int64(n + k), }) } @@ -170,10 +169,10 @@ func TestIntervalMerging(t *testing.T) { { Chunks: []*filer_pb.FileChunk{ {Offset: 0, Size: 77824, FileId: "4,0b3df938e301", Mtime: 123}, - {Offset: 471040, Size: 472225-471040, FileId: "6,0b3e0650019c", Mtime: 130}, - {Offset: 77824, Size: 208896-77824, FileId: "4,0b3f0c7202f0", Mtime: 140}, - {Offset: 208896, Size: 339968-208896, FileId: "2,0b4031a72689", Mtime: 150}, - {Offset: 339968, Size: 471040-339968, FileId: "3,0b416a557362", Mtime: 160}, + {Offset: 471040, Size: 472225 - 471040, FileId: "6,0b3e0650019c", Mtime: 130}, + {Offset: 77824, Size: 208896 - 77824, FileId: "4,0b3f0c7202f0", Mtime: 140}, + {Offset: 208896, Size: 339968 - 208896, FileId: "2,0b4031a72689", Mtime: 150}, + {Offset: 339968, Size: 471040 - 339968, FileId: "3,0b416a557362", Mtime: 160}, }, Expected: []*visibleInterval{ {start: 0, stop: 77824, fileId: "4,0b3df938e301"}, @@ -372,10 +371,10 @@ func BenchmarkCompactFileChunks(b *testing.B) { for n := 0; n < k; n++ { chunks = append(chunks, &filer_pb.FileChunk{ - Offset: int64(n * 100), Size: 100, FileId: fmt.Sprintf("fileId%d",n), Mtime: int64(n), + Offset: int64(n * 100), Size: 100, FileId: fmt.Sprintf("fileId%d", n), Mtime: int64(n), }) chunks = append(chunks, &filer_pb.FileChunk{ - Offset: int64(n * 50), Size: 100, FileId: fmt.Sprintf("fileId%d",n+k), Mtime: int64(n + k), + Offset: int64(n * 50), Size: 100, FileId: fmt.Sprintf("fileId%d", n+k), Mtime: int64(n + k), }) } diff --git a/weed/filer2/filer_deletion.go b/weed/filer2/filer_deletion.go index 4561ecf54..8fe8ae04f 100644 --- a/weed/filer2/filer_deletion.go +++ b/weed/filer2/filer_deletion.go @@ -3,9 +3,9 @@ package filer2 import ( "time" + "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/operation" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" - "github.com/chrislusf/seaweedfs/weed/glog" ) func (f *Filer) loopProcessingDeletion() { |
