mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
go fmt
This commit is contained in:
parent
b09e8dbb37
commit
b142f9f1d5
|
@ -88,7 +88,7 @@ func (fs *FilerServer) moveFolderSubEntries(ctx context.Context, oldParent filer
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fs *FilerServer) moveSelfEntry(ctx context.Context, oldParent filer2.FullPath, entry *filer2.Entry, newParent filer2.FullPath, newName string, events *MoveEvents) (error) {
|
func (fs *FilerServer) moveSelfEntry(ctx context.Context, oldParent filer2.FullPath, entry *filer2.Entry, newParent filer2.FullPath, newName string, events *MoveEvents) error {
|
||||||
|
|
||||||
oldPath, newPath := oldParent.Child(entry.Name()), newParent.Child(newName)
|
oldPath, newPath := oldParent.Child(entry.Name()), newParent.Child(newName)
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ func (vs *VolumeServer) VolumeCopy(ctx context.Context, req *volume_server_pb.Vo
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = checkCopyFiles(volFileInfoResp, idxFileName, datFileName); err != nil { // added by panyc16
|
if err = checkCopyFiles(volFileInfoResp, idxFileName, datFileName); err != nil { // added by panyc16
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,9 +97,9 @@ func (vs *VolumeServer) VolumeCopy(ctx context.Context, req *volume_server_pb.Vo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
only check the the differ of the file size
|
only check the the differ of the file size
|
||||||
todo: maybe should check the received count and deleted count of the volume
|
todo: maybe should check the received count and deleted count of the volume
|
||||||
*/
|
*/
|
||||||
func checkCopyFiles(originFileInf *volume_server_pb.ReadVolumeFileStatusResponse, idxFileName, datFileName string) error {
|
func checkCopyFiles(originFileInf *volume_server_pb.ReadVolumeFileStatusResponse, idxFileName, datFileName string) error {
|
||||||
stat, err := os.Stat(idxFileName)
|
stat, err := os.Stat(idxFileName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -56,7 +56,7 @@ func (c *commandFsMetaLoad) Do(args []string, commandEnv *commandEnv, writer io.
|
||||||
|
|
||||||
for {
|
for {
|
||||||
if n, err := dst.Read(sizeBuf); n != 4 {
|
if n, err := dst.Read(sizeBuf); n != 4 {
|
||||||
if err == io.EOF{
|
if err == io.EOF {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -51,7 +51,7 @@ func (ce *commandEnv) parseUrl(input string) (filerServer string, filerPort int6
|
||||||
|
|
||||||
func (ce *commandEnv) isDirectory(ctx context.Context, filerServer string, filerPort int64, path string) bool {
|
func (ce *commandEnv) isDirectory(ctx context.Context, filerServer string, filerPort int64, path string) bool {
|
||||||
|
|
||||||
return ce.checkDirectory(ctx,filerServer,filerPort,path) == nil
|
return ce.checkDirectory(ctx, filerServer, filerPort, path) == nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -279,10 +279,10 @@ func toNeedleValue(snve SectionalNeedleValueExtra, snv SectionalNeedleValue, cs
|
||||||
|
|
||||||
func (nv NeedleValue) toSectionalNeedleValue(cs *CompactSection) (SectionalNeedleValue, SectionalNeedleValueExtra) {
|
func (nv NeedleValue) toSectionalNeedleValue(cs *CompactSection) (SectionalNeedleValue, SectionalNeedleValueExtra) {
|
||||||
return SectionalNeedleValue{
|
return SectionalNeedleValue{
|
||||||
SectionalNeedleId(nv.Key - cs.start),
|
SectionalNeedleId(nv.Key - cs.start),
|
||||||
nv.Offset.OffsetLower,
|
nv.Offset.OffsetLower,
|
||||||
nv.Size,
|
nv.Size,
|
||||||
}, SectionalNeedleValueExtra{
|
}, SectionalNeedleValueExtra{
|
||||||
nv.Offset.OffsetHigher,
|
nv.Offset.OffsetHigher,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,9 @@ type NeedleMapType int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
NeedleMapInMemory NeedleMapType = iota
|
NeedleMapInMemory NeedleMapType = iota
|
||||||
NeedleMapLevelDb // small memory footprint, 4MB total, 1 write buffer, 3 block buffer
|
NeedleMapLevelDb // small memory footprint, 4MB total, 1 write buffer, 3 block buffer
|
||||||
NeedleMapLevelDbMedium // medium memory footprint, 8MB total, 3 write buffer, 5 block buffer
|
NeedleMapLevelDbMedium // medium memory footprint, 8MB total, 3 write buffer, 5 block buffer
|
||||||
NeedleMapLevelDbLarge // large memory footprint, 12MB total, 4write buffer, 8 block buffer
|
NeedleMapLevelDbLarge // large memory footprint, 12MB total, 4write buffer, 8 block buffer
|
||||||
)
|
)
|
||||||
|
|
||||||
type NeedleMapper interface {
|
type NeedleMapper interface {
|
||||||
|
|
|
@ -60,7 +60,6 @@ func (mm mapMetric) MaybeSetMaxFileKey(key NeedleId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func newNeedleMapMetricFromIndexFile(r *os.File) (mm *mapMetric, err error) {
|
func newNeedleMapMetricFromIndexFile(r *os.File) (mm *mapMetric, err error) {
|
||||||
mm = &mapMetric{}
|
mm = &mapMetric{}
|
||||||
var bf *bloom.BloomFilter
|
var bf *bloom.BloomFilter
|
||||||
|
|
|
@ -22,12 +22,12 @@ type OffsetLower struct {
|
||||||
type Cookie uint32
|
type Cookie uint32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SizeSize = 4 // uint32 size
|
SizeSize = 4 // uint32 size
|
||||||
NeedleEntrySize = CookieSize + NeedleIdSize + SizeSize
|
NeedleEntrySize = CookieSize + NeedleIdSize + SizeSize
|
||||||
TimestampSize = 8 // int64 size
|
TimestampSize = 8 // int64 size
|
||||||
NeedlePaddingSize = 8
|
NeedlePaddingSize = 8
|
||||||
TombstoneFileSize = math.MaxUint32
|
TombstoneFileSize = math.MaxUint32
|
||||||
CookieSize = 4
|
CookieSize = 4
|
||||||
)
|
)
|
||||||
|
|
||||||
func CookieToBytes(bytes []byte, cookie Cookie) {
|
func CookieToBytes(bytes []byte, cookie Cookie) {
|
||||||
|
|
|
@ -79,22 +79,22 @@ func (v *Volume) Size() int64 {
|
||||||
return 0 // -1 causes integer overflow and the volume to become unwritable.
|
return 0 // -1 causes integer overflow and the volume to become unwritable.
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Volume)IndexFileSize() uint64 {
|
func (v *Volume) IndexFileSize() uint64 {
|
||||||
return v.nm.IndexFileSize()
|
return v.nm.IndexFileSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Volume)DataFileSize() uint64 {
|
func (v *Volume) DataFileSize() uint64 {
|
||||||
return uint64(v.Size())
|
return uint64(v.Size())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
unix time in seconds
|
unix time in seconds
|
||||||
*/
|
*/
|
||||||
func (v *Volume)LastModifiedTime() uint64 {
|
func (v *Volume) LastModifiedTime() uint64 {
|
||||||
return v.lastModifiedTime
|
return v.lastModifiedTime
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Volume)FileCount() uint64 {
|
func (v *Volume) FileCount() uint64 {
|
||||||
return uint64(v.nm.FileCount())
|
return uint64(v.nm.FileCount())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue