-
Notifications
You must be signed in to change notification settings - Fork 41
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
transactions supported ? #1
Comments
Hi @barry-bvl, As far as I know, you can do transactions with the batch mode: using var batch = new WriteBatch();
batch.Put(key1, bytes1, myDbFamily1);
batch.Put(key2, bytes2, myDbFamily2);
batch.Put(key3, bytes3, myDbFamily3);
DB.Write(batch); Is this the use-case you had in mind? |
Thx for the reply but I was looking for something more then the writebatch (which I was aware that this was available, and this gives you under the hood in deed some kind of atomicity/transaction). |
Ah I missed the part where you're also reading in the code - then yes WriteBatch won't do it... If you want to extend the current C# API with support for this, happy to incorporate the changes in a PR |
I've added basic transaction support in a PR just now, hopefully we can get this built in :) |
Do you have any updates? It seems that #47 implemented this issue, but any comment is not in there. Is there any problem with hanging PR? |
Just want to check if transactions in RocksDb are supported by the C# library?
I saw it was possible in the c++ API but I did not see it immediately in the C# library but maybe I overlooked something.
The only way I think I could do it is using the low level bindings.
something like the following (just some hack example)
public static void TryTranscation()
{
IntPtr options = Native.Instance.rocksdb_options_create();
Native.Instance.rocksdb_options_set_create_if_missing(options,true);
IntPtr transactionDbOptions = Native.Instance.rocksdb_transactiondb_options_create();
var txDb = Native.Instance.rocksdb_transactiondb_open(options,transactionDbOptions,(IntPtr)Marshal.StringToHGlobalAnsi("F:\tryout\rocksdb"),out IntPtr error);
Debug.Assert(error == IntPtr.Zero);
The text was updated successfully, but these errors were encountered: