(filename string)
| 114 | } |
| 115 | |
| 116 | func OpenDataFile(filename string) (*DataFile, error) { |
| 117 | file, err := os.OpenFile(filename, os.O_RDWR, 0755) |
| 118 | if err != nil { |
| 119 | return nil, err |
| 120 | } |
| 121 | dataFile := &DataFile{ |
| 122 | file: file, |
| 123 | } |
| 124 | return dataFile, dataFile.readHeader() |
| 125 | } |
| 126 | |
| 127 | func (df *DataFile) Contains(chunkIdx uint64) bool { |
| 128 | return chunkIdx >= df.chunkIdxStart && chunkIdx < df.ChunkIdxEnd() |