/// <summary>
 /// Instructs the transaction to write the value to the subkey of the key.
 /// </summary>
 /// <remarks>The effect of any previous Put() or Delete() calls on the same subkey
 /// within this transaction will be overwritten by this call.
 /// When the transaction is applied, the new value will overwrite any previous
 /// value that this subkey had (or insert it if it was missing).</remarks>
 public unsafe void Put(KeyRef key, ulong subkey, ReadOnlySpan <byte> value)
 {
     fixed(byte *bytes = value)
     {
         PInvoke_PutBytes(handle, key.handle, subkey, bytes, value.Length);
     }
 }
 /// <summary>
 /// Instructs the transaction to check that the subkey is present before
 /// applying the transaction. The transaction will fail if the subkey is missing.
 /// </summary>
 /// <remarks>The effect of any previous Require* call on the same subkey
 /// within this transaction will be overwritten by this call.</remarks>
 public void RequirePresentSubkey(KeyRef key, ulong subkey)
 {
     PInvoke_RequirePresentSubkey(handle, key.handle, subkey);
 }
 /// <summary>
 /// Instructs the transaction to delete all subkeys of the key.
 /// </summary>
 /// <remarks>The effect of any previous Put() or Delete() calls on the same key
 /// within this transaction will be overwritten by this call.
 ///
 /// Note that this marks the whole key for deletion, and the exact number
 /// of affected subkeys is only known only when the transaction is applied.
 ///
 /// Use it to safely delete the key instead of calling <see cref="Delete(KeyRef, ulong)"/>
 /// on individual subkeys when this is the intended effect.
 ///
 /// You can call <see cref="Put"/> for the same key after calling <see cref="Delete(KeyRef)"/>
 /// if you want to insert any subkeys within the same transaction.</remarks>
 public void Delete(KeyRef key)
 {
     PInvoke_DeleteKey(handle, key.handle);
 }
 /// <summary>
 /// Instructs the transaction to delete the subkey of the key.
 /// </summary>
 /// <remarks>The effect of any previous Put() or Delete() calls on the same subkey
 /// within this transaction will be overwritten by this call.</remarks>
 public void Delete(KeyRef key, ulong subkey)
 {
     PInvoke_DeleteSubkey(handle, key.handle, subkey);
 }
 /// <summary>
 /// Instructs the transaction to check that the number of subkeys of the key
 /// is equal to the provided number.
 /// The transaction will fail if the number of subkeys is different.
 /// </summary>
 /// <remarks>Any number is allowed, including 0 (to require that the entire key is missing).
 /// The effect of any previous Require* call on the same subkey
 /// within this transaction will be overwritten by this call.</remarks>
 public void RequireSubkeysCount(KeyRef key, ulong requiredSubkeysCount)
 {
     PInvoke_RequireSubkeysCount(handle, key.handle, requiredSubkeysCount);
 }
 /// <summary>
 /// Instructs the transaction to write the value to the subkey of the key.
 /// </summary>
 /// <remarks>The effect of any previous Put() or Delete() calls on the same subkey
 /// within this transaction will be overwritten by this call.
 /// When the transaction is applied, the new value will overwrite any previous
 /// value that this subkey had (or insert it if it was missing).</remarks>
 public void Put(KeyRef key, ulong subkey, ValueRef value)
 {
     PInvoke_Put(handle, key.handle, subkey, value.handle);
 }
 /// <summary>
 /// Instructs the transaction to check that the subkey has the provided value before
 /// applying the transaction.
 /// The transaction will fail if the value is different, or the subkey is missing.
 /// </summary>
 /// <remarks>The effect of any previous Require* call on the same subkey
 /// within this transaction will be overwritten by this call.</remarks>
 public void RequireValue(KeyRef key, ulong subkey, ValueRef requiredValue)
 {
     PInvoke_RequireValue(handle, key.handle, subkey, requiredValue.handle);
 }
 /// <summary>
 /// Instructs the transaction to check that the subkey has the provided version before
 /// applying the transaction.
 /// The transaction will fail if the version is different, or the subkey is missing.
 /// </summary>
 /// <remarks>The effect of any previous Require* call on the same subkey
 /// within this transaction will be overwritten by this call.</remarks>
 public void RequireVersion(KeyRef key, ulong subkey, ulong requiredVersion)
 {
     PInvoke_RequireVersion(handle, key.handle, subkey, requiredVersion);
 }
 /// <summary>
 /// Indicates whether the current object references the same key as the provided <see cref="KeyRef"/>.
 /// </summary>
 /// <param name="other">A <see cref="KeyRef"/> object to compare with this object.</param>
 /// <returns>true if the current object is equal to the other parameter (references the same key);
 /// otherwise, false.</returns>
 public bool Equals(KeyRef other)
 {
     return(handle == other.handle);
 }
 /// <summary>
 /// Instructs the transaction to check that the subkey is missing before
 /// applying the transaction. The transaction will fail if the subkey is present.
 /// </summary>
 /// <remarks>The effect of any previous Require* call on the same subkey
 /// within this transaction will be overwritten by this call.</remarks>
 public void RequireMissingSubkey(KeyRef key, ulong subkey)
 {
     PInvoke_RequireMissingSubkey(handle, key.handle, subkey);
 }
Exemple #11
0
 /// <summary>
 /// Returns the snapshot of the <paramref name="subkey"/> associated with the provided <paramref name="key"/>.
 /// </summary>
 /// <returns><see cref="SubkeySnapshot"/> object representing the state of the subkey.
 /// If the subkey doesn't exist in this snapshot, the returned <see cref="SubkeySnapshot"/> will be without a value.
 /// Use <see cref="SubkeySnapshot.HasValue"/> to check whether the subkey was found.</returns>
 public SubkeySnapshot TryGetValue(KeyRef key, ulong subkey)
 {
     throw new NotImplementedException();
 }
Exemple #12
0
 /// <summary>
 /// Returns true if the {key:subkey} pair exists in this snapshot.
 /// </summary>
 public bool Contains(KeyRef key, ulong subkey)
 {
     return(PInvoke_Contains(handle, key.handle, subkey));
 }
Exemple #13
0
 /// <summary>
 /// Returns the number of subkeys associated with the key in this snapshot, or 0 if the key is missing.
 /// </summary>
 public ulong GetSubkeysCount(KeyRef key)
 {
     return(PInvoke_GetSubkeysCount(handle, key.handle));
 }
Exemple #14
0
 /// <summary>
 /// Returns a <see cref="KeySnapshot"/> for the provided key.
 /// </summary>
 /// <remarks>The returned snapshot can be empty if the key doesn't exist in this snapshot.
 /// Use <see cref="KeySnapshot.SubkeysCount"/> to check if the key was found.</remarks>
 public KeySnapshot GetKey(KeyRef key)
 {
     throw new NotImplementedException();
 }
Exemple #15
0
 /// <summary>
 /// Sets <paramref name="readOnlySpan"/> to the current binary value of the subkey.
 /// </summary>
 /// <returns>True if the subkey was found, and the <paramref name="readOnlySpan"/> now contains its value.
 /// False otherwise (in this case <paramref name="readOnlySpan"/> will be empty).</returns>
 /// <remarks>Note that the method can return true while assigning an empty <paramref name="readOnlySpan"/>,
 /// in case if the subkey exists, but its value is empty. Do not use the emptiness of the span
 /// as an indication of a successful search.</remarks>
 public bool TryGetValue(KeyRef key, ulong subkey, out ReadOnlySpan <byte> readOnlySpan)
 {
     throw new NotImplementedException();
 }