src/Pure/Thy/export.scala
changeset 68418 366e43cddd20
parent 68331 7eaaa8f48331
child 68831 a6c69599ab99
equal deleted inserted replaced
68417:21465884037a 68418:366e43cddd20
   180     {
   180     {
   181       consumer.shutdown()
   181       consumer.shutdown()
   182       if (close) db.close()
   182       if (close) db.close()
   183       export_errors.value.reverse
   183       export_errors.value.reverse
   184     }
   184     }
       
   185   }
       
   186 
       
   187 
       
   188   /* abstract provider */
       
   189 
       
   190   object Provider
       
   191   {
       
   192     def database(db: SQL.Database, session_name: String, theory_name: String): Provider =
       
   193       new Provider {
       
   194         def apply(export_name: String): Option[Entry] =
       
   195           read_entry(db, session_name, theory_name, export_name)
       
   196       }
       
   197 
       
   198     def snapshot(snapshot: Document.Snapshot): Provider =
       
   199       new Provider {
       
   200         def apply(export_name: String): Option[Entry] =
       
   201           snapshot.exports_map.get(export_name)
       
   202       }
       
   203   }
       
   204 
       
   205   trait Provider
       
   206   {
       
   207     def apply(export_name: String): Option[Entry]
       
   208 
       
   209     def uncompressed_yxml(export_name: String, cache: XZ.Cache = XZ.cache()): XML.Body =
       
   210       apply(export_name) match {
       
   211         case Some(entry) => entry.uncompressed_yxml(cache = cache)
       
   212         case None => Nil
       
   213       }
   185   }
   214   }
   186 
   215 
   187 
   216 
   188   /* export to file-system */
   217   /* export to file-system */
   189 
   218