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 column family.
13  */
14 public class ColumnFamilyMetaData {
15   private final long size;
16   private final long fileCount;
17   private final byte[] name;
18   private final LevelMetaData[] levels;
19 
20   /**
21    * Called from JNI C++
22    */
ColumnFamilyMetaData( final long size, final long fileCount, final byte[] name, final LevelMetaData[] levels)23   private ColumnFamilyMetaData(
24       final long size,
25       final long fileCount,
26       final byte[] name,
27       final LevelMetaData[] levels) {
28     this.size = size;
29     this.fileCount = fileCount;
30     this.name = name;
31     this.levels = levels;
32   }
33 
34   /**
35    * The size of this column family in bytes, which is equal to the sum of
36    * the file size of its {@link #levels()}.
37    *
38    * @return the size of this column family
39    */
size()40   public long size() {
41     return size;
42   }
43 
44   /**
45    * The number of files in this column family.
46    *
47    * @return the number of files
48    */
fileCount()49   public long fileCount() {
50     return fileCount;
51   }
52 
53   /**
54    * The name of the column family.
55    *
56    * @return the name
57    */
name()58   public byte[] name() {
59     return name;
60   }
61 
62   /**
63    * The metadata of all levels in this column family.
64    *
65    * @return the levels metadata
66    */
levels()67   public List<LevelMetaData> levels() {
68     return Arrays.asList(levels);
69   }
70 }
71