Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose MappedByteBuffer#force() #6

Open
tomfitzhenry opened this issue Apr 18, 2017 · 2 comments
Open

Expose MappedByteBuffer#force() #6

tomfitzhenry opened this issue Apr 18, 2017 · 2 comments

Comments

@tomfitzhenry
Copy link

Good day MrWilson,

For applications that aspire to be less... dirty, it'd be useful to be able to msync, via MappedByteBuffer#force(). Is this reasonable or outside the scope of java-dirty?

Regards,
tom

@mrwilson
Copy link
Owner

mrwilson commented Apr 19, 2017

Hi Tom,

Under the hood, java-dirty uses multiple MappedByteBuffers as partitions.

It feels like the safest way to implement Store#force() would be to lock the store against writes (but not reads), then force all of them - something along the lines of below.

public void force() {
  lock.acquire();
  partitions.forEach(MappedByteBuffer::force);
  lock.release();
}

@tomfitzhenry
Copy link
Author

Ah, I hadn't noticed partitions. That seems a reasonable safe way to do it, though I no longer have this requirement as I'm no longer looking at java-dirty. I'm looking at other DBs due to additional requirements (persisted indexes).

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

No branches or pull requests

2 participants