Exemple #1
0
func singlenode(args []string) {
	numDNs, err := strconv.Atoi(args[0])
	if err != nil {
		usage(err)
		return
	}
	volsPerDn, err := strconv.Atoi(args[1])
	if err != nil {
		usage(err)
		return
	}
	replicationFactor, err := strconv.Atoi(args[2])
	if err != nil {
		usage(err)
		return
	}
	baseDir := args[3]
	mountPoint := args[4]
	nncfg, dscfg, err := conf.NewConfSet2(numDNs, volsPerDn, uint32(replicationFactor), baseDir)
	if err != nil {
		usage(err)
		return
	}
	cluster, err := integration.NewSingleNodeCluster(nncfg, dscfg, true)
	if err != nil {
		usage(err)
		return
	}
	cluster.Start()
	client, err := newMountedClient(cluster.Leases, cluster.Names, cluster.Datas, mountPoint)
	client.Loop()
	cluster.Close()
}
Exemple #2
0
func initCluster() {
	os.RemoveAll("/tmp/testcluster")
	var err error
	nncfg, dscfg, err := conf.NewConfSet2(4, 2, 3, "/tmp/testcluster")
	if err != nil {
		panic(err)
	}
	testCluster, err = integration.NewSingleNodeCluster(nncfg, dscfg, true)
	if err != nil {
		panic(err)
	}
}
Exemple #3
0
func setup() {
	// set up cluster
	os.RemoveAll("/tmp/testcluster")
	var err error
	os.RemoveAll(mountPoint)
	os.MkdirAll(mountPoint, 0777)
	testCluster, err = integration.NewSingleNodeCluster(4, 2, 3, "/tmp/testcluster", "/tmp/mfsTestMount", true)
	if err != nil {
		fmt.Println("failed to set up")
		fmt.Println(err)
		os.Exit(1)
	}
	go func() {
		serviceError <- testCluster.Serve()
	}()
}