"Memset-esque" Update #12
-
Are there any plans to implement "memset-esque" update functionality, where I could write a given length of bytes at a given offset? Avoiding the need to pull the whole value out of memory and then write the whole thing back? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
No. Internally we use MVCC to implement snapshot isolation, and the mechanisms we use assume a put operation replaces the existing value. That said, there is a way to logically implement what you want using the HSE API, assuming a degree of structure to the values you are storing. Consider a value with K logical components that you need to update individually. You can store each component of the value individually with keys of the form (ID, COMP), where ID uniquely identifies the value, and COMP is the logical component number (e.g., 0 through K-1). In this case, ID is the key prefix, and the KVS storing the KV pairs has a pfx_len=sizeof(ID). You can initially store the value atomically using K puts inside of a transaction. Later, you can atomically update from 1 to K components of the value by again using 1 to K puts inside a transaction. Similarly, you can atomically read from 1 to K components of the value by using 1 to K gets inside a transaction. Finally, you can atomically delete all components of the value using a single prefix delete operation. |
Beta Was this translation helpful? Give feedback.
No. Internally we use MVCC to implement snapshot isolation, and the mechanisms we use assume a put operation replaces the existing value.
That said, there is a way to logically implement what you want using the HSE API, assuming a degree of structure to the values you are storing.
Consider a value with K logical components that you need to update individually. You can store each component of the value individually with keys of the form (ID, COMP), where ID uniquely identifies the value, and COMP is the logical component number (e.g., 0 through K-1). In this case, ID is the key prefix, and the KVS storing the KV pairs has a pfx_len=sizeof(ID).
You can initially store the value atomically u…