001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2013 ForgeRock AS. 015 */ 016package org.opends.server.replication.server.changelog.api; 017 018 019 020/** 021 * This interface is the entry point for the changelog database which stores the 022 * replication data on persistent storage. It allows to control the overall 023 * database or access more specialized interfaces. 024 */ 025public interface ChangelogDB 026{ 027 028 /** 029 * Initializes the replication database by reading its previous state and 030 * building the relevant ReplicaDBs according to the previous state. This 031 * method must be called once before using the ChangelogDB. 032 */ 033 void initializeDB(); 034 035 /** 036 * Sets the purge delay for the replication database. Can be called while the 037 * database is running. 038 * <p> 039 * Purging happens on a best effort basis, i.e. the purge delay is used by the 040 * replication database to know which data can be purged, but there are no 041 * guarantees on when the purging will actually happen. 042 * 043 * @param delayInMillis 044 * the purge delay in milliseconds 045 */ 046 void setPurgeDelay(long delayInMillis); 047 048 /** 049 * Sets whether the replication database must compute change numbers for 050 * replicated changes. Change numbers are computed using a separate new 051 * thread. 052 * 053 * @param computeChangeNumber 054 * whether to compute change numbers for replicated changes 055 * @throws ChangelogException 056 * If a database problem happened 057 */ 058 void setComputeChangeNumber(boolean computeChangeNumber) 059 throws ChangelogException; 060 061 /** 062 * Shutdown the replication database. 063 * 064 * @throws ChangelogException 065 * If a database problem happened 066 */ 067 void shutdownDB() throws ChangelogException; 068 069 /** 070 * Removes the changelog database directory. 071 * 072 * @throws ChangelogException 073 * If a database problem happened 074 */ 075 void removeDB() throws ChangelogException; 076 077 /** 078 * Returns the {@link ChangeNumberIndexDB} object. 079 * 080 * @return the {@link ChangeNumberIndexDB} object 081 */ 082 ChangeNumberIndexDB getChangeNumberIndexDB(); 083 084 /** 085 * Returns the {@link ReplicationDomainDB} object. 086 * 087 * @return the {@link ReplicationDomainDB} object 088 */ 089 ReplicationDomainDB getReplicationDomainDB(); 090}