Example #1
0
func mkdirOp(done chan bool, num int, f func(c *client.CatClient, fnn string)) {
	c := client.NewCatClient()
	fn := uuid.New()
	for i := 0; i < num; i++ {
		fnn := fn + strconv.Itoa(i)
		f(c, fnn)
	}
	done <- true
}
Example #2
0
func writeOp(done chan bool, mb int) {
	c := client.NewCatClient()
	fi, err := c.Create(uuid.New())
	if err != nil {
		printError(err)
		return
	}
	buf := make([]byte, 1<<10)
	for i := 0; i < mb*(1<<10); i++ {
		_, err := fi.Write(buf)
		if err != nil {
			printError(err)
			return
		}
	}
	fi.Close()
	done <- true
}
Example #3
0
func readOp(done chan bool, path string, mb int) {
	c := client.NewCatClient()
	fi, err := c.Open(path, proc.OPEN_MODE_READ)
	if err != nil {
		log.Printf("Error %s", err.Error())
		done <- false
		return
	}
	buf := make([]byte, 1<<10)
	for i := 0; i < mb*(1<<10); i++ {
		_, err := fi.Read(buf)
		if err == io.EOF {
			break
		}
		if err != nil {
			log.Printf("Error %s", err.Error())
			done <- false
			return
		}
	}
	fi.Close()
	done <- true
}
Example #4
0
File: fs.go Project: proj-223/CatFs
func NewClient() *client.CatClient {
	return client.NewCatClient()
}