Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

ChunkStore::Writer::Close() should also commit the write #6

Closed
rafaelweinstein opened this issue Jun 25, 2015 · 2 comments
Closed

ChunkStore::Writer::Close() should also commit the write #6

rafaelweinstein opened this issue Jun 25, 2015 · 2 comments
Assignees

Comments

@rafaelweinstein
Copy link
Contributor

Currently, only ::Ref() commits the write. I believe this is different than other io.Writer impls in the Go stdlib. For example File will flush the write on Close (I think).

If this indeed a guarantee in other io.Writer impls, then it should be for us too. And then I guess we'd want an Abandon() method to actually abandon halfway through a write.

@cmasone-attic
Copy link
Contributor

As far as I can tell, the Closer interface doesn't guarantee that Close() flushes data. The File implementation looks to me like it just calls the underlying POSIX close() syscall, which ALSO makes no guarantees about data being flushed.

That said, I think that for our API usage, it makes sense to provide this guarantee, so I'm gonna look into doing it. We may add Abandon() as well if it makes sense, but skip it for now.

@cmasone-attic cmasone-attic self-assigned this Jul 7, 2015
cmasone-attic added a commit that referenced this issue Jul 7, 2015
In both FileStore and S3Store, the behavior of calling Ref() twice, or of
calling Ref() after Close() was undefined and probably crashy. After this,
the semantics are as follows:

Once either Ref() or Close() is called, you can't Write() any more.
Ref() can be called any number of times
Close() can be called any number of times
Ref() and Close() can be called in any order.

Addresses issue #6
@cmasone-attic
Copy link
Contributor

I think this does the things, now?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants