Skip to content

Blob.{Read,Write}At #36

Answered by zombiezen
anacrolix asked this question in Q&A
Jan 13, 2022 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

So the problem is in the specification of io.ReaderAt:

Clients of ReadAt can execute parallel ReadAt calls on the same input source.

This is emphatically not safe to do with *sqlite.Blob, even in the crawshaw implementation, so implementing those methods seemed like a footgun. I have thought about adding convenience functions that use the underlying API, but then the functions would be specific to *sqlite.Blob, so you can't use an interface like io.ReadWriteSeeker.

The Seek function is quite lightweight, since it only does bounds checks, so the only real cost is LOC in callers. For heavy Seek users, a custom wrapper at the caller seemed not unduly burdensome to me, so that's where I lan…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@anacrolix
Comment options

@zombiezen
Comment options

@anacrolix
Comment options

@zombiezen
Comment options

@anacrolix
Comment options

Answer selected by zombiezen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants