Example #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()
}
Example #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)
	}
}