示例#1
0
文件: main.go 项目: proj-223/CatFs
func main() {
	flag.Parse()
	args := flag.Args()
	config.LoadConfig("/tmp/catfs.json")
	i, err := strconv.Atoi(args[0])
	if err != nil {
		log.Fatal(err)
	}
	for _, arg := range args[1:] {
		ii, err := strconv.Atoi(arg)
		if err != nil {
			log.Fatal(err)
		}
		go func(index int) {
			data.Serve(index)
		}(ii)
	}
	data.Serve(i)
}
示例#2
0
func TestData(t *testing.T) {
	go data.Serve(0)
	time.Sleep(time.Second)
	block := &proc.CatBlock{
		ID:        "111",
		Locations: []proc.ServerLocation{0},
	}
	testSendBlock(block, t)
	testGetBlock(block, t)
	os.Remove(getFilename(block.ID))
}