/usr/lib/ocaml/eliom/server/eliom_state.mli is in libeliom-ocaml-dev 2.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 | (* Ocsigen
* http://www.ocsigen.org
* Copyright (C) 2007 Vincent Balat
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, with linking exception;
* either version 2.1 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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.
*)
(**
Manage server-side state.
{% <<outline>>%}
*)
open Eliom_lib
open Ocsigen_extensions
(*****************************************************************************)
(** {2 Managing the state of an application} *)
(** {3 Closing sessions, removing state data and services} *)
(** Delete server-side state data and services for a session,
a group of sessions, a client process or a request.
Use that function to close a session (using scope [Eliom_common.session]).
Closing a group of sessions will close all sessions in the group.
By default will remove both secure and unsecure data and services, but
if [~secure] is present.
{e Warning: you may also want to unset some request-scoped Eliom references
when discarding a state.}
*)
val discard :
scope:[< Eliom_common.user_scope | Eliom_common.request_scope ] ->
?secure:bool ->
unit ->
unit Lwt.t
val discard_all_scopes :
?secure:bool ->
unit ->
unit Lwt.t
(** Remove current state data.
If the optional parameter [?persistent] is not present, will
remove both volatile and persistent data. Otherwise only volatile
or persistent data.
*)
val discard_data :
?persistent:bool ->
scope:[< Eliom_common.user_scope | Eliom_common.request_scope ] ->
?secure:bool ->
unit ->
unit Lwt.t
(** Remove all services registered for the given scope (the default beeing
[`Session]). *)
val discard_services :
scope:[< Eliom_common.user_scope ] ->
?secure:bool ->
unit ->
unit
(*****************************************************************************)
(** {3 State status} *)
(** The following functions return the current state of the state for a given
scope:
- [Alive_state] means that data has been recorded for this scope
- [Empty_state] means that there is no data for this scope
- [Expired_state] means that data for this scope has been removed
because the timeout has been reached.
The default scope is [`Session].
*)
type state_status = Alive_state | Empty_state | Expired_state
val service_state_status :
scope:[< Eliom_common.user_scope ] ->
?secure:bool ->
unit -> state_status
val volatile_data_state_status :
scope:[< Eliom_common.user_scope ] ->
?secure:bool ->
unit -> state_status
val persistent_data_state_status :
scope:[< Eliom_common.user_scope ] ->
?secure:bool ->
unit -> state_status Lwt.t
(*****************************************************************************)
(** {3 User cookies}
If you want to store a client-side state, and ask the browser to
send it back with each request, you can set manually your own cookies.
Usual cookies correspond to scope [`Session] (that is, one browser).
The browser send them with each request to the same Web site.
But Eliom also implements client-side process cookies
(scope [`Client_process]), that behave in the same way,
but for one instance of the client-side Eliom program (if there is one).
Cookies can be limited to a subsite using the [?path] optional
parameter. This path is relative to the main path of your Web site.
(It is not possible to set a cookie for a subsite larger than your current
Web site).
Cookies can have an expiration date, specified (in seconds
since the 1st of January 1970) in the optional parameter [?exp].
If the parameter is not set,
the expiration date will be when the browser is closed.
Secure cookies are sent by the browser only with HTTPS (default: [false]).
*)
(** Ask the browser to record a cookie. *)
val set_cookie :
?cookie_scope:Eliom_common.cookie_scope ->
?path:string list ->
?exp:float ->
?secure:bool -> name:string -> value:string -> unit -> unit
(** Ask the browser to remove a cookie. *)
val unset_cookie :
?cookie_scope:Eliom_common.cookie_scope ->
?path:string list ->
name:string -> unit -> unit
(*****************************************************************************)
(** {2 Session groups} *)
(** If your Web site has users,
it is a good idea to group together all the sessions for one user.
Otherwise, you may want to group sessions according to another
criterion.
Session groups may be used for example to limit
the number of sessions one user can open at the same time, or to implement
a "close all your sessions" feature.
Usually, the group is the user name.
*)
(** {3 Putting a session in a group, removing a session from a group} *)
(** sets the group to which belong the service session.
If the optional [?set_max] parameter is present, also sets the
maximum number of sessions in the group. Default: follow current
configuration for the group or default configuration if the group
does not exist.
If [~secure] is false when the protocol is https, it will affect
the unsecure session. Otherwise, il will affect the secure session in
https, the unsecure one in http.
*)
val set_service_session_group :
?set_max: int ->
?scope:Eliom_common.session_scope ->
?secure:bool ->
string ->
unit
(** Remove the session from its group *)
val unset_service_session_group :
?set_max: int ->
?scope:Eliom_common.session_scope ->
?secure:bool ->
unit ->
unit
(** returns the group to which belong the service session.
If the session does not belong to any group,
or if no session is opened, return [None].
*)
val get_service_session_group :
?scope:Eliom_common.session_scope ->
?secure:bool ->
unit ->
string option
(** returns the number of sessions in the group. If he session does not
belong to any group or if no session is opened, returns [None] *)
val get_service_session_group_size :
?scope:Eliom_common.session_scope ->
?secure:bool ->
unit ->
int option
(** sets the group to which belong the volatile data session.
If the optional [?set_max] parameter is present, also sets the maximum
number of sessions in the group.
Default: follow current configuration for the group
or default configuration if the group does not exist.
*)
val set_volatile_data_session_group :
?set_max: int ->
?scope:Eliom_common.session_scope ->
?secure:bool ->
string ->
unit
(** Remove the session from its group *)
val unset_volatile_data_session_group :
?set_max: int ->
?scope:Eliom_common.session_scope ->
?secure:bool ->
unit ->
unit
(** returns the group to which belong the data session.
If the session does not belong to any group, or if no session is opened,
return [None].
*)
val get_volatile_data_session_group :
?scope:Eliom_common.session_scope ->
?secure:bool ->
unit ->
string option
(** returns the number of sessions in the group. If he session does not
belong to any group or if no session is opened, returns [None] *)
val get_volatile_data_session_group_size :
?scope:Eliom_common.session_scope ->
?secure:bool ->
unit ->
int option
(** sets the group to which belong the persistent session.
If the optional [?set_max] parameter is present, also sets the
maximum number of sessions in the group. When [~set_max:None] is
present, the number of session is unlimited. Default: follow
current configuration for the group or default configuration if
the group does not exist.
*)
val set_persistent_data_session_group :
?set_max: int option ->
?scope:Eliom_common.session_scope ->
?secure:bool ->
string ->
unit Lwt.t
(** Remove the session from its group. *)
val unset_persistent_data_session_group :
?scope:Eliom_common.session_scope ->
?secure:bool ->
unit ->
unit Lwt.t
(** returns the group to which belong the persistent session.
If the session does not belong to any group, or if no session is opened,
return [None].
*)
val get_persistent_data_session_group :
?scope:Eliom_common.session_scope ->
?secure:bool ->
unit ->
string option Lwt.t
(** {3 Maximum group size} *)
(** The following functions of this section set the maximum number of
sessions in a session group, for the different kinds of session.
This won't modify existing groups.
That value will be used only as default value if you do not specify the
optional parameter [?set_max] of function
{!Eliom_state.set_volatile_data_session_group}.
If there is no group, the number of sessions is limitated by sub network
(which can be a problem for example if the server is behind a
reverse proxy).
It is highly recommended to use session groups!
- Default number of sessions in a group: 5
- Default number of sessions in a sub network: 1000000
- Default IPV4 sub network: /16
- Default IPV6 sub network: /56
These default can be changed from configuration file and/or
using these functions.
If [~override_configfile] is [true] (default ([false]),
then the function will set the value even if it has been
modified in the configuration file.
It means that by default, these functions have no effect
if there is a value in the configuration file.
This gives the ability to override the values chosen by the module
in the configuration file.
Use [~override_configfile:true] for example if your
Eliom module wants to change the values afterwards
(for example in the site configuration Web interface).
*)
(** Sets the maximum number of service sessions in a session group
(see above).
*)
val set_default_max_service_sessions_per_group :
?override_configfile:bool -> int -> unit
(** Sets the maximum number of volatile data sessions in a session
group (see above).
*)
val set_default_max_volatile_data_sessions_per_group :
?override_configfile:bool -> int -> unit
(** Sets the maximum number of persistent data sessions in a session
group (see above). [None] means "no limitation".
*)
val set_default_max_persistent_data_sessions_per_group :
?override_configfile:bool -> int option -> unit
(** Sets the maximum number of volatile sessions (data and service) in a session
group (see above).
*)
val set_default_max_volatile_sessions_per_group :
?override_configfile:bool -> int -> unit
(** Sets the maximum number of service sessions in a subnet (see above).
*)
val set_default_max_service_sessions_per_subnet :
?override_configfile:bool -> int -> unit
(** Sets the maximum number of volatile data sessions in a subnet (see above).
*)
val set_default_max_volatile_data_sessions_per_subnet :
?override_configfile:bool -> int -> unit
(** Sets the maximum number of volatile sessions (data and service)
in a subnet (see above).
*)
val set_default_max_volatile_sessions_per_subnet :
?override_configfile:bool -> int -> unit
(** Sets the maximum number of tab service sessions in a session group
(see above).
*)
val set_default_max_service_tab_sessions_per_group :
?override_configfile:bool -> int -> unit
(** Sets the maximum number of volatile data tab sessions in a session
group (see above).
*)
val set_default_max_volatile_data_tab_sessions_per_group :
?override_configfile:bool -> int -> unit
(** Sets the maximum number of persistent data tab sessions in a session
group (see above).
*)
val set_default_max_persistent_data_tab_sessions_per_group :
?override_configfile:bool -> int option -> unit
(** Sets the maximum number of volatile tab sessions (data and service)
in a session group (see above).
*)
val set_default_max_volatile_tab_sessions_per_group :
?override_configfile:bool -> int -> unit
(** Sets the mask for subnet (IPV4). *)
val set_ipv4_subnet_mask :
?override_configfile:bool -> int32 -> unit
(** Sets the mask for subnet (IPV6). *)
val set_ipv6_subnet_mask :
?override_configfile:bool -> int64 * int64 -> unit
(** Sets the maximum number of service sessions in the current session
group (or for the client sub network, if there is no group).
*)
val set_max_service_states_for_group_or_subnet :
scope:Eliom_common.user_scope ->
?secure:bool ->
int ->
unit
(** Sets the maximum number of volatile data sessions in the current session
group (or for the client sub network, if there is no group).
*)
val set_max_volatile_data_states_for_group_or_subnet :
scope:Eliom_common.user_scope ->
?secure:bool ->
int ->
unit
(** Sets the maximum number of volatile sessions
(both data and service sessions) in the current
group (or for the client sub network, if there is no group).
*)
val set_max_volatile_states_for_group_or_subnet :
scope:Eliom_common.user_scope ->
?secure:bool ->
int ->
unit
(** {2 Expiration of cookies and timeouts} *)
(** {3 Cookie expiration} *)
(** The functions in this section ask the browser to set the state cookie
expiration date, for the different kinds of session, in seconds,
since the 1st of January 1970. [None] means the cookie will expire
when the browser is closed. Note: there is no way to set cookies
for an infinite time on browsers.
By default, it will affect regular browser cookies (sessions).
But if you set [~cookie_scope:`Client_process],
it will only affect the client-side Eliom process (if there is one),
which simulates some kind of "tab cookies".
*)
(** Sets the cookie expiration date for the current service state
(see above).
*)
val set_service_cookie_exp_date :
scope:Eliom_common.user_scope ->
?secure:bool ->
float option ->
unit
(** Sets the cookie expiration date for the current data state (see
above).
*)
val set_volatile_data_cookie_exp_date :
scope:Eliom_common.user_scope ->
?secure:bool ->
float option ->
unit
(** Sets the cookie expiration date for the persistent state (see
above).
*)
val set_persistent_data_cookie_exp_date :
scope:Eliom_common.user_scope ->
?secure:bool ->
float option ->
unit Lwt.t
(** {3 Global configuration of state timeouts} *)
(** The following functions set the timeout for states, for the
different kinds of states. States will be closed after
this amount of time of inactivity from the user. [None] means no
timeout.
The optional parameter [?recompute_expdates] is [false] by
default. If you set it to [true], the expiration dates for all
states in the table will be recomputed with the new timeout.
That is, the difference between the new timeout and the old one
will be added to their expiration dates (asynchronously,
by another Lwt thread, as this can take a long time).
States whose timeout has been set individually with
functions like
{!Eliom_state.set_volatile_data_state_timeout} won't be affected.
If [~scope_name] is not present, it is the default for all scope names,
and in that case [recompute_expdates] is ignored. [~scope_name:None]
means the default scope name.
If [~override_configfile] is [true] (default ([false]),
then the function will set the timeout even if it has been
modified in the configuration file.
It means that by default, these functions have no effect
if there is a value in the configuration file.
This gives the ability to override the values chosen by the module
in the configuration file.
Use [~override_configfile:true] for example if your
Eliom module wants to change the values afterwards
(for example in the site configuration Web interface).
*)
(** Sets the (server side) timeout for volatile (= "in memory") sessions (both
service session and volatile data session).
*)
val set_global_volatile_state_timeout :
scope:[< Eliom_common.user_scope ] ->
?recompute_expdates:bool ->
?override_configfile:bool ->
float option -> unit
val set_default_global_service_state_timeout :
cookie_scope:[< Eliom_common.cookie_scope ] ->
?override_configfile:bool ->
float option -> unit
(** Sets the (server side) timeout for service states.
*)
val set_global_service_state_timeout :
scope:[< Eliom_common.user_scope ] ->
?recompute_expdates:bool ->
?override_configfile:bool ->
float option -> unit
val set_default_global_service_state_timeout :
cookie_scope:[< Eliom_common.cookie_scope ] ->
?override_configfile:bool ->
float option -> unit
(** Sets the (server side) timeout for volatile (= "in memory") data states.
*)
val set_global_volatile_data_state_timeout :
scope:[< Eliom_common.user_scope ] ->
?recompute_expdates:bool ->
?override_configfile:bool ->
float option -> unit
val set_default_global_volatile_data_state_timeout :
cookie_scope:[< Eliom_common.cookie_scope ] ->
?override_configfile:bool ->
float option -> unit
(** Sets the (server side) timeout for persistent states.
*)
val set_global_persistent_data_state_timeout :
scope:[< Eliom_common.user_scope ] ->
?recompute_expdates:bool ->
?override_configfile:bool ->
float option -> unit
val set_default_global_persistent_data_state_timeout :
cookie_scope:[< Eliom_common.cookie_scope ] ->
?override_configfile:bool ->
float option -> unit
(** Returns the (server side) timeout for service states.
*)
val get_global_service_state_timeout :
scope:[< Eliom_common.user_scope ] ->
unit -> float option
(** Returns the (server side) timeout for "volatile data" states.
*)
val get_global_volatile_data_state_timeout :
scope:[< Eliom_common.user_scope ] ->
unit -> float option
(** Returns the (server side) timeout for persistent states.
*)
val get_global_persistent_data_state_timeout :
scope:[< Eliom_common.user_scope ] ->
unit -> float option
(** {3 Personalizing timeouts for current state} *)
(** sets the timeout for service state (server side) for current user,
in seconds. [None] = no timeout *)
val set_service_state_timeout :
scope:Eliom_common.user_scope ->
?secure:bool ->
float option -> unit
(** remove the service state timeout for current user
(and turn back to the default). *)
val unset_service_state_timeout :
scope:Eliom_common.user_scope ->
?secure:bool ->
unit -> unit
(** returns the timeout for current service state.
[None] = no timeout
*)
val get_service_state_timeout :
scope:Eliom_common.user_scope ->
?secure:bool ->
unit -> float option
(** sets the (server side) timeout for volatile data state for current user,
in seconds. [None] = no timeout *)
val set_volatile_data_state_timeout :
scope:Eliom_common.user_scope ->
?secure:bool ->
float option -> unit
(** remove the "volatile data" state timeout for current user
(and turn back to the default). *)
val unset_volatile_data_state_timeout :
scope:Eliom_common.user_scope ->
?secure:bool ->
unit -> unit
(** returns the timeout for current volatile data state.
[None] = no timeout
*)
val get_volatile_data_state_timeout :
scope:Eliom_common.user_scope ->
?secure:bool ->
unit -> float option
(** sets the (server side) timeout for persistent state for current user,
in seconds. [None] = no timeout *)
val set_persistent_data_state_timeout :
scope:Eliom_common.user_scope ->
?secure:bool ->
float option -> unit Lwt.t
(** remove the persistent state timeout for current user
(and turn back to the default). *)
val unset_persistent_data_state_timeout :
scope:Eliom_common.user_scope ->
?secure:bool ->
unit -> unit Lwt.t
(** returns the persistent state timeout for current user.
[None] = no timeout *)
val get_persistent_data_state_timeout :
scope:Eliom_common.user_scope ->
?secure:bool ->
unit -> float option Lwt.t
(*****************************************************************************)
(** {2 Administrating server side state} *)
(** {e Warning: Most these functions must be called when the site
information is available, that is, either
during a request or during the initialisation phase of the site.
Otherwise, it will raise the exception
{!Eliom_common.Eliom_site_information_not_available}.
If you are using static linking, you must delay the call to this function
until the configuration file is read, using
{!Eliom_service.register_eliom_module}. Otherwise you will also get
this exception.}
*)
(** The type of (volatile) state data tables. *)
type 'a volatile_table
(** The type of persistent state data tables. *)
type 'a persistent_table
(** Discard all services and persistent and volatile data for every scopes. *)
val discard_everything : unit -> unit Lwt.t
(*CCC missing ~secure? *)
(** Discard all services and persistent and volatile data for one scope. *)
val discard_all :
scope:Eliom_common.user_scope ->
unit ->
unit Lwt.t
(*VVV missing: scope group *)
(*VVV missing ~secure? *)
(** Discard server side data for all clients, for the given scope.
If the optional parameter [?persistent] is not present,
both the persistent and volatile data will be removed.
*)
val discard_all_data :
?persistent:bool ->
scope:Eliom_common.user_scope ->
unit ->
unit Lwt.t
(*VVV missing: scope group *)
(*VVV missing ~secure? *)
(** Remove all services registered for clients for the given scope. *)
val discard_all_services :
scope:Eliom_common.user_scope ->
unit ->
unit Lwt.t
(*VVV missing: scope group *)
(*VVV missing ~secure? *)
module Session_admin : sig
(** Type used to describe session timeouts *)
type timeout =
| TGlobal (** see global setting *)
| TNone (** explicitly set no timeout *)
| TSome of float (** timeout duration in seconds *)
type service_session
type data_session
type persistent_session
val close_service_session :
?close_group:bool ->
session:service_session ->
unit
val close_volatile_data_session :
?close_group:bool ->
session:data_session ->
unit
val close_persistent_data_session :
?close_group:bool ->
session:persistent_session ->
unit Lwt.t
(** Raises [Not_found] if no data in the table for the session. *)
val get_volatile_session_data :
session:data_session ->
table:'a volatile_table ->
'a
(** Fails with lwt exception [Not_found]
if no data in the table for the session. *)
val get_persistent_session_data :
session:persistent_session ->
table:'a persistent_table ->
'a Lwt.t
val remove_volatile_session_data :
session:data_session -> table:'a volatile_table -> unit
val remove_persistent_session_data :
session:persistent_session -> table:'a persistent_table -> unit Lwt.t
val get_service_scope_name :
session:service_session -> Eliom_common.scope_name
val get_volatile_data_scope_name : session:data_session ->
Eliom_common.scope_name
val get_persistent_data_scope_name :
session:persistent_session -> Eliom_common.scope_name
val get_service_session_cookie_scope :
session:service_session -> Eliom_common.cookie_scope
val get_volatile_data_session_cookie_scope : session:data_session ->
Eliom_common.cookie_scope
val get_persistent_data_session_cookie_scope :
session:persistent_session -> Eliom_common.cookie_scope
val set_service_session_timeout :
session:service_session -> float option -> unit
val set_volatile_data_session_timeout :
session:data_session -> float option -> unit
val set_persistent_data_session_timeout :
session:persistent_session -> float option -> unit Lwt.t
val get_service_session_timeout :
session:service_session -> timeout
val get_volatile_data_session_timeout :
session:data_session -> timeout
val get_persistent_data_session_timeout :
session:persistent_session -> timeout
val unset_service_session_timeout :
session:service_session -> unit
val unset_volatile_data_session_timeout :
session:data_session -> unit
val unset_persistent_data_session_timeout :
session:persistent_session -> unit Lwt.t
(** Iterator on service sessions. [Lwt_unix.yield] is called automatically
after each iteration.
*)
val iter_service_sessions :
(service_session -> unit Lwt.t) -> unit Lwt.t
(** Iterator on data sessions. [Lwt_unix.yield] is called automatically
after each iteration.
*)
val iter_volatile_data_sessions :
(data_session -> unit Lwt.t) -> unit Lwt.t
(** Iterator on persistent sessions. [Lwt_unix.yield] is called automatically
after each iteration. *)
val iter_persistent_data_sessions :
(persistent_session -> unit Lwt.t) -> unit Lwt.t
(** Iterator on service sessions. [Lwt_unix.yield] is called automatically
after each iteration.
*)
val fold_service_sessions :
(service_session -> 'b -> 'b Lwt.t) -> 'b -> 'b Lwt.t
(** Iterator on data sessions. [Lwt_unix.yield] is called automatically
after each iteration.
*)
val fold_volatile_data_sessions :
(data_session -> 'b -> 'b Lwt.t) -> 'b -> 'b Lwt.t
(** Iterator on persistent sessions. [Lwt_unix.yield] is called automatically
after each iteration. *)
val fold_persistent_data_sessions :
(persistent_session -> 'b -> 'b Lwt.t) -> 'b -> 'b Lwt.t
end
(*****************************************************************************)
(** {3 Session data (deprecated interface)} *)
(** This interface is deprecated. Now use Eliom references. *)
(** The type used for getting data from a state. *)
type 'a state_data =
| No_data
| Data_session_expired
| Data of 'a
(** {4 In memory state data} *)
(** creates a table in memory where you can store the session data for
all users. (deprecated)
{e Warning: This functions must be called when the site
information is available, that is, either
during a request or during the initialisation phase of the site.
Otherwise, it will raise the exception
{!Eliom_common.Eliom_site_information_not_available}.
If you are using static linking, you must delay the call to this function
until the configuration file is read, using
{!Eliom_service.register_eliom_module}. Otherwise you will also get
this exception.}
*)
val create_volatile_table :
scope:Eliom_common.user_scope ->
?secure:bool ->
unit -> 'a volatile_table
(** gets session data for the current session (if any). (deprecated) *)
val get_volatile_data :
table:'a volatile_table ->
unit ->
'a state_data
(** sets session data for the current session. (deprecated) *)
val set_volatile_data :
table:'a volatile_table ->
'a ->
unit
(** removes session data for the current session
(but does not close the session).
If the session does not exist, does nothing.
(deprecated)
*)
val remove_volatile_data :
table:'a volatile_table ->
unit ->
unit
(** {4 Persistent state data} *)
(** creates a table on hard disk where you can store the session data for
all users. It uses {!Ocsipersist}. (deprecated) *)
val create_persistent_table :
scope:Eliom_common.user_scope ->
?secure:bool ->
string -> 'a persistent_table
(** gets persistent session data for the current persistent session (if any).
(deprecated) *)
val get_persistent_data :
table:'a persistent_table ->
unit ->
'a state_data Lwt.t
(** sets persistent session data for the current persistent session.
(deprecated) *)
val set_persistent_data :
table:'a persistent_table ->
'a ->
unit Lwt.t
(** removes session data for the current persistent session
(but does not close the session).
If the session does not exist, does nothing.
(deprecated)
*)
val remove_persistent_data :
table:'a persistent_table ->
unit ->
unit Lwt.t
(**/**)
(*
(** {3 Default timeouts} *)
(** returns the default timeout for service sessions (server side).
The default timeout is common for all sessions for which no other value
has been set. At the beginning of the server, it is taken from the
configuration file, (or set to default value).
[None] = no timeout.
*)
val get_default_service_session_timeout : unit -> float option
(** returns the default timeout for "volatile data" sessions (server side).
The default timeout is common for all sessions for which no other value
has been set. At the beginning of the server, it is taken from the
configuration file, (or set to default value).
[None] = no timeout.
*)
val get_default_volatile_data_session_timeout : unit -> float option
(** returns the default timeout for sessions (server side).
The default timeout is common for all sessions for which no other value
has been set. At the beginning of the server, it is taken from the
configuration file, (or set to default value).
[None] = no timeout.
*)
val get_default_persistent_data_session_timeout : unit -> float option
(** sets the default timeout for volatile (= "in memory")
sessions (i.e. both service session and volatile data session)
(server side).
[None] = no timeout.
Warning: this function sets the default for all sites. You should
probably use [set_global_volatile_session_timeout] instead.
*)
val set_default_volatile_session_timeout : float option -> unit
(** sets the default timeout for service sessions.
[None] = no timeout.
Warning: this function sets the default for all sites. You should
probably use [set_global_service_session_timeout] instead.
*)
val set_default_service_session_timeout : float option -> unit
(** sets the default timeout for "volatile data" sessions (server side).
[None] = no timeout.
Warning: this function sets the default for all sites. You should
probably use [set_global_volatile_data_session_timeout] instead.
*)
val set_default_volatile_data_session_timeout : float option -> unit
(** sets the default timeout for sessions (server side).
[None] = no timeout.
Warning: this function sets the default for all sites. You should
probably use [set_global_persistent_data_session_timeout] instead.
*)
val set_default_persistent_data_session_timeout : float option -> unit
*)
(**/**)
(*****************************************************************************)
(** {3 Other low level functions} *)
(** You probably don't need these functions. *)
(** returns the value of the Eliom's cookies for one persistent session.
Returns [None] is no session is active.
*)
val get_persistent_data_cookie :
scope:Eliom_common.user_scope ->
?secure:bool ->
unit -> string option Lwt.t
(** returns the value of Eliom's cookies for one service session.
Returns [None] is no session is active.
*)
val get_service_cookie :
scope:Eliom_common.user_scope ->
?secure:bool ->
unit -> string option
(** returns the value of Eliom's cookies for one "volatile data" session.
Returns [None] is no session is active.
*)
val get_volatile_data_cookie :
scope:Eliom_common.user_scope ->
?secure:bool ->
unit -> string option
(**/**)
(*****************************************************************************)
val number_of_service_sessions : unit -> int
val number_of_volatile_data_sessions : unit -> int
val number_of_tables : unit -> int
val number_of_table_elements : unit -> int list
val number_of_persistent_data_sessions : unit -> int Lwt.t
val number_of_persistent_tables : unit -> int
val number_of_persistent_table_elements : unit -> (string * int) list Lwt.t
(* Because of Dbm implementation, the result may be less than the expected
result in some case (with a version of ocsipersist based on Dbm) *)
val get_global_table : unit -> Eliom_common.tables
val get_session_service_table :
sp:Eliom_common.server_params ->
scope:Eliom_common.user_scope ->
?secure:bool ->
unit ->
Eliom_common.tables ref
val get_session_service_table_if_exists :
sp:Eliom_common.server_params ->
scope:Eliom_common.user_scope ->
?secure:bool ->
unit ->
Eliom_common.tables ref
val create_volatile_table_during_session_ :
scope:Eliom_common.user_scope ->
secure:bool ->
Eliom_common.sitedata ->
'a volatile_table
|