首页 > 其他分享 >dremio HomeFileSystemStoragePlugin简单介绍

dremio HomeFileSystemStoragePlugin简单介绍

时间:2022-10-17 23:15:09浏览次数:83  
标签:HomeFileSystemStoragePlugin dremio java dac 简单 home include com

使用过dremio 的同学应该了解dremio 对于每个用户会支持一个@ 的导航(小房子标记)

参考接口效果

rest api 请求的,会包含一个containerType home 的就是HomeFileSystemStoragePlugin 产生的文件信息

 

 

HomeFileSystemStoragePlugin 接口定义

从下图可以看出,home 文件系统可能会是一个分布式文件系统(比如s3)而且可能会支持iceberg ,当前对于分布式文件系统支持aws,s3,azure,gcs。。。
当然本地的nas 也是可以的,而且本地文件系统也是可以的(伪分布式文件系统)

 

 

 

 

接口集成

  • CatalogResource
 
 @GET
  public ResponseList<? extends CatalogItem> listTopLevelCatalog(@QueryParam("include") final List<String> include) {
    return new ResponseList<>(catalogServiceHelper.getTopLevelCatalogItems(include));
  }

数据获取处理

public List<? extends CatalogItem> getTopLevelCatalogItems(final List<String> include) {
    Preconditions.checkNotNull(include);
 
    List<CatalogItem> topLevelItems = new ArrayList<>();
 
    try {
     // home 
      HomeConfig homeForCurrentUser = getHomeForCurrentUser();
      topLevelItems.add(CatalogItem.fromHomeConfig(homeForCurrentUser));
    } catch (NamespaceException e) {
      // if for some reason we can't find a home space, log it but keep going
      logger.warn("Failed to find home space for user [{}]", context.getUserPrincipal().getName());
    }
 
   // space 
    for (SpaceConfig spaceConfig : namespaceService.getSpaces()) {
      topLevelItems.add(CatalogItem.fromSpaceConfig(spaceConfig));
    }
 
   // source 
    for (SourceConfig sourceConfig : sourceService.getSources()) {
      topLevelItems.add(CatalogItem.fromSourceConfig(sourceConfig));
    }
 
    return applyAdditionalInfoToContainers(topLevelItems, include.stream()
        .map(CatalogServiceHelper.DetailType::valueOf)
        .collect(Collectors.toList()));
  }

HomeFileSystemStoragePlugin 额外的能力

home 也支持文件的上传,下载以及更新(包含文件夹),同时也支持format 处理,支持sql 查询
当然这些是基于rest api 的,同时利用了HomeFileTool 工具,提供的文件操作能力,具体rest api
参考HomeResource.java

说明

dremio 将home 设计会一个独立的文件系统是比较有意义的,可以实现用户自定义数据的上传可以与其他source 以及space 的数据进行vds 的处理,实现数据
的自助能力

参考资料

https://github.com/dremio/dremio-oss/blob/d41cb52143b6b0289fc8ed4d970bfcf410a669e8/dac/backend/src/main/java/com/dremio/dac/homefiles/HomeFileSystemStoragePlugin.java
https://github.com/dremio/dremio-oss/blob/d41cb52143b6b0289fc8ed4d970bfcf410a669e8/dac/backend/src/main/java/com/dremio/dac/homefiles/HomeFileConf.java
https://github.com/dremio/dremio-oss/blob/d41cb52143b6b0289fc8ed4d970bfcf410a669e8/dac/backend/src/main/java/com/dremio/dac/api/CatalogResource.java
https://github.com/dremio/dremio-oss/blob/d41cb52143b6b0289fc8ed4d970bfcf410a669e8/dac/backend/src/main/java/com/dremio/dac/resource/HomeResource.java

标签:HomeFileSystemStoragePlugin,dremio,java,dac,简单,home,include,com
From: https://www.cnblogs.com/rongfengliang/p/16801083.html

相关文章