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 */
018package org.apache.hadoop.hbase.regionserver;
019
020import java.util.List;
021import org.apache.yetus.audience.InterfaceAudience;
022
023/**
024 * Request a flush.
025 */
026@InterfaceAudience.Private
027public interface FlushRequester {
028  /**
029   * Tell the listener the cache needs to be flushed.
030   * @param region the Region requesting the cache flush
031   * @return true if our region is added into the queue, false otherwise
032   */
033  boolean requestFlush(HRegion region, FlushLifeCycleTracker tracker);
034
035  /**
036   * Tell the listener the cache needs to be flushed.
037   * @param region   the Region requesting the cache flush
038   * @param families stores of region to flush, if null then use flush policy
039   * @return true if our region is added into the queue, false otherwise
040   */
041  boolean requestFlush(HRegion region, List<byte[]> families, FlushLifeCycleTracker tracker);
042
043  /**
044   * Tell the listener the cache needs to be flushed after a delay
045   * @param region the Region requesting the cache flush
046   * @param delay  after how much time should the flush happen
047   * @return true if our region is added into the queue, false otherwise
048   */
049  boolean requestDelayedFlush(HRegion region, long delay);
050
051  /**
052   * Register a FlushRequestListener
053   */
054  void registerFlushRequestListener(final FlushRequestListener listener);
055
056  /**
057   * Unregister the given FlushRequestListener
058   * @return true when passed listener is unregistered successfully.
059   */
060  public boolean unregisterFlushRequestListener(final FlushRequestListener listener);
061
062  /**
063   * Sets the global memstore limit to a new size.
064   */
065  public void setGlobalMemStoreLimit(long globalMemStoreSize);
066}