public void Merge_data(Xow_wiki wiki, Io_url src_url, int idx_cur) { long all_time_bgn = gplx.core.envs.System_.Ticks(); wiki.Init_by_wiki(); Db_conn src_conn = Db_conn_bldr.Instance.Get_or_autocreate(false, src_url); ctx.Init(wiki, src_conn); // merge data int hash_len = wkr_hash.Len(); for (int i = 0; i < hash_len; ++i) { if (prog_wkr.Canceled()) break; Merge2_wkr wkr = (Merge2_wkr) wkr_hash.Get_at(i); // if (prog_wkr.Checkpoint__skip_wkr(src_url, wkr.Tbl_name())) continue; long wkr_time_bgn = gplx.core.envs.System_.Ticks(); wkr.Merge_data(ctx, prog_wkr); Gfo_log_.Instance.Info( "merge.wkr.done", "data", src_url.NameAndExt() + "|" + wkr.Tbl().Tbl_name() + "|" + gplx.core.envs.System_.Ticks__elapsed_in_frac(wkr_time_bgn)); } if (ctx.Heap__copy_to_wiki()) ctx.Heap__increment_nxt(); Gfo_log_.Instance.Info( "merge.wkr.done", "data", src_url.NameAndExt() + "|-1|" + gplx.core.envs.System_.Ticks__elapsed_in_frac(all_time_bgn)); src_conn.Rls_conn(); // NOTE: must close conn else pack_conn will stay open }
public static Xob_db_file New(Io_url dir, String name) { Io_url url = dir.GenSubFil(name); Db_conn_bldr_data conn_data = Db_conn_bldr.Instance.Get_or_new(url); Db_conn conn = conn_data.Conn(); Xob_db_file rv = new Xob_db_file(url, conn); if (conn_data.Created()) rv.Tbl__cfg().Create_tbl(); return rv; }
public static Fsdb_db_mgr new_src_bin_db_mgr(Xow_wiki wiki, String version) { String domain_str = wiki.Domain_str(); Fsdb_db_mgr rv = null; Io_url url = null; if (String_.Eq(version, "v1")) { url = wiki.Fsys_mgr() .File_dir() .OwnerDir() .GenSubDir(domain_str + "-prv"); // v1: EX: /xowa/file/en.wikipedia.org-prv/ rv = new Fsdb_db_mgr__v1(url); } else if (String_.Eq(version, "v2")) { url = wiki.Fsys_mgr().Root_dir().GenSubDir("prv"); // v2: EX: /xowa/wiki/en.wikipedia.org/prv/ rv = Fsdb_db_mgr_.new_detect(wiki, url, url); // note that v2 is prioritized over v1 } else throw Err_.new_wo_type("fsdb.make:unknown fsdb_type", "version", version); if (rv == null) throw Err_.new_wo_type( "fsdb.make:source fsdb not found", "version", version, "url", url.Raw()); return rv; }