Skip to content
Snippets Groups Projects
rfile.mli 1.99 KiB
Newer Older
heinz's avatar
heinz committed
(* $Id: rfile.mli,v 1.1 2005/12/31 21:10:46 heinz Exp $
 *
 * AUS - the advanced update system
 * Copyright (C) 2004  Heinz Deinhart
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *)

(** Remote file access

    Provides abstracted access to remote URLs or files via wget
*)

type t
  (** Rfile type for one cache path *)

exception Illegal_url of string
  (** *)

exception Connection_failure of string
  (** URL may be valid, but connection could not be made (e.g. network failure)
  *)

exception Url_not_found of string
  (** Raised if URL is not found (e.g. 404) *)

exception Cache_failure of string
  (** Error accessing cache. Fatal internal error, should not happen *)

val make: string -> t
  (** [make path] create Rfile type that is bound to cache dir [path] *)

val open_in_channel: t -> string -> in_channel
  (** [open_in_channel t url] access [url] (or its cached content) and return
      an input channel for it. Url can be interpreted as an absolute file
      name, if it starts with an '/'. Other supported URLs start with
      "file", "http" or "ftp".
      @raise [Illegal_url] if url format is not detected/supported
      @raise [Connection_failure] if url can be temporarly not reached
      @raise [Url_not_found] if url is permanently non existant
      @raise [Cache_failure] if an internal fatal error in the cache system occurs
  *)