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