Beispiel #1
0
func setUpClient() *client.Client {
	// Set up a connection to the server.
	c, err := client.New(address)
	if err != nil {
		log.Fatalf("Cannot create cfs client: %v", err)
	}
	return c
}
Beispiel #2
0
func main() {
	flag.Parse()
	if len(flag.Args()) < 1 {
		log.Fatal("Usage:\n  ./main MOUNTPOINT")
	}
	cli, err := client.New(1, "localhost:15524")
	if err != nil {
		log.Fatalf("cannot connect to cfs server %v\n", err)
	}
	log.Println("Connected to server")
	nfs := pathfs.NewPathNodeFs(&CFuse{FileSystem: pathfs.NewDefaultFileSystem(),
		client: cli}, nil)
	server, _, err := nodefs.MountRoot(flag.Arg(0), nfs.Root(), nil)
	if err != nil {
		log.Fatalf("Mount fail: %v\n", err)
	}
	server.Serve()
}