Exemplo n.º 1
0
 void run() {
     create();
     ASSERT( nsd() );
     ASSERT_EQUALS( 0, nRecords() );
     ASSERT( nsd()->firstExtent == nsd()->capExtent );
     DiskLoc initial = DiskLoc();
     initial.setInvalid();
     ASSERT( initial == nsd()->capFirstNewRecord );
 }
Exemplo n.º 2
0
 void run() {
     create();
     ASSERT( nsd() );
     ASSERT_EQUALS( 0, nRecords() );
     ASSERT( nsd()->firstExtent() == nsd()->capExtent() );
     RecordId initial = RecordId();
     initial.setInvalid();
     ASSERT( initial == nsd()->capFirstNewRecord() );
 }
Exemplo n.º 3
0
            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() );
            }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
 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 );
 }
Exemplo n.º 6
0
 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 );
 }
Exemplo n.º 7
0
 virtual ~Base() {
     if ( !nsd() )
         return;
     string s( ns() );
     string errmsg;
     BSONObjBuilder result;
     dropCollection( s, errmsg, result );
 }
Exemplo n.º 8
0
 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 );
 }
Exemplo n.º 9
0
 int nExtents() const {
     int count = 0;
     for ( DiskLoc extLoc = nsd()->firstExtent();
             !extLoc.isNull();
             extLoc = extentManager()->getExtent(extLoc)->xnext ) {
         ++count;
     }
     return count;
 }
Exemplo n.º 10
0
 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;
 }
Exemplo n.º 11
0
 virtual ~Base() {
     if ( !nsd() )
         return;
     _context.db()->dropCollection( ns() );
 }
Exemplo n.º 12
0
 virtual ~Base() {
     if ( !nsd() )
         return;
     string n( ns() );
     dropNS( n );
 }
Exemplo n.º 13
0
 virtual void prepare() {
     insert( nsd()->capExtent, 0 );
     insert( nsd()->lastExtent, 1 );
     nsd()->capFirstNewRecord = insert( nsd()->capExtent, 2 );
     insert( nsd()->capExtent, 3 );
 }
Exemplo n.º 14
0
 virtual void prepare() {
     nsd()->capFirstNewRecord = insert( nsd()->capExtent, 0 );
     insert( nsd()->capExtent, 1 );
 }
Exemplo n.º 15
0
 virtual void prepare() {
     nsd()->capFirstNewRecord = DiskLoc();
 }
Exemplo n.º 16
0
 Zlomek(unsigned c, unsigned j): c(c), j(j) { nsd(); }
Exemplo n.º 17
0
 virtual void prepare() {
     nsd()->writingWithExtra()->capFirstNewRecord() = DiskLoc();
 }
Exemplo n.º 18
0
 virtual void prepare() {
     nsd()->writingWithExtra()->capFirstNewRecord() = insert( nsd()->capExtent(), 0 );
 }
Exemplo n.º 19
0
 virtual void prepare() {
     DiskLoc x = insert( nsd()->capExtent(), 0 );
     nsd()->writingWithExtra()->capFirstNewRecord() = x;
     insert( nsd()->capExtent(), 1 );
 }
Exemplo n.º 20
0
 virtual ~Base() {
     DurTransaction txn;
     if ( !nsd() )
         return;
     _context.db()->dropCollection( &txn, ns() );
 }
Exemplo n.º 21
0
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());
}
Exemplo n.º 22
0
 virtual void prepare() {
     insert( nsd()->capExtent(), 0 );
     nsd()->capFirstNewRecord().writing() = insert( nsd()->capExtent(), 1 );
     insert( nsd()->capExtent(), 2 );
 }
Exemplo n.º 23
0
 int nExtents() const {
     int count = 0;
     for ( DiskLoc i = nsd()->firstExtent; !i.isNull(); i = i.ext()->xnext )
         ++count;
     return count;
 }
Exemplo n.º 24
0
            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() );
            }
Exemplo n.º 25
0
            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() );
            }
Exemplo n.º 26
0
 virtual ~Base() {
     OperationContextImpl txn;
     if ( !nsd() )
         return;
     _context.db()->dropCollection( &txn, ns() );
 }