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
03c2f03509
commit
45a9d852d3
|
@ -34,7 +34,7 @@ func runMount(cmd *Command, args []string) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(args)>0 {
|
if len(args) > 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ var (
|
||||||
serverDisableHttp = cmdServer.Flag.Bool("disableHttp", false, "disable http requests, only gRPC operations are allowed.")
|
serverDisableHttp = cmdServer.Flag.Bool("disableHttp", false, "disable http requests, only gRPC operations are allowed.")
|
||||||
volumeDataFolders = cmdServer.Flag.String("dir", os.TempDir(), "directories to store data files. dir[,dir]...")
|
volumeDataFolders = cmdServer.Flag.String("dir", os.TempDir(), "directories to store data files. dir[,dir]...")
|
||||||
volumeMaxDataVolumeCounts = cmdServer.Flag.String("volume.max", "7", "maximum numbers of volumes, count[,count]... If set to zero on non-windows OS, the limit will be auto configured.")
|
volumeMaxDataVolumeCounts = cmdServer.Flag.String("volume.max", "7", "maximum numbers of volumes, count[,count]... If set to zero on non-windows OS, the limit will be auto configured.")
|
||||||
volumeMinFreeSpacePercent = cmdServer.Flag.String("volume.minFreeSpacePercent", "0", "minimum free disk space(in percents). If free disk space lower this value - all volumes marks as ReadOnly")
|
volumeMinFreeSpacePercent = cmdServer.Flag.String("volume.minFreeSpacePercent", "0", "minimum free disk space(in percents). If free disk space lower this value - all volumes marks as ReadOnly")
|
||||||
|
|
||||||
// pulseSeconds = cmdServer.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats")
|
// pulseSeconds = cmdServer.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats")
|
||||||
isStartingFiler = cmdServer.Flag.Bool("filer", false, "whether to start filer")
|
isStartingFiler = cmdServer.Flag.Bool("filer", false, "whether to start filer")
|
||||||
|
@ -208,7 +208,7 @@ func runServer(cmd *Command, args []string) bool {
|
||||||
|
|
||||||
// start volume server
|
// start volume server
|
||||||
{
|
{
|
||||||
go serverOptions.v.startVolumeServer(*volumeDataFolders, *volumeMaxDataVolumeCounts, *serverWhiteListOption, *volumeMinFreeSpacePercent )
|
go serverOptions.v.startVolumeServer(*volumeDataFolders, *volumeMaxDataVolumeCounts, *serverWhiteListOption, *volumeMinFreeSpacePercent)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ type VolumeServerOptions struct {
|
||||||
memProfile *string
|
memProfile *string
|
||||||
compactionMBPerSecond *int
|
compactionMBPerSecond *int
|
||||||
fileSizeLimitMB *int
|
fileSizeLimitMB *int
|
||||||
minFreeSpacePercent []float32
|
minFreeSpacePercent []float32
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -88,7 +88,7 @@ var (
|
||||||
volumeFolders = cmdVolume.Flag.String("dir", os.TempDir(), "directories to store data files. dir[,dir]...")
|
volumeFolders = cmdVolume.Flag.String("dir", os.TempDir(), "directories to store data files. dir[,dir]...")
|
||||||
maxVolumeCounts = cmdVolume.Flag.String("max", "7", "maximum numbers of volumes, count[,count]... If set to zero on non-windows OS, the limit will be auto configured.")
|
maxVolumeCounts = cmdVolume.Flag.String("max", "7", "maximum numbers of volumes, count[,count]... If set to zero on non-windows OS, the limit will be auto configured.")
|
||||||
volumeWhiteListOption = cmdVolume.Flag.String("whiteList", "", "comma separated Ip addresses having write permission. No limit if empty.")
|
volumeWhiteListOption = cmdVolume.Flag.String("whiteList", "", "comma separated Ip addresses having write permission. No limit if empty.")
|
||||||
minFreeSpacePercent = cmdVolume.Flag.String("minFreeSpacePercent ", "0", "minimum free disk space(in percents). If free disk space lower this value - all volumes marks as ReadOnly")
|
minFreeSpacePercent = cmdVolume.Flag.String("minFreeSpacePercent ", "0", "minimum free disk space(in percents). If free disk space lower this value - all volumes marks as ReadOnly")
|
||||||
)
|
)
|
||||||
|
|
||||||
func runVolume(cmd *Command, args []string) bool {
|
func runVolume(cmd *Command, args []string) bool {
|
||||||
|
|
|
@ -26,7 +26,7 @@ func (mc *MessagingClient) NewPublisher(publisherId, namespace, topic string) (*
|
||||||
for i := 0; i < int(topicConfiguration.PartitionCount); i++ {
|
for i := 0; i < int(topicConfiguration.PartitionCount); i++ {
|
||||||
tp := broker.TopicPartition{
|
tp := broker.TopicPartition{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Topic: topic,
|
Topic: topic,
|
||||||
Partition: int32(i),
|
Partition: int32(i),
|
||||||
}
|
}
|
||||||
grpcClientConn, err := mc.findBroker(tp)
|
grpcClientConn, err := mc.findBroker(tp)
|
||||||
|
|
|
@ -3,8 +3,8 @@ package msgclient
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"time"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/messaging/broker"
|
"github.com/chrislusf/seaweedfs/weed/messaging/broker"
|
||||||
"github.com/chrislusf/seaweedfs/weed/pb/messaging_pb"
|
"github.com/chrislusf/seaweedfs/weed/pb/messaging_pb"
|
||||||
|
@ -26,12 +26,12 @@ func (mc *MessagingClient) NewSubscriber(subscriberId, namespace, topic string,
|
||||||
subscriberCancels := make([]context.CancelFunc, topicConfiguration.PartitionCount)
|
subscriberCancels := make([]context.CancelFunc, topicConfiguration.PartitionCount)
|
||||||
|
|
||||||
for i := 0; i < int(topicConfiguration.PartitionCount); i++ {
|
for i := 0; i < int(topicConfiguration.PartitionCount); i++ {
|
||||||
if partitionId>=0 && i != partitionId {
|
if partitionId >= 0 && i != partitionId {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
tp := broker.TopicPartition{
|
tp := broker.TopicPartition{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Topic: topic,
|
Topic: topic,
|
||||||
Partition: int32(i),
|
Partition: int32(i),
|
||||||
}
|
}
|
||||||
grpcClientConn, err := mc.findBroker(tp)
|
grpcClientConn, err := mc.findBroker(tp)
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
kernel32 = windows.NewLazySystemDLL("Kernel32.dll")
|
kernel32 = windows.NewLazySystemDLL("Kernel32.dll")
|
||||||
getDiskFreeSpaceEx = kernel32.NewProc("GetDiskFreeSpaceExW")
|
getDiskFreeSpaceEx = kernel32.NewProc("GetDiskFreeSpaceExW")
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package storage
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/chrislusf/seaweedfs/weed/stats"
|
"github.com/chrislusf/seaweedfs/weed/stats"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||||
|
@ -16,11 +16,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type DiskLocation struct {
|
type DiskLocation struct {
|
||||||
Directory string
|
Directory string
|
||||||
MaxVolumeCount int
|
MaxVolumeCount int
|
||||||
MinFreeSpacePercent float32
|
MinFreeSpacePercent float32
|
||||||
volumes map[needle.VolumeId]*Volume
|
volumes map[needle.VolumeId]*Volume
|
||||||
volumesLock sync.RWMutex
|
volumesLock sync.RWMutex
|
||||||
|
|
||||||
// erasure coding
|
// erasure coding
|
||||||
ecVolumes map[needle.VolumeId]*erasure_coding.EcVolume
|
ecVolumes map[needle.VolumeId]*erasure_coding.EcVolume
|
||||||
|
|
|
@ -11,7 +11,7 @@ type OffsetHigher struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
OffsetSize = 4
|
OffsetSize = 4
|
||||||
MaxPossibleVolumeSize uint64 = 4 * 1024 * 1024 * 1024 * 8 // 32GB
|
MaxPossibleVolumeSize uint64 = 4 * 1024 * 1024 * 1024 * 8 // 32GB
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ type OffsetHigher struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
OffsetSize = 4 + 1
|
OffsetSize = 4 + 1
|
||||||
MaxPossibleVolumeSize uint64 = 4 * 1024 * 1024 * 1024 * 8 * 256 /* 256 is from the extra byte */ // 8TB
|
MaxPossibleVolumeSize uint64 = 4 * 1024 * 1024 * 1024 * 8 * 256 /* 256 is from the extra byte */ // 8TB
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
VERSION = fmt.Sprintf("%s %d.%d", sizeLimit, 1, 79)
|
VERSION = fmt.Sprintf("%s %d.%d", sizeLimit, 1, 79)
|
||||||
COMMIT = ""
|
COMMIT = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
func Version() string {
|
func Version() string {
|
||||||
|
|
|
@ -42,7 +42,7 @@ func (l *ExclusiveLocker) GetToken() (token int64, lockTsNs int64) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *ExclusiveLocker) RequestLock() {
|
func (l *ExclusiveLocker) RequestLock() {
|
||||||
if l.isLocking {
|
if l.isLocking {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue