Archive

Archive element used in the DART Recorder

Constructors

this
this(HashNet net, const(Document) doc, Type t)
Undocumented in source.

Members

Enums

Type
enum Type
Undocumented in source.

Functions

dump
void dump(File fout)
Undocumented in source. Be warned that the author may not have intended to support it.
isAdd
bool isAdd()

Checks if the archive is an add-type

isRecord
bool isRecord()

Check if the filed archive is of type T

isRemove
bool isRemove(GetType get_type)

Checks the translate function get_type result in a remove-type

isRemove
bool isRemove()

Checks if the archive type is a remove-type

isStub
bool isStub()

Check if archive is a stub

store
const(Document) store()

Generates Document to be store in the BlockFile

toDoc
const(Document) toDoc()

Convert archive to a Document

toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.

Manifest constants

archiveLabel
enum archiveLabel;
Undocumented in source.
fingerprintLabel
enum fingerprintLabel;
Undocumented in source.
typeLabel
enum typeLabel;
Undocumented in source.

Mixins

__anonymous
mixin JSONString
Undocumented in source.

Variables

dart_index
const(DARTIndex) dart_index;
Undocumented in source.
filed
Document filed;

The actual data strute stored

fingerprint
const(Fingerprint) fingerprint;

Stub hash-pointer used in sharding

type
const(Type) type;

Acrhive type

Mixed In Members

From mixin JSONString

toString
void toString(void delegate(scope const(char)[]) @(safe) sink, FormatSpec!char fmt)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

// 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);
       }

   }

Meta