/* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt * or http://forgerock.org/license/CDDLv1.0.html. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at legal-notices/CDDLv1_0.txt. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: * Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END * * * Copyright 2013-2015 ForgeRock AS */ package org.opends.server.replication.server.changelog.api; import java.util.Set; import org.opends.server.replication.common.CSN; import org.opends.server.replication.common.MultiDomainServerState; import org.opends.server.replication.common.ServerState; import org.opends.server.replication.protocol.UpdateMsg; import org.opends.server.replication.server.changelog.api.DBCursor.CursorOptions; import org.opends.server.replication.server.changelog.file.MultiDomainDBCursor; import org.opends.server.types.DN; /** * This interface allows to query or control the replication domain database(s) * (composed of one or more ReplicaDBs) and query/update each ReplicaDB. *
* In particular, the {@code getCursorFom()} methods allow to obtain a cursor at any level: *
* When the cursor is not used anymore, client code MUST call the * {@link DBCursor#close()} method to free the resources and locks used by the * cursor. * * @param startState * Starting point for each domain cursor. If any {@link ServerState} * for a domain is null, then start from the oldest CSN for each * replicaDBs * @param options The cursor options * @return a non null {@link DBCursor} * @throws ChangelogException * If a database problem happened * @see #getCursorFrom(DN, ServerState, CursorOptions) */ MultiDomainDBCursor getCursorFrom(MultiDomainServerState startState, CursorOptions options) throws ChangelogException; /** * Generates a {@link DBCursor} across all the domains starting before, at or * after the provided {@link MultiDomainServerState} for each domain, * excluding a provided set of domain DNs. *
* When the cursor is not used anymore, client code MUST call the
* {@link DBCursor#close()} method to free the resources and locks used by the
* cursor.
*
* @param startState
* Starting point for each domain cursor. If any {@link ServerState}
* for a domain is null, then start from the oldest CSN for each
* replicaDBs
* @param options The cursor options
* @param excludedDomainDns
* Every domain appearing in this set is excluded from the cursor
* @return a non null {@link DBCursor}
* @throws ChangelogException
* If a database problem happened
* @see #getCursorFrom(DN, ServerState, CursorOptions)
*/
MultiDomainDBCursor getCursorFrom(MultiDomainServerState startState, CursorOptions options, Set
* When the cursor is not used anymore, client code MUST call the
* {@link DBCursor#close()} method to free the resources and locks used by the
* cursor.
*
* @param baseDN
* the replication domain baseDN
* @param startState
* Starting point for each ReplicaDB cursor. If any CSN for a
* replicaDB is null, then start from the oldest CSN for this
* replicaDB
* @param options The cursor options
* @return a non null {@link DBCursor}
* @throws ChangelogException
* If a database problem happened
* @see #getCursorFrom(DN, int, CSN, CursorOptions)
*/
DBCursor
* When the cursor is not used anymore, client code MUST call the
* {@link DBCursor#close()} method to free the resources and locks used by the
* cursor.
*
* @param baseDN
* the replication domain baseDN of the replicaDB
* @param serverId
* the serverId of the replicaDB
* @param startCSN
* Starting point for the ReplicaDB cursor. If the CSN is null, then
* start from the oldest CSN for this replicaDB
* @param options The cursor options
* @return a non null {@link DBCursor}
* @throws ChangelogException
* If a database problem happened
*/
DBCursor
* This method allows the medium consistency point to move forward in case
* this replica did not publish new changes.
*
* @param baseDN
* the replication domain baseDN
* @param heartbeatCSN
* The CSN heartbeat sent by this replica (contains the serverId and
* timestamp of the heartbeat)
* @throws ChangelogException
* If a database problem happened
*/
void replicaHeartbeat(DN baseDN, CSN heartbeatCSN) throws ChangelogException;
/**
* Let the DB know this replica is going down.
*
* This method allows to let the medium consistency point move forward while
* this replica is offline.
*
* Note: This method must not be called to let the DB know the replica is not
* sending heartbeats anymore, i.e. it must not be used in case of suspected
* network partition.
*
* @param baseDN
* the replication domain baseDN
* @param offlineCSN
* The CSN (serverId and timestamp) for the replica's going offline
* @throws ChangelogException
* If a database problem happened
*/
void notifyReplicaOffline(DN baseDN, CSN offlineCSN) throws ChangelogException;
}