-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathNativeMethods.g.cs
More file actions
133 lines (95 loc) · 6.88 KB
/
Copy pathNativeMethods.g.cs
File metadata and controls
133 lines (95 loc) · 6.88 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// <auto-generated>
// This code is generated by csbindgen.
// DON'T CHANGE THIS DIRECTLY.
// </auto-generated>
#pragma warning disable CS8500
#pragma warning disable CS8981
using System;
using System.Runtime.InteropServices;
namespace Redb
{
internal static unsafe partial class NativeMethods
{
const string __DllName = "libredb";
internal const int REDB_OK = 0;
internal const int REDB_ERROR_FILE_ERROR = 1;
internal const int REDB_ERROR_DATABASE_ALREADY_OPEN = 2;
internal const int REDB_ERROR_REPAIR_ABORTED = 3;
internal const int REDB_ERROR_UPGRADE_REQUIRED = 4;
internal const int REDB_ERROR_STORAGE_ERROR = 5;
internal const int REDB_ERROR_COMPACTION = 11;
internal const int REDB_ERROR_TABLE_TYPE_MISMATCH = 21;
internal const int REDB_ERROR_TABLE_IS_MULTIMAP = 22;
internal const int REDB_ERROR_TABLE_IS_NOT_MULTIMAP = 23;
internal const int REDB_ERROR_TYPE_DEFINITION_CHANGED = 24;
internal const int REDB_ERROR_TABLE_DOES_NOT_EXIST = 25;
internal const int REDB_ERROR_TABLE_EXISTS = 26;
internal const int REDB_ERROR_TABLE_ALREADY_OPEN = 27;
internal const int REDB_ERROR_READ_TRANSACTION_STILL_IN_USE = 41;
internal const int REDB_ERROR_KEY_NOT_FOUND = 100;
[DllImport(__DllName, EntryPoint = "redb_create_database", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_create_database(byte* path, redb_database_options* options, void** @out);
[DllImport(__DllName, EntryPoint = "redb_open_database", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_open_database(byte* path, void** @out);
[DllImport(__DllName, EntryPoint = "redb_compact_database", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_compact_database(void* db);
[DllImport(__DllName, EntryPoint = "redb_free_database", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern void redb_free_database(void* db);
[DllImport(__DllName, EntryPoint = "redb_free_table", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern void redb_free_table(void* table);
[DllImport(__DllName, EntryPoint = "redb_free_readonly_table", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern void redb_free_readonly_table(void* table);
[DllImport(__DllName, EntryPoint = "redb_free_write_transaction", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern void redb_free_write_transaction(void* tx);
[DllImport(__DllName, EntryPoint = "redb_free_read_transaction", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern void redb_free_read_transaction(void* tx);
[DllImport(__DllName, EntryPoint = "redb_free_string", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern void redb_free_string(byte* s);
[DllImport(__DllName, EntryPoint = "redb_free_blob", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern void redb_free_blob(byte* blob);
[DllImport(__DllName, EntryPoint = "redb_begin_write", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_begin_write(void* db, void** @out);
[DllImport(__DllName, EntryPoint = "redb_write_tx_set_durability", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_write_tx_set_durability(void* tx, redb_durability durability);
[DllImport(__DllName, EntryPoint = "redb_write_tx_set_quick_repair", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_write_tx_set_quick_repair(void* tx, [MarshalAs(UnmanagedType.U1)] bool quick_repair);
[DllImport(__DllName, EntryPoint = "redb_write_tx_set_two_phase_commit", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_write_tx_set_two_phase_commit(void* tx, [MarshalAs(UnmanagedType.U1)] bool two_phase_commit);
[DllImport(__DllName, EntryPoint = "redb_write_tx_open_table", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_write_tx_open_table(void* tx, byte* name, void** @out);
[DllImport(__DllName, EntryPoint = "redb_write_tx_delete_table", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_write_tx_delete_table(void* tx, byte* name);
[DllImport(__DllName, EntryPoint = "redb_write_tx_rename_table", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_write_tx_rename_table(void* tx, byte* old_name, byte* new_name);
[DllImport(__DllName, EntryPoint = "redb_write_tx_abort", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_write_tx_abort(void* tx);
[DllImport(__DllName, EntryPoint = "redb_write_tx_commit", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_write_tx_commit(void* tx);
[DllImport(__DllName, EntryPoint = "redb_insert", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_insert(void* table, byte* key, nuint key_len, byte* value, nuint value_len);
[DllImport(__DllName, EntryPoint = "redb_begin_read", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_begin_read(void* db, void** @out);
[DllImport(__DllName, EntryPoint = "redb_read_tx_open_table", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_read_tx_open_table(void* tx, byte* name, void** @out);
[DllImport(__DllName, EntryPoint = "redb_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_get(void* table, byte* key, nuint key_len, byte** blob, nuint* count);
[DllImport(__DllName, EntryPoint = "redb_table_len", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
internal static extern int redb_table_len(void* table, ulong* @out);
}
[StructLayout(LayoutKind.Sequential)]
internal unsafe partial struct redb_database_options
{
public nuint cache_size;
public redb_backend backend;
}
internal enum redb_backend : uint
{
File,
InMemory,
}
internal enum redb_durability : uint
{
None,
Immediate,
}
}