~marionnet-drivers/marionnet/trunk

362 by Jean-Vincent Loddo
Major change managing cow files: now they are copied (from a variant or from an ancestor) only during the startup of the device (machine or router). The benefit is that projects containing machines that have never been started are now very lightweight (only a few Kb).
1
(* This file is part of Marionnet, a virtual network laboratory
2
   Copyright (C) 2012  Jean-Vincent Loddo
3
4
   This program is free software: you can redistribute it and/or modify
5
   it under the terms of the GNU General Public License as published by
6
   the Free Software Foundation, either version 2 of the License, or
7
   (at your option) any later version.
8
9
   This program is distributed in the hope that it will be useful,
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
   GNU General Public License for more details.
13
14
   You should have received a copy of the GNU General Public License
15
   along with this program.  If not, see <http://www.gnu.org/licenses/>. *)
16
17
(* Useful tools to manage cow files. *)
18
19
(** Create a fresh filename, without making the file (empty cow files are not allowed) *)
20
val make_temporary_cow_file_name :
21
  states_directory:string -> unit -> string
22
23
(** Alias for make_temporary_cow_file_name: *)
24
val make_fresh_cow_file_name :
25
  states_directory:string -> unit -> string
26
27
(** Make a sparse copy of the given file, and return the (relative) name of the copy.
28
    Note that this also succeeds when the source file does not exist, as it's the case
29
    with 'fresh' states.
30
    If not given, a cow_file_name is created, then used as target file.
31
    Both the source_pathname and cow_file_name may be implicit or absolute. *)
32
val duplicate_cow_file_into_states_directory :
33
  source_pathname:string ->
34
  states_directory:string ->
35
  ?cow_file_name:string -> unit -> string
36
37
(** Note that the cow_file_name may be implicit or absolute: *)
38
val cow_file_exists :
39
  states_directory:string ->
40
  cow_file_name:string -> unit -> bool