checkpoint

This commit is contained in:
2020-04-30 20:40:52 -04:00
parent 9aa367e9f5
commit abba062f4f
28 changed files with 615 additions and 544 deletions

View File

@@ -1,30 +1,15 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
namespace Foodsoft.Alpm
{
internal sealed class SafeCachePackageHandle : SafePackageHandle
{
internal SafeAlpmHandle SafeAlpmHandle
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[PrePrepareMethod]
get => SafeDatabaseHandle.SafeAlpmHandle;
}
internal SafeDatabaseHandle SafeDatabaseHandle
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[PrePrepareMethod]
get;
} = null!;
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
[PrePrepareMethod]
internal SafeCachePackageHandle(IntPtr ptr, SafeDatabaseHandle parentHandle)
: base()
: base(parentHandle.SafeAlpmHandle)
{
var success = false;
@@ -43,6 +28,15 @@ namespace Foodsoft.Alpm
if (!success) throw new ObjectDisposedException(GetType().FullName);
}
internal SafeDatabaseHandle SafeDatabaseHandle
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[PrePrepareMethod]
get;
} = null!;
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[PrePrepareMethod]
protected override bool ReleaseHandle()
{
SafeDatabaseHandle.DangerousRelease();