View Javadoc

1   /*
2    * Copyright 2011 The Apache Software Foundation
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  package org.apache.hadoop.hbase.regionserver.wal;
21  
22  import java.io.IOException;
23  
24  import org.apache.hadoop.fs.Path;
25  import org.apache.hadoop.hbase.HRegionInfo;
26  import org.apache.hadoop.hbase.HTableDescriptor;
27  
28  /**
29   * Get notification of {@link HLog}/WAL log events. The invocations are inline
30   * so make sure your implementation is fast else you'll slow hbase.
31   */
32  public interface WALActionsListener {
33    /**
34     * The WAL was rolled.
35     * @param newFile the path to the new hlog
36     */
37    public void logRolled(Path newFile) throws IOException;
38  
39    /**
40     * A request was made that the WAL be rolled.
41     */
42    public void logRollRequested();
43  
44    /**
45     * The WAL is about to close.
46     */
47    public void logCloseRequested();
48  
49    /**
50    * Called before each write.
51    * @param info
52    * @param logKey
53    * @param logEdit
54    */
55   public void visitLogEntryBeforeWrite(HRegionInfo info, HLogKey logKey,
56     WALEdit logEdit);
57  
58    /**
59     *
60     * @param htd
61     * @param logKey
62     * @param logEdit
63     */
64   public void visitLogEntryBeforeWrite(HTableDescriptor htd, HLogKey logKey,
65     WALEdit logEdit);
66  
67  }