Browse Source

go fmt

pull/664/head
Chris Lu 7 years ago
parent
commit
458ada173e
  1. 6
      weed/command/filer.go
  2. 2
      weed/command/mount_std.go
  3. 2
      weed/filer2/abstract_sql/abstract_sql_store.go
  4. 2
      weed/filer2/cassandra/cassandra_store.go
  5. 12
      weed/filer2/configuration.go
  6. 2
      weed/filer2/entry.go
  7. 4
      weed/filer2/entry_codec.go
  8. 2
      weed/filer2/filechunks.go
  9. 2
      weed/filer2/filechunks_test.go
  10. 14
      weed/filer2/filer.go
  11. 4
      weed/filer2/filerstore.go
  12. 2
      weed/filer2/fullpath.go
  13. 10
      weed/filer2/leveldb/leveldb_store.go
  14. 2
      weed/filer2/leveldb/leveldb_store_test.go
  15. 4
      weed/filer2/memdb/memdb_store.go
  16. 2
      weed/filer2/memdb/memdb_store_test.go
  17. 6
      weed/filer2/mysql/mysql_store.go
  18. 6
      weed/filer2/postgres/postgres_store.go
  19. 2
      weed/filer2/redis/redis_store.go
  20. 4
      weed/filesys/dir.go
  21. 6
      weed/filesys/file.go
  22. 13
      weed/filesys/filehandle.go
  23. 2
      weed/filesys/wfs.go
  24. 2
      weed/images/favicon.go
  25. 8
      weed/server/filer_grpc_server.go
  26. 8
      weed/server/filer_server.go
  27. 4
      weed/server/filer_server_handlers_admin.go
  28. 2
      weed/server/filer_server_handlers_read.go
  29. 5
      weed/server/filer_server_handlers_write.go
  30. 2
      weed/server/filer_ui/breadcrumb.go
  31. 2
      weed/server/volume_server_handlers_admin.go
  32. 2
      weed/server/volume_server_handlers_ui.go
  33. 2
      weed/storage/volume_checking.go

6
weed/command/filer.go

@ -5,14 +5,14 @@ import (
"strconv"
"time"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/server"
"github.com/chrislusf/seaweedfs/weed/util"
"github.com/soheilhy/cmux"
"google.golang.org/grpc/reflection"
"google.golang.org/grpc"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/filer2"
"google.golang.org/grpc/reflection"
)
var (

2
weed/command/mount_std.go

@ -8,9 +8,9 @@ import (
"bazil.org/fuse"
"bazil.org/fuse/fs"
"github.com/chrislusf/seaweedfs/weed/filesys"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/filesys"
)
func runMount(cmd *Command, args []string) bool {

2
weed/filer2/abstract_sql/abstract_sql_store.go

@ -1,8 +1,8 @@
package abstract_sql
import (
"fmt"
"database/sql"
"fmt"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"

2
weed/filer2/cassandra/cassandra_store.go

@ -2,9 +2,9 @@ package cassandra
import (
"fmt"
"github.com/gocql/gocql"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/gocql/gocql"
"github.com/spf13/viper"
)

12
weed/filer2/configuration.go

@ -3,8 +3,8 @@ package filer2
import (
"os"
"github.com/spf13/viper"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/spf13/viper"
)
const (
@ -20,12 +20,11 @@ enabled = false
enabled = false
dir = "." # directory to store level db files
[mysql]
####################################################
# multiple filers on shared storage, fairly scalable
#
# need to choose or create a database.
# need to manually create a table "filemeta".
#
####################################################
[mysql]
# CREATE TABLE IF NOT EXISTS filemeta (
# dirhash BIGINT COMMENT 'first 64 bits of MD5 hash value of directory field',
# name VARCHAR(1000) COMMENT 'directory or file name',
@ -33,7 +32,6 @@ dir = "." # directory to store level db files
# meta BLOB,
# PRIMARY KEY (dirhash, name)
# ) DEFAULT CHARSET=utf8;
#
enabled = true
hostname = "localhost"
port = 3306

2
weed/filer2/entry.go

@ -15,7 +15,7 @@ type Attr struct {
Gid uint32 // group gid
}
func (attr Attr) IsDirectory() (bool) {
func (attr Attr) IsDirectory() bool {
return attr.Mode&os.ModeDir > 0
}

4
weed/filer2/entry_codec.go

@ -4,9 +4,9 @@ import (
"os"
"time"
"fmt"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/gogo/protobuf/proto"
"fmt"
)
func (entry *Entry) EncodeAttributesAndChunks() ([]byte, error) {
@ -23,7 +23,7 @@ func (entry *Entry) EncodeAttributesAndChunks() ([]byte, error) {
return proto.Marshal(message)
}
func (entry *Entry) DecodeAttributesAndChunks(blob []byte) (error) {
func (entry *Entry) DecodeAttributesAndChunks(blob []byte) error {
message := &filer_pb.Entry{}

2
weed/filer2/filechunks.go

@ -1,9 +1,9 @@
package filer2
import (
"sort"
"log"
"math"
"sort"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
)

2
weed/filer2/filechunks_test.go

@ -1,8 +1,8 @@
package filer2
import (
"testing"
"log"
"testing"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
)

14
weed/filer2/filer.go

@ -3,12 +3,12 @@ package filer2
import (
"fmt"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/karlseguin/ccache"
"strings"
"os"
"path/filepath"
"strings"
"time"
"os"
"github.com/chrislusf/seaweedfs/weed/glog"
)
type Filer struct {
@ -24,15 +24,15 @@ func NewFiler(master string) *Filer {
}
}
func (f *Filer) SetStore(store FilerStore) () {
func (f *Filer) SetStore(store FilerStore) {
f.store = store
}
func (f *Filer) DisableDirectoryCache() () {
func (f *Filer) DisableDirectoryCache() {
f.directoryCache = nil
}
func (f *Filer) CreateEntry(entry *Entry) (error) {
func (f *Filer) CreateEntry(entry *Entry) error {
dirParts := strings.Split(string(entry.FullPath), "/")
@ -140,7 +140,7 @@ func (f *Filer) ListDirectoryEntries(p FullPath, startFileName string, inclusive
return f.store.ListDirectoryEntries(p, startFileName, inclusive, limit)
}
func (f *Filer) cacheGetDirectory(dirpath string) (*Entry) {
func (f *Filer) cacheGetDirectory(dirpath string) *Entry {
if f.directoryCache == nil {
return nil
}

4
weed/filer2/filerstore.go

@ -7,8 +7,8 @@ import (
type FilerStore interface {
GetName() string
Initialize(viper *viper.Viper) (error)
InsertEntry(*Entry) (error)
Initialize(viper *viper.Viper) error
InsertEntry(*Entry) error
UpdateEntry(*Entry) (err error)
FindEntry(FullPath) (entry *Entry, err error)
DeleteEntry(FullPath) (fileEntry *Entry, err error)

2
weed/filer2/fullpath.go

@ -25,7 +25,7 @@ func (fp FullPath) DirAndName() (string, string) {
return dir[:len(dir)-1], name
}
func (fp FullPath) Name() (string) {
func (fp FullPath) Name() string {
_, name := filepath.Split(string(fp))
return name
}

10
weed/filer2/leveldb/leveldb_store.go

@ -1,15 +1,15 @@
package leveldb
import (
"fmt"
"bytes"
"fmt"
"github.com/syndtr/goleveldb/leveldb"
"github.com/chrislusf/seaweedfs/weed/filer2"
leveldb_util "github.com/syndtr/goleveldb/leveldb/util"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/spf13/viper"
weed_util "github.com/chrislusf/seaweedfs/weed/util"
"github.com/spf13/viper"
"github.com/syndtr/goleveldb/leveldb"
leveldb_util "github.com/syndtr/goleveldb/leveldb/util"
)
const (
@ -162,7 +162,7 @@ func genDirectoryKeyPrefix(fullpath filer2.FullPath, startFileName string) (keyP
return keyPrefix
}
func getNameFromKey(key []byte) (string) {
func getNameFromKey(key []byte) string {
sepIndex := len(key) - 1
for sepIndex >= 0 && key[sepIndex] != DIR_FILE_SEPARATOR {

2
weed/filer2/leveldb/leveldb_store_test.go

@ -1,10 +1,10 @@
package leveldb
import (
"testing"
"github.com/chrislusf/seaweedfs/weed/filer2"
"io/ioutil"
"os"
"testing"
)
func TestCreateAndFind(t *testing.T) {

4
weed/filer2/memdb/memdb_store.go

@ -1,11 +1,11 @@
package memdb
import (
"fmt"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/google/btree"
"strings"
"fmt"
"github.com/spf13/viper"
"strings"
)
func init() {

2
weed/filer2/memdb/memdb_store_test.go

@ -1,8 +1,8 @@
package memdb
import (
"testing"
"github.com/chrislusf/seaweedfs/weed/filer2"
"testing"
)
func TestCreateAndFind(t *testing.T) {

6
weed/filer2/mysql/mysql_store.go

@ -1,13 +1,13 @@
package mysql
import (
"fmt"
"database/sql"
"fmt"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/spf13/viper"
_ "github.com/go-sql-driver/mysql"
"github.com/chrislusf/seaweedfs/weed/filer2/abstract_sql"
_ "github.com/go-sql-driver/mysql"
"github.com/spf13/viper"
)
const (

6
weed/filer2/postgres/postgres_store.go

@ -1,13 +1,13 @@
package postgres
import (
"fmt"
"database/sql"
"fmt"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/spf13/viper"
_ "github.com/lib/pq"
"github.com/chrislusf/seaweedfs/weed/filer2/abstract_sql"
_ "github.com/lib/pq"
"github.com/spf13/viper"
)
const (

2
weed/filer2/redis/redis_store.go

@ -4,8 +4,8 @@ import (
"fmt"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/spf13/viper"
"github.com/go-redis/redis"
"github.com/spf13/viper"
"sort"
"strings"
)

4
weed/filesys/dir.go

@ -7,12 +7,12 @@ import (
"path"
"sync"
"bazil.org/fuse/fs"
"bazil.org/fuse"
"bazil.org/fuse/fs"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"time"
"path/filepath"
"time"
)
type Dir struct {

6
weed/filesys/file.go

@ -1,15 +1,15 @@
package filesys
import (
"context"
"bazil.org/fuse"
"bazil.org/fuse/fs"
"context"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"path/filepath"
"os"
"path/filepath"
"time"
"github.com/chrislusf/seaweedfs/weed/filer2"
)
var _ = fs.Node(&File{})

13
weed/filesys/filehandle.go

@ -1,19 +1,19 @@
package filesys
import (
"bazil.org/fuse"
"bazil.org/fuse/fs"
"bytes"
"context"
"fmt"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/filer2"
"context"
"github.com/chrislusf/seaweedfs/weed/glog"
"bazil.org/fuse"
"bytes"
"github.com/chrislusf/seaweedfs/weed/operation"
"time"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/util"
"strings"
"sync"
"github.com/chrislusf/seaweedfs/weed/util"
"time"
)
type FileHandle struct {
@ -32,6 +32,7 @@ type FileHandle struct {
}
var _ = fs.Handle(&FileHandle{})
// var _ = fs.HandleReadAller(&FileHandle{})
var _ = fs.HandleReader(&FileHandle{})
var _ = fs.HandleFlusher(&FileHandle{})

2
weed/filesys/wfs.go

@ -3,9 +3,9 @@ package filesys
import (
"bazil.org/fuse/fs"
"fmt"
"google.golang.org/grpc"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/karlseguin/ccache"
"google.golang.org/grpc"
)
type WFS struct {

2
weed/images/favicon.go

@ -181,6 +181,7 @@ type bintree struct {
Func func() (*asset, error)
Children map[string]*bintree
}
var _bintree = &bintree{nil, map[string]*bintree{
"favicon": &bintree{nil, map[string]*bintree{
"favicon.ico": &bintree{favicon, map[string]*bintree{}},
@ -233,4 +234,3 @@ func _filePath(dir, name string) string {
cannonicalName := strings.Replace(name, "\\", "/", -1)
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
}

8
weed/server/filer_grpc_server.go

@ -1,16 +1,16 @@
package weed_server
import (
"fmt"
"context"
"time"
"fmt"
"os"
"path/filepath"
"time"
"github.com/chrislusf/seaweedfs/weed/operation"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/operation"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
)
func (fs *FilerServer) LookupDirectoryEntry(ctx context.Context, req *filer_pb.LookupDirectoryEntryRequest) (*filer_pb.LookupDirectoryEntryResponse, error) {

8
weed/server/filer_server.go

@ -7,10 +7,6 @@ import (
"sync"
"time"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/security"
"github.com/chrislusf/seaweedfs/weed/storage"
"github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/filer2"
_ "github.com/chrislusf/seaweedfs/weed/filer2/cassandra"
_ "github.com/chrislusf/seaweedfs/weed/filer2/leveldb"
@ -18,6 +14,10 @@ import (
_ "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/glog"
"github.com/chrislusf/seaweedfs/weed/security"
"github.com/chrislusf/seaweedfs/weed/storage"
"github.com/chrislusf/seaweedfs/weed/util"
)
type FilerServer struct {

4
weed/server/filer_server_handlers_admin.go

@ -3,10 +3,10 @@ package weed_server
import (
"net/http"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/filer2"
"strconv"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"strconv"
"time"
)

2
weed/server/filer_server_handlers_read.go

@ -7,11 +7,11 @@ import (
"strconv"
"strings"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/operation"
ui "github.com/chrislusf/seaweedfs/weed/server/filer_ui"
"github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/filer2"
)
// listDirectoryHandler lists directories and folers under a directory

5
weed/server/filer_server_handlers_write.go

@ -17,13 +17,12 @@ import (
"strconv"
"strings"
"github.com/chrislusf/seaweedfs/weed/filer"
"github.com/chrislusf/seaweedfs/weed/filer2"
"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/storage"
"github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"time"
)

2
weed/server/filer_ui/breadcrumb.go

@ -1,8 +1,8 @@
package master_ui
import (
"strings"
"path/filepath"
"strings"
)
type Breadcrumb struct {

2
weed/server/volume_server_handlers_admin.go

@ -8,8 +8,8 @@ import (
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/stats"
"github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/storage"
"github.com/chrislusf/seaweedfs/weed/util"
)
func (vs *VolumeServer) statusHandler(w http.ResponseWriter, r *http.Request) {

2
weed/server/volume_server_handlers_ui.go

@ -5,9 +5,9 @@ import (
"path/filepath"
"time"
ui "github.com/chrislusf/seaweedfs/weed/server/volume_server_ui"
"github.com/chrislusf/seaweedfs/weed/stats"
"github.com/chrislusf/seaweedfs/weed/util"
ui "github.com/chrislusf/seaweedfs/weed/server/volume_server_ui"
)
func (vs *VolumeServer) uiStatusHandler(w http.ResponseWriter, r *http.Request) {

2
weed/storage/volume_checking.go

@ -12,7 +12,7 @@ func getActualSize(size uint32) int64 {
return NeedleHeaderSize + int64(size) + NeedleChecksumSize + int64(padding)
}
func CheckVolumeDataIntegrity(v *Volume, indexFile *os.File) (error) {
func CheckVolumeDataIntegrity(v *Volume, indexFile *os.File) error {
var indexSize int64
var e error
if indexSize, e = verifyIndexFileIntegrity(indexFile); e != nil {

Loading…
Cancel
Save