Browse Source

go fmt

pull/1020/head
Chris Lu 6 years ago
parent
commit
862c2cb8e6
  1. 6
      weed/filer2/leveldb2/leveldb2_store.go
  2. 4
      weed/filer2/leveldb2/leveldb2_store_test.go
  3. 6
      weed/s3api/filer_multipart.go
  4. 2
      weed/s3api/filer_util.go
  5. 3
      weed/shell/command_fs_mv.go
  6. 1
      weed/topology/topology.go

6
weed/filer2/leveldb2/leveldb2_store.go

@ -21,7 +21,7 @@ func init() {
} }
type LevelDB2Store struct { type LevelDB2Store struct {
dbs []*leveldb.DB
dbs []*leveldb.DB
dbCount int dbCount int
} }
@ -46,7 +46,7 @@ func (store *LevelDB2Store) initialize(dir string, dbCount int) (err error) {
CompactionTableSizeMultiplier: 4, CompactionTableSizeMultiplier: 4,
} }
for d := 0 ; d < dbCount; d++ {
for d := 0; d < dbCount; d++ {
dbFolder := fmt.Sprintf("%s/%02d", dir, d) dbFolder := fmt.Sprintf("%s/%02d", dir, d)
os.MkdirAll(dbFolder, 0755) os.MkdirAll(dbFolder, 0755)
db, dbErr := leveldb.OpenFile(dbFolder, opts) db, dbErr := leveldb.OpenFile(dbFolder, opts)
@ -204,5 +204,5 @@ func hashToBytes(dir string, dbCount int) ([]byte, int) {
x := b[len(b)-1] x := b[len(b)-1]
return b, int(x)%dbCount
return b, int(x) % dbCount
} }

4
weed/filer2/leveldb2/leveldb2_store_test.go

@ -13,7 +13,7 @@ func TestCreateAndFind(t *testing.T) {
dir, _ := ioutil.TempDir("", "seaweedfs_filer_test") dir, _ := ioutil.TempDir("", "seaweedfs_filer_test")
defer os.RemoveAll(dir) defer os.RemoveAll(dir)
store := &LevelDB2Store{} store := &LevelDB2Store{}
store.initialize(dir,2)
store.initialize(dir, 2)
filer.SetStore(store) filer.SetStore(store)
filer.DisableDirectoryCache() filer.DisableDirectoryCache()
@ -68,7 +68,7 @@ func TestEmptyRoot(t *testing.T) {
dir, _ := ioutil.TempDir("", "seaweedfs_filer_test2") dir, _ := ioutil.TempDir("", "seaweedfs_filer_test2")
defer os.RemoveAll(dir) defer os.RemoveAll(dir)
store := &LevelDB2Store{} store := &LevelDB2Store{}
store.initialize(dir,2)
store.initialize(dir, 2)
filer.SetStore(store) filer.SetStore(store)
filer.DisableDirectoryCache() filer.DisableDirectoryCache()

6
weed/s3api/filer_multipart.go

@ -101,9 +101,9 @@ func (s3a *S3ApiServer) completeMultipartUpload(ctx context.Context, input *s3.C
output = &CompleteMultipartUploadResult{ output = &CompleteMultipartUploadResult{
CompleteMultipartUploadOutput: s3.CompleteMultipartUploadOutput{ CompleteMultipartUploadOutput: s3.CompleteMultipartUploadOutput{
Location: aws.String(fmt.Sprintf("http://%s%s/%s", s3a.option.Filer, dirName, entryName)), Location: aws.String(fmt.Sprintf("http://%s%s/%s", s3a.option.Filer, dirName, entryName)),
Bucket: input.Bucket,
ETag: aws.String("\"" + filer2.ETag(finalParts) + "\""),
Key: objectKey(input.Key),
Bucket: input.Bucket,
ETag: aws.String("\"" + filer2.ETag(finalParts) + "\""),
Key: objectKey(input.Key),
}, },
} }

2
weed/s3api/filer_util.go

@ -151,4 +151,4 @@ func objectKey(key *string) *string {
return &t return &t
} }
return key return key
}
}

3
weed/shell/command_fs_mv.go

@ -49,12 +49,10 @@ func (c *commandFsMv) Do(args []string, commandEnv *CommandEnv, writer io.Writer
ctx := context.Background() ctx := context.Background()
sourceDir, sourceName := filer2.FullPath(sourcePath).DirAndName() sourceDir, sourceName := filer2.FullPath(sourcePath).DirAndName()
destinationDir, destinationName := filer2.FullPath(destinationPath).DirAndName() destinationDir, destinationName := filer2.FullPath(destinationPath).DirAndName()
return commandEnv.withFilerClient(ctx, filerServer, filerPort, func(client filer_pb.SeaweedFilerClient) error { return commandEnv.withFilerClient(ctx, filerServer, filerPort, func(client filer_pb.SeaweedFilerClient) error {
// collect destination entry info // collect destination entry info
@ -77,7 +75,6 @@ func (c *commandFsMv) Do(args []string, commandEnv *CommandEnv, writer io.Writer
targetName = destinationName targetName = destinationName
} }
request := &filer_pb.AtomicRenameEntryRequest{ request := &filer_pb.AtomicRenameEntryRequest{
OldDirectory: sourceDir, OldDirectory: sourceDir,
OldName: sourceName, OldName: sourceName,

1
weed/topology/topology.go

@ -34,7 +34,6 @@ type Topology struct {
Configuration *Configuration Configuration *Configuration
RaftServer raft.Server RaftServer raft.Server
} }
func NewTopology(id string, seq sequence.Sequencer, volumeSizeLimit uint64, pulse int) *Topology { func NewTopology(id string, seq sequence.Sequencer, volumeSizeLimit uint64, pulse int) *Topology {

Loading…
Cancel
Save