summaryrefslogtreecommitdiff
path: root/notes/misclibs/io.lh
blob: 77678dc03cf36a4a3779d3e5b509586e80048360 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27



# FIXME cannot do placement alloc of private types
type File = private

func create_atomic(rwref File base, ref String filename) alloc File
func create_shared(rwref File base, ref String filename) alloc File
func open_read(rwref File base, ref String filename) alloc File
func open_append(rwref File base, ref String filename) alloc File
func open_overwrite(rwref File base, ref String filename) alloc File
func open_readwrite(rwref File base, ref String filename) alloc File

func close(rwref File file)
func close_free(dealloc rwref File file)
func flush_async(rwref File file)
func flush_sync(rwref File file)
func sync(rwref File file) returns SomeKindOfStatus

# for files created with create_atomic
func close_commit(dealloc rwref File file)
func close_cancel(dealloc rwref File file)
func commit(rwref File file)

func read_async(offset offs, size length)
# can we prevent the caller from modifying the data during the write operation?
# needs a new "takeown" keyword? because we want to allow "data" to be on the stack
func write_async(offset offs, size length, ref [length]byte data)