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_replicate/1,   % ?Term
   40            tipc_paxos_on_change/2,   % ?Term, +Goal
   41            tipc_initialize/0
   42          ]).   43:- use_module(library(tipc/tipc_broadcast)).   44:- use_module(library(paxos)).

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). */

   54:- meta_predicate
   55    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_replicate(?Term) is det
 tipc_paxos_on_change(?Term, :Goal) is det
   64tipc_paxos_set(Term) :-             paxos_set(Term, []).
   65tipc_paxos_set(Term, Options) :-    paxos_set(Term, Options).
   66tipc_paxos_get(Term) :-             paxos_get(Term, []).
   67tipc_paxos_get(Term, Options) :-    paxos_get(Term, Options).
   68tipc_paxos_replicate(X) :-          paxos_replicate(X).
   69tipc_paxos_on_change(Term, Goal) :- paxos_on_change(Term, Goal).
   70
   71:- multifile
   72    paxos:paxos_message_hook/3.   73
   74paxos:paxos_message_hook(Paxos, -,   tipc_cluster(Paxos)) :- !.
   75paxos:paxos_message_hook(Paxos, TMO, tipc_cluster(Paxos, TMO))