1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Cfg: Make gfs calls temporary; also, fix layout cfg leading to bad builds

This commit is contained in:
gnosygnu
2016-12-25 13:30:21 -05:00
parent e698b1667f
commit 8db63bbbce
5 changed files with 25 additions and 26 deletions

View File

@@ -20,27 +20,31 @@ import gplx.core.ios.*;
import gplx.xowa.wikis.data.*;
public class Xobldr_cfg {
private static long layout_all_max = 0; // disable by default; may set to 200 MB in future
private static long layout_text_max = Io_size_.To_long_by_int_mb(1500); // 1.0 GB
private static long layout_html_max = Io_size_.To_long_by_int_mb(1500); // 1.0 GB
private static long layout_file_max = Io_size_.To_long_by_int_mb(1500); // 1.0 GB
private static boolean hzip_enabled = Bool_.Y;
private static boolean hzip_mode_is_b256 = Bool_.Y;
public static byte Zip_mode__text(Xoa_app app) {return Zip_mode(app, Cfg__zip_mode__text);}
public static byte Zip_mode__html(Xoa_app app) {return Zip_mode(app, Cfg__zip_mode__html);}
public static byte Zip_mode__text(Xoa_app app) {return Zip_mode(app, "xowa.wiki.database.zip_mode.text");} // CFG: Cfg__
public static byte Zip_mode__html(Xoa_app app) {return Zip_mode(app, "xowa.wiki.database.zip_mode.html");} // CFG: Cfg__
private static byte Zip_mode(Xoa_app app, String key) {
String val = app.Cfg().Get_str_app_or(key, "gzip");
return gplx.core.ios.streams.Io_stream_tid_.To_tid(val);
}
public static long Max_size__text(Xoa_app app) {return Max_size(app, Cfg__max_size__text);}
public static long Max_size__html(Xoa_app app) {return Max_size(app, Cfg__max_size__html);}
public static long Max_size__file(Xoa_app app) {return Max_size(app, Cfg__max_size__file);}
public static long Max_size__text(Xoa_app app) {return Max_size(app, "xowa.wiki.database.max_size.text");} // CFG: Cfg__
public static long Max_size__html(Xoa_app app) {return Max_size(app, "xowa.wiki.database.max_size.html");} // CFG: Cfg__
public static long Max_size__file(Xoa_app app) {return Max_size(app, "xowa.wiki.database.max_size.file");} // CFG: Cfg__
private static long Max_size(Xoa_app app, String key) {
long rv = app.Cfg().Get_long_app_or(key, Io_size_.To_long_by_int_mb(1500));
return rv * Io_mgr.Len_mb;
}
public static byte[] New_ns_file_map(long dump_file_size) {
return dump_file_size < layout_text_max
public static long Layout_size__text(Xoa_app app) {return Layout_size(app, "xowa.wiki.database.layout_size.text");} // CFG: Cfg__
public static long Layout_size__html(Xoa_app app) {return Layout_size(app, "xowa.wiki.database.layout_size.html");} // CFG: Cfg__
public static long Layout_size__file(Xoa_app app) {return Layout_size(app, "xowa.wiki.database.layout_size.file");} // CFG: Cfg__
private static long Layout_size(Xoa_app app, String key) {
long rv = app.Cfg().Get_long_app_or(key, Io_size_.To_long_by_int_mb(1500));
return rv * Io_mgr.Len_mb;
}
public static byte[] New_ns_file_map(Xoa_app app, long dump_file_size) {
return dump_file_size < Layout_size__text(app)
? gplx.xowa.bldrs.cmds.Xob_ns_file_itm_parser.Ns_file_map__few
: gplx.xowa.bldrs.cmds.Xob_ns_file_itm_parser.Ns_file_map__each; // DB.FEW: DATE:2016-06-07
}
@@ -49,18 +53,11 @@ public class Xobldr_cfg {
if (dump_file_size < layout_all_max)
layout_text = layout_html = layout_file = Xow_db_layout.Itm_all;
else {
layout_text = dump_file_size < layout_text_max ? Xow_db_layout.Itm_few : Xow_db_layout.Itm_lot;
layout_html = dump_file_size < layout_html_max ? Xow_db_layout.Itm_few : Xow_db_layout.Itm_lot;
layout_file = dump_file_size < layout_file_max ? Xow_db_layout.Itm_few : Xow_db_layout.Itm_lot;
layout_text = dump_file_size < Layout_size__text(app) ? Xow_db_layout.Itm_few : Xow_db_layout.Itm_lot;
layout_html = dump_file_size < Layout_size__html(app) ? Xow_db_layout.Itm_few : Xow_db_layout.Itm_lot;
layout_file = dump_file_size < Layout_size__file(app) ? Xow_db_layout.Itm_few : Xow_db_layout.Itm_lot;
}
return new Xowd_core_db_props(2, layout_text, layout_html, layout_file, Zip_mode__text(app), Zip_mode__html(app), hzip_enabled, hzip_mode_is_b256);
}
private static final String
Cfg__zip_mode__text = "xowa.wiki.database.zip_mode.text"
, Cfg__zip_mode__html = "xowa.wiki.database.zip_mode.html"
, Cfg__max_size__text = "xowa.wiki.database.max_size.text"
, Cfg__max_size__html = "xowa.wiki.database.max_size.html"
, Cfg__max_size__file = "xowa.wiki.database.max_size.file"
;
public static final byte[] Ns_file_map__each = Bry_.new_a7("<each>");
}

View File

@@ -44,7 +44,7 @@ public class Xob_page_cmd extends Xob_itm_basic_base implements Xob_page_wkr, Gf
redirect_tbl.Conn().Txn_bgn("bldr__page__redirect");
}
app.Bldr().Dump_parser().Trie_tab_del_(); // disable swapping &#09; for \t
byte[] ns_file_map = Xobldr_cfg.New_ns_file_map(wiki.Import_cfg().Src_rdr_len());
byte[] ns_file_map = Xobldr_cfg.New_ns_file_map(app, wiki.Import_cfg().Src_rdr_len());
Xob_ns_file_itm.Init_ns_bldr_data(Xow_db_file_.Tid__text, wiki.Ns_mgr(), ns_file_map);
if (idx_mode.Tid_is_bgn()) page_core_tbl.Create_idx();
page_core_tbl.Insert_bgn();