001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.apache.hadoop.hbase.replication;
020
021import org.apache.yetus.audience.InterfaceAudience;
022import org.apache.hadoop.hbase.HBaseInterfaceAudience;
023import org.apache.hadoop.hbase.wal.WAL.Entry;
024
025/**
026 * A Filter for WAL entries before being sent over to replication. Multiple
027 * filters might be chained together using {@link ChainWALEntryFilter}.
028 * Applied on the replication source side.
029 * <p>There is also a filter that can be installed on the sink end of a replication stream.
030 * See {@link org.apache.hadoop.hbase.replication.regionserver.WALEntrySinkFilter}. Certain
031 * use-cases may need such a facility but better to filter here on the source side rather
032 * than later, after the edit arrives at the sink.</p>
033 * @see org.apache.hadoop.hbase.replication.regionserver.WALEntrySinkFilter for filtering
034 * replication on the sink-side.
035 */
036@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.REPLICATION)
037public interface WALEntryFilter {
038  /**
039   * Applies the filter, possibly returning a different Entry instance.
040   * If null is returned, the entry will be skipped.
041   * @param entry Entry to filter
042   * @return a (possibly modified) Entry to use. Returning null or an entry with
043   * no cells will cause the entry to be skipped for replication.
044   */
045  public Entry filter(Entry entry);
046}