/* -*- C -*- */

/*
 * $Id: ubik.xg,v 1.8 2000/03/14 22:28:12 assar Exp $
 */

package Ubik_

%#include <config.h>
%#include <roken.h>
%#include <fs_errors.h>

error-function conv_to_arla_errno

/*
 * Interface
 */

struct net_tid {
    long epoch;
    long counter;
};

typedef net_tid net_version;

struct ubik_debug {
        long now;
        long lastYesTime;
        long lastYesHost;
        long lastYesState;
        long lastYesClaim;
        long lowestHost;
        long lowestTime;
        long syncHost;
        long syncTime;
        net_version syncVersion;
        net_tid syncTid;
        long amSyncSite;
        long syncSiteUntil;
        long nServers;
        long lockedPages;
        long writeLockedPages;
        net_version localVersion;
        long activeWrite;
        long tidCounter;
        long anyReadLocks;
        long anyWriteLocks;
        long recoveryState;
        long currentTrans;
        long writeTrans;
        long epochTime;
};

struct ubik_sdebug {
        long addr;
        long lastVoteTime;
        long lastBeaconSent;
        long lastVote;
        net_version remoteVersion;
        long currentDB;
        long beaconSinceDown;
        long up;
};



/* Opcodes */

const VOTE_BEACON	= 10000;
const VOTE_DEBUG      	= 10001;
const VOTE_SDEBUG     	= 10002;
const VOTE_GETSYNCSITE	= 10003;

/* Error codes */

const UNOQUORUM		= 5376;
const UNOTSYNC		= 5377;
const UNHOSTS		= 5378;
const UIOERROR		= 5379;
const UINTERNAL		= 5380;
const USYNC		= 5381;
const UNOENT		= 5382;
const UBADLOCK		= 5383;
const UBADLOG		= 5384;
const UBADHOST		= 5385;
const UBADTYPE		= 5386;
const UTWOENDS		= 5387;
const UDONE		= 5388;
const UNOSERVERS	= 5389;
const UEOF		= 5390;
const ULOGIO		= 5391;
const UBADFAM		= 5392;
const UBADCELL		= 5393;
const UBADSECGRP	= 5394;
const UBADGROUP		= 5395;
const UBADUUID		= 5396;
const UNOMEM		= 5397;
const UNOTMEMBER	= 5398;
const UNBINDINGS	= 5399;
const UBADPRINNAME	= 5400;
const UPIPE		= 5401;
const UDEADLOCK		= 5402;
const UEXCEPTION	= 5403;
const UTPQFAIL		= 5404;
const USKEWED		= 5405;
const UNOLOCK		= 5406;
const UNOACCESS		= 5407;
const UNOSPC		= 5408;
const UBADPATH		= 5409;
const UBADF		= 5410;
const UREINITIALIZE	= 5411;

/* The rpc calls */

Beacon (IN long state, 
        IN long voteStart, 
        IN net_version *Version, 
        IN net_tid *tid) multi = VOTE_BEACON;

Debug (OUT ubik_debug *db) = VOTE_DEBUG;

SDebug (IN long which, OUT ubik_sdebug *db) = VOTE_SDEBUG;

GetSyncSite (OUT long *site) = VOTE_GETSYNCSITE;
