1
0
Fork 0
forked from dlang/cdcdb

Сжатие для БД вынесено в параметр

This commit is contained in:
Alexander Zhirov 2025-09-13 00:30:29 +03:00
parent 8a9142234e
commit d93dc4d81b
Signed by: alexander
GPG key ID: C8D8BE544A27C511
3 changed files with 103 additions and 24 deletions

View file

@ -2,11 +2,14 @@ import std.stdio;
import cdcdb;
import std.file : read;
import std.file : read, write;
import std.stdio : File, writeln;
import std.conv : to;
void main()
{
auto storage = new Storage("/tmp/base.db", true);
auto storage = new Storage("/tmp/base.db", true, 22);
storage.newSnapshot("/tmp/text", cast(ubyte[]) read("/tmp/text"));
// if (snapshot !is null) {
@ -14,11 +17,11 @@ void main()
// snapshot.remove();
// }
import std.stdio : writeln;
foreach (snapshot; storage.getSnapshots()) {
writeln(cast(string) snapshot.data);
auto file = File("/tmp/restore" ~ snapshot.id.to!string, "wb");
snapshot.data((const(ubyte)[] content) {
file.rawWrite(content);
});
file.close();
}
// writeln(cas.getVersion);
}