예제 #1
0
func mkfile(path string, size uint64, blksize uint32) (*file.BlockFile, *file.LRUCacheFile) {
	ibf := file.NewBlockFileCustomBlockSize(path, &buf.NoBuffer{}, blksize)
	if err := ibf.Open(); err != nil {
		panic(err)
	}
	f, err := file.NewLRUCacheFile(ibf, size)
	if err != nil {
		panic(err)
	}
	return ibf, f
}
예제 #2
0
func testfile(t *testing.T, path string) file.RemovableBlockDevice {
	const CACHESIZE = 10000
	ibf := file.NewBlockFile(path, &buf.NoBuffer{})
	if err := ibf.Open(); err != nil {
		t.Fatal(err)
	}
	f, err := file.NewLRUCacheFile(ibf, 4096*CACHESIZE)
	if err != nil {
		t.Fatal(err)
	}
	return f
}
예제 #3
0
func testfile(t *testing.T) file.RemovableBlockDevice {
	const CACHESIZE = 100000
	ibf := file.NewBlockFileCustomBlockSize(PATH, &buf.NoBuffer{}, 4096)
	if err := ibf.Open(); err != nil {
		t.Fatal(err)
	}
	f, err := file.NewLRUCacheFile(ibf, 4096*CACHESIZE)
	if err != nil {
		t.Fatal(err)
	}
	return f
}