/// <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(InternedBlobRef key, ulong subkey, ReadOnlySpan <byte> value)
 {
     fixed(byte *bytes = value)
     {
         PInvoke_PutBytes(handle, key.handle, subkey, bytes, value.Length);
     }
 }
 /// <summary>
 /// Indicates whether the current object references the same interned data as the provided <see cref="InternedBlobRef"/>.
 /// </summary>
 /// <param name="other">A <see cref="InternedBlobRef"/> object to compare with this object.</param>
 /// <returns>true if the current object is equal to the other parameter (references the same interned data);
 /// otherwise, false.</returns>
 public bool Equals(InternedBlobRef other)
 {
     return(handle == other.handle);
 }
 /// <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(InternedBlobRef 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(InternedBlobRef, 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(InternedBlobRef)"/>
 /// if you want to insert any subkeys within the same transaction.</remarks>
 public void Delete(InternedBlobRef 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(InternedBlobRef key, ulong subkey)
 {
     PInvoke_DeleteSubkey(handle, key.handle, subkey);
 }
 /// <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(InternedBlobRef key, ulong subkey, BlobRef value)
 {
     PInvoke_Put(handle, key.handle, subkey, value.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(InternedBlobRef key, ulong subkey, ulong requiredVersion)
 {
     PInvoke_RequireVersion(handle, key.handle, subkey, requiredVersion);
 }
 /// <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(InternedBlobRef key, ulong requiredSubkeysCount)
 {
     PInvoke_RequireSubkeysCount(handle, key.handle, requiredSubkeysCount);
 }
Example #9
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(InternedBlobRef key, ulong subkey)
 {
     throw new NotImplementedException();
 }
 /// <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(InternedBlobRef key, ulong subkey, BlobRef requiredValue)
 {
     PInvoke_RequireValue(handle, key.handle, subkey, requiredValue.handle);
 }
Example #11
0
 /// <summary>
 /// Returns true if the {key:subkey} pair exists in this snapshot.
 /// </summary>
 public bool Contains(InternedBlobRef key, ulong subkey)
 {
     return(PInvoke_Contains(handle, key.handle, subkey));
 }
Example #12
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(InternedBlobRef key)
 {
     return(PInvoke_GetSubkeysCount(handle, key.handle));
 }
Example #13
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(InternedBlobRef key)
 {
     throw new NotImplementedException();
 }
Example #14
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(InternedBlobRef key, ulong subkey, out ReadOnlySpan <byte> readOnlySpan)
 {
     throw new NotImplementedException();
 }
Example #15
0
 /// <summary>
 /// Indicates whether the current object references the same internal data as the provided <see cref="InternedBlobRef"/>.
 /// </summary>
 /// <param name="other">A <see cref="InternedBlobRef"/> object to compare with this object.</param>
 /// <returns>true if the current object references the same interned data; otherwise, false.</returns>
 public bool Equals(InternedBlobRef other)
 {
     // Blobs are interned, so just comparing handles is enough.
     return(handle == other.handle);
 }