public byte[] QueuePopFront(string alias) { using (var content = new qdb_buffer(_handle)) { var error = qdb_api.qdb_queue_pop_front(_handle, alias, out content.Pointer, out content.Size); QdbExceptionThrower.ThrowIfNeeded(error); return content.GetBytes(); } }
public byte[] BlobGetAndRemove(string alias) { using (var content = new qdb_buffer(_handle)) { var error = qdb_api.qdb_get_and_remove(_handle, alias, out content.Pointer, out content.Size); QdbExceptionThrower.ThrowIfNeeded(error); return content.GetBytes(); } }
public byte[] BlobGetAndUpdate(string alias, byte[] content, DateTime? expiryTime) { using (var oldContent = new qdb_buffer(_handle)) { var error = qdb_api.qdb_get_and_update(_handle, alias, content, (IntPtr)content.LongLength, qdb_time.FromOptionalDateTime(expiryTime), out oldContent.Pointer, out oldContent.Size); QdbExceptionThrower.ThrowIfNeeded(error); return oldContent.GetBytes(); } }
public byte[] BlobCompareAndSwap(string alias, byte[] content, byte[] comparand, DateTime? expiryTime) { using (var oldContent = new qdb_buffer(_handle)) { var error = qdb_api.qdb_compare_and_swap(_handle, alias, content, (IntPtr)content.LongLength, comparand, (IntPtr)comparand.LongLength, qdb_time.FromOptionalDateTime(expiryTime), out oldContent.Pointer, out oldContent.Size); switch (error) { case qdb_error.qdb_e_ok: return null; case qdb_error.qdb_e_unmatched_content: return oldContent.GetBytes(); default: throw QdbExceptionFactory.Create(error); } } }