1 // Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
2 //  This source code is licensed under both the GPLv2 (found in the
3 //  COPYING file in the root directory) and Apache 2.0 License
4 //  (found in the LICENSE.Apache file in the root directory).
5 
6 package org.rocksdb;
7 
8 import java.util.Arrays;
9 import java.util.List;
10 
11 /**
12  * The metadata that describes a level.
13  */
14 public class LevelMetaData {
15   private final int level;
16   private final long size;
17   private final SstFileMetaData[] files;
18 
19   /**
20    * Called from JNI C++
21    */
LevelMetaData(final int level, final long size, final SstFileMetaData[] files)22   private LevelMetaData(final int level, final long size,
23       final SstFileMetaData[] files) {
24     this.level = level;
25     this.size = size;
26     this.files = files;
27   }
28 
29   /**
30    * The level which this meta data describes.
31    *
32    * @return the level
33    */
level()34   public int level() {
35     return level;
36   }
37 
38   /**
39    * The size of this level in bytes, which is equal to the sum of
40    * the file size of its {@link #files()}.
41    *
42    * @return the size
43    */
size()44   public long size() {
45     return size;
46   }
47 
48   /**
49    * The metadata of all sst files in this level.
50    *
51    * @return the metadata of the files
52    */
files()53   public List<SstFileMetaData> files() {
54     return Arrays.asList(files);
55   }
56 }
57