Пример #1
0
func (md *mdRelation) NBlocks() (system.BlockNumber, error) {
	relpath := system.RelPath(md.node)

	fi, err := os.Stat(relpath)
	if err != nil {
		return 0, err
	}
	return system.BlockNumber(fi.Size() / int64(system.BlockSize)), nil
}
Пример #2
0
func (rel *HeapRelation) GetNumberOfBlocks() (system.BlockNumber, error) {
	relpath := system.RelPath(rel.RelNode)
	fi, err := os.Stat(relpath)
	if err != nil {
		return 0, err
	}
	size := fi.Size()
	if size%system.BlockSize != 0 {
		return 0, fmt.Errorf("size of %s = %d is not module BlockSize", size, relpath)
	}

	return system.BlockNumber(size / system.BlockSize), nil
}