go fmt
This commit is contained in:
@@ -35,7 +35,7 @@ type BenchmarkOptions struct {
|
|||||||
sequentialRead *bool
|
sequentialRead *bool
|
||||||
collection *string
|
collection *string
|
||||||
replication *string
|
replication *string
|
||||||
diskType *string
|
diskType *string
|
||||||
cpuprofile *string
|
cpuprofile *string
|
||||||
maxCpu *int
|
maxCpu *int
|
||||||
grpcDialOption grpc.DialOption
|
grpcDialOption grpc.DialOption
|
||||||
@@ -236,7 +236,7 @@ func writeFiles(idChan chan int, fileIdLineChan chan string, s *stat) {
|
|||||||
Count: 1,
|
Count: 1,
|
||||||
Collection: *b.collection,
|
Collection: *b.collection,
|
||||||
Replication: *b.replication,
|
Replication: *b.replication,
|
||||||
DiskType: *b.diskType,
|
DiskType: *b.diskType,
|
||||||
}
|
}
|
||||||
if assignResult, err := operation.Assign(b.masterClient.GetMaster(), b.grpcDialOption, ar); err == nil {
|
if assignResult, err := operation.Assign(b.masterClient.GetMaster(), b.grpcDialOption, ar); err == nil {
|
||||||
fp.Server, fp.Fid, fp.Collection = assignResult.Url, assignResult.Fid, *b.collection
|
fp.Server, fp.Fid, fp.Collection = assignResult.Url, assignResult.Fid, *b.collection
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ type CopyOptions struct {
|
|||||||
replication *string
|
replication *string
|
||||||
collection *string
|
collection *string
|
||||||
ttl *string
|
ttl *string
|
||||||
diskType *string
|
diskType *string
|
||||||
maxMB *int
|
maxMB *int
|
||||||
masterClient *wdclient.MasterClient
|
masterClient *wdclient.MasterClient
|
||||||
concurrenctFiles *int
|
concurrenctFiles *int
|
||||||
@@ -313,7 +313,7 @@ func (worker *FileCopyWorker) uploadFileAsOne(task FileCopyTask, f *os.File) err
|
|||||||
Replication: *worker.options.replication,
|
Replication: *worker.options.replication,
|
||||||
Collection: *worker.options.collection,
|
Collection: *worker.options.collection,
|
||||||
TtlSec: worker.options.ttlSec,
|
TtlSec: worker.options.ttlSec,
|
||||||
DiskType: *worker.options.diskType,
|
DiskType: *worker.options.diskType,
|
||||||
Path: task.destinationUrlPath,
|
Path: task.destinationUrlPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,7 +408,7 @@ func (worker *FileCopyWorker) uploadFileInChunks(task FileCopyTask, f *os.File,
|
|||||||
Replication: *worker.options.replication,
|
Replication: *worker.options.replication,
|
||||||
Collection: *worker.options.collection,
|
Collection: *worker.options.collection,
|
||||||
TtlSec: worker.options.ttlSec,
|
TtlSec: worker.options.ttlSec,
|
||||||
DiskType: *worker.options.diskType,
|
DiskType: *worker.options.diskType,
|
||||||
Path: task.destinationUrlPath + fileName,
|
Path: task.destinationUrlPath + fileName,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ type SyncOptions struct {
|
|||||||
bCollection *string
|
bCollection *string
|
||||||
aTtlSec *int
|
aTtlSec *int
|
||||||
bTtlSec *int
|
bTtlSec *int
|
||||||
aDiskType *string
|
aDiskType *string
|
||||||
bDiskType *string
|
bDiskType *string
|
||||||
aDebug *bool
|
aDebug *bool
|
||||||
bDebug *bool
|
bDebug *bool
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ type MountOptions struct {
|
|||||||
dirAutoCreate *bool
|
dirAutoCreate *bool
|
||||||
collection *string
|
collection *string
|
||||||
replication *string
|
replication *string
|
||||||
diskType *string
|
diskType *string
|
||||||
ttlSec *int
|
ttlSec *int
|
||||||
chunkSizeLimitMB *int
|
chunkSizeLimitMB *int
|
||||||
concurrentWriters *int
|
concurrentWriters *int
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
|
|||||||
Collection: *option.collection,
|
Collection: *option.collection,
|
||||||
Replication: *option.replication,
|
Replication: *option.replication,
|
||||||
TtlSec: int32(*option.ttlSec),
|
TtlSec: int32(*option.ttlSec),
|
||||||
DiskType: diskType,
|
DiskType: diskType,
|
||||||
ChunkSizeLimit: int64(chunkSizeLimitMB) * 1024 * 1024,
|
ChunkSizeLimit: int64(chunkSizeLimitMB) * 1024 * 1024,
|
||||||
ConcurrentWriters: *option.concurrentWriters,
|
ConcurrentWriters: *option.concurrentWriters,
|
||||||
CacheDir: *option.cacheDir,
|
CacheDir: *option.cacheDir,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ type UploadOptions struct {
|
|||||||
collection *string
|
collection *string
|
||||||
dataCenter *string
|
dataCenter *string
|
||||||
ttl *string
|
ttl *string
|
||||||
diskType *string
|
diskType *string
|
||||||
maxMB *int
|
maxMB *int
|
||||||
usePublicUrl *bool
|
usePublicUrl *bool
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ type VolumeServerOptions struct {
|
|||||||
rack *string
|
rack *string
|
||||||
whiteList []string
|
whiteList []string
|
||||||
indexType *string
|
indexType *string
|
||||||
diskType *string
|
diskType *string
|
||||||
fixJpgOrientation *bool
|
fixJpgOrientation *bool
|
||||||
readRedirect *bool
|
readRedirect *bool
|
||||||
cpuProfile *string
|
cpuProfile *string
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ func (store *AbstractSqlStore) KvPut(ctx context.Context, key []byte, value []by
|
|||||||
}
|
}
|
||||||
|
|
||||||
_, err = res.RowsAffected()
|
_, err = res.RowsAffected()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("kv upsert no rows affected: %s", err)
|
return fmt.Errorf("kv upsert no rows affected: %s", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type Attr struct {
|
|||||||
Replication string // replication
|
Replication string // replication
|
||||||
Collection string // collection name
|
Collection string // collection name
|
||||||
TtlSec int32 // ttl in seconds
|
TtlSec int32 // ttl in seconds
|
||||||
DiskType string
|
DiskType string
|
||||||
UserName string
|
UserName string
|
||||||
GroupNames []string
|
GroupNames []string
|
||||||
SymlinkTarget string
|
SymlinkTarget string
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ func EntryAttributeToPb(entry *Entry) *filer_pb.FuseAttributes {
|
|||||||
Collection: entry.Attr.Collection,
|
Collection: entry.Attr.Collection,
|
||||||
Replication: entry.Attr.Replication,
|
Replication: entry.Attr.Replication,
|
||||||
TtlSec: entry.Attr.TtlSec,
|
TtlSec: entry.Attr.TtlSec,
|
||||||
DiskType: entry.Attr.DiskType,
|
DiskType: entry.Attr.DiskType,
|
||||||
UserName: entry.Attr.UserName,
|
UserName: entry.Attr.UserName,
|
||||||
GroupName: entry.Attr.GroupNames,
|
GroupName: entry.Attr.GroupNames,
|
||||||
SymlinkTarget: entry.Attr.SymlinkTarget,
|
SymlinkTarget: entry.Attr.SymlinkTarget,
|
||||||
|
|||||||
@@ -151,4 +151,3 @@ func (f *Filer) deleteChunksIfNotNew(oldEntry, newEntry *Entry) {
|
|||||||
}
|
}
|
||||||
f.DeleteChunks(toDelete)
|
f.DeleteChunks(toDelete)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ func SaveInsideFiler(client filer_pb.SeaweedFilerClient, dir, name string, conte
|
|||||||
|
|
||||||
if err == filer_pb.ErrNotFound {
|
if err == filer_pb.ErrNotFound {
|
||||||
err = filer_pb.CreateEntry(client, &filer_pb.CreateEntryRequest{
|
err = filer_pb.CreateEntry(client, &filer_pb.CreateEntryRequest{
|
||||||
Directory: dir,
|
Directory: dir,
|
||||||
Entry: &filer_pb.Entry{
|
Entry: &filer_pb.Entry{
|
||||||
Name: name,
|
Name: name,
|
||||||
IsDirectory: false,
|
IsDirectory: false,
|
||||||
Attributes: &filer_pb.FuseAttributes{
|
Attributes: &filer_pb.FuseAttributes{
|
||||||
@@ -92,7 +92,7 @@ func SaveInsideFiler(client filer_pb.SeaweedFilerClient, dir, name string, conte
|
|||||||
FileMode: uint32(0644),
|
FileMode: uint32(0644),
|
||||||
Collection: "",
|
Collection: "",
|
||||||
Replication: "",
|
Replication: "",
|
||||||
FileSize: uint64(len(content)),
|
FileSize: uint64(len(content)),
|
||||||
},
|
},
|
||||||
Content: content,
|
Content: content,
|
||||||
},
|
},
|
||||||
@@ -103,10 +103,10 @@ func SaveInsideFiler(client filer_pb.SeaweedFilerClient, dir, name string, conte
|
|||||||
entry.Attributes.Mtime = time.Now().Unix()
|
entry.Attributes.Mtime = time.Now().Unix()
|
||||||
entry.Attributes.FileSize = uint64(len(content))
|
entry.Attributes.FileSize = uint64(len(content))
|
||||||
err = filer_pb.UpdateEntry(client, &filer_pb.UpdateEntryRequest{
|
err = filer_pb.UpdateEntry(client, &filer_pb.UpdateEntryRequest{
|
||||||
Directory: dir,
|
Directory: dir,
|
||||||
Entry: entry,
|
Entry: entry,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ type Option struct {
|
|||||||
Collection string
|
Collection string
|
||||||
Replication string
|
Replication string
|
||||||
TtlSec int32
|
TtlSec int32
|
||||||
DiskType storage.DiskType
|
DiskType storage.DiskType
|
||||||
ChunkSizeLimit int64
|
ChunkSizeLimit int64
|
||||||
ConcurrentWriters int
|
ConcurrentWriters int
|
||||||
CacheDir string
|
CacheDir string
|
||||||
@@ -178,7 +178,7 @@ func (wfs *WFS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.
|
|||||||
Collection: wfs.option.Collection,
|
Collection: wfs.option.Collection,
|
||||||
Replication: wfs.option.Replication,
|
Replication: wfs.option.Replication,
|
||||||
Ttl: fmt.Sprintf("%ds", wfs.option.TtlSec),
|
Ttl: fmt.Sprintf("%ds", wfs.option.TtlSec),
|
||||||
DiskType: string(wfs.option.DiskType),
|
DiskType: string(wfs.option.DiskType),
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(4).Infof("reading filer stats: %+v", request)
|
glog.V(4).Infof("reading filer stats: %+v", request)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ func (wfs *WFS) saveDataAsChunk(fullPath util.FullPath) filer.SaveDataAsChunkFun
|
|||||||
Replication: wfs.option.Replication,
|
Replication: wfs.option.Replication,
|
||||||
Collection: wfs.option.Collection,
|
Collection: wfs.option.Collection,
|
||||||
TtlSec: wfs.option.TtlSec,
|
TtlSec: wfs.option.TtlSec,
|
||||||
DiskType: string(wfs.option.DiskType),
|
DiskType: string(wfs.option.DiskType),
|
||||||
DataCenter: wfs.option.DataCenter,
|
DataCenter: wfs.option.DataCenter,
|
||||||
Path: string(fullPath),
|
Path: string(fullPath),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type VolumeAssignRequest struct {
|
|||||||
Replication string
|
Replication string
|
||||||
Collection string
|
Collection string
|
||||||
Ttl string
|
Ttl string
|
||||||
DiskType string
|
DiskType string
|
||||||
DataCenter string
|
DataCenter string
|
||||||
Rack string
|
Rack string
|
||||||
DataNode string
|
DataNode string
|
||||||
@@ -55,7 +55,7 @@ func Assign(server string, grpcDialOption grpc.DialOption, primaryRequest *Volum
|
|||||||
Replication: request.Replication,
|
Replication: request.Replication,
|
||||||
Collection: request.Collection,
|
Collection: request.Collection,
|
||||||
Ttl: request.Ttl,
|
Ttl: request.Ttl,
|
||||||
DiskType: request.DiskType,
|
DiskType: request.DiskType,
|
||||||
DataCenter: request.DataCenter,
|
DataCenter: request.DataCenter,
|
||||||
Rack: request.Rack,
|
Rack: request.Rack,
|
||||||
DataNode: request.DataNode,
|
DataNode: request.DataNode,
|
||||||
@@ -107,7 +107,7 @@ func LookupJwt(master string, fileId string) security.EncodedJwt {
|
|||||||
|
|
||||||
type StorageOption struct {
|
type StorageOption struct {
|
||||||
Replication string
|
Replication string
|
||||||
DiskType string
|
DiskType string
|
||||||
Collection string
|
Collection string
|
||||||
DataCenter string
|
DataCenter string
|
||||||
Rack string
|
Rack string
|
||||||
@@ -126,7 +126,7 @@ func (so *StorageOption) ToAssignRequests(count int) (ar *VolumeAssignRequest, a
|
|||||||
Replication: so.Replication,
|
Replication: so.Replication,
|
||||||
Collection: so.Collection,
|
Collection: so.Collection,
|
||||||
Ttl: so.TtlString(),
|
Ttl: so.TtlString(),
|
||||||
DiskType: so.DiskType,
|
DiskType: so.DiskType,
|
||||||
DataCenter: so.DataCenter,
|
DataCenter: so.DataCenter,
|
||||||
Rack: so.Rack,
|
Rack: so.Rack,
|
||||||
WritableVolumeCount: so.VolumeGrowthCount,
|
WritableVolumeCount: so.VolumeGrowthCount,
|
||||||
@@ -137,7 +137,7 @@ func (so *StorageOption) ToAssignRequests(count int) (ar *VolumeAssignRequest, a
|
|||||||
Replication: so.Replication,
|
Replication: so.Replication,
|
||||||
Collection: so.Collection,
|
Collection: so.Collection,
|
||||||
Ttl: so.TtlString(),
|
Ttl: so.TtlString(),
|
||||||
DiskType: so.DiskType,
|
DiskType: so.DiskType,
|
||||||
DataCenter: "",
|
DataCenter: "",
|
||||||
Rack: "",
|
Rack: "",
|
||||||
WritableVolumeCount: so.VolumeGrowthCount,
|
WritableVolumeCount: so.VolumeGrowthCount,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ type FilePart struct {
|
|||||||
Collection string
|
Collection string
|
||||||
DataCenter string
|
DataCenter string
|
||||||
Ttl string
|
Ttl string
|
||||||
DiskType string
|
DiskType string
|
||||||
Server string //this comes from assign result
|
Server string //this comes from assign result
|
||||||
Fid string //this comes from assign result, but customizable
|
Fid string //this comes from assign result, but customizable
|
||||||
Fsync bool
|
Fsync bool
|
||||||
@@ -50,7 +50,7 @@ func SubmitFiles(master string, grpcDialOption grpc.DialOption, files []FilePart
|
|||||||
Collection: collection,
|
Collection: collection,
|
||||||
DataCenter: dataCenter,
|
DataCenter: dataCenter,
|
||||||
Ttl: ttl,
|
Ttl: ttl,
|
||||||
DiskType: diskType,
|
DiskType: diskType,
|
||||||
}
|
}
|
||||||
ret, err := Assign(master, grpcDialOption, ar)
|
ret, err := Assign(master, grpcDialOption, ar)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -146,7 +146,7 @@ func (fi FilePart) Upload(maxMB int, master string, usePublicUrl bool, jwt secur
|
|||||||
Replication: fi.Replication,
|
Replication: fi.Replication,
|
||||||
Collection: fi.Collection,
|
Collection: fi.Collection,
|
||||||
Ttl: fi.Ttl,
|
Ttl: fi.Ttl,
|
||||||
DiskType: fi.DiskType,
|
DiskType: fi.DiskType,
|
||||||
}
|
}
|
||||||
ret, err = Assign(master, grpcDialOption, ar)
|
ret, err = Assign(master, grpcDialOption, ar)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -160,7 +160,7 @@ func (fi FilePart) Upload(maxMB int, master string, usePublicUrl bool, jwt secur
|
|||||||
Replication: fi.Replication,
|
Replication: fi.Replication,
|
||||||
Collection: fi.Collection,
|
Collection: fi.Collection,
|
||||||
Ttl: fi.Ttl,
|
Ttl: fi.Ttl,
|
||||||
DiskType: fi.DiskType,
|
DiskType: fi.DiskType,
|
||||||
}
|
}
|
||||||
ret, err = Assign(master, grpcDialOption, ar)
|
ret, err = Assign(master, grpcDialOption, ar)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ func (fs *FilerSink) fetchAndWrite(sourceChunk *filer_pb.FileChunk, path string)
|
|||||||
Collection: fs.collection,
|
Collection: fs.collection,
|
||||||
TtlSec: fs.ttlSec,
|
TtlSec: fs.ttlSec,
|
||||||
DataCenter: fs.dataCenter,
|
DataCenter: fs.dataCenter,
|
||||||
DiskType: fs.diskType,
|
DiskType: fs.diskType,
|
||||||
Path: path,
|
Path: path,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ type FilerSink struct {
|
|||||||
replication string
|
replication string
|
||||||
collection string
|
collection string
|
||||||
ttlSec int32
|
ttlSec int32
|
||||||
diskType string
|
diskType string
|
||||||
dataCenter string
|
dataCenter string
|
||||||
grpcDialOption grpc.DialOption
|
grpcDialOption grpc.DialOption
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ func (iam *IdentityAccessManagement) loadS3ApiConfigurationFromBytes(content []b
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (iam *IdentityAccessManagement) loadS3ApiConfiguration(config *iam_pb.S3ApiConfiguration) error {
|
func (iam *IdentityAccessManagement) loadS3ApiConfiguration(config *iam_pb.S3ApiConfiguration) error {
|
||||||
var identities []*Identity
|
var identities []*Identity
|
||||||
for _, ident := range config.Identities {
|
for _, ident := range config.Identities {
|
||||||
|
|||||||
@@ -7,4 +7,3 @@ const (
|
|||||||
ACTION_TAGGING = "Tagging"
|
ACTION_TAGGING = "Tagging"
|
||||||
ACTION_LIST = "List"
|
ACTION_LIST = "List"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ func submitForClientHandler(w http.ResponseWriter, r *http.Request, masterUrl st
|
|||||||
Replication: r.FormValue("replication"),
|
Replication: r.FormValue("replication"),
|
||||||
Collection: r.FormValue("collection"),
|
Collection: r.FormValue("collection"),
|
||||||
Ttl: r.FormValue("ttl"),
|
Ttl: r.FormValue("ttl"),
|
||||||
DiskType: r.FormValue("disk"),
|
DiskType: r.FormValue("disk"),
|
||||||
}
|
}
|
||||||
assignResult, ae := operation.Assign(masterUrl, grpcDialOption, ar)
|
assignResult, ae := operation.Assign(masterUrl, grpcDialOption, ar)
|
||||||
if ae != nil {
|
if ae != nil {
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ func (fs *FilerServer) Statistics(ctx context.Context, req *filer_pb.StatisticsR
|
|||||||
Replication: req.Replication,
|
Replication: req.Replication,
|
||||||
Collection: req.Collection,
|
Collection: req.Collection,
|
||||||
Ttl: req.Ttl,
|
Ttl: req.Ttl,
|
||||||
DiskType: req.DiskType,
|
DiskType: req.DiskType,
|
||||||
})
|
})
|
||||||
if grpcErr != nil {
|
if grpcErr != nil {
|
||||||
return grpcErr
|
return grpcErr
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileNa
|
|||||||
Replication: so.Replication,
|
Replication: so.Replication,
|
||||||
Collection: so.Collection,
|
Collection: so.Collection,
|
||||||
TtlSec: so.TtlSeconds,
|
TtlSec: so.TtlSeconds,
|
||||||
DiskType: so.DiskType,
|
DiskType: so.DiskType,
|
||||||
Mime: contentType,
|
Mime: contentType,
|
||||||
Md5: md5bytes,
|
Md5: md5bytes,
|
||||||
FileSize: uint64(chunkOffset),
|
FileSize: uint64(chunkOffset),
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ func (fs *FilerServer) encrypt(ctx context.Context, w http.ResponseWriter, r *ht
|
|||||||
Replication: so.Replication,
|
Replication: so.Replication,
|
||||||
Collection: so.Collection,
|
Collection: so.Collection,
|
||||||
TtlSec: so.TtlSeconds,
|
TtlSec: so.TtlSeconds,
|
||||||
DiskType: so.DiskType,
|
DiskType: so.DiskType,
|
||||||
Mime: pu.MimeType,
|
Mime: pu.MimeType,
|
||||||
Md5: util.Base64Md5ToBytes(pu.ContentMd5),
|
Md5: util.Base64Md5ToBytes(pu.ContentMd5),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ func (ms *MasterServer) Assign(ctx context.Context, req *master_pb.AssignRequest
|
|||||||
Collection: req.Collection,
|
Collection: req.Collection,
|
||||||
ReplicaPlacement: replicaPlacement,
|
ReplicaPlacement: replicaPlacement,
|
||||||
Ttl: ttl,
|
Ttl: ttl,
|
||||||
DiskType: diskType,
|
DiskType: diskType,
|
||||||
Prealloacte: ms.preallocateSize,
|
Prealloacte: ms.preallocateSize,
|
||||||
DataCenter: req.DataCenter,
|
DataCenter: req.DataCenter,
|
||||||
Rack: req.Rack,
|
Rack: req.Rack,
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ func (ms *MasterServer) getVolumeGrowOption(r *http.Request) (*topology.VolumeGr
|
|||||||
Collection: r.FormValue("collection"),
|
Collection: r.FormValue("collection"),
|
||||||
ReplicaPlacement: replicaPlacement,
|
ReplicaPlacement: replicaPlacement,
|
||||||
Ttl: ttl,
|
Ttl: ttl,
|
||||||
DiskType: diskType,
|
DiskType: diskType,
|
||||||
Prealloacte: preallocate,
|
Prealloacte: preallocate,
|
||||||
DataCenter: r.FormValue("dataCenter"),
|
DataCenter: r.FormValue("dataCenter"),
|
||||||
Rack: r.FormValue("rack"),
|
Rack: r.FormValue("rack"),
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ type WebDavOption struct {
|
|||||||
BucketsPath string
|
BucketsPath string
|
||||||
GrpcDialOption grpc.DialOption
|
GrpcDialOption grpc.DialOption
|
||||||
Collection string
|
Collection string
|
||||||
DiskType string
|
DiskType string
|
||||||
Uid uint32
|
Uid uint32
|
||||||
Gid uint32
|
Gid uint32
|
||||||
Cipher bool
|
Cipher bool
|
||||||
@@ -379,7 +379,7 @@ func (f *WebDavFile) saveDataAsChunk(reader io.Reader, name string, offset int64
|
|||||||
Count: 1,
|
Count: 1,
|
||||||
Replication: "",
|
Replication: "",
|
||||||
Collection: f.fs.option.Collection,
|
Collection: f.fs.option.Collection,
|
||||||
DiskType: f.fs.option.DiskType,
|
DiskType: f.fs.option.DiskType,
|
||||||
Path: name,
|
Path: name,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ func moveAwayOneEcVolume(commandEnv *CommandEnv, ecShardInfo *master_pb.VolumeEc
|
|||||||
|
|
||||||
func moveAwayOneNormalVolume(commandEnv *CommandEnv, volumeReplicas map[uint32][]*VolumeReplica, vol *master_pb.VolumeInformationMessage, thisNode *Node, otherNodes []*Node, applyChange bool) (hasMoved bool, err error) {
|
func moveAwayOneNormalVolume(commandEnv *CommandEnv, volumeReplicas map[uint32][]*VolumeReplica, vol *master_pb.VolumeInformationMessage, thisNode *Node, otherNodes []*Node, applyChange bool) (hasMoved bool, err error) {
|
||||||
sort.Slice(otherNodes, func(i, j int) bool {
|
sort.Slice(otherNodes, func(i, j int) bool {
|
||||||
return otherNodes[i].localVolumeRatio(capacityByMaxVolumeCount) + otherNodes[i].localVolumeRatio(capacityByMaxSsdVolumeCount) < otherNodes[j].localVolumeRatio(capacityByMaxVolumeCount) + otherNodes[j].localVolumeRatio(capacityByMaxSsdVolumeCount)
|
return otherNodes[i].localVolumeRatio(capacityByMaxVolumeCount)+otherNodes[i].localVolumeRatio(capacityByMaxSsdVolumeCount) < otherNodes[j].localVolumeRatio(capacityByMaxVolumeCount)+otherNodes[j].localVolumeRatio(capacityByMaxSsdVolumeCount)
|
||||||
})
|
})
|
||||||
|
|
||||||
for i := 0; i < len(otherNodes); i++ {
|
for i := 0; i < len(otherNodes); i++ {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import (
|
|||||||
type DiskLocation struct {
|
type DiskLocation struct {
|
||||||
Directory string
|
Directory string
|
||||||
IdxDirectory string
|
IdxDirectory string
|
||||||
DiskType DiskType
|
DiskType DiskType
|
||||||
MaxVolumeCount int
|
MaxVolumeCount int
|
||||||
OriginalMaxVolumeCount int
|
OriginalMaxVolumeCount int
|
||||||
MinFreeSpacePercent float32
|
MinFreeSpacePercent float32
|
||||||
@@ -43,7 +43,7 @@ func NewDiskLocation(dir string, maxVolumeCount int, minFreeSpacePercent float32
|
|||||||
location := &DiskLocation{
|
location := &DiskLocation{
|
||||||
Directory: dir,
|
Directory: dir,
|
||||||
IdxDirectory: idxDir,
|
IdxDirectory: idxDir,
|
||||||
DiskType: diskType,
|
DiskType: diskType,
|
||||||
MaxVolumeCount: maxVolumeCount,
|
MaxVolumeCount: maxVolumeCount,
|
||||||
OriginalMaxVolumeCount: maxVolumeCount,
|
OriginalMaxVolumeCount: maxVolumeCount,
|
||||||
MinFreeSpacePercent: minFreeSpacePercent,
|
MinFreeSpacePercent: minFreeSpacePercent,
|
||||||
@@ -117,7 +117,7 @@ func (l *DiskLocation) loadExistingVolume(fileInfo os.FileInfo, needleMapKind Ne
|
|||||||
glog.V(0).Infof("new volume %s error %s", volumeName, e)
|
glog.V(0).Infof("new volume %s error %s", volumeName, e)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
l.SetVolume(vid, v)
|
l.SetVolume(vid, v)
|
||||||
|
|
||||||
size, _, _ := v.FileStat()
|
size, _, _ := v.FileStat()
|
||||||
@@ -362,4 +362,4 @@ func (l *DiskLocation) GetDiskType() string {
|
|||||||
return "SSD"
|
return "SSD"
|
||||||
}
|
}
|
||||||
return "HDD"
|
return "HDD"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ type VolumeInfo struct {
|
|||||||
Size uint64
|
Size uint64
|
||||||
ReplicaPlacement *super_block.ReplicaPlacement
|
ReplicaPlacement *super_block.ReplicaPlacement
|
||||||
Ttl *needle.TTL
|
Ttl *needle.TTL
|
||||||
DiskType string
|
DiskType string
|
||||||
Collection string
|
Collection string
|
||||||
Version needle.Version
|
Version needle.Version
|
||||||
FileCount int
|
FileCount int
|
||||||
@@ -41,7 +41,7 @@ func NewVolumeInfo(m *master_pb.VolumeInformationMessage) (vi VolumeInfo, err er
|
|||||||
ModifiedAtSecond: m.ModifiedAtSecond,
|
ModifiedAtSecond: m.ModifiedAtSecond,
|
||||||
RemoteStorageName: m.RemoteStorageName,
|
RemoteStorageName: m.RemoteStorageName,
|
||||||
RemoteStorageKey: m.RemoteStorageKey,
|
RemoteStorageKey: m.RemoteStorageKey,
|
||||||
DiskType: m.DiskType,
|
DiskType: m.DiskType,
|
||||||
}
|
}
|
||||||
rp, e := super_block.NewReplicaPlacementFromByte(byte(m.ReplicaPlacement))
|
rp, e := super_block.NewReplicaPlacementFromByte(byte(m.ReplicaPlacement))
|
||||||
if e != nil {
|
if e != nil {
|
||||||
@@ -93,7 +93,7 @@ func (vi VolumeInfo) ToVolumeInformationMessage() *master_pb.VolumeInformationMe
|
|||||||
ModifiedAtSecond: vi.ModifiedAtSecond,
|
ModifiedAtSecond: vi.ModifiedAtSecond,
|
||||||
RemoteStorageName: vi.RemoteStorageName,
|
RemoteStorageName: vi.RemoteStorageName,
|
||||||
RemoteStorageKey: vi.RemoteStorageKey,
|
RemoteStorageKey: vi.RemoteStorageKey,
|
||||||
DiskType: vi.DiskType,
|
DiskType: vi.DiskType,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
|
|||||||
if err == nil && alsoLoadIndex {
|
if err == nil && alsoLoadIndex {
|
||||||
// adjust for existing volumes with .idx together with .dat files
|
// adjust for existing volumes with .idx together with .dat files
|
||||||
if v.dirIdx != v.dir {
|
if v.dirIdx != v.dir {
|
||||||
if util.FileExists(v.DataFileName()+".idx") {
|
if util.FileExists(v.DataFileName() + ".idx") {
|
||||||
v.dirIdx = v.dir
|
v.dirIdx = v.dir
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,12 +100,12 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
|
|||||||
if v.noWriteOrDelete {
|
if v.noWriteOrDelete {
|
||||||
glog.V(0).Infoln("open to read file", v.FileName(".idx"))
|
glog.V(0).Infoln("open to read file", v.FileName(".idx"))
|
||||||
if indexFile, err = os.OpenFile(v.FileName(".idx"), os.O_RDONLY, 0644); err != nil {
|
if indexFile, err = os.OpenFile(v.FileName(".idx"), os.O_RDONLY, 0644); err != nil {
|
||||||
return fmt.Errorf("cannot read Volume Index %s: %v", v.FileName(".idx"), err)
|
return fmt.Errorf("cannot read Volume Index %s: %v", v.FileName(".idx"), err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
glog.V(1).Infoln("open to write file", v.FileName(".idx"))
|
glog.V(1).Infoln("open to write file", v.FileName(".idx"))
|
||||||
if indexFile, err = os.OpenFile(v.FileName(".idx"), os.O_RDWR|os.O_CREATE, 0644); err != nil {
|
if indexFile, err = os.OpenFile(v.FileName(".idx"), os.O_RDWR|os.O_CREATE, 0644); err != nil {
|
||||||
return fmt.Errorf("cannot write Volume Index %s: %v", v.FileName(".idx"), err)
|
return fmt.Errorf("cannot write Volume Index %s: %v", v.FileName(".idx"), err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if v.lastAppendAtNs, err = CheckAndFixVolumeDataIntegrity(v, indexFile); err != nil {
|
if v.lastAppendAtNs, err = CheckAndFixVolumeDataIntegrity(v, indexFile); err != nil {
|
||||||
@@ -115,7 +115,7 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
|
|||||||
|
|
||||||
if v.noWriteOrDelete || v.noWriteCanDelete {
|
if v.noWriteOrDelete || v.noWriteCanDelete {
|
||||||
if v.nm, err = NewSortedFileNeedleMap(v.IndexFileName(), indexFile); err != nil {
|
if v.nm, err = NewSortedFileNeedleMap(v.IndexFileName(), indexFile); err != nil {
|
||||||
glog.V(0).Infof("loading sorted db %s error: %v", v.FileName(".sdx"), err)
|
glog.V(0).Infof("loading sorted db %s error: %v", v.FileName(".sdx"), err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch needleMapKind {
|
switch needleMapKind {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ type DiskType string
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
HardDriveType DiskType = ""
|
HardDriveType DiskType = ""
|
||||||
SsdType = "ssd"
|
SsdType = "ssd"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ToDiskType(vt string) (diskType DiskType, err error) {
|
func ToDiskType(vt string) (diskType DiskType, err error) {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ func TestHandlingVolumeServerHeartbeat(t *testing.T) {
|
|||||||
ReplicaPlacement: uint32(0),
|
ReplicaPlacement: uint32(0),
|
||||||
Version: uint32(needle.CurrentVersion),
|
Version: uint32(needle.CurrentVersion),
|
||||||
Ttl: 0,
|
Ttl: 0,
|
||||||
DiskType: "ssd",
|
DiskType: "ssd",
|
||||||
}
|
}
|
||||||
volumeMessages = append(volumeMessages, volumeMessage)
|
volumeMessages = append(volumeMessages, volumeMessage)
|
||||||
}
|
}
|
||||||
@@ -168,7 +168,7 @@ func TestAddRemoveVolume(t *testing.T) {
|
|||||||
Id: needle.VolumeId(1),
|
Id: needle.VolumeId(1),
|
||||||
Size: 100,
|
Size: 100,
|
||||||
Collection: "xcollection",
|
Collection: "xcollection",
|
||||||
DiskType: "ssd",
|
DiskType: "ssd",
|
||||||
FileCount: 123,
|
FileCount: 123,
|
||||||
DeleteCount: 23,
|
DeleteCount: 23,
|
||||||
DeletedByteCount: 45,
|
DeletedByteCount: 45,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ type VolumeGrowOption struct {
|
|||||||
Collection string
|
Collection string
|
||||||
ReplicaPlacement *super_block.ReplicaPlacement
|
ReplicaPlacement *super_block.ReplicaPlacement
|
||||||
Ttl *needle.TTL
|
Ttl *needle.TTL
|
||||||
DiskType storage.DiskType
|
DiskType storage.DiskType
|
||||||
Prealloacte int64
|
Prealloacte int64
|
||||||
DataCenter string
|
DataCenter string
|
||||||
Rack string
|
Rack string
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ func (v *volumesBinaryState) copyState(list *VolumeLocationList) copyState {
|
|||||||
type VolumeLayout struct {
|
type VolumeLayout struct {
|
||||||
rp *super_block.ReplicaPlacement
|
rp *super_block.ReplicaPlacement
|
||||||
ttl *needle.TTL
|
ttl *needle.TTL
|
||||||
diskType storage.DiskType
|
diskType storage.DiskType
|
||||||
vid2location map[needle.VolumeId]*VolumeLocationList
|
vid2location map[needle.VolumeId]*VolumeLocationList
|
||||||
writables []needle.VolumeId // transient array of writable volume id
|
writables []needle.VolumeId // transient array of writable volume id
|
||||||
readonlyVolumes *volumesBinaryState // readonly volumes
|
readonlyVolumes *volumesBinaryState // readonly volumes
|
||||||
@@ -123,7 +123,7 @@ func NewVolumeLayout(rp *super_block.ReplicaPlacement, ttl *needle.TTL, diskType
|
|||||||
return &VolumeLayout{
|
return &VolumeLayout{
|
||||||
rp: rp,
|
rp: rp,
|
||||||
ttl: ttl,
|
ttl: ttl,
|
||||||
diskType: diskType,
|
diskType: diskType,
|
||||||
vid2location: make(map[needle.VolumeId]*VolumeLocationList),
|
vid2location: make(map[needle.VolumeId]*VolumeLocationList),
|
||||||
writables: *new([]needle.VolumeId),
|
writables: *new([]needle.VolumeId),
|
||||||
readonlyVolumes: NewVolumesBinaryState(readOnlyState, rp, ExistCopies()),
|
readonlyVolumes: NewVolumesBinaryState(readOnlyState, rp, ExistCopies()),
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ type Configuration interface {
|
|||||||
func LoadConfiguration(configFileName string, required bool) (loaded bool) {
|
func LoadConfiguration(configFileName string, required bool) (loaded bool) {
|
||||||
|
|
||||||
// find a filer store
|
// find a filer store
|
||||||
viper.SetConfigName(configFileName) // name of config file (without extension)
|
viper.SetConfigName(configFileName) // name of config file (without extension)
|
||||||
viper.AddConfigPath(".") // optionally look for config in the working directory
|
viper.AddConfigPath(".") // optionally look for config in the working directory
|
||||||
viper.AddConfigPath("$HOME/.seaweedfs") // call multiple times to add many search paths
|
viper.AddConfigPath("$HOME/.seaweedfs") // call multiple times to add many search paths
|
||||||
viper.AddConfigPath("/usr/local/etc/seaweedfs/") // search path for bsd-style config directory in
|
viper.AddConfigPath("/usr/local/etc/seaweedfs/") // search path for bsd-style config directory in
|
||||||
viper.AddConfigPath("/etc/seaweedfs/") // path to look for the config file in
|
viper.AddConfigPath("/etc/seaweedfs/") // path to look for the config file in
|
||||||
|
|
||||||
glog.V(1).Infof("Reading %s.toml from %s", configFileName, viper.ConfigFileUsed())
|
glog.V(1).Infof("Reading %s.toml from %s", configFileName, viper.ConfigFileUsed())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user