-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathNativeStructs.cs
More file actions
109 lines (102 loc) · 3.01 KB
/
Copy pathNativeStructs.cs
File metadata and controls
109 lines (102 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// Copyright (C) TidesDB
//
// Original Author: Alex Gaetano Padula
//
// Licensed under the Mozilla Public License, v. 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.mozilla.org/en-US/MPL/2.0/
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Runtime.InteropServices;
namespace TidesDB.Native;
[StructLayout(LayoutKind.Sequential)]
internal struct NativeConfig
{
public nint DbPath;
public int NumFlushThreads;
public int NumCompactionThreads;
public int LogLevel;
public nuint BlockCacheSize;
public nuint MaxOpenSstables;
public nuint MaxMemoryUsage;
public int LogToFile;
public nuint LogTruncationAt;
}
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct NativeColumnFamilyConfig
{
public fixed byte Name[128];
public nuint WriteBufferSize;
public nuint LevelSizeRatio;
public int MinLevels;
public int DividingLevelOffset;
public nuint KlogValueThreshold;
public int CompressionAlgo;
public int EnableBloomFilter;
public double BloomFpr;
public int EnableBlockIndexes;
public int IndexSampleRatio;
public int BlockIndexPrefixLen;
public int SyncMode;
public ulong SyncIntervalUs;
public fixed byte ComparatorName[64];
public fixed byte ComparatorCtxStr[256];
public nint ComparatorFnCached;
public nint ComparatorCtxCached;
public int SkipListMaxLevel;
public float SkipListProbability;
public int DefaultIsolationLevel;
public ulong MinDiskSpace;
public int L1FileCountTrigger;
public int L0QueueStallThreshold;
public int UseBtree;
public nint CommitHookFn;
public nint CommitHookCtx;
}
[StructLayout(LayoutKind.Sequential)]
internal struct NativeCommitOp
{
public nint Key;
public nuint KeySize;
public nint Value;
public nuint ValueSize;
public long Ttl;
public int IsDelete;
}
[StructLayout(LayoutKind.Sequential)]
internal struct NativeStats
{
public int NumLevels;
public nuint MemtableSize;
public nint LevelSizes;
public nint LevelNumSstables;
public nint LevelKeyCounts;
public nint Config;
public ulong TotalKeys;
public ulong TotalDataSize;
public double AvgKeySize;
public double AvgValueSize;
public double ReadAmp;
public double HitRate;
public int UseBtree;
public ulong BtreeTotalNodes;
public uint BtreeMaxHeight;
public double BtreeAvgHeight;
}
[StructLayout(LayoutKind.Sequential)]
internal struct NativeCacheStats
{
public int Enabled;
public nuint TotalEntries;
public nuint TotalBytes;
public ulong Hits;
public ulong Misses;
public double HitRate;
public nuint NumPartitions;
}