15964: Delete long out of date (and unused) 'getting started' section
[arvados.git] / lib / mount / command.go
index f99e6da2317b1bb0d21ab9d8d6a7fc02810ba26f..86a9085bda46fc69a517ba2be5faf7ea14688394 100644 (file)
@@ -8,6 +8,8 @@ import (
        "flag"
        "io"
        "log"
+       "net/http"
+       _ "net/http/pprof"
        "os"
 
        "git.arvados.org/arvados.git/sdk/go/arvados"
@@ -24,7 +26,7 @@ type cmd struct {
        // not be called more than once, or when ready is already
        // closed.
        ready chan struct{}
-       // It is safe to call Unmount ounly after ready has been
+       // It is safe to call Unmount only after ready has been
        // closed.
        Unmount func() (ok bool)
 }
@@ -38,6 +40,8 @@ func (c *cmd) RunCommand(prog string, args []string, stdin io.Reader, stdout, st
        flags := flag.NewFlagSet(prog, flag.ContinueOnError)
        ro := flags.Bool("ro", false, "read-only")
        experimental := flags.Bool("experimental", false, "acknowledge this is an experimental command, and should not be used in production (required)")
+       blockCache := flags.Int("block-cache", 4, "read cache size (number of 64MiB blocks)")
+       pprof := flags.String("pprof", "", "serve Go profile data at `[addr]:port`")
        err := flags.Parse(args)
        if err != nil {
                logger.Print(err)
@@ -47,6 +51,11 @@ func (c *cmd) RunCommand(prog string, args []string, stdin io.Reader, stdout, st
                logger.Printf("error: experimental command %q used without --experimental flag", prog)
                return 2
        }
+       if *pprof != "" {
+               go func() {
+                       log.Println(http.ListenAndServe(*pprof, nil))
+               }()
+       }
 
        client := arvados.NewClientFromEnv()
        ac, err := arvadosclient.New(client)
@@ -59,6 +68,7 @@ func (c *cmd) RunCommand(prog string, args []string, stdin io.Reader, stdout, st
                logger.Print(err)
                return 1
        }
+       kc.BlockCache = &keepclient.BlockCache{MaxBlocks: *blockCache}
        host := fuse.NewFileSystemHost(&keepFS{
                Client:     client,
                KeepClient: kc,