From cb3985be70c2b6eb9a0e00a04a6a02f8ebd650d5 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 20 Apr 2020 17:48:06 -0700 Subject: [PATCH] go fmt --- weed/filer2/leveldb/leveldb_store_test.go | 2 +- weed/filer2/leveldb2/leveldb2_store_test.go | 4 ++-- weed/filer2/mongodb/mongodb_store.go | 8 ++++---- weed/messaging/broker/topic_lock.go | 2 +- weed/messaging/client/publisher.go | 4 ++-- weed/server/filer_server.go | 2 +- weed/util/chunk_cache/on_disk_cache_layer.go | 6 +++--- weed/util/log_buffer/log_read.go | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/weed/filer2/leveldb/leveldb_store_test.go b/weed/filer2/leveldb/leveldb_store_test.go index fff6da357..1daa47c97 100644 --- a/weed/filer2/leveldb/leveldb_store_test.go +++ b/weed/filer2/leveldb/leveldb_store_test.go @@ -11,7 +11,7 @@ import ( ) func TestCreateAndFind(t *testing.T) { - filer := filer2.NewFiler(nil, nil, "",0, "", "", nil) + filer := filer2.NewFiler(nil, nil, "", 0, "", "", nil) dir, _ := ioutil.TempDir("", "seaweedfs_filer_test") defer os.RemoveAll(dir) store := &LevelDBStore{} diff --git a/weed/filer2/leveldb2/leveldb2_store_test.go b/weed/filer2/leveldb2/leveldb2_store_test.go index a409a27f4..9ad168233 100644 --- a/weed/filer2/leveldb2/leveldb2_store_test.go +++ b/weed/filer2/leveldb2/leveldb2_store_test.go @@ -11,7 +11,7 @@ import ( ) func TestCreateAndFind(t *testing.T) { - filer := filer2.NewFiler(nil, nil, "",0, "", "", nil) + filer := filer2.NewFiler(nil, nil, "", 0, "", "", nil) dir, _ := ioutil.TempDir("", "seaweedfs_filer_test") defer os.RemoveAll(dir) store := &LevelDB2Store{} @@ -66,7 +66,7 @@ func TestCreateAndFind(t *testing.T) { } func TestEmptyRoot(t *testing.T) { - filer := filer2.NewFiler(nil, nil, "",0, "", "", nil) + filer := filer2.NewFiler(nil, nil, "", 0, "", "", nil) dir, _ := ioutil.TempDir("", "seaweedfs_filer_test2") defer os.RemoveAll(dir) store := &LevelDB2Store{} diff --git a/weed/filer2/mongodb/mongodb_store.go b/weed/filer2/mongodb/mongodb_store.go index aa55145d7..63a7a43e4 100644 --- a/weed/filer2/mongodb/mongodb_store.go +++ b/weed/filer2/mongodb/mongodb_store.go @@ -38,7 +38,7 @@ func (store *MongodbStore) Initialize(configuration util.Configuration, prefix s store.database = configuration.GetString(prefix + "database") store.collectionName = "filemeta" poolSize := configuration.GetInt(prefix + "option_pool_size") - return store.connection(configuration.GetString(prefix + "uri"), uint64(poolSize)) + return store.connection(configuration.GetString(prefix+"uri"), uint64(poolSize)) } func (store *MongodbStore) connection(uri string, poolSize uint64) (err error) { @@ -60,7 +60,7 @@ func (store *MongodbStore) connection(uri string, poolSize uint64) (err error) { return err } -func (store *MongodbStore) createIndex (c *mongo.Collection, index mongo.IndexModel, opts *options.CreateIndexesOptions) error { +func (store *MongodbStore) createIndex(c *mongo.Collection, index mongo.IndexModel, opts *options.CreateIndexesOptions) error { _, err := c.Indexes().CreateOne(context.Background(), index, opts) return err } @@ -169,14 +169,14 @@ func (store *MongodbStore) DeleteFolderChildren(ctx context.Context, fullpath ut func (store *MongodbStore) ListDirectoryEntries(ctx context.Context, fullpath util.FullPath, startFileName string, inclusive bool, limit int) (entries []*filer2.Entry, err error) { - var where = bson.M{"directory": string(fullpath), "name": bson.M{"$gt": startFileName,}} + var where = bson.M{"directory": string(fullpath), "name": bson.M{"$gt": startFileName}} if inclusive { where["name"] = bson.M{ "$gte": startFileName, } } optLimit := int64(limit) - opts := &options.FindOptions{Limit: &optLimit, Sort: bson.M{ "name": 1 }} + opts := &options.FindOptions{Limit: &optLimit, Sort: bson.M{"name": 1}} cur, err := store.connect.Database(store.database).Collection(store.collectionName).Find(ctx, where, opts) for cur.Next(ctx) { var data Model diff --git a/weed/messaging/broker/topic_lock.go b/weed/messaging/broker/topic_lock.go index c98bb3159..d179537c9 100644 --- a/weed/messaging/broker/topic_lock.go +++ b/weed/messaging/broker/topic_lock.go @@ -18,7 +18,7 @@ type TopicPartition struct { } type TopicLock struct { sync.Mutex - cond *sync.Cond + cond *sync.Cond subscriberCount int publisherCount int logBuffer *log_buffer.LogBuffer diff --git a/weed/messaging/client/publisher.go b/weed/messaging/client/publisher.go index 3480ff55d..4854ab92e 100644 --- a/weed/messaging/client/publisher.go +++ b/weed/messaging/client/publisher.go @@ -49,9 +49,9 @@ func (mc *MessagingClient) NewPublisher(namespace, topic string) (*Publisher, er doneChan <- err return } - if in.Redirect != nil{ + if in.Redirect != nil { } - if in.Config != nil{ + if in.Config != nil { } } }() diff --git a/weed/server/filer_server.go b/weed/server/filer_server.go index aa8b42a84..596c91a58 100644 --- a/weed/server/filer_server.go +++ b/weed/server/filer_server.go @@ -21,11 +21,11 @@ import ( _ "github.com/chrislusf/seaweedfs/weed/filer2/etcd" _ "github.com/chrislusf/seaweedfs/weed/filer2/leveldb" _ "github.com/chrislusf/seaweedfs/weed/filer2/leveldb2" + _ "github.com/chrislusf/seaweedfs/weed/filer2/mongodb" _ "github.com/chrislusf/seaweedfs/weed/filer2/mysql" _ "github.com/chrislusf/seaweedfs/weed/filer2/postgres" _ "github.com/chrislusf/seaweedfs/weed/filer2/redis" _ "github.com/chrislusf/seaweedfs/weed/filer2/redis2" - _ "github.com/chrislusf/seaweedfs/weed/filer2/mongodb" "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/notification" _ "github.com/chrislusf/seaweedfs/weed/notification/aws_sqs" diff --git a/weed/util/chunk_cache/on_disk_cache_layer.go b/weed/util/chunk_cache/on_disk_cache_layer.go index 9bd9c2b44..9cf8e3ab2 100644 --- a/weed/util/chunk_cache/on_disk_cache_layer.go +++ b/weed/util/chunk_cache/on_disk_cache_layer.go @@ -14,7 +14,7 @@ type OnDiskCacheLayer struct { diskCaches []*ChunkCacheVolume } -func NewOnDiskCacheLayer(dir, namePrefix string, diskSizeMB int64, segmentCount int) *OnDiskCacheLayer{ +func NewOnDiskCacheLayer(dir, namePrefix string, diskSizeMB int64, segmentCount int) *OnDiskCacheLayer { volumeCount, volumeSize := int(diskSizeMB/30000), int64(30000) if volumeCount < segmentCount { @@ -58,7 +58,7 @@ func (c *OnDiskCacheLayer) setChunk(needleId types.NeedleId, data []byte) { } -func (c *OnDiskCacheLayer) getChunk(needleId types.NeedleId) (data []byte){ +func (c *OnDiskCacheLayer) getChunk(needleId types.NeedleId) (data []byte) { var err error @@ -80,7 +80,7 @@ func (c *OnDiskCacheLayer) getChunk(needleId types.NeedleId) (data []byte){ } -func (c *OnDiskCacheLayer) shutdown(){ +func (c *OnDiskCacheLayer) shutdown() { for _, diskCache := range c.diskCaches { diskCache.Shutdown() diff --git a/weed/util/log_buffer/log_read.go b/weed/util/log_buffer/log_read.go index 06bec2e88..6339d9d77 100644 --- a/weed/util/log_buffer/log_read.go +++ b/weed/util/log_buffer/log_read.go @@ -72,4 +72,4 @@ func (logBuffer *LogBuffer) LoopProcessLogData( // fmt.Printf("sent message ts[%d,%d] size %d\n", startReadTime.UnixNano(), lastReadTime.UnixNano(), batchSize) } -} \ No newline at end of file +}