daily update on 20240422 by nitload youmu, ssd structure improve

This commit is contained in:
YoumuLiu
2024-04-22 02:47:17 +08:00
parent 12345d8405
commit 0162d71d16
30 changed files with 708 additions and 331 deletions
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Data
{
public partial class Area
{
private static byte leastUnusedDisc;
public byte NewDisc(byte raidWith)
{
byte ret = leastUnusedDisc;
leastUnusedDisc++;
return ret;
}
public void ClearDiscIDBuffer()
{
leastUnusedDisc = 0;
}
private static int leastUnusedID;
public static int NewID()
{
int ret = leastUnusedID;
if (ret == int.MaxValue)
{
throw new ArgumentOutOfRangeException("Reaches max IDs that one ssd file can provide.");
}
leastUnusedID++;
return ret;
}
public static void ClearIDBuffer()
{
leastUnusedID = 1;
}
}
}
@@ -0,0 +1,27 @@
using StgSharp.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp
{
public static unsafe partial class StgSharp
{
private static SSD defaultIdProvider = new SSD();
private static List<Area> root = new List<Area>();
private static byte leastUnusedArea;
public static byte NewArea()
{
byte ret = leastUnusedArea;
leastUnusedArea++;
return ret;
}
}//------------------ end of class ---------------------
}