1077 val build_columns = List(sources, input_heaps, output_heap, return_code) |
1077 val build_columns = List(sources, input_heaps, output_heap, return_code) |
1078 |
1078 |
1079 val table = SQL.Table("isabelle_session_info", build_log_columns ::: build_columns) |
1079 val table = SQL.Table("isabelle_session_info", build_log_columns ::: build_columns) |
1080 } |
1080 } |
1081 |
1081 |
1082 def store(options: Options, system_mode: Boolean = false): Store = |
1082 def store(options: Options): Store = new Store(options) |
1083 new Store(options, system_mode) |
1083 |
1084 |
1084 class Store private[Sessions](val options: Options) |
1085 class Store private[Sessions](val options: Options, val system_mode: Boolean) |
|
1086 { |
1085 { |
1087 override def toString: String = "Store(output_dir = " + output_dir.expand + ")" |
1086 override def toString: String = "Store(output_dir = " + output_dir.expand + ")" |
1088 |
1087 |
1089 |
1088 |
1090 /* directories */ |
1089 /* directories */ |
1091 |
1090 |
1092 val system_output_dir: Path = Path.explode("$ISABELLE_HEAPS_SYSTEM/$ML_IDENTIFIER") |
1091 val system_output_dir: Path = Path.explode("$ISABELLE_HEAPS_SYSTEM/$ML_IDENTIFIER") |
1093 val user_output_dir: Path = Path.explode("$ISABELLE_HEAPS/$ML_IDENTIFIER") |
1092 val user_output_dir: Path = Path.explode("$ISABELLE_HEAPS/$ML_IDENTIFIER") |
1094 |
1093 |
|
1094 def system_heaps: Boolean = options.bool("system_heaps") |
|
1095 |
1095 val output_dir: Path = |
1096 val output_dir: Path = |
1096 if (system_mode) system_output_dir else user_output_dir |
1097 if (system_heaps) system_output_dir else user_output_dir |
1097 |
1098 |
1098 val input_dirs: List[Path] = |
1099 val input_dirs: List[Path] = |
1099 if (system_mode) List(system_output_dir) |
1100 if (system_heaps) List(system_output_dir) |
1100 else List(user_output_dir, system_output_dir) |
1101 else List(user_output_dir, system_output_dir) |
1101 |
1102 |
1102 val browser_info: Path = |
1103 val browser_info: Path = |
1103 if (system_mode) Path.explode("$ISABELLE_BROWSER_INFO_SYSTEM") |
1104 if (system_heaps) Path.explode("$ISABELLE_BROWSER_INFO_SYSTEM") |
1104 else Path.explode("$ISABELLE_BROWSER_INFO") |
1105 else Path.explode("$ISABELLE_BROWSER_INFO") |
1105 |
1106 |
1106 |
1107 |
1107 /* file names */ |
1108 /* file names */ |
1108 |
1109 |
1182 } |
1183 } |
1183 } |
1184 } |
1184 |
1185 |
1185 val del = |
1186 val del = |
1186 for { |
1187 for { |
1187 dir <- (if (system_mode) List(user_output_dir, system_output_dir) else List(user_output_dir)) |
1188 dir <- |
|
1189 (if (system_heaps) List(user_output_dir, system_output_dir) else List(user_output_dir)) |
1188 file <- List(heap(name), database(name), log(name), log_gz(name)) |
1190 file <- List(heap(name), database(name), log(name), log_gz(name)) |
1189 path = dir + file if path.is_file |
1191 path = dir + file if path.is_file |
1190 } yield path.file.delete |
1192 } yield path.file.delete |
1191 |
1193 |
1192 val relevant = relevant_db || del.nonEmpty |
1194 val relevant = relevant_db || del.nonEmpty |