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
|
/** BEGIN COPYRIGHT BLOCK
* Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
* Copyright (C) 2005 Red Hat, Inc.
* All rights reserved.
*
* License: GPL (version 3 or any later version).
* See LICENSE for details.
* END COPYRIGHT BLOCK **/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
/* repl5_replsupplier.c */
/*
A replsupplier is an object that knows how to manage outbound replication
for one consumer.
Methods:
init()
configure()
start()
stop()
destroy()
status()
notify()
*/
#include "slapi-plugin.h"
#include "repl5.h"
typedef struct repl_supplier
{
PRUint32 client_change_count; /* # of client-supplied changes */
PRUint32 repl_change_count; /* # of replication updates */
PRLock *lock;
} repl_supplier;
static void repl_supplier_free(Repl_Supplier **rsp);
/*
* Create and initialize this replsupplier object.
*/
Repl_Supplier *
replsupplier_init(Slapi_Entry *e)
{
Repl_Supplier *rs;
if ((rs = (Repl_Supplier *)slapi_ch_malloc(sizeof(Repl_Supplier))) == NULL) {
goto loser;
}
if ((rs->lock = PR_NewLock()) == NULL) {
goto loser;
}
return rs;
loser:
repl_supplier_free(&rs);
return NULL;
}
static void
repl_supplier_free(Repl_Supplier **rsp)
{
if (NULL != rsp) {
Repl_Supplier *rs = *rsp;
if (NULL != rs) {
if (NULL != rs->lock) {
PR_DestroyLock(rs->lock);
rs->lock = NULL;
}
slapi_ch_free((void **)rsp);
}
}
}
/*
* Configure a repl_supplier object.
*/
void
replsupplier_configure(Repl_Supplier *rs, Slapi_PBlock *pb)
{
PR_ASSERT(NULL != rs);
}
/*
* Start a repl_supplier object. This means that it's ok for
* the repl_supplier to begin normal replication duties. It does
* not necessarily mean that a replication session will occur
* immediately.
*/
void
replsupplier_start(Repl_Supplier *rs)
{
PR_ASSERT(NULL != rs);
}
/*
* Stop a repl_supplier object. This causes any active replication
* sessions to be stopped ASAP, and puts the repl_supplier into a
* stopped state. No additional replication activity will occur
* until the replsupplier_start() function is called.
*/
void
replsupplier_stop(Repl_Supplier *rs)
{
PR_ASSERT(NULL != rs);
}
/*
* Destroy a repl_supplier object. The object will be stopped, if it
* is not already stopped.
*/
void
replsupplier_destroy(Repl_Supplier **rsp)
{
Repl_Supplier *rs;
PR_ASSERT(NULL != rsp && NULL != *rsp);
rs = *rsp;
slapi_ch_free((void **)rsp);
}
/*
* This method should be called by the repl_bos whenever it determines
* that a change to the replicated area serviced by this repl_supplier
* has occurred. This gives the repl_supplier a chance to implement a
* scheduling policy.
*/
void
replsupplier_notify(Repl_Supplier *rs, PRUint32 eventmask)
{
PR_ASSERT(NULL != rs);
}
/*
* This method is used to obtain the status of this particular
* repl_supplier object. Eventually it will return some object containing
* status information. For now, it's just a placeholder function.
*/
PRUint32
replsupplier_get_status(Repl_Supplier *rs)
{
PR_ASSERT(NULL != rs);
return 0;
}
|