void run() { create(); ASSERT( nsd() ); ASSERT_EQUALS( 0, nRecords() ); ASSERT( nsd()->firstExtent == nsd()->capExtent ); DiskLoc initial = DiskLoc(); initial.setInvalid(); ASSERT( initial == nsd()->capFirstNewRecord ); }
void run() { create(); ASSERT( nsd() ); ASSERT_EQUALS( 0, nRecords() ); ASSERT( nsd()->firstExtent() == nsd()->capExtent() ); RecordId initial = RecordId(); initial.setInvalid(); ASSERT( initial == nsd()->capFirstNewRecord() ); }
void run() { DurTransaction txn; create(); ASSERT( nsd()->isCapped() ); ASSERT( !nsd()->isUserFlagSet( NamespaceDetails::Flag_UsePowerOf2Sizes ) ); StatusWith<DiskLoc> result = collection()->insertDocument( &txn, docForRecordSize( 300 ), false ); ASSERT( result.isOK() ); Record* record = collection()->getRecordStore()->recordFor( result.getValue() ); // Check that no quantization is performed. ASSERT_EQUALS( 300, record->lengthWithHeaders() ); }
int nRecords() const { int count = 0; for ( DiskLoc i = nsd()->firstExtent; !i.isNull(); i = i.ext()->xnext ) { int fileNo = i.ext()->firstRecord.a(); if ( fileNo == -1 ) continue; for ( int j = i.ext()->firstRecord.getOfs(); j != DiskLoc::NullOfs; j = DiskLoc( fileNo, j ).rec()->nextOfs ) { ++count; } } ASSERT_EQUALS( count, nsd()->nrecords ); return count; }
virtual void prepare() { nsd()->capExtent = nsd()->firstExtent.ext()->xnext; insert( nsd()->capExtent, 0 ); insert( nsd()->lastExtent, 1 ); insert( nsd()->firstExtent, 2 ); nsd()->capFirstNewRecord = insert( nsd()->capExtent, 3 ); insert( nsd()->capExtent, 4 ); }
virtual void prepare() { nsd()->capExtent().writing() = nsd()->firstExtent().ext()->xnext; insert( nsd()->capExtent(), 0 ); insert( nsd()->lastExtent(), 1 ); insert( nsd()->firstExtent(), 2 ); nsd()->capFirstNewRecord().writing() = insert( nsd()->capExtent(), 3 ); insert( nsd()->capExtent(), 4 ); }
virtual ~Base() { if ( !nsd() ) return; string s( ns() ); string errmsg; BSONObjBuilder result; dropCollection( s, errmsg, result ); }
virtual void prepare() { nsd()->capExtent.writing() = nsd()->lastExtent; insert( nsd()->capExtent, 0 ); insert( nsd()->firstExtent, 1 ); nsd()->capFirstNewRecord.writing() = insert( nsd()->capExtent, 2 ); insert( nsd()->capExtent, 3 ); }
int nExtents() const { int count = 0; for ( DiskLoc extLoc = nsd()->firstExtent(); !extLoc.isNull(); extLoc = extentManager()->getExtent(extLoc)->xnext ) { ++count; } return count; }
int nRecords() const { int count = 0; const Extent* ext; for ( DiskLoc extLoc = nsd()->firstExtent(); !extLoc.isNull(); extLoc = ext->xnext) { ext = extentManager()->getExtent(extLoc); int fileNo = ext->firstRecord.a(); if ( fileNo == -1 ) continue; for ( int recOfs = ext->firstRecord.getOfs(); recOfs != DiskLoc::NullOfs; recOfs = recordStore()->recordFor(DiskLoc(fileNo, recOfs))->nextOfs() ) { ++count; } } ASSERT_EQUALS( count, nsd()->numRecords() ); return count; }
virtual ~Base() { if ( !nsd() ) return; _context.db()->dropCollection( ns() ); }
virtual ~Base() { if ( !nsd() ) return; string n( ns() ); dropNS( n ); }
virtual void prepare() { insert( nsd()->capExtent, 0 ); insert( nsd()->lastExtent, 1 ); nsd()->capFirstNewRecord = insert( nsd()->capExtent, 2 ); insert( nsd()->capExtent, 3 ); }
virtual void prepare() { nsd()->capFirstNewRecord = insert( nsd()->capExtent, 0 ); insert( nsd()->capExtent, 1 ); }
virtual void prepare() { nsd()->capFirstNewRecord = DiskLoc(); }
Zlomek(unsigned c, unsigned j): c(c), j(j) { nsd(); }
virtual void prepare() { nsd()->writingWithExtra()->capFirstNewRecord() = DiskLoc(); }
virtual void prepare() { nsd()->writingWithExtra()->capFirstNewRecord() = insert( nsd()->capExtent(), 0 ); }
virtual void prepare() { DiskLoc x = insert( nsd()->capExtent(), 0 ); nsd()->writingWithExtra()->capFirstNewRecord() = x; insert( nsd()->capExtent(), 1 ); }
virtual ~Base() { DurTransaction txn; if ( !nsd() ) return; _context.db()->dropCollection( &txn, ns() ); }
void RepeatWorkerFactory::init() { QList<PortDescriptor*> p; QList<Attribute*> a; { Descriptor id(BasePorts::IN_SEQ_PORT_ID(), RepeatWorker::tr("Input sequences"), RepeatWorker::tr("A nucleotide sequence to search repeats in.")); Descriptor od(BasePorts::OUT_ANNOTATIONS_PORT_ID(), RepeatWorker::tr("Repeat annotations"), RepeatWorker::tr("A set of annotations marking repeats found in the sequence.")); QMap<Descriptor, DataTypePtr> inM; inM[BaseSlots::DNA_SEQUENCE_SLOT()] = BaseTypes::DNA_SEQUENCE_TYPE(); p << new PortDescriptor(id, DataTypePtr(new MapDataType("repeat.seq", inM)), true /*input*/); QMap<Descriptor, DataTypePtr> outM; outM[BaseSlots::ANNOTATION_TABLE_SLOT()] = BaseTypes::ANNOTATION_TABLE_TYPE(); p << new PortDescriptor(od, DataTypePtr(new MapDataType("repeat.annotations", outM)), false /*input*/, true /*multi*/); } { Descriptor nd(NAME_ATTR, RepeatWorker::tr("Annotate as"), RepeatWorker::tr("Name of the result annotations marking found repeats.")); Descriptor idd(IDENTITY_ATTR, RepeatWorker::tr("Identity"), RepeatWorker::tr("Repeats identity.")); Descriptor ld(LEN_ATTR, RepeatWorker::tr("Min length"), RepeatWorker::tr("Minimum length of repeats.")); Descriptor mid(MIN_DIST_ATTR, RepeatWorker::tr("Min distance"), RepeatWorker::tr("Minimum distance between repeats.")); Descriptor mad(MAX_DIST_ATTR, RepeatWorker::tr("Max distance"), RepeatWorker::tr("Maximum distance between repeats.")); Descriptor ind(INVERT_ATTR, RepeatWorker::tr("Inverted"), RepeatWorker::tr("Search for inverted repeats.")); Descriptor nsd(NESTED_ATTR, RepeatWorker::tr("Filter algorithm"), RepeatWorker::tr("Filter repeats algorithm.")); Descriptor ald(ALGO_ATTR, RepeatWorker::tr("Algorithm"), RepeatWorker::tr("Control over variations of algorithm.")); Descriptor thd(THREADS_ATTR, RepeatWorker::tr("Parallel threads"), RepeatWorker::tr("Number of parallel threads used for the task.")); Descriptor tan(TANMEDS_ATTR, RepeatWorker::tr("Exclude tandems"), RepeatWorker::tr("Exclude tandems areas before find repeat task is run.")); Descriptor umaxd(USE_MAX_DISTANCE_ATTR, RepeatWorker::tr("Apply 'Max distance' attribute"), RepeatWorker::tr("Apply 'Max distance' attribute.")); Descriptor umind(USE_MIN_DISTANCE_ATTR, RepeatWorker::tr("Apply 'Min distance' attribute"), RepeatWorker::tr("Apply 'Max distance' attribute.")); FindRepeatsTaskSettings cfg = FindRepeatsDialog::defaultSettings(); Attribute *aa; a << new Attribute(nd, BaseTypes::STRING_TYPE(), true, "repeat_unit"); aa = new Attribute(ld, BaseTypes::NUM_TYPE(), false); aa->setAttributeValue(cfg.minLen); a << aa; aa = new Attribute(idd, BaseTypes::NUM_TYPE(), false); aa->setAttributeValue(cfg.getIdentity()); a << aa; a << new Attribute(umind, BaseTypes::BOOL_TYPE(), false, true); aa = new Attribute(mid, BaseTypes::NUM_TYPE(), false); aa->setAttributeValue(cfg.minDist); aa->addRelation(new VisibilityRelation(USE_MIN_DISTANCE_ATTR, true)); a << aa; a << new Attribute(umaxd, BaseTypes::BOOL_TYPE(), false, true); aa = new Attribute(mad, BaseTypes::NUM_TYPE(), false); aa->setAttributeValue(cfg.maxDist); aa->addRelation(new VisibilityRelation(USE_MAX_DISTANCE_ATTR, true)); a << aa; aa = new Attribute(ind, BaseTypes::BOOL_TYPE(), false); aa->setAttributeValue(cfg.inverted); a << aa; aa = new Attribute(nsd, BaseTypes::NUM_TYPE(), false); aa->setAttributeValue(cfg.filter); a << aa; aa = new Attribute(ald, BaseTypes::NUM_TYPE(), false); aa->setAttributeValue(cfg.algo); a << aa; aa = new Attribute(thd, BaseTypes::NUM_TYPE(), false); aa->setAttributeValue(cfg.nThreads); a << aa; aa = new Attribute(tan, BaseTypes::BOOL_TYPE(), false); aa->setAttributeValue(cfg.excludeTandems); a << aa; } Descriptor desc(ACTOR_ID, RepeatWorker::tr("Find Repeats"), RepeatWorker::tr("Finds repeats in each supplied sequence, stores found regions as annotations.") ); ActorPrototype* proto = new IntegralBusActorPrototype(desc, p, a); QMap<QString, PropertyDelegate*> delegates; delegates[USE_MIN_DISTANCE_ATTR] = new ComboBoxWithBoolsDelegate(); delegates[USE_MAX_DISTANCE_ATTR] = new ComboBoxWithBoolsDelegate(); { QVariantMap m; m["minimum"] = 0; m["maximum"] = INT_MAX; m["suffix"] = L10N::suffixBp(); delegates[MIN_DIST_ATTR] = new SpinBoxDelegate(m); m["specialValueText"] = RepeatWorker::tr("Any"); delegates[MAX_DIST_ATTR] = new SpinBoxDelegate(m); m["minimum"] = 2; delegates[LEN_ATTR] = new SpinBoxDelegate(m); } { QVariantMap m; m["minimum"] = 50; m["maximum"] = 100; m["suffix"] = "%"; delegates[IDENTITY_ATTR] = new SpinBoxDelegate(m); } { QVariantMap m; m["specialValueText"] = "Auto"; delegates[THREADS_ATTR] = new SpinBoxDelegate(m); } { QVariantMap m; m["Auto"] = RFAlgorithm_Auto; m["Diagonals"] = RFAlgorithm_Diagonal; m["Suffix index"] = RFAlgorithm_Suffix; delegates[ALGO_ATTR] = new ComboBoxDelegate(m); } { QVariantMap m; m["Disjoint repeats"] = DisjointRepeats; m["No filtering"] = NoFiltering; m["Unique repeats"] = UniqueRepeats; delegates[NESTED_ATTR] = new ComboBoxDelegate(m); } proto->setPrompter(new RepeatPrompter()); proto->setEditor(new DelegateEditor(delegates)); proto->setIconPath(":repeat_finder/images/repeats.png"); WorkflowEnv::getProtoRegistry()->registerProto(BaseActorCategories::CATEGORY_BASIC(), proto); DomainFactory* localDomain = WorkflowEnv::getDomainRegistry()->getById(LocalDomainFactory::ID); localDomain->registerEntry(new RepeatWorkerFactory()); }
virtual void prepare() { insert( nsd()->capExtent(), 0 ); nsd()->capFirstNewRecord().writing() = insert( nsd()->capExtent(), 1 ); insert( nsd()->capExtent(), 2 ); }
int nExtents() const { int count = 0; for ( DiskLoc i = nsd()->firstExtent; !i.isNull(); i = i.ext()->xnext ) ++count; return count; }
void run() { create(); nsd()->deletedListEntry( 2 ) = nsd()->cappedListOfAllDeletedRecords().drec()->nextDeleted().drec()->nextDeleted(); nsd()->cappedListOfAllDeletedRecords().drec()->nextDeleted().drec()->nextDeleted().writing() = DiskLoc(); nsd()->cappedLastDelRecLastExtent().Null(); NamespaceDetails *d = nsd(); zero( &d->capExtent() ); zero( &d->capFirstNewRecord() ); // this has a side effect of called NamespaceDetails::cappedCheckMigrate db()->namespaceIndex().details( ns() ); ASSERT( nsd()->firstExtent() == nsd()->capExtent() ); ASSERT( nsd()->capExtent().getOfs() != 0 ); ASSERT( !nsd()->capFirstNewRecord().isValid() ); int nDeleted = 0; for ( DiskLoc i = nsd()->cappedListOfAllDeletedRecords(); !i.isNull(); i = i.drec()->nextDeleted(), ++nDeleted ); ASSERT_EQUALS( 10, nDeleted ); ASSERT( nsd()->cappedLastDelRecLastExtent().isNull() ); }
void run() { create(); nsd()->deletedList[ 2 ] = nsd()->deletedList[ 0 ].drec()->nextDeleted.drec()->nextDeleted; nsd()->deletedList[ 0 ].drec()->nextDeleted.drec()->nextDeleted = DiskLoc(); nsd()->deletedList[ 1 ].Null(); NamespaceDetails *d = nsd(); zero( &d->capExtent ); zero( &d->capFirstNewRecord ); nsd(); ASSERT( nsd()->firstExtent == nsd()->capExtent ); ASSERT( nsd()->capExtent.getOfs() != 0 ); ASSERT( !nsd()->capFirstNewRecord.isValid() ); int nDeleted = 0; for ( DiskLoc i = nsd()->deletedList[ 0 ]; !i.isNull(); i = i.drec()->nextDeleted, ++nDeleted ); ASSERT_EQUALS( 10, nDeleted ); ASSERT( nsd()->deletedList[ 1 ].isNull() ); }
virtual ~Base() { OperationContextImpl txn; if ( !nsd() ) return; _context.db()->dropCollection( &txn, ns() ); }