Checks if the archive is an add-type
Check if the filed archive is of type T
Checks the translate function get_type result in a remove-type
Checks if the archive type is a remove-type
Check if archive is a stub
Generates Document to be store in the BlockFile
Convert archive to a Document
The actual data strute stored
Stub hash-pointer used in sharding
Acrhive type
// Archive // import std.stdio; import std.format; import std.string : representation; import tagion.dart.DARTFakeNet; import tagion.hibon.HiBONJSON; auto net = new DARTFakeNet; auto manufactor = RecordFactory(net); static assert(isHiBONRecord!Archive); Document filed_doc; // This is the data which is filed in the DART { auto hibon = new HiBON; hibon["#text"] = "Some text"; filed_doc = Document(hibon); } immutable filed_doc_fingerprint = net.calcHash(filed_doc); immutable filed_doc_dart_index = net.dartIndex(filed_doc); Archive a; { // Simple archive a = new Archive(net, filed_doc); assert(a.fingerprint == filed_doc_fingerprint); assert(a.dart_index == filed_doc_dart_index); assert(a.filed == filed_doc); assert(a.type is Archive.Type.NONE); const archived_doc = a.toDoc; assert(archived_doc[Archive.archiveLabel].get!Document == filed_doc); const result_a = new Archive(net, archived_doc); assert(result_a.fingerprint == a.fingerprint); assert(a.dart_index == filed_doc_dart_index); assert(result_a.filed == a.filed); assert(result_a.type == a.type); assert(result_a.store == filed_doc); } a.changeType(Archive.Type.ADD); { // Simple archive with ADD/REMOVE Type // a=new Archive(net, filed_doc); assert(a.fingerprint == filed_doc_fingerprint); const archived_doc = a.toDoc; { // Same type const result_a = new Archive(net, archived_doc); assert(result_a.fingerprint == a.fingerprint); assert(result_a.filed == a.filed); assert(result_a.type == a.type); assert(result_a.store == filed_doc); } }
Archive element used in the DART Recorder