Skip to content

Commit 7d1d6bc

Browse files
author
MPCoreDeveloper
committed
major upgrade multi and single file support
1 parent a231644 commit 7d1d6bc

27 files changed

+1707
-64
lines changed

SingleFileTest.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using SharpCoreDB.Storage.Scdb;
2+
using System.Runtime.InteropServices;
3+
4+
class SingleFileTest
5+
{
6+
static void Main(string[] args)
7+
{
8+
Console.WriteLine("Testing SCDB Structures");
9+
10+
// Test ScdbFileHeader
11+
var header = ScdbFileHeader.CreateDefault(4096);
12+
Console.WriteLine($"Header magic: 0x{header.Magic:X16}");
13+
Console.WriteLine($"Header version: {header.FormatVersion}");
14+
Console.WriteLine($"Page size: {header.PageSize}");
15+
Console.WriteLine($"Header valid: {header.IsValid}");
16+
17+
// Test serialization
18+
Span<byte> buffer = stackalloc byte[(int)ScdbFileHeader.HEADER_SIZE];
19+
header.WriteTo(buffer);
20+
21+
var parsed = ScdbFileHeader.Parse(buffer);
22+
Console.WriteLine($"Parsed magic: 0x{parsed.Magic:X16}");
23+
Console.WriteLine($"Round-trip success: {header.Magic == parsed.Magic}");
24+
25+
// Test BlockEntry
26+
var entry = new BlockEntry
27+
{
28+
BlockType = (uint)BlockType.TableData,
29+
Offset = 4096,
30+
Length = 1024,
31+
Flags = (uint)BlockFlags.Dirty
32+
};
33+
34+
var namedEntry = BlockEntry.WithName("table:users:data", entry);
35+
var name = namedEntry.GetName();
36+
Console.WriteLine($"Block name: {name}");
37+
Console.WriteLine($"Block type: {namedEntry.BlockType}");
38+
Console.WriteLine($"Block offset: {namedEntry.Offset}");
39+
40+
Console.WriteLine("\n✅ SCDB structures test completed successfully!");
41+
}
42+
}

SingleFileTest.csproj

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net10.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
9+
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<Compile Include="SingleFileTest.cs" />
14+
<Compile Include="src\SharpCoreDB\Storage\Scdb\ScdbStructures.cs" />
15+
</ItemGroup>
16+
17+
</Project>

docs/SCDB_COMPILATION_FIXES.md

Whitespace-only changes.

docs/SCDB_COMPILATION_FIXES_NL.md

Whitespace-only changes.

docs/SCDB_IMPLEMENTATION_STATUS.md

Whitespace-only changes.

docs/SCDB_PHASE1_IMPLEMENTATION.md

Whitespace-only changes.

src/SharpCoreDB/Database/Core/Database.Core.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace SharpCoreDB;
1212

1313
using Microsoft.Extensions.DependencyInjection;
1414
using SharpCoreDB.Core.Cache;
15+
using SharpCoreDB.Storage;
1516
using System.Collections.Concurrent;
1617
using System.Security.Cryptography;
1718
using System.Text.Json;

0 commit comments

Comments
 (0)