| 15 | |
| 16 | |
| 17 | class IndexedFileWriter(object): |
| 18 | def __init__(self, path): |
| 19 | self.f = open(path, 'wb') |
| 20 | self.index_f = open(path + '.index', 'wb') |
| 21 | |
| 22 | def append(self, record): |
| 23 | offset = self.f.tell() |
| 24 | self.f.write(record) |
| 25 | self.index_f.write(struct.pack('<Q', offset)) |
| 26 | |
| 27 | def close(self): |
| 28 | self.f.close() |
| 29 | self.index_f.close() |
| 30 | |
| 31 | |
| 32 | class IndexedFileReader(object): |
nothing calls this directly
no outgoing calls
no test coverage detected