HBASE-21843 RegionGroupingProvider breaks the meta wal file name pattern which may...
[hbase.git] / hbase-server / src / main / java / org / apache / hadoop / hbase / quotas / FileArchiverNotifier.java
blob7f1e47bc708b760bc3485366c31b21081e629639
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to you under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 package org.apache.hadoop.hbase.quotas;
19 import java.io.IOException;
20 import java.util.Collection;
21 import java.util.Map.Entry;
22 import java.util.Set;
24 import org.apache.yetus.audience.InterfaceAudience;
26 /**
27 * Interface allowing various implementations of tracking files that have recently been archived to
28 * allow for the Master to notice changes to snapshot sizes for space quotas.
30 * This object needs to ensure that {@link #addArchivedFiles(Set)} and
31 * {@link #computeAndStoreSnapshotSizes(Collection)} are mutually exclusive. If a "full" computation
32 * is in progress, new changes being archived should be held.
34 @InterfaceAudience.Private
35 public interface FileArchiverNotifier {
37 /**
38 * Records a file and its size in bytes being moved to the archive directory.
40 * @param fileSizes A collection of file name to size in bytes
41 * @throws IOException If there was an IO-related error persisting the file size(s)
43 void addArchivedFiles(Set<Entry<String, Long>> fileSizes) throws IOException;
45 /**
46 * Computes the size of a table and all of its snapshots, recording new "full" sizes for each.
48 * @param currentSnapshots the current list of snapshots against this table
49 * @return The total size of all snapshots against this table.
50 * @throws IOException If there was an IO-related error computing or persisting the sizes.
52 long computeAndStoreSnapshotSizes(Collection<String> currentSnapshots) throws IOException;