| <!doctype html> |
| <html lang="zh-CN" dir="ltr" class="docs-wrapper docs-doc-page docs-version-1.5.0 plugin-docs plugin-id-default docs-doc-id-architecture/feature/public-enhancement-services/bml/overview"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="generator" content="Docusaurus v2.2.0"> |
| <title data-rh="true">总览 | Apache Linkis</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://linkis.apache.org/zh-CN/docs/1.5.0/architecture/feature/public-enhancement-services/bml/overview"><meta data-rh="true" name="docusaurus_locale" content="zh-CN"><meta data-rh="true" name="docsearch:language" content="zh-CN"><meta data-rh="true" name="docusaurus_version" content="1.5.0"><meta data-rh="true" name="docusaurus_tag" content="docs-default-1.5.0"><meta data-rh="true" name="docsearch:version" content="1.5.0"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-1.5.0"><meta data-rh="true" property="og:title" content="总览 | Apache Linkis"><meta data-rh="true" name="description" content="背景"><meta data-rh="true" property="og:description" content="背景"><link data-rh="true" rel="icon" href="/zh-CN/img/favicon.ico"><link data-rh="true" rel="canonical" href="https://linkis.apache.org/zh-CN/docs/1.5.0/architecture/feature/public-enhancement-services/bml/overview"><link data-rh="true" rel="alternate" href="https://linkis.apache.org/docs/1.5.0/architecture/feature/public-enhancement-services/bml/overview" hreflang="en"><link data-rh="true" rel="alternate" href="https://linkis.apache.org/zh-CN/docs/1.5.0/architecture/feature/public-enhancement-services/bml/overview" hreflang="zh-CN"><link data-rh="true" rel="alternate" href="https://linkis.apache.org/docs/1.5.0/architecture/feature/public-enhancement-services/bml/overview" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://AE29KQB3IA-dsn.algolia.net" crossorigin="anonymous"><link rel="alternate" type="application/rss+xml" href="/zh-CN/blog/rss.xml" title="Apache Linkis RSS Feed"> |
| <link rel="alternate" type="application/atom+xml" href="/zh-CN/blog/atom.xml" title="Apache Linkis Atom Feed"> |
| <link rel="alternate" type="application/json" href="/zh-CN/blog/feed.json" title="Apache Linkis JSON Feed"> |
| |
| |
| |
| <link rel="search" type="application/opensearchdescription+xml" title="Apache Linkis" href="/zh-CN/opensearch.xml"><link rel="stylesheet" href="/zh-CN/assets/css/styles.3e8e01b6.css"> |
| <link rel="preload" href="/zh-CN/assets/js/runtime~main.40411d4a.js" as="script"> |
| <link rel="preload" href="/zh-CN/assets/js/main.b85ef3f0.js" as="script"> |
| </head> |
| <body class="navigation-with-keyboard"> |
| <script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus"> |
| <div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#docusaurus_skipToContent_fallback">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/zh-CN/"><div class="navbar__logo"><img src="/zh-CN/img/logo.png" alt="Apache Linkis Logo" class="themedImage_ToTc themedImage--light_HNdA"><img src="/zh-CN/img/logo.png" alt="Apache Linkis Logo" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Apache Linkis</b></a><a class="navbar__item navbar__link" href="/zh-CN/download/main">下载</a><a class="navbar__item navbar__link" href="/zh-CN/community/how-to-subscribe">社区</a><a class="navbar__item navbar__link" href="/zh-CN/blog">博客</a><a class="navbar__item navbar__link" href="/zh-CN/team">团队</a><a class="navbar__item navbar__link" href="/zh-CN/user">用户</a><a href="https://docs.qq.com/doc/DUkdTTGhVSlZ0VXVt" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">FAQ</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">Apache</a><ul class="dropdown__menu"><li><a href="https://www.apache.org/" target="_blank" rel="noopener noreferrer" class="dropdown__link">基金会</a></li><li><a href="https://www.apache.org/licenses/" target="_blank" rel="noopener noreferrer" class="dropdown__link">证书</a></li><li><a href="https://www.apache.org/events/current-event" target="_blank" rel="noopener noreferrer" class="dropdown__link">事件</a></li><li><a href="https://www.apache.org/security/" target="_blank" rel="noopener noreferrer" class="dropdown__link">安全</a></li><li><a href="https://www.apache.org/foundation/sponsorship.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">赞助</a></li><li><a href="https://privacy.apache.org/policies/privacy-policy-public.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">Privacy</a></li><li><a href="https://www.apache.org/foundation/thanks.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">致谢</a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">文档</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/zh-CN/docs/latest/about/introduction">1.6.0</a></li><li><a class="dropdown__link" href="/zh-CN/docs/1.5.0/about/introduction">1.5.0</a></li><li><a class="dropdown__link" href="/zh-CN/docs/1.4.0/about/introduction">1.4.0</a></li><li><a class="dropdown__link" href="/zh-CN/docs/1.7.0/about/introduction">Next(1.7.0)</a></li><li><a class="dropdown__link" href="/zh-CN/versions">All Version</a></li></ul></div><a href="https://github.com/apache/linkis" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link header-github-link" aria-label="GitHub"></a><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link"><svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" class="iconLanguage_nlXk"><path fill="currentColor" d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path></svg>简体中文</a><ul class="dropdown__menu"><li><a href="/docs/1.5.0/architecture/feature/public-enhancement-services/bml/overview" target="_self" rel="noopener noreferrer" class="dropdown__link" lang="en">English</a></li><li><a href="/zh-CN/docs/1.5.0/architecture/feature/public-enhancement-services/bml/overview" target="_self" rel="noopener noreferrer" class="dropdown__link dropdown__link--active" lang="zh-CN">简体中文</a></li></ul></div><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="搜索"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20" aria-hidden="true"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">搜索</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="回到顶部" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebar_njMd"><nav class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh-CN/docs/1.5.0/about/introduction">关于 Linkis</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh-CN/docs/1.5.0/quick/live-demo">快速体验</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh-CN/docs/1.5.0/deployment/deploy-quick">部署指南</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh-CN/docs/1.5.0/user-guide/how-to-use">使用指南</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh-CN/docs/1.5.0/engine-usage/overview">引擎使用</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh-CN/docs/1.5.0/auth/ldap">安全认证</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh-CN/docs/1.5.0/api/overview">API</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/zh-CN/docs/1.5.0/architecture/overview">架构设计</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.5.0/architecture/overview">总览</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.5.0/architecture/task-flow">任务流转流程介绍</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/zh-CN/docs/1.5.0/architecture/service-architecture/overview">微服务架构</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/zh-CN/docs/1.5.0/architecture/feature/commons/variable">关键特性架构</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-3 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/zh-CN/docs/1.5.0/architecture/feature/commons/variable">公共依赖模块</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-3 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/zh-CN/docs/1.5.0/architecture/feature/computation-governance-services/overview">计算治理模块</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-3 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/zh-CN/docs/1.5.0/architecture/feature/public-enhancement-services/overview">公共增强模块</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-4 menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.5.0/architecture/feature/public-enhancement-services/overview">总览</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-4 menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.5.0/architecture/feature/public-enhancement-services/public-service">公共服务架构</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-4 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/zh-CN/docs/1.5.0/architecture/feature/public-enhancement-services/context-service/">上下文服务</a><button aria-label="打开/收起侧边栏菜单「上下文服务」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-4 menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.5.0/architecture/feature/public-enhancement-services/metadata-manager">元数据管理服务架构</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-4 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/zh-CN/docs/1.5.0/architecture/feature/public-enhancement-services/bml/overview">BML</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-5 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/zh-CN/docs/1.5.0/architecture/feature/public-enhancement-services/bml/overview">总览</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-5 menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.5.0/architecture/feature/public-enhancement-services/bml/engine-bml-dissect">BML 引擎物料管理功能剖析</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-4 menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.5.0/architecture/feature/public-enhancement-services/datasource-manager">数据源管理服务架构</a></li></ul></li></ul></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh-CN/docs/1.5.0/development/directory-structure">开发指南</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh-CN/docs/1.5.0/tuning-and-troubleshooting/overview">调优排障</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/zh-CN/docs/1.5.0/upgrade/upgrade-from-0.X-to-1.0-guide">升级指南</a></div></li></ul></nav></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->Apache Linkis<!-- --> <b>1.5.0</b>, 非最新版本。</div><div class="margin-top--md">有关最新文档,请参阅最新稳定版本<b><a href="/zh-CN/docs/latest/architecture/feature/public-enhancement-services/bml/overview">latest version</a></b> (<!-- -->1.6.0<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="页面路径"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="主页面" class="breadcrumbs__link" href="/zh-CN/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_OVgt"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">架构设计</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">关键特性架构</span><meta itemprop="position" content="2"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">公共增强模块</span><meta itemprop="position" content="3"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">BML</span><meta itemprop="position" content="4"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">总览</span><meta itemprop="position" content="5"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">版本:1.5.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>总览</h1></header><h2 class="anchor anchorWithStickyNavbar_LWe7" id="背景">背景<a class="hash-link" href="#背景" title="Direct link to heading"></a></h2><p>BML(物料库服务)是linkis的物料管理系统,主要用来存储用户的各种文件数据,包括用户脚本、资源文件、第三方Jar包等,也可以存储引擎运行时需要使用到的类库。</p><p>具备以下功能点:</p><p>1)、支持各种类型的文件。支持文本形式和二进制形式的文件,如果是在大数据领域的用户,可以将他们的脚本文件、物料压缩包都可以存储到本系统中。</p><p>2)、服务无状态,多实例部署,做到服务高可用。本系统在部署的时候,可以进行多实例部署,每个实例对外独立提供服务,不会互相干扰,所有的信息都是存储在数据库中进行共享。</p><p>3)、使用方式多样。提供Rest接口和SDK两种方式,用户可以根据自己的需要进行选择。</p><p>4)、文件采用追加方式,避免过多的HDFS小文件。HDFS小文件多会导致HDFS整体性能的下降,我们采用了文件追加的方式,将多个版本的资源文件合成一个大文件,有效减少了HDFS的文件数量。</p><p>5)、精确权限控制,用户资源文件内容安全存储。资源文件往往会有重要的内容,用户只希望自己可读</p><p>6)、提供了文件上传、更新、下载等操作任务的生命周期管理。</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="架构图">架构图<a class="hash-link" href="#架构图" title="Direct link to heading"></a></h2><p><img loading="lazy" alt="BML架构图" src="/zh-CN/assets/images/bml-02-130262a1f618d615779b1fa2b2f0e570.png" width="665" height="460" class="img_ev3q"></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="架构说明">架构说明<a class="hash-link" href="#架构说明" title="Direct link to heading"></a></h2><p>1、Service层 包含资源管理、上传资源、下载资源、共享资源还有工程资源管理。</p><p>资源管理负责资源的增删改查操作,访问权限控制,文件是否过期等基本操作。</p><p>2、文件版本控制 |
| 每个BML资源文件都是具有版本信息的,同一个资源每次更新操作都会产生一个新的版本,当然也支持历史版本的查询和下载操作。BML使用版本信息表记录了每个版本的资源文件HDFS存储的偏离位置和大小,可以在一个HDFS文件上存储多个版本的数据。</p><p>3、资源文件存储 |
| 主要使用HDFS文件作为实际的数据存储,HDFS文件可以有效保证物料库文件不被丢失,文件采用追加方式,避免过多的HDFS小文件。</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="核心流程">核心流程<a class="hash-link" href="#核心流程" title="Direct link to heading"></a></h3><p><strong>上传文件:</strong></p><ol><li><p>判断用户上传文件的操作类型,属于首次上传还是更新上传,如果是首次上传需要新增一条资源信息记录,系统已经为这个资源生成了一个全局唯一标识的resource_id和一个资源放置的位置resource_location。资源A的第一个版本A1需要在HDFS文件系统中resource_location位置进行存储。存储完之后,就可以得到第一个版本记为V00001,如果是更新上传需要查找上次最新的版本。</p></li><li><p>上传文件流到指定的HDFS文件,如果是更新则采用文件追加的方式加到上次内容的末尾。</p></li><li><p>新增一条版本记录,每次上传都会产生一条新的版本记录。除了记录这个版本的元数据信息外,最重要的是记录了该版本的文件的存储位置,包括文件路径,起始位置,结束位置。</p></li></ol><p><strong>下载文件:</strong></p><ol><li><p>用户下载资源的时候,需要指定两个参数一个是resource_id,另外一个是版本version,如果不指定version的话,默认下载最新版本。</p></li><li><p>用户传入resource_id和version两个参数到系统之后,系统查询resource_version表,查到对应的resource_location和start_byte和end<!-- -->_<!-- -->byte进行下载,通过流处理的skipByte方法,将resource<!-- -->_<!-- -->location的前(start_byte-1)个字节跳过,然后读取到end_byte |
| 字节数。读取成功之后,将流信息返回给用户。</p></li><li><p>在resource_download_history中插入一条下载成功的记录</p></li></ol><h2 class="anchor anchorWithStickyNavbar_LWe7" id="数据库设计">数据库设计<a class="hash-link" href="#数据库设计" title="Direct link to heading"></a></h2><p>1、资源信息表(resource)</p><table><thead><tr><th>字段名</th><th>作用</th><th>备注</th></tr></thead><tbody><tr><td>resource_id</td><td>全局唯一标识一个资源的字符串</td><td>可以采用UUID进行标识</td></tr><tr><td>resource_location</td><td>存放资源的位置</td><td>例如 hdfs:///tmp/bdp/\${用户名}/</td></tr><tr><td>owner</td><td>资源的所属者</td><td>例如 zhangsan</td></tr><tr><td>create_time</td><td>记录创建时间</td><td></td></tr><tr><td>is_share</td><td>是否共享</td><td>0表示不共享,1表示共享</td></tr><tr><td>update<!-- -->_<!-- -->time</td><td>资源最后的更新时间</td><td></td></tr><tr><td>is<!-- -->_<!-- -->expire</td><td>记录资源是否过期</td><td></td></tr><tr><td>expire_time</td><td>记录资源过期时间</td><td></td></tr></tbody></table><p>2、资源版本信息表(resource_version)</p><table><thead><tr><th>字段名</th><th>作用</th><th>备注</th></tr></thead><tbody><tr><td>resource_id</td><td>唯一标识资源</td><td>联合主键</td></tr><tr><td>version</td><td>资源文件的版本</td><td></td></tr><tr><td>start_byte</td><td>资源文件开始字节数</td><td></td></tr><tr><td>end<!-- -->_<!-- -->byte</td><td>资源文件结束字节数</td><td></td></tr><tr><td>size</td><td>资源文件大小</td><td></td></tr><tr><td>resource_location</td><td>资源文件放置位置</td><td></td></tr><tr><td>start_time</td><td>记录上传的开始时间</td><td></td></tr><tr><td>end<!-- -->_<!-- -->time</td><td>记录上传的结束时间</td><td></td></tr><tr><td>updater</td><td>记录更新用户</td><td></td></tr></tbody></table><p>3、资源下载历史表(resource_download_history)</p><table><thead><tr><th>字段</th><th>作用</th><th>备注</th></tr></thead><tbody><tr><td>resource_id</td><td>记录下载资源的resource_id</td><td></td></tr><tr><td>version</td><td>记录下载资源的version</td><td></td></tr><tr><td>downloader</td><td>记录下载的用户</td><td></td></tr><tr><td>start<!-- -->_<!-- -->time</td><td>记录下载时间</td><td></td></tr><tr><td>end<!-- -->_<!-- -->time</td><td>记录结束时间</td><td></td></tr><tr><td>status</td><td>记录是否成功</td><td>0表示成功,1表示失败</td></tr><tr><td>err<!-- -->_<!-- -->msg</td><td>记录失败原因</td><td>null表示成功,否则记录失败原因</td></tr></tbody></table></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apache/linkis-website/edit/dev/i18n/zh-CN/docusaurus-plugin-content-docs/version-1.5.0/architecture/feature/public-enhancement-services/bml/overview.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>编辑</a></div><div class="col lastUpdated_vwxv"></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/zh-CN/docs/1.5.0/architecture/feature/public-enhancement-services/metadata-manager"><div class="pagination-nav__sublabel">上一篇</div><div class="pagination-nav__label">元数据管理服务架构</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/zh-CN/docs/1.5.0/architecture/feature/public-enhancement-services/bml/engine-bml-dissect"><div class="pagination-nav__sublabel">下一篇</div><div class="pagination-nav__label">BML 引擎物料管理功能剖析</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#背景" class="table-of-contents__link toc-highlight">背景</a></li><li><a href="#架构图" class="table-of-contents__link toc-highlight">架构图</a></li><li><a href="#架构说明" class="table-of-contents__link toc-highlight">架构说明</a><ul><li><a href="#核心流程" class="table-of-contents__link toc-highlight">核心流程</a></li></ul></li><li><a href="#数据库设计" class="table-of-contents__link toc-highlight">数据库设计</a></li></ul></div></div></div></div></main></div></div><footer class="footer"><div class="container container-fluid"><div class="row footer__links"><div class="col footer__col"><div class="footer__title">Linkis</div><ul class="footer__items clean-list"><li class="footer__item"><a class="footer__link-item" href="/zh-CN/docs/latest/about/introduction">文档</a></li><li class="footer__item"><a class="footer__link-item" href="/zh-CN/faq/main">FAQ</a></li><li class="footer__item"><a href="https://github.com/apache/linkis/releases" target="_blank" rel="noopener noreferrer" class="footer__link-item">版本</a></li></ul></div><div class="col footer__col"><div class="footer__title">社区</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://github.com/apache/linkis" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub</a></li><li class="footer__item"><a href="https://github.com/apache/linkis/issues" target="_blank" rel="noopener noreferrer" class="footer__link-item">Issue Tracker</a></li><li class="footer__item"><a href="https://github.com/apache/linkis/pulls" target="_blank" rel="noopener noreferrer" class="footer__link-item">Pull Requests</a></li></ul></div><div class="col footer__col"><div class="footer__title">订阅邮件组</div><ul class="footer__items clean-list"><li class="footer__item"><a class="footer__link-item" href="/zh-CN/community/how-to-subscribe">如何订阅</a></li><li class="footer__item"><a href="mailto:dev-subscribe@linkis.apache.org" target="_blank" rel="noopener noreferrer" class="footer__link-item">订阅邮件</a></li><li class="footer__item"><a href="https://lists.apache.org/list.html?dev@linkis.apache.org" target="_blank" rel="noopener noreferrer" class="footer__link-item">邮件归档</a></li></ul></div></div><div class="footer__bottom text--center"><div class="footer__copyright"><div style="text-align: left;"> |
| <div> |
| <p style="font-family: Avenir-Medium;font-size: 14px;color: #999;line-height: 20px;">Apache Linkis is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.</p> |
| </div> |
| <div style="border-top: 1px solid #ccc;min-height: 60px;line-height: 20px;text-align: center;font-family: Avenir-Medium;font-size: 14px;color: #999;display: flex;align-items: center;"><span>Copyright © 2019-2020 The Apache Software Foundation. Apache Linkis, Linkis, and its feather logo are trademarks of The Apache Software Foundation.</span></div> |
| </div></div></div></div></footer></div> |
| <script src="/zh-CN/assets/js/runtime~main.40411d4a.js"></script> |
| <script src="/zh-CN/assets/js/main.b85ef3f0.js"></script> |
| </body> |
| </html> |