Browse Source

removing volume list

pull/2/head
Chris Lu 12 years ago
parent
commit
2002111a80
  1. 9
      weed-fs/src/cmd/weed/volume.go
  2. 7
      weed-fs/src/pkg/storage/store.go

9
weed-fs/src/cmd/weed/volume.go

@ -21,7 +21,7 @@ func init() {
} }
var cmdVolume = &Command{ var cmdVolume = &Command{
UsageLine: "volume -port=8080 -dir=/tmp -min=3 -max=5 -publicUrl=server_name:8080 -mserver=localhost:9333",
UsageLine: "volume -port=8080 -dir=/tmp -max=5 -publicUrl=server_name:8080 -mserver=localhost:9333",
Short: "start a volume server", Short: "start a volume server",
Long: `start a volume server to provide storage spaces Long: `start a volume server to provide storage spaces
@ -30,10 +30,9 @@ var cmdVolume = &Command{
var ( var (
vport = cmdVolume.Flag.Int("port", 8080, "http listen port") vport = cmdVolume.Flag.Int("port", 8080, "http listen port")
volumeFolder = cmdVolume.Flag.String("dir", "/tmp", "data directory to store files")
volumes = cmdVolume.Flag.String("volumes", "", "comma-separated list, or ranges of volume ids")
volumeFolder = cmdVolume.Flag.String("dir", "/tmp", "directory to store data files")
publicUrl = cmdVolume.Flag.String("publicUrl", "localhost:8080", "public url to serve data read") publicUrl = cmdVolume.Flag.String("publicUrl", "localhost:8080", "public url to serve data read")
masterNode = cmdVolume.Flag.String("mserver", "localhost:9333", "master directory server to store mappings")
masterNode = cmdVolume.Flag.String("mserver", "localhost:9333", "master server location")
vpulse = cmdVolume.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats") vpulse = cmdVolume.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats")
maxVolumeCount = cmdVolume.Flag.Int("max", 5, "maximum number of volumes") maxVolumeCount = cmdVolume.Flag.Int("max", 5, "maximum number of volumes")
@ -234,7 +233,7 @@ func runVolume(cmd *Command, args []string) bool {
perm := fileInfo.Mode().Perm() perm := fileInfo.Mode().Perm()
log.Println("Volume Folder permission:", perm) log.Println("Volume Folder permission:", perm)
store = storage.NewStore(*vport, *publicUrl, *volumeFolder, *maxVolumeCount, *volumes)
store = storage.NewStore(*vport, *publicUrl, *volumeFolder, *maxVolumeCount)
defer store.Close() defer store.Close()
http.HandleFunc("/", storeHandler) http.HandleFunc("/", storeHandler)
http.HandleFunc("/status", statusHandler) http.HandleFunc("/status", statusHandler)

7
weed-fs/src/pkg/storage/store.go

@ -19,15 +19,12 @@ type Store struct {
MaxVolumeCount int MaxVolumeCount int
} }
func NewStore(port int, publicUrl, dirname string, maxVolumeCount int, volumeListString string) (s *Store) {
func NewStore(port int, publicUrl, dirname string, maxVolumeCount int) (s *Store) {
s = &Store{Port: port, PublicUrl: publicUrl, dir: dirname, MaxVolumeCount: maxVolumeCount} s = &Store{Port: port, PublicUrl: publicUrl, dir: dirname, MaxVolumeCount: maxVolumeCount}
s.volumes = make(map[VolumeId]*Volume) s.volumes = make(map[VolumeId]*Volume)
s.loadExistingVolumes() s.loadExistingVolumes()
if volumeListString != "" {
s.AddVolume(volumeListString, "00")
}
log.Println("Store started on dir:", dirname, "with", len(s.volumes), "volumes", volumeListString)
log.Println("Store started on dir:", dirname, "with", len(s.volumes), "volumes")
return return
} }
func (s *Store) AddVolume(volumeListString string, replicationType string) (error) { func (s *Store) AddVolume(volumeListString string, replicationType string) (error) {

Loading…
Cancel
Save