Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
HdfsCachePool.java
Go to the documentation of this file.
1 // Copyright 2012 Cloudera Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 package com.cloudera.impala.catalog;
16 
17 import org.apache.hadoop.hdfs.protocol.CachePoolInfo;
18 
19 import com.cloudera.impala.thrift.TCatalogObjectType;
20 import com.cloudera.impala.thrift.THdfsCachePool;
21 import com.google.common.base.Preconditions;
22 
28 public class HdfsCachePool implements CatalogObject {
29  private long catalogVersion_;
30  private final THdfsCachePool cachePool_;
31 
32  public HdfsCachePool(CachePoolInfo cachePoolInfo) {
33  cachePool_ = new THdfsCachePool(cachePoolInfo.getPoolName());
34  }
35 
36  public HdfsCachePool(THdfsCachePool cachePool) {
37  Preconditions.checkNotNull(cachePool);
38  cachePool_ = cachePool;
39  }
40 
41  @Override
42  public TCatalogObjectType getCatalogObjectType() {
43  return TCatalogObjectType.HDFS_CACHE_POOL;
44  }
45 
46  public THdfsCachePool toThrift() {
47  return cachePool_;
48  }
49 
50  public static HdfsCachePool fromThrift(THdfsCachePool cachePool) {
51  return new HdfsCachePool(cachePool);
52  }
53 
54  @Override
55  public String getName() { return cachePool_.getPool_name(); }
56  @Override
57  public long getCatalogVersion() { return catalogVersion_; }
58  @Override
59  public void setCatalogVersion(long newVersion) { catalogVersion_ = newVersion; }
60  @Override
61  public boolean isLoaded() { return true; }
62 }
HdfsCachePool(CachePoolInfo cachePoolInfo)
HdfsCachePool(THdfsCachePool cachePool)
static HdfsCachePool fromThrift(THdfsCachePool cachePool)