tpie
tpie copied to clipboard
Change file_stream::open() to accepting a bit mask of flags
Currently, file_stream::open accepts three enumeration valued parameters: read/write, sequential/random access, compressed/uncompressed.
We should probably switch to a typesafe bitmask to save us from a horrible mess in the future.
I have pushed branch open_flags
which implements this.
Comments?
I think the default flag value should be zero. The Linux syscall open(2) has O_RDONLY = 0, O_WRONLY = 1 and O_RDWR = 2, and other flags only for non-default behaviors.
Thus I think read_write
, access_sequential
and compression_none
should correspond to zeros in the file_stream.open API, and I'm considering if we should just drop the identifiers altogether -- instead specifying that read/write, optimizing for sequential access and no compression are the defaults, and the user should specify otherwise to get a different behavior.
Seems to have been closed in 71567f02f9f3adc194ac0d1c17b78d2584f2dc65 .