module Db:sig
..end
Patoline documents can be interactive, allowing for example an audience to connect remotely to a presentation and interact with it, possibly changing some parts of it (such as answering a poll, results being updated on-screen immediately).
This module provides tools for managing user sessions and a storage
space for key/value pairs associated to each session.
type 'a
data = {
|
name : |
|
init : |
|
read : |
|
write : |
|
reset : |
|
distribution : |
exception DummyData
Db.dummyData
below.val dummyData : string data
Db.data
, which can be used to
initialize data structure, but whose content should never be used
(calling any member function raises Db.DummyData
).type 'a
coding = {
|
encode : |
(* |
Serializing some value of type
'a to a string which can be
stored in database. | *) |
|
decode : |
(* |
Parsing a string from the database and creating a value of type
'a . This should be the inverse of encode . | *) |
val default_coding : 'a coding
Marshal
module,
escaped using base64.val string_coding : string coding
val bool_coding : bool coding
"true"
and "false"
. Any value other
than "true"
in the database is decoded as false
.module type DbInterface =sig
..end
module type DbInstance =sig
..end
typedatabase =
(module Db.DbInstance)
type
db = {
|
db : |
|
create_data : |
|
disconnect : |
val init_db : (module Db.DbInterface with type dbinfo = 'a) -> string -> 'a -> db
val interaction_start_hook : (unit -> unit) list Pervasives.ref
val read_hook : (string -> Util.visibility -> unit) list Pervasives.ref
val write_hook : (string -> Util.visibility -> unit) list Pervasives.ref
val record : ('a -> 'b -> unit) list Pervasives.ref ->
('c -> 'd) -> 'c -> 'd * ('a * 'b) list
val stop_record : 'a list Pervasives.ref -> ('b -> 'c) -> 'b -> 'c
val record_read : ('a -> 'b) -> 'a -> 'b * (string * Util.visibility) list
val record_write : ('a -> 'b) -> 'a -> (string * Util.visibility) list
val stop_record_read : ('a -> 'b) -> 'a -> 'b
val stop_record_write : ('a -> 'b) -> 'a -> 'b
val do_interaction_start_hook : unit -> unit
Db.interaction_start_hook
.val do_record_read : 'a data -> Util.visibility -> unit
Db.read_hook
.val do_record_write : 'a data -> Util.visibility -> unit
Db.write_hook
.val sessid : (string * string * (string * string) list) option Pervasives.ref
val secret : string Pervasives.ref
val make_sessid : unit -> string
val friends_from_string : string -> (string * string) list
val friends_to_string : (string * string) list -> string