View source with raw comments or as raw
    1/*  Part of SWI-Prolog
    2
    3    Author:        Jan Wielemaker
    4    WWW:           http://www.swi-prolog.org
    5    Copyright (c)  2018, CWI, Amsterdam
    6    All rights reserved.
    7
    8    Redistribution and use in source and binary forms, with or without
    9    modification, are permitted provided that the following conditions
   10    are met:
   11
   12    1. Redistributions of source code must retain the above copyright
   13       notice, this list of conditions and the following disclaimer.
   14
   15    2. Redistributions in binary form must reproduce the above copyright
   16       notice, this list of conditions and the following disclaimer in
   17       the documentation and/or other materials provided with the
   18       distribution.
   19
   20    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   21    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   22    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   23    FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   24    COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   25    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   26    BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   27    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   28    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   29    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   30    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   31    POSSIBILITY OF SUCH DAMAGE.
   32*/
   33
   34:- module(tipc_paxos,
   35          [ tipc_paxos_get/1,         % ?Term
   36            tipc_paxos_get/2,         % ?Term, +Options
   37            tipc_paxos_set/1,         % ?Term
   38            tipc_paxos_set/2,         % ?Term, +Options
   39            tipc_paxos_on_change/2,   % ?Term, +Goal
   40            tipc_initialize/0
   41          ]).   42:- use_module(library(tipc/tipc_broadcast), [tipc_initialize/0]).   43:- autoload(library(paxos),[paxos_set/2,paxos_get/2,paxos_on_change/2]).

Paxos on TIPC

This module provides compatibility for using paxos over TIPC. As of SWI-Prolog 7.7.15 the core of this module has been moved to the core library as library(paxos) and can be used with other distributed implementations of library(broadcast) such as library(udb_broadcast). */

   53:- meta_predicate
   54    tipc_paxos_on_change(?, 0).
 tipc_paxos_set(?Term) is semidet
 tipc_paxos_get(?Term) is semidet
 tipc_paxos_get(?Term, +Options) is semidet
 tipc_paxos_set(?Term, +Options) is semidet
 tipc_paxos_on_change(?Term, :Goal) is det
   62tipc_paxos_set(Term) :-             paxos_set(Term, []).
   63tipc_paxos_set(Term, Options) :-    paxos_set(Term, Options).
   64tipc_paxos_get(Term) :-             paxos_get(Term, []).
   65tipc_paxos_get(Term, Options) :-    paxos_get(Term, Options).
   66tipc_paxos_on_change(Term, Goal) :- paxos_on_change(Term, Goal).
   67
   68:- multifile
   69    paxos:paxos_message_hook/3.   70
   71paxos:paxos_message_hook(Paxos, -,   tipc_cluster(Paxos)) :- !.
   72paxos:paxos_message_hook(Paxos, TMO, tipc_cluster(Paxos, TMO))