Recorder.find

Undocumented in source. Be warned that the author may not have intended to support it.
  1. Archive find(const(DARTIndex) dart_index)
  2. Archive find(const(Buffer) fingerprint)
    class Recorder

Examples

// Check find
           import tagion.crypto.SecureNet : StdHashNet;

           const hash_net = new StdHashNet;

           auto record_factory = RecordFactory(hash_net);
           Archive[DARTIndex] set_of_archives;
           foreach (i; 0 .. 7) {
               auto hibon = new HiBON;
               hibon["text"] = format("Some text %d", i);
               hibon["index"] = i;
               auto archive = new Archive(hash_net, Document(hibon));
               set_of_archives[archive.dart_index] = archive;
           }

           auto recorder = record_factory.recorder;

           // Check for an empty record
           assert(recorder.find(set_of_archives.byKey.front) is null);

           // Fill up the record with set_of_archives
           foreach (a; set_of_archives) {
               recorder.insert(a);
           }

           foreach (a; set_of_archives) {
               auto archive_found = recorder.find(a.dart_index);
               assert(archive_found);
               assert(archive_found is a);
           }

           { // None existing archive
               auto hibon = new HiBON;
               hibon["text"] = "Does not exist in the recoder";
               auto none_existing_archive = new Archive(hash_net, Document(hibon));
               assert(recorder.find(none_existing_archive.dart_index) is null);
           }

Meta