|
@ -12,10 +12,11 @@ import ( |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
var ( |
|
|
var ( |
|
|
dir = flag.String("dir", "/tmp", "directory to create files") |
|
|
|
|
|
n = flag.Int("n", 100, "the number of metadata") |
|
|
|
|
|
tailFiler = flag.String("filer", "localhost:8888", "the filer address") |
|
|
|
|
|
isWrite = flag.Bool("write", false, "only write") |
|
|
|
|
|
|
|
|
dir = flag.String("dir", "/tmp", "directory to create files") |
|
|
|
|
|
n = flag.Int("n", 100, "the number of metadata") |
|
|
|
|
|
tailFiler = flag.String("filer", "localhost:8888", "the filer address") |
|
|
|
|
|
isWrite = flag.Bool("write", false, "only write") |
|
|
|
|
|
writeInterval = flag.Duration("writeInterval", 0, "write interval, e.g., 1s") |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
func main() { |
|
|
func main() { |
|
@ -54,6 +55,7 @@ func startGenerateMetadata() { |
|
|
|
|
|
|
|
|
for i := 0; i < *n; i++ { |
|
|
for i := 0; i < *n; i++ { |
|
|
name := fmt.Sprintf("file%d", i) |
|
|
name := fmt.Sprintf("file%d", i) |
|
|
|
|
|
glog.V(0).Infof("write %s/%s", *dir, name) |
|
|
if err := filer_pb.CreateEntry(client, &filer_pb.CreateEntryRequest{ |
|
|
if err := filer_pb.CreateEntry(client, &filer_pb.CreateEntryRequest{ |
|
|
Directory: *dir, |
|
|
Directory: *dir, |
|
|
Entry: &filer_pb.Entry{ |
|
|
Entry: &filer_pb.Entry{ |
|
@ -63,6 +65,9 @@ func startGenerateMetadata() { |
|
|
fmt.Printf("create entry %s: %v\n", name, err) |
|
|
fmt.Printf("create entry %s: %v\n", name, err) |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
|
|
|
if *writeInterval > 0 { |
|
|
|
|
|
time.Sleep(*writeInterval) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return nil |
|
|
return nil |
|
|