forked from dlang/cdcdb
Обновлена схема БД - добавлены таблицы users, processes, files. Добавлен параметр Context с идентификацией пользователей и процесса. label сменен на file.
This commit is contained in:
parent
5bb4d65c92
commit
49ee7a4053
7 changed files with 289 additions and 168 deletions
18
test/app.d
18
test/app.d
|
@ -8,6 +8,18 @@ void main()
|
|||
// Создаем временную базу для примера
|
||||
string dbPath = "./bin/example.db";
|
||||
|
||||
if (exists(dbPath)) {
|
||||
remove(dbPath);
|
||||
}
|
||||
|
||||
Context context;
|
||||
|
||||
context.uid = 1000;
|
||||
context.ruid = 1001;
|
||||
context.uidName = "user1";
|
||||
context.ruidName = "user2";
|
||||
context.process = "mcedit";
|
||||
|
||||
// Инициализация Storage с компрессией Zstd
|
||||
auto storage = new Storage(dbPath, true, Level.speed);
|
||||
|
||||
|
@ -19,17 +31,17 @@ void main()
|
|||
ubyte[] data2 = cast(ubyte[]) "Hello, updated cdcdb!".dup;
|
||||
|
||||
// Создание первого снимка
|
||||
auto snap1 = storage.newSnapshot("example_file", data1, "Версия 1.0");
|
||||
auto snap1 = storage.newSnapshot("example_file", data1, context, "Версия 1.0");
|
||||
if (snap1)
|
||||
{
|
||||
writeln("Создан снимок с ID: ", snap1.id);
|
||||
writeln("Метка: ", snap1.label);
|
||||
writeln("Файл: ", snap1.file);
|
||||
writeln("Размер: ", snap1.length, " байт");
|
||||
writeln("Статус: ", snap1.status);
|
||||
}
|
||||
|
||||
// Создание второго снимка (обновление)
|
||||
auto snap2 = storage.newSnapshot("example_file", data2, "Версия 2.0");
|
||||
auto snap2 = storage.newSnapshot("example_file", data2, context, "Версия 2.0");
|
||||
if (snap2)
|
||||
{
|
||||
writeln("Создан обновленный снимок с ID: ", snap2.id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue