예제 #1
0
rc_t whack_ref_exclude( ref_exclude *exclude )
{
    BSTreeWhack ( &exclude->ref_nodes, whack_ref_node, &exclude->info );
    BSTreeWhack ( &exclude->translations, whack_trans_node, NULL );
    if ( exclude->mgr != NULL )
        VDBManagerRelease( exclude->mgr );
    if ( exclude->path != NULL )
        free( exclude->path );
    return 0;
}
예제 #2
0
static rc_t cg_dump_src_dst_rows_cur( cg_dump_opts * opts, cg_dump_ctx * cg_ctx )
{
    /* preparations */
    rc_t rc = cg_dump_prepare_seq_tab( cg_ctx );
/*
    if ( rc == 0 )
        rc = cg_dump_prepare_prim_tab( cg_ctx );
*/
    if ( rc == 0 )
        rc = cg_dump_adjust_rowrange( cg_ctx );
    if ( rc == 0 )
        rc = cg_dump_setup_progressbar( cg_ctx );
    if ( rc == 0 )
        rc = cg_dump_prepare_output( opts, cg_ctx );

    /* loop through the SEQUENCE-table */
    if ( rc == 0 )
    {
        rc = cg_dump_loop( opts, cg_ctx ); /* <================== */

        if ( cg_ctx->progress != NULL )
            destroy_progressbar( cg_ctx->progress );
        BSTreeWhack ( &cg_ctx->lanes, whack_lanes_nodes, NULL );
        KDirectoryRelease( cg_ctx->out_dir );
    }
    return rc;
}
예제 #3
0
void whack_statistic( statistic *data )
{
    BSTreeWhack ( &data->spotgroups, whack_spotgroup, NULL );
    if ( data->case_vector != NULL )
    {
        free( data->case_vector );
    }
}
예제 #4
0
void skiplist_release( struct skiplist * list )
{
    if ( list != NULL )
    {
        BSTreeWhack ( &(list->nodes), release_skiplist_entry, NULL );
        free( ( void * ) list );
    }
}
예제 #5
0
void SRA_StatisticsWhack ( SRA_Statistics * self, ctx_t ctx )
{
    FUNC_ENTRY ( ctx, rcSRA, rcDatabase, rcDestroying );
    
    assert ( self );
    
    BSTreeWhack ( & self -> dictionary, DictionaryEntryWhack, ( void * ) ctx );
}
예제 #6
0
/* Whack
 */
rc_t VTableWhack ( VTable *self )
{
    KRefcountWhack ( & self -> refcount, "VTable" );

    BSTreeWhack ( & self -> read_col_cache, VColumnRefWhack, NULL );
    BSTreeWhack ( & self -> write_col_cache, VColumnRefWhack, NULL );

    KMDataNodeRelease ( self -> col_node );
    KMetadataRelease ( self -> meta );
    KTableRelease ( self -> ktbl );
    VSchemaRelease ( self -> schema );
    VLinkerRelease ( self -> linker );
    VDatabaseSever ( self -> db );
    VDBManagerSever ( self -> mgr );

    free ( self );
    return 0;
}
예제 #7
0
LIB_EXPORT rc_t CC VCursorCommit ( VCursor *self )
{
    rc_t rc = VCursorFlushPage ( self );
    if ( rc == 0 )
    {
        VTable *tbl = self -> tbl;
        if ( tbl -> read_col_cache_valid )
        {
            tbl -> read_col_cache_valid = false;
            BSTreeWhack ( & tbl -> read_col_cache, VColumnRefWhack, NULL );
        }
        if ( tbl -> write_col_cache_valid )
        {
            tbl -> write_col_cache_valid = false;
            BSTreeWhack ( & tbl -> write_col_cache, VColumnRefWhack, NULL );
        }
    }
    return rc;
}
예제 #8
0
static
void CC RefPosWhack ( void *obj )
{
    RefPos * self = obj;
    if ( self != NULL )
    {
    	BSTreeWhack( &self->tr_range, bst_range_free, NULL );
        VCursorRelease ( self -> curs );
        free ( self );
    }
}
예제 #9
0
LIB_EXPORT
rc_t CC
XFSOwpWhack ( struct XFSOwp * self )
{
    if ( self == NULL ) {
        return XFS_RC ( rcNull );
    }

    BSTreeWhack ( ( BSTree * ) self, _OWPEntryWhack, NULL );

    return 0;
}   /* XFSOwpWhack () */
예제 #10
0
/* Whack
 */
static
rc_t CC VLinkerWhack ( VLinker *self )
{
    KRefcountWhack ( & self -> refcount, "VLinker" );

    VectorWhack ( & self -> fact, LFactoryWhack, NULL );
    VectorWhack ( & self -> special, LSpecialWhack, NULL );
    BSTreeWhack ( & self -> scope, KSymbolWhack, NULL );

    KDyldRelease ( self -> dl );
    VLinkerSever ( self -> dad );

    free ( self );

    return 0;
}
예제 #11
0
static
rc_t CC
_TeleportWhack ()
{
    rc_t RCt;

    RCt = 0;

    if ( _sTeleportInited != true ) {
        return XFS_RC ( rcInvalid );
    }

    BSTreeWhack ( & _sTeleport, _TeleportWhacker, NULL );

    _sTeleportInited = false;

    return RCt;
}   /* _TeleportWhack () */
예제 #12
0
/*  ----------------------------------------------------------------------
 */
static
rc_t build_tree_then_run ()
{
    rc_data data;

    data.rc = 0;

    BSTreeInit (&options.pathtree);

    VectorForEach (&options.pathvpath, false, handle_path, &data);

    if (data.rc == 0)
        data.rc = extract();

    BSTreeWhack (&options.pathtree, extnode_whack, NULL);
    
    return data.rc;
}
예제 #13
0
파일: wtable.c 프로젝트: binlu1981/ncbi-vdb
LIB_EXPORT rc_t CC VTableListSeededWritableColumns ( VTable *self,
    KNamelist **names, const KNamelist *seed )
{
    rc_t rc;

    if ( names == NULL )
        rc = RC ( rcVDB, rcTable, rcListing, rcParam, rcNull );
    else
    {
        * names = NULL;

        if ( self == NULL )
            rc = RC ( rcVDB, rcTable, rcListing, rcSelf, rcNull );
        else if ( seed == NULL )
            rc = RC ( rcVDB, rcTable, rcListing, rcParam, rcNull );
        else
        {
            BSTree cache;
            BSTreeInit ( & cache );

            rc = 0;

            if ( ! self -> read_only )
            {
                VCursor *curs;
                rc = VTableCreateCursorWriteInt ( self, & curs, kcmInsert, false );
                if (  rc == 0 )
                {
                    /* let this private VCursor-function list the columns */
                    rc = VCursorListSeededWritableColumns ( curs, & cache, seed );
                    VCursorRelease ( curs );
                }
            }

            if ( rc == 0 )
                rc = make_column_namelist ( & cache, names );

            BSTreeWhack ( & cache, VColumnRefWhack, NULL );
        }
    }

    return rc;
}
예제 #14
0
파일: proxy.c 프로젝트: ncbi/ncbi-vdb
rc_t KNSProxiesWhack ( KNSProxies * self ) {
    size_t i = 0;

    assert ( self );

    for ( i = 0; i < self -> http_proxies_cnt; ++ i ) {
        HttpProxyWhack ( self -> http_proxies [ i ] );
        self -> http_proxies [ i ] = NULL;
    }

    BSTreeWhack ( & self -> proxie_tree, BSTItemWhack, NULL );

    free ( self -> http_proxies );
    self -> http_proxies = NULL;

    free ( self );

    return 0;
}
예제 #15
0
파일: colidx1.c 프로젝트: ImAWolf/ncbi-vdb
/* Whack
 */
rc_t KColumnIdx1Whack ( KColumnIdx1 *self )
{
    rc_t rc = KFileRelease ( self -> fidx );
    if ( rc == 0 )
    {
        self -> fidx = NULL;
        rc = KFileRelease ( self -> f );
        if ( rc == 0 )
        {
            self -> f = NULL;
#if USE_BSTREE_IN_COLUMN_IDX1
            BSTreeWhack ( & self -> bst, KColumnIdx1NodeWhack, NULL );
            BSTreeInit ( & self -> bst );
#else
            free ( self -> data );
            self -> data = NULL;
#endif
        }
    }
    return rc;
}
예제 #16
0
파일: tocentry.c 프로젝트: ncbi/ncbi-vdb
/* ----------------------------------------------------------------------
 * KTocEntryDelete
 * [INOUT] self the entry to delete
 */
rc_t KTocEntryDelete ( KTocEntry * self )
{
    /* defensive programming ensure minimally valid pointer */
    if (self == NULL)
    {
        return 0;
/* 	return RC (rcFS, rcToc, rcConstructing, rcSelf, rcNull); */
    }

    switch (self->type)
    {
    case ktocentrytype_unknown:
    case ktocentrytype_file:
    case ktocentrytype_chunked:
    case ktocentrytype_softlink:
    case ktocentrytype_hardlink:
    case ktocentrytype_zombiefile:
    default:
	/* -----
	 * at this point in the implementation there is nothing we need to
	 * do with these entry types except free their "self" allocated memory.
	 *
	 * Used a switch in case we did for one or more of these.
	 */
	break;
    case ktocentrytype_dir:
	/* -----
	 * directories have a BSTree below them that need to be 
	 * deleted first
	 */
	BSTreeWhack (&self->u.dir.tree, KTocEntryWhack, NULL);
	break;
    }
    free (self);
    return 0;
}
예제 #17
0
void KeyRingDataWhack ( KeyRingData* self )
{
    BSTreeWhack ( & self->projects, ProjectWhack, NULL );
    BSTreeWhack ( & self->objects, ObjectWhack, NULL );
}
예제 #18
0
rc_t KU64IndexWhack_v3(KU64Index_v3* self)
{
    self->rc = 0;
    BSTreeWhack(&self->tree, KU64Index_WhackBSTree, NULL);
    return 0;
}
예제 #19
0
파일: cg-load.c 프로젝트: mariux/sratoolkit
static rc_t Load( SParam* param )
{
    rc_t rc = 0, rc1 = 0;
    BSTree slides, evidence;
    

    param->map_dir = NULL;
    param->asm_dir = NULL;
    param->output_dir = ( KDirectory * )param->input_dir;
    BSTreeInit( &slides );
    BSTreeInit( &evidence );

    rc = open_dir_or_tar( param->input_dir, &param->map_dir, param->map_path );
    if ( rc == 0 )
    {
        DirVisit_Data dv;

        dv.param = param;
        dv.tree = &slides;
        dv.dir = param->map_dir;
        rc = KDirectoryVisit( param->map_dir, true, DirVisitor, &dv, NULL );
        if ( rc == 0 )
        {
            if ( param->asm_path != NULL )
            {
                rc_t rc2 = open_dir_or_tar( param->input_dir, &param->asm_dir, param->asm_path );
                if ( rc2 == 0 )
                {
                    dv.tree = &evidence;
                    dv.dir = param->asm_dir;
                    rc = KDirectoryVisit( param->asm_dir, true, DirVisitor, &dv, NULL );
                }
            }
            if ( rc == 0 )
            {
                /* SHOULD HAVE A BSTreeEmpty FUNCTION OR SOMETHING...
                   MAKE ONE HERE - WITH KNOWLEDGE THAT TREE IS NOT NULL: */
#ifndef BSTreeEmpty
#define BSTreeEmpty( bst ) \
    ( ( bst ) -> root == NULL )
#endif
                if ( BSTreeEmpty ( & slides ) && BSTreeEmpty ( & evidence ) )
                    rc = RC( rcExe, rcFile, rcReading, rcData, rcInsufficient );
                else
                {
                    /* CORRECTED SETTING OF "rc" IN "FGroupMAP_Validate" */
                    assert ( rc == 0 );
                    BSTreeForEach( &slides, false, FGroupMAP_Validate, &rc );
                    BSTreeForEach( &evidence, false, FGroupMAP_Validate, &rc );
                }

                if ( rc == 0 )
                {
                    FGroupMAP_LoadData data;

                    PLOGMSG( klogInfo, ( klogInfo, "file set validation complete", "severity=status" ) );
                    memset( &data, 0, sizeof( data ) );
                    data.rc = 0;
                    data.param = param;
                    data.reads = &slides;
                    rc = DB_Init( param, &data.db );
                    if ( rc == 0 )
                    {
                        BSTreeDoUntil( &slides, false, FGroupMAP_LoadReads, &data );
                        rc = data.rc;
                        if ( rc == 0 )
                        {
                            PLOGMSG( klogInfo, ( klogInfo, "MAP loaded", "severity=status" ) );
                            BSTreeDoUntil( &evidence, false, FGroupMAP_LoadEvidence, &data );
                            rc = data.rc;
                            if ( rc == 0 )
                                PLOGMSG( klogInfo, ( klogInfo, "ASM loaded", "severity=status" ) );
                        }
                    }
                    rc1 = DB_Fini( param, &data.db, rc != 0 );
                    if ( rc == 0 )
                        rc = rc1;
                }
            }
        }

        /* copy the extra library ( file or recursive directory ) */
        if ( rc == 0 && param->library != NULL )
        {
            const KDirectory *lib_src;
            rc = open_dir_or_tar( param->input_dir, &lib_src, param->library );
            if ( rc == 0 )
            {
                rc = copy_library( param->input_dir, param->output_dir,
                                   param->library, param->out );
                if ( rc == 0 )
                    STSMSG( 0, ( "extra lib copied" ) );
                else
                    LOGERR( klogErr, rc, "failed to copy extra library" );
                KDirectoryRelease( lib_src );
            }
/*
            else
            {
                rc = copy_library( param->input_dir, param->output_dir,
                                   ".", param->out );
                if ( rc == 0 )
                    STSMSG( 0, ( "extra lib copied" ) );
                else
                    LOGERR( klogErr, rc, "failed to copy extra library" );
            }
*/
        }
        KDirectoryRelease( param->map_dir );
        KDirectoryRelease( param->asm_dir );
    }
    BSTreeWhack( &slides, FGroupMAP_Whack, NULL );
    BSTreeWhack( &evidence, FGroupMAP_Whack, NULL );
    return rc;
}
예제 #20
0
void free_ref_regions( BSTree * regions )
{    
    BSTreeWhack ( regions, release_ref_region_wrapper, NULL );
}
예제 #21
0
static void free_seq_id_tree( BSTree * tree )
{
    BSTreeWhack( tree, free_seq_id_tree_callback, NULL );
}
예제 #22
0
void whack_statistic( statistic *self )
{
    BSTreeWhack ( &self->spotgroups, whack_spotgroup, NULL );
}
예제 #23
0
static
rc_t populate_cursors ( VTable *dtbl, VCursor *dcurs, const VCursor *scurs,
    vtblcp_column_map *cm, const Vector *v, uint32_t *rd_filt )
{
    uint32_t end = VectorLength ( v );
    uint32_t i = VectorStart ( v );

    BSTree stype_tbl, rftype_tbl;

    const VSchema *schema;
    rc_t rc = VTableOpenSchema ( dtbl, & schema );
    if ( rc != 0 )
    {
        LOGERR ( klogInt, rc, "failed to open destination table schema" );
        return rc;
    }

    /* populate sensitive type table */
    rc = populate_stype_tbl ( & stype_tbl, schema );
    if ( rc != 0 )
    {
        VSchemaRelease ( schema );
        return rc;
    }

    /* populate read filter type table */
    rc = populate_rdfilt_tbl ( & rftype_tbl, schema );
    if ( rc != 0 )
    {
        BSTreeWhack ( & stype_tbl, stype_id_whack, NULL );
        VSchemaRelease ( schema );
        return rc;
    }

    for ( end += i, rc = 0, * rd_filt = 0; i < end; ++ i )
    {
        VTypedecl td;
        char typedecl [ 128 ];

        const char *spec = ( const void* ) VectorGet ( v, i );

        /* request column in destination */
        rc = VCursorAddColumn ( dcurs, & cm [ i ] . wr, spec );
        if ( rc != 0 )
        {
            PLOGERR ( klogErr,  (klogErr, rc, "failed to add '$(spec)' to destination cursor", "spec=%s", spec ));
            break;
        }

        /* always retrieve data type */
        rc = VCursorDatatype ( dcurs, cm [ i ] . wr, & td, NULL );
        if ( rc != 0 )
        {
            PLOGERR ( klogInt,  (klogInt, rc, "failed to determine datatype of destination column '$(name)'", "name=%s", spec ));
            break;
        }

        /* mark column as sensitive or not */
        rc = mark_type_sensitivity ( & stype_tbl, schema, & td, & cm [ i ] );
        if ( rc != 0 )
            break;

        /* if spec is already typed, request it in source */
        if ( spec [ 0 ] == '(' )
        {
            rc = VCursorAddColumn ( scurs, & cm [ i ] . rd, spec );
            if ( rc != 0 )
            {
                PLOGERR ( klogErr,  (klogErr, rc, "failed to add '$(spec)' to source cursor", "spec=%s", spec ));
                break;
            }
        }
        else
        {
            rc = VTypedeclToText ( & td, schema, typedecl, sizeof typedecl );
            if ( rc != 0 )
            {
                PLOGERR ( klogInt,  (klogInt, rc, "failed to print datatype of destination column '$(name)'", "name=%s", spec ));
                break;
            }

            rc = VCursorAddColumn ( scurs, & cm [ i ] . rd, "(%s)%s", typedecl, spec );
            if ( rc != 0 )
            {
                PLOGERR ( klogErr,  (klogErr, rc, "failed to add '$(spec)' to source cursor", "spec=(%s)%s", typedecl, spec ));
                break;
            }
        }

        /* check if column is a read filter */
        cm [ i ] . rd_filter = false;
        if ( ! cm [ i ] . sensitive )
        {
            if ( BSTreeFind ( & rftype_tbl, & td, stype_id_cmp ) != NULL )
            {
                if ( * rd_filt != 0 )
                {
                    rc = RC ( rcExe, rcColumn, rcOpening, rcColumn, rcExists );
                    PLOGERR ( klogInt,  (klogInt, rc, "can't use column '$(name)' as read filter", "name=%s", spec ));
                    break;
                }

                * rd_filt = cm [ i ] . rd;
                cm [ i ] . rd_filter = true;
            }
        }
    }

    BSTreeWhack ( & rftype_tbl, stype_id_whack, NULL );
    BSTreeWhack ( & stype_tbl, stype_id_whack, NULL );
    VSchemaRelease ( schema );

    /* add read filter to input if not already there in some way */
    if ( * rd_filt == 0 )
    {
        rc = VCursorAddColumn ( scurs, rd_filt, "RD_FILTER" );
        if ( rc != 0 && GetRCState ( rc ) == rcNotFound )
            rc = 0;
    }

    return rc;
}
예제 #24
0
rc_t CC
_ClearSidStorageNoLock ()
{
    BSTreeWhack (  & _sSidStorage, _SidStorageWhackCallback, NULL );
    return 0;
}   /* _ClearSidStorageNoLock () */
예제 #25
0
static void free_fragments( BSTree * fragments )
{    
    BSTreeWhack ( fragments, free_indel_fragment, NULL );
}