forked from dlang/cdcdb
		
	Сжатие для БД вынесено в параметр
This commit is contained in:
		
							parent
							
								
									8a9142234e
								
							
						
					
					
						commit
						d93dc4d81b
					
				
					 3 changed files with 103 additions and 24 deletions
				
			
		
							
								
								
									
										17
									
								
								test/app.d
									
										
									
									
									
								
							
							
						
						
									
										17
									
								
								test/app.d
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -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);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue