├── .github └── workflows │ ├── build-master.yml │ └── build-tag.yml ├── .gitignore ├── CMakeLists.txt ├── CONTRIBUTING.md ├── CONTRIBUTING_COMMIT.md ├── Changelist.md ├── LICENSE.TXT ├── README-EN.md ├── README.md ├── deploy ├── assets │ ├── ConfigServer.json │ ├── DCacheOptServer.json │ └── PropertyServer.json ├── config │ ├── ConfigServer.conf │ ├── DCacheOptServer.conf │ └── PropertyServer.conf ├── install.sh └── sql │ └── db_dcache_relation.sql ├── dockerfile ├── Dockerfile ├── Dockerfile.config ├── Dockerfile.dbaccess ├── Dockerfile.kvcache ├── Dockerfile.mkvcache ├── Dockerfile.nodejs ├── Dockerfile.opt ├── Dockerfile.property ├── Dockerfile.proxy └── Dockerfile.router ├── docs-en ├── README.md ├── install-en.md ├── proxy_api_guide-en.md └── server_config_example-en.md ├── docs ├── README.md ├── Router.md ├── benchmark.md ├── dbaccess.md ├── images │ ├── KV_module_conf.png │ ├── KV_service_conf.png │ ├── add_conf_for_module.png │ ├── add_opt_conf.png │ ├── cache_config.png │ ├── click_OpsMan.png │ ├── create_KV_module.png │ ├── create_proxy&router.png │ ├── deployDbaccess.png │ ├── deploy_opt_succ.png │ ├── getDbaccessObj.png │ ├── install_ConfigServer.png │ ├── install_OptServer.png │ ├── install_PropertyServer.png │ ├── install_and_release.png │ ├── install_dcache_app.png │ ├── install_kv_succ.png │ ├── install_proxy&router_succ.png │ ├── newModuleWithDbaccess.png │ ├── opt_release_magage.png │ ├── releaseDbaccess.png │ ├── release_opt.png │ ├── release_opt_afterUploadPackage.png │ ├── release_opt_succ.png │ ├── restart_opt.png │ ├── restart_opt_succ.png │ ├── set_default.png │ ├── tars_add_tmplate.png │ ├── tars_mainPage.png │ ├── upload_cache_package.png │ ├── upload_cache_package_succ.png │ ├── upload_opt_conf.png │ └── upload_proxy_package.png ├── install.md ├── kv_demo.md ├── proxy_api_guide.md └── server_config_example.md ├── logo ├── DCache-Config.png ├── DCache-DbAccess.png ├── DCache-KVCache.png ├── DCache-MKCache.png ├── DCache-Opt.png ├── DCache-Property.png ├── DCache-Proxy.png ├── DCache-Router.png ├── DCache.png └── logo.png ├── src ├── CMakeLists.txt ├── CombinDbAccessServer │ ├── CMakeLists.txt │ ├── CombinDbAccessServer.cpp │ ├── CombinDbAccessServer.h │ ├── DBAccessServer1.conf │ ├── DBAccessServer2.conf │ ├── DbAccess.tars │ ├── DbAccessImp.cpp │ ├── DbAccessImp.h │ ├── Globe.cpp │ ├── Globe.h │ ├── JceOperator.cpp │ ├── JceOperator.h │ ├── MKDbOperator.cpp │ ├── MKDbOperator.h │ ├── MysqlTimeOutHandle.cpp │ ├── MysqlTimeOutHandle.h │ ├── tc_mysql.cpp │ └── tc_mysql.h ├── Comm │ ├── BaseHash.h │ ├── BinLogEncodeComm.h │ ├── CMakeLists.txt │ ├── Common.h │ ├── Gzip.cpp │ ├── Gzip.h │ ├── NormalHash.cpp │ ├── NormalHash.h │ ├── StringUtil.cpp │ ├── StringUtil.h │ ├── UnpackTable.cpp │ └── UnpackTable.h ├── ConfigServer │ ├── CMakeLists.txt │ ├── Config.tars │ ├── ConfigImp.cpp │ ├── ConfigImp.h │ ├── ConfigServer.cpp │ ├── ConfigServer.h │ ├── RigUp.cpp │ └── RigUp.h ├── KVCacheServer │ ├── BackUp.tars │ ├── BackUpImp.cpp │ ├── BackUpImp.h │ ├── BinLog.tars │ ├── BinLogImp.cpp │ ├── BinLogImp.h │ ├── BinLogThread.cpp │ ├── BinLogThread.h │ ├── BinLogTimeThread.cpp │ ├── BinLogTimeThread.h │ ├── CMakeLists.txt │ ├── Cache.tars │ ├── CacheGlobe.cpp │ ├── CacheGlobe.h │ ├── CacheImp.cpp │ ├── CacheImp.h │ ├── CacheServer.cpp │ ├── CacheServer.h │ ├── ControlAck.tars │ ├── ControlAckImp.cpp │ ├── ControlAckImp.h │ ├── DbAccessCallback.cpp │ ├── DbAccessCallback.h │ ├── DumpThread.cpp │ ├── DumpThread.h │ ├── EraseThread.cpp │ ├── EraseThread.h │ ├── ExpireThread.cpp │ ├── ExpireThread.h │ ├── RouterClientImp.cpp │ ├── RouterClientImp.h │ ├── RouterHandle.cpp │ ├── RouterHandle.h │ ├── SlaveCreateThread.cpp │ ├── SlaveCreateThread.h │ ├── SyncAllThread.cpp │ ├── SyncAllThread.h │ ├── SyncThread.cpp │ ├── SyncThread.h │ ├── TBinLogEncode.h │ ├── TimerThread.cpp │ ├── TimerThread.h │ ├── WCache.tars │ ├── WCacheImp.cpp │ ├── WCacheImp.h │ ├── jmem_hashmap_malloc │ │ ├── dcache_jmem_hashmap_malloc.h │ │ ├── dcache_jmem_policy.h │ │ ├── dcache_sem_mutex.cpp │ │ ├── dcache_sem_mutex.h │ │ ├── jmem_hashmap_malloc.h │ │ ├── tc_hashmap_malloc.cpp │ │ ├── tc_hashmap_malloc.h │ │ ├── tc_malloc_chunk.cpp │ │ └── tc_malloc_chunk.h │ └── main.cpp ├── MKVCacheServer │ ├── CMakeLists.txt │ ├── DeleteThread.cpp │ ├── DeleteThread.h │ ├── DumpThread.cpp │ ├── DumpThread.h │ ├── EraseThread.cpp │ ├── EraseThread.h │ ├── ExpireThread.cpp │ ├── ExpireThread.h │ ├── MKBackUp.tars │ ├── MKBackUpImp.cpp │ ├── MKBackUpImp.h │ ├── MKBinLog.tars │ ├── MKBinLogEncode.h │ ├── MKBinLogImp.cpp │ ├── MKBinLogImp.h │ ├── MKBinLogThread.cpp │ ├── MKBinLogThread.h │ ├── MKBinLogTimeThread.cpp │ ├── MKBinLogTimeThread.h │ ├── MKCache.tars │ ├── MKCacheComm.cpp │ ├── MKCacheComm.h │ ├── MKCacheGlobe.cpp │ ├── MKCacheGlobe.h │ ├── MKCacheImp.cpp │ ├── MKCacheImp.h │ ├── MKCacheServer.cpp │ ├── MKCacheServer.h │ ├── MKControlAck.tars │ ├── MKControlAckImp.cpp │ ├── MKControlAckImp.h │ ├── MKDbAccessCallback.cpp │ ├── MKDbAccessCallback.h │ ├── MKHash.cpp │ ├── MKHash.h │ ├── MKWCache.tars │ ├── MKWCacheImp.cpp │ ├── MKWCacheImp.h │ ├── RouterClientImp.cpp │ ├── RouterClientImp.h │ ├── RouterHandle.cpp │ ├── RouterHandle.h │ ├── SlaveCreateThread.cpp │ ├── SlaveCreateThread.h │ ├── SyncAllThread.cpp │ ├── SyncAllThread.h │ ├── SyncThread.cpp │ ├── SyncThread.h │ ├── TimerThread.cpp │ ├── TimerThread.h │ └── jmem_multi_hashmap_malloc │ │ ├── MKCacheUtil.cpp │ │ ├── MKCacheUtil.h │ │ ├── dcache_jmem_policy.h │ │ ├── dcache_policy_multi_hashmap_malloc.h │ │ ├── dcache_sem_mutex.cpp │ │ ├── dcache_sem_mutex.h │ │ ├── policy_multi_hashmap_malloc.h │ │ ├── tc_malloc_chunk.cpp │ │ ├── tc_malloc_chunk.h │ │ ├── tc_multi_hashmap_malloc.cpp │ │ └── tc_multi_hashmap_malloc.h ├── OptServer │ ├── Assistance.cpp │ ├── Assistance.h │ ├── CMakeLists.txt │ ├── DCacheOpt.tars │ ├── DCacheOptImp.cpp │ ├── DCacheOptImp.h │ ├── DCacheOptServer.cpp │ ├── DCacheOptServer.h │ ├── ExpandThread.cpp │ ├── ExpandThread.h │ ├── ReleaseThread.cpp │ ├── ReleaseThread.h │ ├── TransferThread.cpp │ ├── TransferThread.h │ ├── UndeployThread.cpp │ ├── UndeployThread.h │ ├── UninstallThread.cpp │ ├── UninstallThread.h │ └── main.cpp ├── PropertyServer │ ├── CMakeLists.txt │ ├── CacheInfo.h │ ├── CacheInfoManager.cpp │ ├── CacheInfoManager.h │ ├── CacheInfoUpdateThread.cpp │ ├── CacheInfoUpdateThread.h │ ├── Property.tars │ ├── PropertyDbManager.cpp │ ├── PropertyDbManager.h │ ├── PropertyHashMap.h │ ├── PropertyImp.cpp │ ├── PropertyImp.h │ ├── PropertyReapThread.cpp │ ├── PropertyReapThread.h │ ├── PropertyServer.cpp │ └── PropertyServer.h ├── Proxy │ ├── CMakeLists.txt │ ├── CacheCallbackComm.cpp │ ├── CacheCallbackComm.h │ ├── CacheProxyFactory.cpp │ ├── CacheProxyFactory.h │ ├── Global.h │ ├── KVCacheCallback.h │ ├── MKVCacheCallback.h │ ├── Proxy.tars │ ├── ProxyImp.cpp │ ├── ProxyImp.h │ ├── ProxyServer.cpp │ ├── ProxyServer.h │ ├── RouterClientImp.cpp │ ├── RouterClientImp.h │ ├── RouterHandle.cpp │ ├── RouterHandle.h │ ├── RouterTableInfoFactory.cpp │ ├── RouterTableInfoFactory.h │ ├── StatThread.cpp │ ├── StatThread.h │ ├── TimerThread.cpp │ ├── TimerThread.h │ └── main.cpp ├── Router │ ├── CMakeLists.txt │ ├── DbHandle.cpp │ ├── DbHandle.h │ ├── NodeDescriptor.h │ ├── OuterProxyFactory.h │ ├── ProxyWrapper.h │ ├── Router.tars │ ├── RouterClient.tars │ ├── RouterImp.cpp │ ├── RouterImp.h │ ├── RouterServer.cpp │ ├── RouterServer.h │ ├── RouterServerConfig.cpp │ ├── RouterServerConfig.h │ ├── RouterShare.tars │ ├── StatProperty.cpp │ ├── StatProperty.h │ ├── SwitchThread.cpp │ ├── SwitchThread.h │ ├── TimerThread.cpp │ ├── TimerThread.h │ ├── Transfer.cpp │ ├── Transfer.h │ ├── create_table_new.sql │ ├── global.h │ └── main.cpp └── TarsComm │ ├── CMakeLists.txt │ ├── CacheShare.tars │ ├── DbAccess.tars │ └── ProxyShare.tars ├── test ├── .lcov-ignore ├── CMakeLists.txt ├── KVCacheServer │ ├── CMakeLists.txt │ ├── HashmapTest.cpp │ └── TBinLogEncodeTest.cpp ├── Proxy │ ├── CMakeLists.txt │ ├── KVCallbackTest.cpp │ ├── MockClass │ │ ├── MockCacheProxy.h │ │ └── MockRouterHandle.h │ ├── RouterTableInfoFactoryTest.cpp │ ├── RouterTableInfoTest.cpp │ ├── RouterTableTest.cpp │ └── TimerThreadTest.cpp ├── README.md ├── Router │ ├── CMakeLists.txt │ ├── DbHandleTest.cpp │ ├── MockDbHandle.h │ ├── MockRouterServerConfig.h │ ├── SwitchThreadTest.cpp │ └── TransferTest.cpp ├── run_lcov.sh └── run_test.sh ├── web ├── ChangeList.md ├── README.md ├── client │ ├── .browserslistrc │ ├── .postcssrc.js │ ├── babel.config.js │ ├── dist │ │ ├── index.html │ │ └── static │ │ │ ├── css │ │ │ ├── chunk-vendors.2f593a51.css │ │ │ └── index.9d21a0b0.css │ │ │ ├── favicon.ico │ │ │ ├── fonts │ │ │ ├── element-icons.535877f5.woff │ │ │ └── element-icons.732389de.ttf │ │ │ ├── img │ │ │ ├── default.c68b0cc8.svg │ │ │ ├── iconfont.4980b013.svg │ │ │ ├── spinner.dee5f891.svg │ │ │ └── zoom-in.a42f35f1.svg │ │ │ └── js │ │ │ ├── chunk-vendors.a0c238a1.js │ │ │ └── index.ccc0514d.js │ ├── package-lock.json │ ├── package.json │ ├── public │ │ └── index.html │ ├── src │ │ ├── assets │ │ │ ├── css │ │ │ │ ├── let-ui.css │ │ │ │ ├── reset.css │ │ │ │ └── variable.css │ │ │ ├── icon │ │ │ │ ├── default.svg │ │ │ │ ├── icon_active.png │ │ │ │ ├── icon_inactive.png │ │ │ │ ├── spinner.svg │ │ │ │ └── zoom-in.svg │ │ │ ├── img │ │ │ │ ├── cache-g.png │ │ │ │ ├── cache-l.png │ │ │ │ ├── create-g.png │ │ │ │ ├── create-l.png │ │ │ │ ├── dcache-logo.png │ │ │ │ ├── focus-bg.png │ │ │ │ ├── opa-icon.png │ │ │ │ ├── operator-g.png │ │ │ │ ├── operator-l.png │ │ │ │ ├── package-g.png │ │ │ │ ├── package-l.png │ │ │ │ ├── package.png │ │ │ │ ├── server-icon.png │ │ │ │ ├── tars-logo.png │ │ │ │ └── tree-icon-2.png │ │ │ └── theme │ │ │ │ └── element-to-let │ │ │ │ ├── alert.css │ │ │ │ ├── aside.css │ │ │ │ ├── autocomplete.css │ │ │ │ ├── avatar.css │ │ │ │ ├── backtop.css │ │ │ │ ├── badge.css │ │ │ │ ├── base.css │ │ │ │ ├── breadcrumb-item.css │ │ │ │ ├── breadcrumb.css │ │ │ │ ├── button-group.css │ │ │ │ ├── button.css │ │ │ │ ├── calendar.css │ │ │ │ ├── card.css │ │ │ │ ├── carousel-item.css │ │ │ │ ├── carousel.css │ │ │ │ ├── cascader-panel.css │ │ │ │ ├── cascader.css │ │ │ │ ├── checkbox-button.css │ │ │ │ ├── checkbox-group.css │ │ │ │ ├── checkbox.css │ │ │ │ ├── col.css │ │ │ │ ├── collapse-item.css │ │ │ │ ├── collapse.css │ │ │ │ ├── color-picker.css │ │ │ │ ├── container.css │ │ │ │ ├── date-picker.css │ │ │ │ ├── dialog.css │ │ │ │ ├── display.css │ │ │ │ ├── divider.css │ │ │ │ ├── drawer.css │ │ │ │ ├── dropdown-item.css │ │ │ │ ├── dropdown-menu.css │ │ │ │ ├── dropdown.css │ │ │ │ ├── fonts │ │ │ │ ├── element-icons.ttf │ │ │ │ └── element-icons.woff │ │ │ │ ├── footer.css │ │ │ │ ├── form-item.css │ │ │ │ ├── form.css │ │ │ │ ├── header.css │ │ │ │ ├── icon.css │ │ │ │ ├── image.css │ │ │ │ ├── index.css │ │ │ │ ├── infinite-scroll.css │ │ │ │ ├── infiniteScroll.css │ │ │ │ ├── input-number.css │ │ │ │ ├── input.css │ │ │ │ ├── link.css │ │ │ │ ├── loading.css │ │ │ │ ├── main.css │ │ │ │ ├── menu-item-group.css │ │ │ │ ├── menu-item.css │ │ │ │ ├── menu.css │ │ │ │ ├── message-box.css │ │ │ │ ├── message.css │ │ │ │ ├── notification.css │ │ │ │ ├── option-group.css │ │ │ │ ├── option.css │ │ │ │ ├── page-header.css │ │ │ │ ├── pagination.css │ │ │ │ ├── popconfirm.css │ │ │ │ ├── popover.css │ │ │ │ ├── popper.css │ │ │ │ ├── progress.css │ │ │ │ ├── radio-button.css │ │ │ │ ├── radio-group.css │ │ │ │ ├── radio.css │ │ │ │ ├── rate.css │ │ │ │ ├── reset.css │ │ │ │ ├── row.css │ │ │ │ ├── scrollbar.css │ │ │ │ ├── select-dropdown.css │ │ │ │ ├── select.css │ │ │ │ ├── slider.css │ │ │ │ ├── spinner.css │ │ │ │ ├── step.css │ │ │ │ ├── steps.css │ │ │ │ ├── submenu.css │ │ │ │ ├── switch.css │ │ │ │ ├── tab-pane.css │ │ │ │ ├── table-column.css │ │ │ │ ├── table.css │ │ │ │ ├── tabs.css │ │ │ │ ├── tag.css │ │ │ │ ├── time-picker.css │ │ │ │ ├── time-select.css │ │ │ │ ├── timeline-item.css │ │ │ │ ├── timeline.css │ │ │ │ ├── tooltip.css │ │ │ │ ├── transfer.css │ │ │ │ ├── tree.css │ │ │ │ └── upload.css │ │ ├── common │ │ │ ├── monitor-property.vue │ │ │ ├── monitor-server.vue │ │ │ └── user-manage.vue.bak │ │ ├── components │ │ │ ├── app │ │ │ │ └── dcache-header.vue │ │ │ ├── charts │ │ │ │ └── compare-chart.vue │ │ │ ├── diff │ │ │ │ └── index.vue │ │ │ ├── hours-filter.vue │ │ │ ├── icon.vue │ │ │ ├── section-wrappper.vue │ │ │ └── tars-form-item.vue │ │ ├── dcache │ │ │ ├── cacheConfig │ │ │ │ ├── ServerConfig.vue │ │ │ │ ├── ServerConfigList.vue │ │ │ │ ├── add.vue │ │ │ │ ├── addServerConfig.vue │ │ │ │ ├── config.vue │ │ │ │ ├── edit.vue │ │ │ │ └── moduleCache.vue │ │ │ ├── dcache │ │ │ │ ├── components │ │ │ │ │ ├── releaseProgress.vue │ │ │ │ │ └── tarsReleaseProgress.vue │ │ │ │ ├── moduleManage │ │ │ │ │ ├── batchOperation.vue │ │ │ │ │ ├── batchPublish.vue │ │ │ │ │ ├── expand.vue │ │ │ │ │ ├── index.vue │ │ │ │ │ ├── mixin.js │ │ │ │ │ ├── nonServerMigration.vue │ │ │ │ │ ├── offline.vue │ │ │ │ │ └── serverMigration.vue │ │ │ │ ├── operationManage │ │ │ │ │ ├── index.vue │ │ │ │ │ ├── mainBackup.vue │ │ │ │ │ └── typeList.vue │ │ │ │ ├── propertyMonitor │ │ │ │ │ └── index.vue │ │ │ │ └── routerManage │ │ │ │ │ ├── group.vue │ │ │ │ │ ├── index.vue │ │ │ │ │ ├── module.vue │ │ │ │ │ ├── record.vue │ │ │ │ │ ├── server.vue │ │ │ │ │ └── transfer.vue │ │ │ ├── dcacheOperation │ │ │ │ ├── apply │ │ │ │ │ ├── createApply.vue │ │ │ │ │ ├── createService.vue │ │ │ │ │ ├── index.vue │ │ │ │ │ └── installAndPublish.vue │ │ │ │ ├── batchModule.vue │ │ │ │ ├── deploy.vue │ │ │ │ ├── expand.vue │ │ │ │ ├── index.vue │ │ │ │ ├── module │ │ │ │ │ ├── CreateModule.vue │ │ │ │ │ ├── InstallAndPublish.vue │ │ │ │ │ ├── ModuleConfig.vue │ │ │ │ │ ├── ServerConfig.vue │ │ │ │ │ └── index.vue │ │ │ │ ├── region.vue │ │ │ │ └── templates.vue.bak │ │ │ ├── publish │ │ │ │ └── status.vue │ │ │ ├── releasePackage │ │ │ │ ├── accessList.vue │ │ │ │ ├── index.vue │ │ │ │ ├── kvcacheList.vue │ │ │ │ ├── mkvcacheList.vue │ │ │ │ ├── proxyList.vue │ │ │ │ └── routerList.vue │ │ │ └── server │ │ │ │ ├── config.vue │ │ │ │ ├── dcacheIndex.vue │ │ │ │ ├── dcacheManage.vue │ │ │ │ └── dcachePublish.vue │ │ ├── index.js │ │ ├── indexApp.vue │ │ ├── lib │ │ │ ├── ajax.js │ │ │ ├── axios.js │ │ │ └── date.js │ │ ├── locale │ │ │ └── i18n.js │ │ ├── plugins │ │ │ ├── ajax.js │ │ │ ├── charts.js │ │ │ ├── common.js │ │ │ ├── interface.js │ │ │ ├── tars.js │ │ │ └── ui.js │ │ └── router │ │ │ └── index.js │ ├── static │ │ └── favicon.ico │ └── vue.config.js ├── dev.config.conf ├── package-lock.json ├── package.json ├── publish.sh └── src │ ├── app.js │ ├── common │ ├── AdminService.js │ └── rpc │ │ ├── getservant │ │ └── lib │ │ │ ├── EndpointF.tars │ │ │ ├── EndpointFTars.js │ │ │ ├── QueryF.tars │ │ │ ├── QueryFProxy.js │ │ │ ├── config.js │ │ │ ├── create.sh │ │ │ └── getEndpoint.js │ │ ├── index.js │ │ ├── proxy │ │ ├── AdminReg.tars │ │ ├── AdminRegProxy.js │ │ ├── DCacheOpt.tars │ │ ├── DCacheOptProxy.js │ │ ├── NodeDescriptor.tars │ │ ├── NodeDescriptorTars.js │ │ └── create.sh │ │ ├── service.js │ │ └── struct.js │ ├── config │ ├── config.json │ └── webConf.js │ ├── dcache │ ├── apply │ │ ├── controller.js │ │ ├── dao.js │ │ └── service.js │ ├── config │ │ ├── controller.js │ │ └── service.js │ ├── db │ │ ├── db_cache_tpl_models │ │ │ ├── t_router_group.js │ │ │ ├── t_router_module.js │ │ │ ├── t_router_record.js │ │ │ ├── t_router_server.js │ │ │ └── t_router_transfer.js │ │ ├── db_cache_web_models │ │ │ ├── t_apply_app_base.js │ │ │ ├── t_apply_app_dbaccess_conf.js │ │ │ ├── t_apply_app_proxy_conf.js │ │ │ ├── t_apply_app_router_conf.js │ │ │ ├── t_apply_cache_module_base.js │ │ │ ├── t_apply_cache_module_conf.js │ │ │ ├── t_apply_cache_server_conf.js │ │ │ ├── t_expand_server.js │ │ │ ├── t_module_operation.js │ │ │ └── t_region.js │ │ ├── db_dcache_relation_models │ │ │ ├── t_cache_router.js │ │ │ ├── t_config_appMod.js │ │ │ ├── t_config_item.js │ │ │ ├── t_config_reference.js │ │ │ ├── t_config_table.js │ │ │ ├── t_dbaccess_app.js │ │ │ ├── t_expand_status.js │ │ │ ├── t_idc_map.js │ │ │ ├── t_proxy_app.js │ │ │ ├── t_proxy_cache.js │ │ │ ├── t_proxy_router.js │ │ │ ├── t_router_app.js │ │ │ ├── t_router_switch.js │ │ │ └── t_transfer_status.js │ │ ├── index.js │ │ ├── index_tpl.js │ │ └── update.js │ ├── dbaccess │ │ ├── controller.js │ │ ├── dao.js │ │ └── service.js │ ├── index.js │ ├── module │ │ ├── controller.js │ │ ├── dao.js │ │ └── service.js │ ├── moduleConfig │ │ ├── controller.js │ │ ├── dao.js │ │ └── service.js │ ├── moduleOperation │ │ ├── controller.js │ │ └── service.js │ ├── proxy │ │ ├── controller.js │ │ ├── dao.js │ │ └── service.js │ ├── region │ │ ├── controller.js │ │ ├── dao.js │ │ └── service.js │ ├── router │ │ ├── controller.js │ │ ├── dao.js │ │ └── service.js │ ├── routerManage │ │ ├── controller.js │ │ ├── dao.js │ │ └── service.js │ ├── serverConfig │ │ ├── controller.js │ │ ├── dao.js │ │ └── service.js │ ├── test │ │ └── serverConfig.test.js │ └── tree │ │ └── TreeService.js │ ├── index │ ├── controller │ │ ├── locale │ │ │ └── LocaleController.js │ │ └── page │ │ │ └── PageController.js │ ├── index.js │ └── json │ │ ├── cn.json │ │ └── en.json │ ├── logger │ └── index.js │ ├── midware │ ├── index.js │ ├── localeMidware.js │ ├── loginMidware.js │ ├── noCacheMidware.js │ └── paramsMidware.js │ └── tools │ └── util.js └── yaml ├── config.yaml ├── dbaccess.yaml ├── dcache.yaml ├── kvcache.yaml ├── mkvcache.yaml ├── opt.yaml ├── property.yaml ├── proxy.yaml ├── router.yaml └── web.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | .o 3 | .a 4 | node_modules/ -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project(DCache) 4 | 5 | option(TARS_MYSQL "option for mysql" ON) 6 | option(TARS_SSL "option for ssl" OFF) 7 | option(TARS_HTTP2 "option for http2" OFF) 8 | 9 | set(TARS_TOOL_FLAG "--with-tars") 10 | set(TARS_WEB_HOST "http://127.0.0.1:3000") 11 | 12 | if(WIN32) 13 | include (c:\\tars\\cpp\\makefile\\tars-tools.cmake) 14 | else() 15 | include (/usr/local/tars/cpp/makefile/tars-tools.cmake) 16 | endif() 17 | 18 | include_directories(/usr/local/tars/cpp/thirdparty/include) 19 | link_directories(/usr/local/tars/cpp/thirdparty/lib) 20 | link_libraries(pthread) 21 | link_libraries(dl) 22 | 23 | if(APPLE) 24 | link_libraries(iconv) 25 | endif() 26 | 27 | add_subdirectory(src) 28 | add_subdirectory(test) 29 | 30 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | 我们提倡您通过提 issue 和 pull request 方式来促进 DCache 的发展。 4 | 5 | 即使是在 issue 中回答问题,或者做一些简单的 bugfix ,也会给 Dcache 带来很大的帮助。 6 | 7 | ## Issue 提交 8 | 9 | #### 对于贡献者 10 | 11 | 在提 issue 前请确保满足一下条件: 12 | 13 | - 必须是一个 bug 或者功能新增。 14 | - 已经在 issue 中搜索过,并且没有找到相似的 issue 或者解决方案。 15 | - 完善下面模板中的信息 16 | 17 | 如果已经满足以上条件,我们提供了 issue 的标准模版,请按照模板填写。 18 | 19 | ​ 20 | 21 | ## Pull request 22 | 23 | 我们除了希望听到您的反馈和建议外,我们也希望您接受代码形式的直接帮助,对我们的 GitHub 发出 pull request 请求。 24 | 25 | 以下是具体步骤: 26 | 27 | #### Fork仓库 28 | 29 | 点击 `Fork` 按钮,将需要参与的项目仓库 fork 到自己的 Github 中。 30 | 31 | #### Clone 已 fork 项目 32 | 33 | 在自己的 github 中,找到 fork 下来的项目,git clone 到本地。 34 | 35 | ```bash 36 | $ git clone git@github.com:/DCache.git 37 | ``` 38 | 39 | #### 添加 DCache 仓库 40 | 41 | 将 fork 源仓库连接到本地仓库: 42 | 43 | ```bash 44 | $ git remote add 45 | # 例如: 46 | $ git remote add DCache git@github.com:Tencent/DCache.git 47 | ``` 48 | 49 | #### 保持与 DCache 仓库的同步 50 | 51 | 更新上游仓库: 52 | 53 | ```bash 54 | $ git pull --rebase 55 | # 等同于以下两条命令 56 | $ git fetch 57 | $ git rebase / 58 | ``` 59 | 60 | #### commit 信息提交 61 | 62 | commit 信息请遵循[commit消息约定](./CONTRIBUTING_COMMIT.md),具体格式请参考 commit 文档规范。 63 | -------------------------------------------------------------------------------- /README-EN.md: -------------------------------------------------------------------------------- 1 | [点我查看中文版](README.md) 2 | 3 | DCache is a distributed NoSQL system based on [Tars framework](https://github.com/TarsCloud/Tars), which supports LRU algorithm and data persistence. 4 | 5 | There are many teams int Tencent that use DCache, and the total number of daily access exceeds one trillion. 6 | 7 | ## Features Of DCache 8 | 9 | * Support a variety of data structures: including key-value, k-k-row, list, set, zset. 10 | * Distributed storage with good scalability. 11 | * An LRU cache, support expiration mechanism and data persistence. 12 | * With a perfect platform for maintaining and monitoring. 13 | * The business does not need to interact with MySQL directly. DCache will automatically write data to DB 14 | 15 | ## Supported operating systems 16 | 17 | > * Linux 18 | 19 | ## Develop languages 20 | 21 | > * C++ 22 | 23 | ## Documents 24 | 25 | For API usage, see [proxy_api_guide-en.md](docs-en/proxy_api_guide-en.md),for more details, see [docs](docs-en/). 26 | 27 | ## Installation 28 | 29 | See [install-en.md](docs/install.md) 30 | 31 | ## Overview Of Project Directories 32 | 33 | Directory |Role 34 | ------------------|---------------- 35 | src/Comm |Shared code 36 | src/ConfigServer |Configuration service 37 | src/DbAccess |Data persistence service 38 | src/KVCacheServer |k-v storage engine 39 | src/MKVCacheServer |k-k-row、list、set、zset storage engine 40 | src/OptServer |Service deployment, operation and maintenance management, this module serves the web management platform 41 | src/PropertyServer |Monitor information reporting service 42 | src/Proxy |Proxy service 43 | src/Router |Routing service 44 | src/TarsComm |Tars data structures 45 | src/thirdParty |Third party libraries 46 | 47 | * ```docs-en``` : Documentation 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 背景 2 | 3 | DCache是一个基于[TARS](https://github.com/TarsCloud/Tars)框架开发的分布式NoSQL存储系统,数据采用内存存储,支持连接后端DB实现数据持久化。DCache采用集群模式,具有高扩展、高可用的特点。 4 | 5 | DCache在腾讯内部有大量业务使用,日访问总量超万亿次。 6 | 7 | DCache具有以下特点 8 | 9 | * 高性能存储引擎,支持key-value,k-k-row,list,set,zset多种数据结构,支持数据持久化落地后端DB。 10 | * 集群模式,高扩展,高可用,支持异地镜像,就近接入。 11 | * 通过名字访问,支持同步、异步、单向RPC调用。 12 | * 高效运维平台,在线完成服务部署、扩缩容、迁移,以及服务配置,服务调用质量监控。 13 | * 业务无须和直接和mysql交互, DCache会自动缓写DB 14 | 15 | ## 支持平台 16 | 17 | > * Linux 18 | 19 | ## 开发语言 20 | 21 | > * C++ 22 | 23 | ## 快速上手 24 | 25 | DCache的安装建议通过TarsWeb的服务市场安装. 26 | 27 | ## 文档 28 | 29 | DCache接口使用方法请参考文档[Proxy接口指南](docs/proxy_api_guide.md),更多文档请查看[docs目录](docs/README.md) 30 | 31 | ## 目录说明 32 | 33 | * ```src```:存储相关的后台服务代码。 34 | 35 | 目录 |功能 36 | ------------------|---------------- 37 | src/Comm |各服务共用的通用代码 38 | src/ConfigServer |DCache配置服务 39 | src/DbAccess |数据持久化DB的代理服务 40 | src/KVCacheServer |key-value存储服务 41 | src/MKVCacheServer |k-k-row、list、set、zset存储服务 42 | src/OptServer |服务部署、运维管理,供web管理平台调用 43 | src/PropertyServer |监控信息上报服务 44 | src/Proxy |DCache代理服务 45 | src/Router |DCache路由管理服务 46 | src/TarsComm |Tars数据结构定义 47 | 48 | * ```docs```:文档。 49 | 50 | ## 数据库说明 51 | 52 | DCache框架依赖mysql数据库, 当DCache安装以后, 它自动会创建以下数据库 53 | - db_cache_web: DCache的web依赖 54 | - db_dcache_relation: DCacheOptServer/ConfigServer/PropertyServer/DCacheWebServer依赖, 注意DCacheWebServer只是会创建它, 并不是直接使用它 55 | - db_dcache_property: DCache统计数据库, PropertyServer依赖 56 | 57 | 需要在安装过程中正确设置配置文件中的数据库的地址. 58 | 59 | 实际每套创建的每套Cache, 如果设置了数据落地, 那么也依赖mysql, 这个在DCache管理平台上可以设置, 安装时正确配置即可. 60 | 61 | ## 参与贡献 62 | 63 | 如果你有任何想法,别犹豫,立即提 Issues 或 Pull Requests,欢迎所有人参与到DCache的开源建设中。
详见:[CONTRIBUTING.md](./CONTRIBUTING.md) 64 | 65 | -------------------------------------------------------------------------------- /deploy/assets/ConfigServer.json: -------------------------------------------------------------------------------- 1 | { 2 | "application": "DCache", 3 | "server_name": "ConfigServer", 4 | "node_name": "host_ip", 5 | "server_type": "tars_cpp", 6 | "template_name": "tars.default", 7 | "setting_state": "active", 8 | "enable_set": false, 9 | "set_name": "", 10 | "set_area": "", 11 | "set_group": "", 12 | "adapters": [{ 13 | "obj_name": "ConfigObj", 14 | "bind_ip": "host_ip", 15 | "port": "11772", 16 | "port_type": "tcp", 17 | "protocol": "tars", 18 | "thread_num": 5, 19 | "max_connections": 100000, 20 | "queuecap": 50000, 21 | "queuetimeout": 20000 22 | }] 23 | } -------------------------------------------------------------------------------- /deploy/assets/DCacheOptServer.json: -------------------------------------------------------------------------------- 1 | { 2 | "application": "DCache", 3 | "server_name": "DCacheOptServer", 4 | "node_name": "host_ip", 5 | "server_type": "tars_cpp", 6 | "template_name": "tars.default", 7 | "setting_state": "active", 8 | "enable_set": false, 9 | "set_name": "", 10 | "set_area": "", 11 | "set_group": "", 12 | "adapters": [{ 13 | "obj_name": "DCacheOptObj", 14 | "bind_ip": "host_ip", 15 | "port": "11771", 16 | "port_type": "tcp", 17 | "protocol": "tars", 18 | "thread_num": 5, 19 | "max_connections": 100000, 20 | "queuecap": 50000, 21 | "queuetimeout": 20000 22 | }] 23 | } -------------------------------------------------------------------------------- /deploy/assets/PropertyServer.json: -------------------------------------------------------------------------------- 1 | { 2 | "application": "DCache", 3 | "server_name": "PropertyServer", 4 | "node_name": "host_ip", 5 | "server_type": "tars_cpp", 6 | "template_name": "DCache.Cache", 7 | "setting_state": "active", 8 | "enable_set": false, 9 | "set_name": "", 10 | "set_area": "", 11 | "set_group": "", 12 | "adapters": [{ 13 | "obj_name": "PropertyObj", 14 | "bind_ip": "host_ip", 15 | "port": "11773", 16 | "port_type": "tcp", 17 | "protocol": "tars", 18 | "thread_num": 5, 19 | "max_connections": 100000, 20 | "queuecap": 50000, 21 | "queuetimeout": 20000 22 | }] 23 | } 24 | -------------------------------------------------------------------------------- /deploy/config/ConfigServer.conf: -------------------------------------------------------------------------------- 1 | { 2 | "force": "true", 3 | "application": "DCache", 4 | "filename": "ConfigServer.conf", 5 | "level": 5, 6 | "server_name": "ConfigServer", 7 | "set_area": "", 8 | "set_group": "", 9 | "set_name": "", 10 | "config": "
\n 11 | \n 12 | dbhost= dcache_host\n 13 | dbpass= dcache_pass\n 14 | dbuser= dcache_user\n 15 | dbname= db_dcache_relation\n 16 | charset=utf8mb4\n 17 | dbport= dcache_port\n 18 | \n 19 |
" 20 | } 21 | -------------------------------------------------------------------------------- /deploy/config/DCacheOptServer.conf: -------------------------------------------------------------------------------- 1 | { 2 | "force": "true", 3 | "application": "DCache", 4 | "filename": "DCacheOptServer.conf", 5 | "level": 5, 6 | "server_name": "DCacheOptServer", 7 | "set_area": "", 8 | "set_group": "", 9 | "set_name": "", 10 | "config": "
\n 11 | # admin registry obj\n 12 | AdminRegObj = tars.tarsAdminRegistry.AdminRegObj\n 13 | \n 14 | \n 15 | charset = utf8mb4\n 16 | dbname = db_dcache_relation\n 17 | dbhost = dcache_host\n 18 | dbport = dcache_port\n 19 | dbuser = dcache_user\n 20 | dbpass = dcache_pass\n 21 | \n 22 | \n 23 | \n 24 | # 发布服务线程数\n 25 | ThreadCount = 5\n 26 | \n 27 | \n 28 | # 通知node下线服务超时时间(秒)\n 29 | Timeout = 20\n 30 | # 下线服务备份目录\n 31 | BakPath = /data/dcacheuninstall/\n 32 | # 下线服务线程数\n 33 | ThreadCount = 2\n 34 | \n 35 |
" 36 | } 37 | -------------------------------------------------------------------------------- /dockerfile/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM tarscloud/base-compiler 2 | 3 | RUN mkdir -p /data 4 | COPY . /data 5 | RUN cd /data \ 6 | && mkdir -p build \ 7 | && cd build \ 8 | && cmake .. -DCMAKE_BUILD_TYPE=Release \ 9 | && make -j2 10 | 11 | -------------------------------------------------------------------------------- /dockerfile/Dockerfile.config: -------------------------------------------------------------------------------- 1 | FROM tarscloud/dcache-compiler as First 2 | 3 | FROM tarscloud/tars.cppbase 4 | 5 | ARG TARGETARCH 6 | ENV ServerType=cpp 7 | 8 | RUN mkdir -p /usr/local/server/bin/ 9 | COPY --from=First /data/build/bin/ConfigServer /usr/local/server/bin/ 10 | -------------------------------------------------------------------------------- /dockerfile/Dockerfile.dbaccess: -------------------------------------------------------------------------------- 1 | FROM tarscloud/dcache-compiler as First 2 | 3 | FROM tarscloud/tars.cppbase 4 | 5 | ENV ServerType=cpp 6 | 7 | RUN mkdir -p /usr/local/server/bin/ 8 | COPY --from=First /data/build/bin/CombinDbAccessServer /usr/local/server/bin/ 9 | -------------------------------------------------------------------------------- /dockerfile/Dockerfile.kvcache: -------------------------------------------------------------------------------- 1 | FROM tarscloud/dcache-compiler as First 2 | 3 | FROM tarscloud/tars.cppbase 4 | 5 | ENV ServerType=cpp 6 | 7 | RUN mkdir -p /usr/local/server/bin/ 8 | COPY --from=First /data/build/bin/KVCacheServer /usr/local/server/bin/ 9 | -------------------------------------------------------------------------------- /dockerfile/Dockerfile.mkvcache: -------------------------------------------------------------------------------- 1 | FROM tarscloud/dcache-compiler as First 2 | 3 | FROM tarscloud/tars.cppbase 4 | 5 | ENV ServerType=cpp 6 | 7 | RUN mkdir -p /usr/local/server/bin/ 8 | COPY --from=First /data/build/bin/MKVCacheServer /usr/local/server/bin/ 9 | -------------------------------------------------------------------------------- /dockerfile/Dockerfile.nodejs: -------------------------------------------------------------------------------- 1 | FROM tarscloud/base-compiler as First 2 | 3 | RUN mkdir -p /data 4 | COPY . /data 5 | RUN cd /data/web/src; npm install; 6 | 7 | FROM tarscloud/tars.nodejsbase 8 | 9 | ENV ServerType=nodejs 10 | 11 | RUN mkdir -p /usr/local/server/bin/ 12 | COPY --from=First /data/web/ /usr/local/server/bin/ 13 | -------------------------------------------------------------------------------- /dockerfile/Dockerfile.opt: -------------------------------------------------------------------------------- 1 | FROM tarscloud/dcache-compiler as First 2 | 3 | FROM tarscloud/tars.cppbase 4 | 5 | ENV ServerType=cpp 6 | 7 | RUN mkdir -p /usr/local/server/bin/ 8 | COPY --from=First /data/build/bin/DCacheOptServer /usr/local/server/bin/ 9 | -------------------------------------------------------------------------------- /dockerfile/Dockerfile.property: -------------------------------------------------------------------------------- 1 | FROM tarscloud/dcache-compiler as First 2 | 3 | FROM tarscloud/tars.cppbase 4 | 5 | ENV ServerType=cpp 6 | 7 | RUN mkdir -p /usr/local/server/bin/ 8 | COPY --from=First /data/build/bin/PropertyServer /usr/local/server/bin/ 9 | -------------------------------------------------------------------------------- /dockerfile/Dockerfile.proxy: -------------------------------------------------------------------------------- 1 | FROM tarscloud/dcache-compiler as First 2 | 3 | FROM tarscloud/tars.cppbase 4 | 5 | ENV ServerType=cpp 6 | 7 | RUN mkdir -p /usr/local/server/bin/ 8 | COPY --from=First /data/build/bin/ProxyServer /usr/local/server/bin/ 9 | -------------------------------------------------------------------------------- /dockerfile/Dockerfile.router: -------------------------------------------------------------------------------- 1 | FROM tarscloud/dcache-compiler as First 2 | 3 | FROM tarscloud/tars.cppbase 4 | 5 | ENV ServerType=cpp 6 | 7 | RUN mkdir -p /usr/local/server/bin/ 8 | COPY --from=First /data/build/bin/RouterServer /usr/local/server/bin/ 9 | -------------------------------------------------------------------------------- /docs-en/README.md: -------------------------------------------------------------------------------- 1 | # DCache 2 | 3 | > * [Install](install.md) 4 | > * [Proxy](proxy_api_guide.md) -------------------------------------------------------------------------------- /docs-en/install-en.md: -------------------------------------------------------------------------------- 1 | # Compiling and deploy DCache Services 2 | 3 | ## Dependence 4 | Install Tars development environment and Tars web before compiling DCache, since it is based on [Tars](https://github.com/TarsCloud/Tars) framework. 5 | 6 | ## Compilation 7 | 8 | In source director:`mkdir build; cd build; cmake ..; make; make release; make tar` 9 | 10 | to generate a Tars release package for each service. 11 | 12 | ## Depoly Public Services 13 | 14 | Deploy OptServer, ConfigServer and PropertyServer on Tars web, APP name must be "DCache", to get each server's configuration information, please refer to [server_config_example](server_config_example-en.md) 15 | 16 | ## Install DCache web 17 | 18 | DCache web is a module of Tars web, please get details from ["how to install DCache web"](https://github.com/TarsCloud/TarsWeb) 19 | 20 | ## Deploy DCache APP and module 21 | 22 | step1: Create a APP on DCache web. 23 | 24 | step2: Deploy Router and Proxy, Router and Proxy serve all modules of a APP. 25 | 26 | step3: Deploy Cache module. KVCache module is for key-value, MKVCache module is for k-k-row, list, set, zset. 27 | 28 | to be continue... -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | 2 | [返回](../README.md) 3 | 4 | # DCache 5 | 6 | > * [环境安装](install.md) 7 | > * [路由服务](Router.md) 8 | > * [数据库存储](dbaccess.md) 9 | > * [各模块配置文件](server_config_example.md) 10 | > * [接口描述](proxy_api_guide.md) 11 | > * [性能测试数据](benchmark.md) 12 | > * [使用示例](kv_demo.md) 13 | -------------------------------------------------------------------------------- /docs/benchmark.md: -------------------------------------------------------------------------------- 1 | [返回](../README.md) 2 | 3 | ## 测试背景和目标 4 | 了解DCache两种数据类型的读写性能,以及对于机器的压力情况(包括CPU、IO、网络)。 5 | 6 | ## 测试环境 7 | #### 软件环境 8 | > 1. 基于Tars(2019年4月最新版本) 9 | > 2. 单进程服务,Cache是纯内存类型(即后端不带DB) 10 | 11 | #### 硬件环境 12 | > 1. CPU 48核(Intel(R) Xeon(R) CPU E5-2670 v3 @2.30GHz),内存128G,万兆网卡 13 | > 2. 测试客户端与服务端同机房 14 | 15 | ## 测试方法 16 | 有两个客户端并发访问DCache的接口(不经过Proxy,直接访问cache),其中每个客户端开启10个进程,每个进程开启20个线程,共有400个线程并发调用DCache的读写接口(先测写接口,再测读接口);DCache服务端开启6个网络线程和12个工作线程。在压测过程中记录机器的各项性能指标。 17 | 18 | ## 测试结果 19 | 20 | 数据类型 | 读/写 | 数据长度(Byte) | CPU | 网卡(Mbit/s) | TPS(w/s) 21 | ---|---|---|---|---|--- 22 | k-v | 读 | 100 | 1400% | 800 | 66 23 | k-v | 写 | 100 | 800% | 450 | 18.5 24 | k-k-row | 读 | 100 | 1600% | 900 | 45 25 | k-k-row | 写 | 100 | 950% | 430 | 16 -------------------------------------------------------------------------------- /docs/images/KV_module_conf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/KV_module_conf.png -------------------------------------------------------------------------------- /docs/images/KV_service_conf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/KV_service_conf.png -------------------------------------------------------------------------------- /docs/images/add_conf_for_module.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/add_conf_for_module.png -------------------------------------------------------------------------------- /docs/images/add_opt_conf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/add_opt_conf.png -------------------------------------------------------------------------------- /docs/images/cache_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/cache_config.png -------------------------------------------------------------------------------- /docs/images/click_OpsMan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/click_OpsMan.png -------------------------------------------------------------------------------- /docs/images/create_KV_module.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/create_KV_module.png -------------------------------------------------------------------------------- /docs/images/create_proxy&router.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/create_proxy&router.png -------------------------------------------------------------------------------- /docs/images/deployDbaccess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/deployDbaccess.png -------------------------------------------------------------------------------- /docs/images/deploy_opt_succ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/deploy_opt_succ.png -------------------------------------------------------------------------------- /docs/images/getDbaccessObj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/getDbaccessObj.png -------------------------------------------------------------------------------- /docs/images/install_ConfigServer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/install_ConfigServer.png -------------------------------------------------------------------------------- /docs/images/install_OptServer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/install_OptServer.png -------------------------------------------------------------------------------- /docs/images/install_PropertyServer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/install_PropertyServer.png -------------------------------------------------------------------------------- /docs/images/install_and_release.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/install_and_release.png -------------------------------------------------------------------------------- /docs/images/install_dcache_app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/install_dcache_app.png -------------------------------------------------------------------------------- /docs/images/install_kv_succ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/install_kv_succ.png -------------------------------------------------------------------------------- /docs/images/install_proxy&router_succ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/install_proxy&router_succ.png -------------------------------------------------------------------------------- /docs/images/newModuleWithDbaccess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/newModuleWithDbaccess.png -------------------------------------------------------------------------------- /docs/images/opt_release_magage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/opt_release_magage.png -------------------------------------------------------------------------------- /docs/images/releaseDbaccess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/releaseDbaccess.png -------------------------------------------------------------------------------- /docs/images/release_opt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/release_opt.png -------------------------------------------------------------------------------- /docs/images/release_opt_afterUploadPackage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/release_opt_afterUploadPackage.png -------------------------------------------------------------------------------- /docs/images/release_opt_succ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/release_opt_succ.png -------------------------------------------------------------------------------- /docs/images/restart_opt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/restart_opt.png -------------------------------------------------------------------------------- /docs/images/restart_opt_succ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/restart_opt_succ.png -------------------------------------------------------------------------------- /docs/images/set_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/set_default.png -------------------------------------------------------------------------------- /docs/images/tars_add_tmplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/tars_add_tmplate.png -------------------------------------------------------------------------------- /docs/images/tars_mainPage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/tars_mainPage.png -------------------------------------------------------------------------------- /docs/images/upload_cache_package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/upload_cache_package.png -------------------------------------------------------------------------------- /docs/images/upload_cache_package_succ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/upload_cache_package_succ.png -------------------------------------------------------------------------------- /docs/images/upload_opt_conf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/upload_opt_conf.png -------------------------------------------------------------------------------- /docs/images/upload_proxy_package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/docs/images/upload_proxy_package.png -------------------------------------------------------------------------------- /logo/DCache-Config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/logo/DCache-Config.png -------------------------------------------------------------------------------- /logo/DCache-DbAccess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/logo/DCache-DbAccess.png -------------------------------------------------------------------------------- /logo/DCache-KVCache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/logo/DCache-KVCache.png -------------------------------------------------------------------------------- /logo/DCache-MKCache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/logo/DCache-MKCache.png -------------------------------------------------------------------------------- /logo/DCache-Opt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/logo/DCache-Opt.png -------------------------------------------------------------------------------- /logo/DCache-Property.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/logo/DCache-Property.png -------------------------------------------------------------------------------- /logo/DCache-Proxy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/logo/DCache-Proxy.png -------------------------------------------------------------------------------- /logo/DCache-Router.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/logo/DCache-Router.png -------------------------------------------------------------------------------- /logo/DCache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/logo/DCache.png -------------------------------------------------------------------------------- /logo/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/logo/logo.png -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(Comm) 3 | include_directories(TarsComm) 4 | 5 | macro(gen_dcache_group TARGET) 6 | SET(RUN_TAR_COMMAND_FILE "${CMAKE_BINARY_DIR}/run-tar-${TARGET}.cmake") 7 | FILE(WRITE ${RUN_TAR_COMMAND_FILE} "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/tmp/DCacheServerGroup)\n") 8 | FILE(APPEND ${TARS_TAR} "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/${TARGET}.tgz)\n") 9 | FILE(APPEND ${RUN_TAR_COMMAND_FILE} "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/tmp/DCacheServerGroup)\n") 10 | FILE(APPEND ${RUN_TAR_COMMAND_FILE} "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/${TARGET} ${CMAKE_BINARY_DIR}/tmp/DCacheServerGroup)\n") 11 | FILE(APPEND ${RUN_TAR_COMMAND_FILE} "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/tmp/ tar czfv ${TARGET}.tgz DCacheServerGroup)\n") 12 | FILE(APPEND ${RUN_TAR_COMMAND_FILE} "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/tmp/${TARGET}.tgz ${CMAKE_BINARY_DIR}/${TARGET}.tgz)\n") 13 | 14 | add_custom_command(OUTPUT ${TARGET}.tgz 15 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 16 | COMMAND ${CMAKE_COMMAND} -P ${RUN_TAR_COMMAND_FILE} 17 | COMMENT "call ${RUN_TAR_COMMAND_FILE}") 18 | 19 | FILE(APPEND ${TARS_TAR} "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -P ${RUN_TAR_COMMAND_FILE})\n") 20 | endmacro() 21 | 22 | set(APP "DCache") 23 | add_subdirectory(Comm) 24 | add_subdirectory(ConfigServer) 25 | #add_subdirectory(DbAccess) 26 | add_subdirectory(CombinDbAccessServer) 27 | add_subdirectory(KVCacheServer) 28 | add_subdirectory(MKVCacheServer) 29 | add_subdirectory(OptServer) 30 | add_subdirectory(PropertyServer) 31 | add_subdirectory(Proxy) 32 | add_subdirectory(Router) 33 | add_subdirectory(TarsComm) -------------------------------------------------------------------------------- /src/CombinDbAccessServer/CombinDbAccessServer.h: -------------------------------------------------------------------------------- 1 | #ifndef _CombinDbAccessServer_H_ 2 | #define _CombinDbAccessServer_H_ 3 | 4 | #include 5 | #include "util/tc_config.h" 6 | #include "servant/Application.h" 7 | using namespace tars; 8 | 9 | /** 10 | * 11 | **/ 12 | class CombinDbAccessServer : public Application 13 | { 14 | public: 15 | /** 16 | * 17 | **/ 18 | virtual ~CombinDbAccessServer() {}; 19 | 20 | /** 21 | * 22 | **/ 23 | virtual void initialize(); 24 | 25 | /** 26 | * 27 | **/ 28 | virtual void destroyApp(); 29 | 30 | bool showVer(const string& command, const string& params, string& result); 31 | }; 32 | 33 | extern CombinDbAccessServer g_app; 34 | 35 | //////////////////////////////////////////// 36 | #endif 37 | -------------------------------------------------------------------------------- /src/CombinDbAccessServer/DBAccessServer1.conf: -------------------------------------------------------------------------------- 1 | 2 | #主从机读写配置 m|s 3 | #readAble = m 4 | #writeAble = m 5 | #dcache是一期还是二期的 6 | CacheType = 1 7 | #如果key为非数字,可以通过hash算法把字符串转批为数字 8 | isHashForLocateDB = Y 9 | #一期需要配置,二期请忽略配置 10 | 11 | #主key字段名 12 | KeyNameInDB = sIme 13 | #value是否有序列化存储 14 | isSerializated = Y 15 | #序列化存储的字段结构定义,如果非序列化,此处写vale的字段名即可 16 | 17 | sGuid=0|string|require| 18 | sQua=1|string|optional| 19 | sList=2|string|optional| 20 | 21 | 22 | 23 | #判断表名后缀的key尾的长度,表名后缀=key.substr(key.length() - PostfixLen) % Div 24 | PostfixLen = 1 25 | #表名前缀 26 | TableNamePrefix = t_TRomUserHistory_ 27 | #判断表名后缀命名的模数 28 | Div = 1 29 |
30 | 31 | #判断数据连接配置 32 | #从key倒数第几位开始 33 | PosInKey = 2 34 | #从开始位向右截取key一定长度的数字,库名后缀=key.substr(key.length() - PostfixLen) / Div 35 | PostfixLen = 1 36 | #数据连接配置节名称前缀 37 | DbPrefix = db_TRomUserHistory_ 38 | #判断数据库后缀命名的除数 39 | Div = 10 40 | #连接超时时间,单位s,默认1秒 41 | #conTimeOut= 42 | #查询超时时间,单位s,默认1秒 43 | #queryTimeOut= 44 | #屏蔽后多久尝试重连,单位s,默认300秒 45 | #retryDBInterval= 46 | #检查超时的时间片,单位s,默认60 47 | #checkTimeoutInterval= 48 | #连续超时次数,默认10 49 | #frequenceFailInvoke= 50 | #最小失败次数 到达该值后 才开始检查radio,默认5 51 | #minTimeoutInvoke= 52 | #失败比例到达多少会屏蔽,默认30,单位% 53 | #radio= 54 | 55 | 56 | # 连接编号; host; user; pass; charset; dbport 57 | 0 = 10.198.7.245; dcachetest; dcachetest; utf8; 3304 58 | 59 | 60 | # DataBase编号; DataBase所在的连接编号 61 | [0-0] = 0 62 | 63 |
-------------------------------------------------------------------------------- /src/CombinDbAccessServer/DBAccessServer2.conf: -------------------------------------------------------------------------------- 1 | 2 | #主从机读写配置 m|s 3 | #readAble = m 4 | #writeAble = m 5 | #dcache是一期还是二期的 6 | CacheType = 1 7 | #如果key为非数字,可以通过hash算法把字符串转批为数字 8 | isHashForLocateDB = Y 9 | #一期需要配置,二期请忽略配置 10 | 11 | #主key字段名 12 | KeyNameInDB = userid 13 | #value是否有序列化存储 14 | isSerializated = N 15 | #序列化存储的字段结构定义,如果非序列化,此处写vale的字段名即可 16 | 17 | value=0|string|optional| 18 | 19 | 20 | 21 | #判断表名后缀的key尾的长度,表名后缀=key.substr(key.length() - PostfixLen) % Div 22 | PostfixLen = 1 23 | #表名前缀 24 | TableNamePrefix = t_TRomCommData_ 25 | #判断表名后缀命名的模数 26 | Div = 1 27 |
28 | 29 | #判断数据连接配置 30 | #从key倒数第几位开始 31 | PosInKey = 2 32 | #从开始位向右截取key一定长度的数字,库名后缀=key.substr(key.length() - PostfixLen) / Div 33 | PostfixLen = 1 34 | #数据连接配置节名称前缀 35 | DbPrefix = db_TRomCommData_ 36 | #判断数据库后缀命名的除数 37 | Div = 10 38 | #连接超时时间,单位s,默认1秒 39 | #conTimeOut= 40 | #查询超时时间,单位s,默认1秒 41 | #queryTimeOut= 42 | #屏蔽后多久尝试重连,单位s,默认300秒 43 | #retryDBInterval= 44 | #检查超时的时间片,单位s,默认60 45 | #checkTimeoutInterval= 46 | #连续超时次数,默认10 47 | #frequenceFailInvoke= 48 | #最小失败次数 到达该值后 才开始检查radio,默认5 49 | #minTimeoutInvoke= 50 | #失败比例到达多少会屏蔽,默认30,单位% 51 | #radio= 52 | 53 | 54 | # 连接编号; host; user; pass; charset; dbport 55 | 0 = 10.198.7.245; dcachetest; dcachetest; utf8; 3304 56 | 57 | 58 | # DataBase编号; DataBase所在的连接编号 59 | [0-0] = 0 60 | 61 |
-------------------------------------------------------------------------------- /src/CombinDbAccessServer/JceOperator.h: -------------------------------------------------------------------------------- 1 | #ifndef _JCEOPERATOR_H 2 | #define _JCEOPERATOR_H 3 | //#include "StringUtil.h" 4 | #include "util/tc_common.h" 5 | #include 6 | // #include "wup-linux-c++/Jce.h" 7 | #include "tup/Tars.h" 8 | /* 9 | * 封装jce编码二进制流 10 | */ 11 | 12 | using namespace std; 13 | using namespace tars; 14 | 15 | class JceEncode 16 | { 17 | public: 18 | JceEncode(){} 19 | ~JceEncode(){} 20 | 21 | const char* getBuffer() 22 | { 23 | return m_osk.getBuffer(); 24 | } 25 | 26 | size_t getLength() 27 | { 28 | return m_osk.getLength(); 29 | } 30 | 31 | /* 32 | * 返回jce编码二进制流 33 | */ 34 | /* 35 | const vector& getBuffer() 36 | { 37 | return m_osk.getByteBuffer(); 38 | } 39 | */ 40 | 41 | /* 42 | * 将某字段写入jce编码 43 | * @param s: 某字段的值 44 | * @param tag: 某字段的tag编号 45 | * @param type: 某字段的类型 46 | */ 47 | void write(const string &s, uint8_t tag, string type); 48 | 49 | private: 50 | TarsOutputStream m_osk; 51 | }; 52 | 53 | /* 54 | * 解码jce编码二进制流 55 | */ 56 | class JceDecode 57 | { 58 | public: 59 | JceDecode(){} 60 | ~JceDecode(){} 61 | void setBuffer(const string &sBuf) 62 | { 63 | m_sBuf = sBuf; 64 | } 65 | string getBuffer() 66 | { 67 | return m_sBuf; 68 | } 69 | 70 | /* 71 | * 将某字段从jce编码流中读出 72 | * @param tag: 某字段的tag编号 73 | * @param type: 某字段的类型 74 | * @param sDefault: 默认值 75 | * @param isRequire: 是否是必须字段 76 | */ 77 | string read(uint8_t tag, const string& type, const string &sDefault, bool isRequire); 78 | 79 | private: 80 | string m_sBuf; 81 | }; 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /src/CombinDbAccessServer/MysqlTimeOutHandle.h: -------------------------------------------------------------------------------- 1 | #ifndef __MysqlTimeOutHandle_H_ 2 | #define __MysqlTimeOutHandle_H_ 3 | 4 | #include "util/tc_common.h" 5 | #include "Globe.h" 6 | 7 | using namespace tars; 8 | struct CheckMysqlTimeoutInfo; 9 | 10 | class MysqlTimeOutHandle : public TC_ThreadMutex 11 | { 12 | public: 13 | MysqlTimeOutHandle(CheckMysqlTimeoutInfo * timeoutInfo,const string &mysqlIp,const string &mysqlport); 14 | 15 | bool checkActive(); 16 | 17 | void finishInvoke(bool bTimeout); 18 | protected: 19 | 20 | void resetInvoke(); 21 | private: 22 | 23 | uint32_t _timeoutInvoke; 24 | 25 | uint32_t _totalInvoke; 26 | 27 | uint32_t _frequenceFailInvoke; 28 | 29 | time_t _lastFinishInvokeTime; 30 | 31 | time_t _lastRetryTime; 32 | 33 | bool _activeStatus; 34 | 35 | CheckMysqlTimeoutInfo * _timeoutInfo; 36 | 37 | string _mysqlIp; 38 | 39 | string _mysqlPort; 40 | }; 41 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /src/Comm/BaseHash.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | 15 | #ifndef _BASEHASH_H 16 | #define _BASEHASH_H 17 | #include 18 | 19 | using namespace std; 20 | 21 | class P_Hash 22 | { 23 | public: 24 | P_Hash() {}; 25 | virtual ~P_Hash() {}; 26 | 27 | virtual size_t HashRawInt(const int key) { return 0; } 28 | virtual size_t HashRawLong(const long long key) { return 0; } 29 | virtual size_t HashRawString(const string & key) { return 0; } 30 | virtual size_t HashInt(const string & key) { return 0; } 31 | virtual size_t HashLong(const string & key) { return 0; } 32 | virtual size_t HashString(const string & key) { return 0; } 33 | 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/Comm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | aux_source_directory(. DIR_SRC) 3 | 4 | include_directories(../Router) 5 | 6 | add_library(cache_comm ${DIR_SRC}) 7 | 8 | add_dependencies(cache_comm RouterServer) 9 | -------------------------------------------------------------------------------- /src/Comm/Gzip.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #ifndef _GZIP_H_ 15 | #define _GZIP_H_ 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | using namespace std; 22 | 23 | class Gzip 24 | { 25 | public: 26 | Gzip() {} 27 | 28 | ~Gzip() {} 29 | 30 | /** 31 | * gzip压缩 32 | * @param src 33 | * @param length 34 | * @param buffer 35 | * 36 | * @return bool 37 | */ 38 | static bool gzipCompress(const char* src, size_t length, string& buffer); 39 | 40 | /** 41 | * gzip解压 42 | * @param src 43 | * @param length 44 | * @param buffer 45 | * 46 | * @return int 47 | */ 48 | static bool gzipUncompress(const char *src, size_t length, string &buffer); 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/Comm/NormalHash.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #include "NormalHash.h" 15 | 16 | size_t NormalHash::HashRawInt(const int key) 17 | { 18 | string sKey; 19 | sKey.assign((char *)&key, sizeof(int)); 20 | 21 | return HashRawString(sKey); 22 | } 23 | size_t NormalHash::HashRawLong(const long long key) 24 | { 25 | string sKey; 26 | sKey.assign((char *)&key, sizeof(long long)); 27 | 28 | return HashRawString(sKey); 29 | } 30 | size_t NormalHash::HashRawString(const string &key) 31 | { 32 | const char *ptr = key.c_str(); 33 | size_t key_length = key.length(); 34 | uint32_t value = 0; 35 | 36 | while (key_length--) 37 | { 38 | value += *ptr++; 39 | value += (value << 10); 40 | value ^= (value >> 6); 41 | } 42 | value += (value << 3); 43 | value ^= (value >> 11); 44 | value += (value << 15); 45 | 46 | return value == 0 ? 1 : value; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/Comm/NormalHash.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #ifndef _NORMALHASH_H 15 | #define _NORMALHASH_H 16 | 17 | #include "BaseHash.h" 18 | 19 | class NormalHash : public P_Hash 20 | { 21 | public: 22 | NormalHash() {}; 23 | virtual ~NormalHash() {}; 24 | 25 | virtual size_t HashRawInt(const int key); 26 | virtual size_t HashRawLong(const long long key); 27 | virtual size_t HashRawString(const string &key); 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/Comm/StringUtil.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #ifndef _STRING_UTIL_H_ 15 | #define _STRING_UTIL_H_ 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | using namespace std; 23 | 24 | class StringUtil 25 | { 26 | public: 27 | StringUtil() {} 28 | 29 | ~StringUtil() {} 30 | 31 | /** 32 | * 对字符串进行gzip压缩 33 | * @param src 34 | * @param length 35 | * @param buffer 36 | * 37 | * @return bool 38 | */ 39 | static bool gzipCompress(const char* src, size_t length, string& buffer); 40 | 41 | /** 42 | * 对字符串进行gzip解压 43 | * @param src 44 | * @param length 45 | * @param buffer 46 | * 47 | * @return int 48 | */ 49 | static bool gzipUncompress(const char *src, size_t length, string &buffer); 50 | 51 | 52 | /* 53 | * 解析字符串 54 | */ 55 | static bool parseString(const string& str, vector& res); 56 | 57 | public: 58 | 59 | const static size_t GZIP_MIN_STR_LEN; 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/ConfigServer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | gen_server(DCache ConfigServer) 4 | 5 | target_link_libraries(ConfigServer mysqlclient) -------------------------------------------------------------------------------- /src/ConfigServer/Config.tars: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | 15 | module DCache 16 | { 17 | 18 | interface Config 19 | { 20 | /** 21 | * 读取配置文件 22 | * @inparam appName: 应用名 23 | * @inparam serverName: 服务名 24 | * @outparam config: 读取到的配置 25 | * @return int: 成功返回0,否则返回-1 26 | */ 27 | int readConfig(string appName, string serverName, out string config); 28 | 29 | /** 30 | * 读取服务的配置文件,这是指在服务名存在的情况下,根据服务的ip来读取服务的配置 31 | * @inparam appServerName: 服务名称,由应用名称和服务名称合并构成 32 | * @inparam host: 节点ip 33 | * @outparam config: 读取到的配置 34 | * @return int: 成功返回0,否则返回-1 35 | */ 36 | int readConfigByHost(string appServerName, string host, out string config); 37 | 38 | /** 39 | * 读取应用的配置文件 40 | * @inparam appName: 应用名 41 | * @outparam config: 读取到的配置 42 | * @return int: 成功返回0,否则返回-1 43 | */ 44 | int readAppConfig(string appName, out string config); 45 | }; 46 | 47 | }; 48 | -------------------------------------------------------------------------------- /src/ConfigServer/ConfigServer.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #include "ConfigServer.h" 15 | #include "ConfigImp.h" 16 | 17 | void ConfigServer::initialize() 18 | { 19 | //加载配置文件 20 | addConfig("ConfigServer.conf"); 21 | 22 | //增加对象 23 | addServant(ServerConfig::Application + "." + ServerConfig::ServerName + ".ConfigObj"); 24 | } 25 | 26 | void ConfigServer::destroyApp() 27 | { 28 | TLOG_DEBUG("ConfigServer::destroyApp succ." << endl); 29 | } 30 | 31 | int main(int argc, char *argv[]) 32 | { 33 | try 34 | { 35 | ConfigServer app; 36 | 37 | app.main(argc, argv); 38 | 39 | app.waitForShutdown(); 40 | } 41 | catch(exception &ex) 42 | { 43 | cerr<< ex.what() << endl; 44 | } 45 | 46 | return 0; 47 | } -------------------------------------------------------------------------------- /src/ConfigServer/ConfigServer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #ifndef __CONFIG_SERVER_H_ 15 | #define __CONFIG_SERVER_H_ 16 | 17 | #include "servant/Application.h" 18 | 19 | using namespace tars; 20 | 21 | /** 22 | * 23 | **/ 24 | class ConfigServer : public Application 25 | { 26 | public: 27 | /** 28 | * 析构函数 29 | **/ 30 | virtual ~ConfigServer() {}; 31 | 32 | /** 33 | * 初始化, 进程只会调用一次 34 | **/ 35 | virtual void initialize(); 36 | 37 | /** 38 | * 析构, 进程退出时会调用一次 39 | **/ 40 | virtual void destroyApp(); 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/KVCacheServer/BackUp.tars: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | module DCache 15 | { 16 | interface BackUp 17 | { 18 | /* 19 | * dump内存数据到指定路径文件 20 | * dumpPath: 存放镜像文件的绝对路径,如果为空则dump到默认路径:/data/dcache/dump_binlog/ 21 | * mirrorName: 镜像文件名, 如果为空则使用组名和当前时间生成文件名,例如:TestModuleKVGroup1_dump_binlog_20190701120101.log.gz 22 | */ 23 | int dump(string dumpPath, string mirrorName, out string errmsg); 24 | 25 | /* 26 | * 恢复mirror和binlog,路径下没有mirror,则只恢复binlog,有的话先恢复mirror,再恢复binlog 27 | * mirrorPath: mirror文件绝对路径 28 | * binlogPath: binlog文件绝对路径 29 | * lastTime: 恢复到该时间点,unix时间戳,精度:秒 30 | * normal:是否强制恢复,正常的恢复流程在加载完镜像和binlog后,会再从主机同步一条binlog 31 | * 强制恢复流程,则是加载完镜像和binlog后,就认为恢复完成 32 | */ 33 | int restore(string mirrorPath, vectorbinlogPath, int lastTime, bool normal, out string errmsg); 34 | }; 35 | }; -------------------------------------------------------------------------------- /src/KVCacheServer/BackUpImp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #ifndef _BACKUP_IMP_H_ 15 | #define _BACKUP_IMP_H_ 16 | 17 | #include "CacheGlobe.h" 18 | #include "BackUp.h" 19 | #include "servant/Application.h" 20 | #include "DumpThread.h" 21 | #include "SlaveCreateThread.h" 22 | 23 | using namespace tars; 24 | using namespace std; 25 | 26 | class BackUpImp : public DCache::BackUp 27 | { 28 | public: 29 | 30 | BackUpImp() {} 31 | 32 | /** 33 | * 34 | */ 35 | virtual ~BackUpImp() {} 36 | 37 | /** 38 | * 39 | */ 40 | virtual void initialize(); 41 | 42 | /** 43 | * 44 | */ 45 | virtual void destroy() {} 46 | 47 | /** 48 | * 49 | */ 50 | tars::Int32 dump(const std::string &dumpPath, const std::string &mirrorName, std::string &errmsg, tars::TarsCurrentPtr current); 51 | 52 | tars::Int32 restore(const std::string & mirrorPath, const vector & binlogpath, tars::Int32 lastTime, tars::Bool normal, std::string &errmsg, tars::TarsCurrentPtr current); 53 | 54 | private: 55 | string _config; 56 | TC_Config _tcConf; 57 | 58 | }; 59 | 60 | #endif 61 | 62 | -------------------------------------------------------------------------------- /src/KVCacheServer/BinLog.tars: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #include "../TarsComm/CacheShare.tars" 15 | module DCache 16 | { 17 | interface BinLog 18 | { 19 | /** 20 | *获取Binlog日志 21 | *返回值: 22 | * 0: 成功 23 | * 其他: 失败 24 | */ 25 | int getLog(BinLogReq req, out BinLogRsp rsp); 26 | 27 | /** 28 | *获取经过压缩的Binlog日志 29 | *返回值: 30 | * 0或者1: 成功,0表示binlog经过压缩,1表示未压缩 31 | * 其他: 失败 32 | */ 33 | int getLogCompress(BinLogReq req, out BinLogRsp rsp); 34 | 35 | /** 36 | *获取最后记录binlog的时间 37 | *参数: 38 | * lastTime: 最后记录binlog的时间 39 | *返回值: 40 | * 0: 成功 41 | * 其他: 失败 42 | */ 43 | int getLastBinLogTime(out unsigned int lastTime); 44 | }; 45 | }; 46 | -------------------------------------------------------------------------------- /src/KVCacheServer/ControlAck.tars: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | module DCache 15 | { 16 | 17 | interface ControlAck 18 | { 19 | //备机上报连接心跳 20 | int connectHb(); 21 | }; 22 | }; 23 | -------------------------------------------------------------------------------- /src/KVCacheServer/ControlAckImp.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #include "ControlAckImp.h" 15 | #include "RouterHandle.h" 16 | #include "CacheServer.h" 17 | 18 | void ControlAckImp::initialize() 19 | { 20 | try 21 | { 22 | _tcConf.parseFile(ServerConfig::BasePath + "CacheServer.conf"); 23 | } 24 | catch (exception &ex) 25 | { 26 | TLOG_ERROR("ControlAckImp::initialize exception:" << ex.what() << endl); 27 | } 28 | catch (...) 29 | { 30 | TLOG_ERROR("ControlAckImp::initialize unknown exception." << endl); 31 | } 32 | 33 | } 34 | 35 | tars::Int32 ControlAckImp::connectHb(tars::TarsCurrentPtr current) 36 | { 37 | if (g_app.gstat()->serverType() != MASTER) 38 | { 39 | TLOG_ERROR("ControlAckImp::connectHb, server is not master. maybe downgrade." << endl); 40 | return -1; 41 | } 42 | 43 | RouterHandle::getInstance()->incSlaveHbCount(); 44 | 45 | return 0; 46 | } 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/KVCacheServer/ControlAckImp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #ifndef _CONTROL_ACK_H 15 | #define _CONTROL_ACK_H 16 | 17 | #include "servant/Application.h" 18 | #include "ControlAck.h" 19 | 20 | 21 | using namespace tars; 22 | using namespace std; 23 | 24 | /* 25 | *BinLogAckObj接口的实现类 26 | */ 27 | class ControlAckImp : public DCache::ControlAck 28 | { 29 | public: 30 | /** 31 | * 32 | */ 33 | virtual ~ControlAckImp() {} 34 | 35 | /** 36 | * 37 | */ 38 | virtual void initialize(); 39 | 40 | /** 41 | * 42 | */ 43 | virtual void destroy() {} 44 | 45 | 46 | virtual tars::Int32 connectHb(tars::TarsCurrentPtr current); 47 | 48 | private: 49 | TC_Config _tcConf; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/KVCacheServer/main.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #include "CacheServer.h" 15 | 16 | extern CacheServer g_app; 17 | 18 | int main(int argc, char *argv[]) 19 | { 20 | try 21 | { 22 | g_app.main(argc, argv); 23 | g_app.waitForShutdown(); 24 | } 25 | catch (std::exception &e) 26 | { 27 | cerr << "std::exception:" << e.what() << std::endl; 28 | } 29 | catch (...) 30 | { 31 | cerr << "unknown exception." << std::endl; 32 | } 33 | return -1; 34 | } 35 | -------------------------------------------------------------------------------- /src/MKVCacheServer/MKBackUp.tars: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | module DCache 15 | { 16 | interface MKBackUp 17 | { 18 | /* 19 | * dump内存数据到指定路径文件 20 | * dumpPath: 存放镜像文件的绝对路径,如果为空则dump到默认路径:/data/dcache/dump_binlog/ 21 | * mirrorName: 镜像文件名, 如果为空则使用组名和当前时间生成文件名,例如:TestModuleMKVGroup1_dump_binlog_20190701120101.log.gz 22 | */ 23 | int dump(string dumpPath, string mirrorName, out string errmsg); 24 | 25 | /* 26 | * 恢复mirror和binlog,路径下没有mirror,则只恢复binlog,有的话先恢复mirror,再恢复binlog 27 | * mirrorPath: mirror文件绝对路径 28 | * binlogPath: binlog文件绝对路径 29 | * lastTime: 恢复到该时间点,unix时间戳,精度:秒 30 | * normal:是否强制恢复,正常的恢复流程在加载完镜像和binlog后,会再从主机同步一条binlog 31 | * 强制恢复流程,则是加载完镜像和binlog后,就认为恢复完成 32 | */ 33 | int restore(string mirrorPath, vectorbinlogPath, int lastTime, bool normal, out string errmsg); 34 | }; 35 | }; -------------------------------------------------------------------------------- /src/MKVCacheServer/MKBackUpImp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #ifndef _MKBACKUP_IMP_H_ 15 | #define _MKBACKUP_IMP_H_ 16 | 17 | #include "servant/Application.h" 18 | #include "MKCacheGlobe.h" 19 | #include "MKBackUp.h" 20 | #include "DumpThread.h" 21 | #include "SlaveCreateThread.h" 22 | 23 | using namespace tars; 24 | using namespace std; 25 | 26 | class MKBackUpImp : public DCache::MKBackUp 27 | { 28 | public: 29 | 30 | MKBackUpImp() {} 31 | 32 | /** 33 | * 34 | */ 35 | virtual ~MKBackUpImp() {} 36 | 37 | /** 38 | * 39 | */ 40 | virtual void initialize(); 41 | 42 | /** 43 | * 44 | */ 45 | virtual void destroy() {} 46 | 47 | /** 48 | * 49 | */ 50 | tars::Int32 dump(const std::string &dumpPath, const std::string &mirrorName, std::string &errmsg, tars::TarsCurrentPtr current); 51 | 52 | tars::Int32 restore(const std::string & mirrorPath, const vector & binlogPath, tars::Int32 lastTime, tars::Bool normal, std::string &errmsg, tars::TarsCurrentPtr current); 53 | 54 | private: 55 | string _config; 56 | TC_Config _tcConf; 57 | 58 | }; 59 | 60 | #endif 61 | 62 | -------------------------------------------------------------------------------- /src/MKVCacheServer/MKBinLog.tars: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #include "../TarsComm/CacheShare.tars" 15 | module DCache 16 | { 17 | interface MKBinLog 18 | { 19 | /** 20 | *获取Binlog日志 21 | *返回值: 22 | * 0: 成功 23 | * 其他: 失败 24 | */ 25 | int getLog(BinLogReq req, out BinLogRsp rsp); 26 | 27 | /** 28 | *获取经过压缩的Binlog日志 29 | *参数: 30 | *返回值: 31 | * 0或者1: 成功,0表示binlog经过压缩,1表示未压缩 32 | * 其他: 失败 33 | */ 34 | int getLogCompress(BinLogReq req, out BinLogRsp rsp); 35 | 36 | /** 37 | *获取经过压缩的Binlog日志,如果返回的数据超过8M,会分块返回 38 | *返回值: 39 | * 0: 成功 40 | * 其他: 失败 41 | */ 42 | int getLogCompressWithPart(BinLogReq req, out BinLogCompPartRsp rsp); 43 | 44 | /** 45 | *获取最后记录binlog的时间 46 | *参数: 47 | * lastTime: 最后记录binlog的时间 48 | *返回值: 49 | * 0: 成功 50 | * 其他: 失败 51 | */ 52 | int getLastBinLogTime(out unsigned int lastTime); 53 | }; 54 | }; 55 | -------------------------------------------------------------------------------- /src/MKVCacheServer/MKControlAck.tars: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | module DCache 15 | { 16 | 17 | interface MKControlAck 18 | { 19 | //备机上报连接心跳 20 | int connectHb(); 21 | }; 22 | }; 23 | -------------------------------------------------------------------------------- /src/MKVCacheServer/MKControlAckImp.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #include "MKControlAckImp.h" 15 | #include "RouterHandle.h" 16 | #include "MKCacheServer.h" 17 | 18 | void MKControlAckImp::initialize() 19 | { 20 | try 21 | { 22 | _tcConf.parseFile(ServerConfig::BasePath + "MKCacheServer.conf"); 23 | } 24 | catch (exception &ex) 25 | { 26 | TLOG_ERROR("MKControlAckImp::initialize exception:" << ex.what() << endl); 27 | } 28 | catch (...) 29 | { 30 | TLOG_ERROR("MKControlAckImp::initialize unknown exception." << endl); 31 | } 32 | 33 | } 34 | 35 | tars::Int32 MKControlAckImp::connectHb(tars::TarsCurrentPtr current) 36 | { 37 | if (g_app.gstat()->serverType() != MASTER) 38 | { 39 | TLOG_ERROR("MKControlAckImp::connectHb, server is not master. maybe downgrade." << endl); 40 | return -1; 41 | } 42 | 43 | RouterHandle::getInstance()->incSlaveHbCount(); 44 | 45 | return 0; 46 | } 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/MKVCacheServer/MKControlAckImp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #ifndef _CONTROL_ACK_H 15 | #define _CONTROL_ACK_H 16 | 17 | #include "servant/Application.h" 18 | #include "MKControlAck.h" 19 | 20 | 21 | using namespace tars; 22 | using namespace std; 23 | 24 | /* 25 | *BinLogAckObj接口的实现类 26 | */ 27 | class MKControlAckImp : public DCache::MKControlAck 28 | { 29 | public: 30 | /** 31 | * 32 | */ 33 | virtual ~MKControlAckImp() {} 34 | 35 | /** 36 | * 37 | */ 38 | virtual void initialize(); 39 | 40 | /** 41 | * 42 | */ 43 | virtual void destroy() {} 44 | 45 | 46 | virtual tars::Int32 connectHb(tars::TarsCurrentPtr current); 47 | 48 | private: 49 | TC_Config _tcConf; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/MKVCacheServer/MKHash.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #include "MKHash.h" 15 | 16 | unsigned int MKHash::HashRawString(const string &key) 17 | { 18 | const char *ptr = key.c_str(); 19 | size_t key_length = key.length(); 20 | unsigned int value = 0; 21 | 22 | while (key_length--) 23 | { 24 | value += *ptr++; 25 | value += (value << 10); 26 | value ^= (value >> 6); 27 | } 28 | value += (value << 3); 29 | value ^= (value >> 11); 30 | value += (value << 15); 31 | 32 | return value == 0 ? 1 : value; 33 | } 34 | 35 | unsigned int MKHash::HashMK(const string &key) 36 | { 37 | unsigned int uHash = HashRawString(key); 38 | 39 | return uHash; 40 | } 41 | 42 | unsigned int MKHash::HashMKUK(const string &key) 43 | { 44 | unsigned int uHash = HashRawString(key); 45 | return uHash; 46 | } 47 | -------------------------------------------------------------------------------- /src/MKVCacheServer/MKHash.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | 15 | #ifndef _MKHASH_H 16 | #define _MKHASH_H 17 | 18 | #include 19 | 20 | using namespace std; 21 | 22 | class MKHash// : public NormalHash 23 | { 24 | public: 25 | 26 | MKHash() {}; 27 | virtual ~MKHash() {}; 28 | 29 | virtual unsigned int HashRawString(const string &key); 30 | virtual unsigned int HashMK(const string &key); 31 | virtual unsigned int HashMKUK(const string &key); 32 | private: 33 | 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/OptServer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories(/usr/local/tars/cpp/include/framework) 3 | include_directories(/usr/local/tars/cpp/include/servant) 4 | include_directories(../Proxy) 5 | include_directories(../Router) 6 | include_directories(../PropertyServer) 7 | 8 | gen_server(DCache DCacheOptServer) 9 | 10 | add_dependencies(DCacheOptServer PropertyServer ProxyServer RouterServer) 11 | 12 | target_link_libraries(DCacheOptServer mysqlclient) -------------------------------------------------------------------------------- /src/OptServer/UndeployThread.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #ifndef _UNDEPLOY_TREAHD_H_ 15 | #define _UNDEPLOY_TREAHD_H_ 16 | 17 | #include 18 | 19 | #include "servant/Application.h" 20 | #include "util/tc_thread.h" 21 | #include "util/tc_mysql.h" 22 | 23 | #include "Router.h" 24 | #include "DCacheOpt.h" 25 | #include "Assistance.h" 26 | 27 | using namespace std; 28 | using namespace tars; 29 | using namespace DCache; 30 | 31 | class UndeployThread : public TC_Thread, public TC_ThreadLock 32 | { 33 | public: 34 | UndeployThread() {} 35 | 36 | ~UndeployThread() {} 37 | 38 | void init(const string& sConf); 39 | 40 | virtual void run(); 41 | 42 | void terminate(); 43 | 44 | protected: 45 | 46 | void doUndeploy(time_t tLastCheck); 47 | 48 | int getRouterDBInfo(const string &appName, TC_DBConf &routerDbInfo, string& errmsg); 49 | 50 | private: 51 | 52 | bool _terminate; 53 | 54 | TC_Config _tcConf; 55 | 56 | tars::CommunicatorPtr _communicator; 57 | 58 | AdminRegPrx _adminRegPrx; 59 | 60 | int _checkInterval; 61 | 62 | TC_Mysql _mysqlRelationDB; 63 | 64 | }; 65 | 66 | #endif 67 | 68 | -------------------------------------------------------------------------------- /src/OptServer/main.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #include "DCacheOptServer.h" 15 | 16 | extern DCacheOptServer g_app; 17 | 18 | int main(int argc, char *argv[]) 19 | { 20 | try 21 | { 22 | g_app.main(argc, argv); 23 | g_app.waitForShutdown(); 24 | } 25 | catch (std::exception &e) 26 | { 27 | cerr << "std::exception:" << e.what() << std::endl; 28 | } 29 | catch (...) 30 | { 31 | cerr << "unknown exception." << std::endl; 32 | } 33 | return -1; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/PropertyServer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | gen_server(DCache PropertyServer) 3 | 4 | target_link_libraries(PropertyServer mysqlclient) 5 | -------------------------------------------------------------------------------- /src/PropertyServer/CacheInfoUpdateThread.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #include "CacheInfoUpdateThread.h" 15 | #include "util/tc_config.h" 16 | #include "CacheInfoManager.h" 17 | 18 | CacheInfoUpdateThread::~CacheInfoUpdateThread() 19 | { 20 | if (isAlive()) 21 | { 22 | terminate(); 23 | 24 | getThreadControl().join(); 25 | } 26 | } 27 | 28 | void CacheInfoUpdateThread::terminate() 29 | { 30 | TLOG_DEBUG("CacheInfoUpdateThread::terminate"); 31 | 32 | _terminate = true; 33 | 34 | TC_ThreadLock::Lock lock(*this); 35 | 36 | notifyAll(); 37 | } 38 | 39 | void CacheInfoUpdateThread::run() 40 | { 41 | TLOG_DEBUG("CacheInfoUpdateThread::run once in " << _reloadInterval << " ms" << endl); 42 | 43 | while(!_terminate) 44 | { 45 | { 46 | TC_ThreadLock::Lock lock(*this); 47 | timedWait(_reloadInterval * 1000); 48 | } 49 | 50 | CacheInfoManager::getInstance()->reload(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/PropertyServer/CacheInfoUpdateThread.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #ifndef __CACHEINFO_UPDATE_THREAD_H_ 15 | #define __CACHEINFO_UPDATE_THREAD_H_ 16 | 17 | #include 18 | #include "util/tc_thread.h" 19 | #include "util/tc_common.h" 20 | #include "servant/Application.h" 21 | 22 | using namespace tars; 23 | 24 | /** 25 | * 用于执行定时更新Cache服务信息的线程类 26 | */ 27 | class CacheInfoUpdateThread : public TC_Thread, public TC_ThreadLock 28 | { 29 | public: 30 | 31 | CacheInfoUpdateThread(int iReloadInterval) 32 | : _terminate(false), _reloadInterval(iReloadInterval) 33 | {} 34 | 35 | ~CacheInfoUpdateThread(); 36 | 37 | /** 38 | * 结束线程 39 | */ 40 | void terminate(); 41 | 42 | /** 43 | * 轮询函数 44 | */ 45 | virtual void run(); 46 | 47 | private: 48 | /** 49 | * 结束线程标识 50 | */ 51 | bool _terminate; 52 | 53 | /** 54 | * 重新加载Cache服务信息的时间间隔,单位秒 55 | */ 56 | int _reloadInterval; 57 | }; 58 | 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /src/Proxy/CacheCallbackComm.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #include "CacheCallbackComm.h" 15 | 16 | ////////////////////////////////////////////////////////////////////////// 17 | 18 | void ThreadKey::destructor(void *p) 19 | { 20 | ThreadData *t = (ThreadData *)p; 21 | 22 | if (t) 23 | { 24 | delete t; 25 | } 26 | } 27 | 28 | ThreadKey::KeyInitialize ThreadKey::_threadKeyInitialize; 29 | 30 | pthread_key_t ThreadKey::_threadKey; 31 | 32 | ////////////////////////////////////////////////////////////////////////// 33 | 34 | BatchCallParamComm::BatchCallParamComm(size_t count) 35 | { 36 | _count = count; 37 | } 38 | 39 | ////////////////////////////////////////////////////////////////////////// 40 | -------------------------------------------------------------------------------- /src/Proxy/CacheProxyFactory.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #include "CacheProxyFactory.h" 15 | 16 | CacheProxyFactory::CacheProxyFactory(const CommunicatorPtr &communicator, RouterTableInfoFactory *routeTableFactory) 17 | : _communicator(communicator), _routeTableFactory(routeTableFactory) 18 | { 19 | } 20 | 21 | CacheProxyFactory::~CacheProxyFactory() 22 | { 23 | _servantProxy.clear(); 24 | } 25 | -------------------------------------------------------------------------------- /src/Proxy/Global.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #ifndef _PROXY_GLOBAL_H_ 15 | #define _PROXY_GLOBAL_H_ 16 | 17 | #define CONTEXT_CALLER "DCache::Proxy::Caller" 18 | //#define TNOWMS tars::TC_TimeProvider::getInstance()->getNowMs() 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/Proxy/main.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #include "ProxyServer.h" 15 | 16 | extern ProxyServer g_app; 17 | 18 | int main(int argc, char *argv[]) 19 | { 20 | try 21 | { 22 | g_app.main(argc, argv); 23 | g_app.waitForShutdown(); 24 | } 25 | catch (std::exception &e) 26 | { 27 | cerr << "std::exception:" << e.what() << std::endl; 28 | } 29 | catch (...) 30 | { 31 | cerr << "unknown exception." << std::endl; 32 | } 33 | return -1; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/Router/main.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making DCache available. 3 | * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file 5 | * except in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/BSD-3-Clause 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under 10 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 11 | * either express or implied. See the License for the specific language governing permissions 12 | * and limitations under the License. 13 | */ 14 | #include "RouterServer.h" 15 | 16 | extern RouterServer g_app; 17 | 18 | int main(int argc, char *argv[]) 19 | { 20 | try 21 | { 22 | g_app.main(argc, argv); 23 | g_app.waitForShutdown(); 24 | } 25 | catch (std::exception &e) 26 | { 27 | cerr << "std::exception:" << e.what() << std::endl; 28 | } 29 | catch (...) 30 | { 31 | cerr << "unknown exception." << std::endl; 32 | } 33 | return -1; 34 | } -------------------------------------------------------------------------------- /src/TarsComm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | gen_tars(TarsComm) -------------------------------------------------------------------------------- /test/.lcov-ignore: -------------------------------------------------------------------------------- 1 | /src/Router/AdminReg.h 2 | /src/Router/NodeDescriptor.h 3 | /src/Router/Router.h 4 | /src/Router/RouterClient.h 5 | /src/Router/main.cpp 6 | -------------------------------------------------------------------------------- /test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | include_directories(../src/Comm) 4 | include_directories(../src/TarsComm) 5 | include_directories(../src/Proxy) 6 | include_directories(../src/Router) 7 | include_directories(../src/KVCacheServer) 8 | include_directories(../src/MKVCacheServer) 9 | 10 | add_subdirectory(Proxy) 11 | add_subdirectory(Router) 12 | add_subdirectory(KVCacheServer) 13 | 14 | #add_dependencies(test-ProxyServer cache_common TarsComm ProxyServer RouterServer KVCacheServer MKVCacheServer) 15 | #add_dependencies(test-RouterServer cache_common TarsComm ProxyServer RouterServer KVCacheServer MKVCacheServer) 16 | #add_dependencies(test-KVCacheServer cache_common TarsComm ProxyServer RouterServer KVCacheServer MKVCacheServer) 17 | 18 | link_libraries(mysqlclient gtest cache_common) 19 | -------------------------------------------------------------------------------- /test/KVCacheServer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | aux_source_directory(../../src/KVCacheServer DIR_SRC) 4 | aux_source_directory(../../src/KVCacheServer/jmem_hashmap_malloc CACHE_DIR_SRC) 5 | 6 | list(REMOVE_ITEM DIR_SRC "../../src/KVCacheServer/main.cpp") 7 | 8 | add_library(libKVCacheServer ${DIR_SRC} ${CACHE_DIR_SRC}) 9 | 10 | file(GLOB_RECURSE TEST_CPPS *.cpp) 11 | 12 | link_directories(/usr/local/tars/cpp/thirdparty/lib64) 13 | 14 | find_package(ZLIB) 15 | 16 | foreach(TEST_CPP ${TEST_CPPS}) 17 | get_filename_component(TEST_NAME ${TEST_CPP} NAME_WE) 18 | 19 | add_executable(test-${TEST_NAME} ${TEST_CPP}) 20 | 21 | target_link_libraries(test-${TEST_NAME} mysqlclient gtest gmock tarsservant libKVCacheServer cache_comm tarsutil ${ZLIB_LIBRARIES}) 22 | 23 | add_dependencies(test-${TEST_NAME} libKVCacheServer cache_comm TarsComm ProxyServer RouterServer KVCacheServer MKVCacheServer) 24 | 25 | endforeach() 26 | 27 | 28 | -------------------------------------------------------------------------------- /test/Proxy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | aux_source_directory(../../src/Proxy DIR_SRC) 3 | 4 | list(REMOVE_ITEM DIR_SRC "../../src/Proxy/main.cpp") 5 | 6 | add_library(libProxy ${DIR_SRC}) 7 | 8 | file(GLOB_RECURSE TEST_CPPS *.cpp) 9 | 10 | link_directories(/usr/local/tars/cpp/thirdparty/lib64) 11 | 12 | foreach(TEST_CPP ${TEST_CPPS}) 13 | get_filename_component(TEST_NAME ${TEST_CPP} NAME_WE) 14 | 15 | add_executable(test-${TEST_NAME} ${TEST_CPP}) 16 | 17 | target_link_libraries(test-${TEST_NAME} mysqlclient gtest gmock libProxy cache_comm tarsservant tarsutil) 18 | 19 | add_dependencies(test-${TEST_NAME} libProxy cache_comm TarsComm ProxyServer RouterServer KVCacheServer MKVCacheServer) 20 | 21 | endforeach() 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/README.md: -------------------------------------------------------------------------------- 1 | DCache测试说明 2 | ==== 3 | DCache单元测试采用[googletest](https://github.com/abseil/googletest),其具体使用方法请参考[官方文档](https://github.com/abseil/googletest/blob/master/googletest/docs/primer.md)。另外还引入了[googlemock](https://github.com/abseil/googletest/tree/master/googlemock)来辅助单元测试,可自行选用。 4 | 5 | ## 添加测试用例 6 | 测试代码位于此test目录下,目录结构和源码结构保持统一。原则上保证测试代码文件和源代码文件一一对应,即每个cpp文件都有对应的测试文件且统一命名,如源代码文件为:/src/Router/Transfer.cpp,对应的测试代码为/test/Router/TransferTest.cpp。 7 | 各自模块应包含此目录下的makefile.inc文件,增加测试代码后,在其模块目录执行make命令进行编译,会生成对应的测试可执行程序,如TransferTest,直接运行它就可以进行测试。 8 | 另外也可以通过run_test.sh脚本批量执行测试用例。使用之前需要先编译测试用例代码,然后执行脚本,并指定要执行测试用例的文件夹名称,如 9 | > ./run_test.sh Router 10 | 11 | 便可批量执行所有Router目录下的测试用例,如遇执行失败会终止并给出失败用例的名称。 12 | 13 | ## 关于测试文件依赖 14 | 测试代码可能会对其他头文件产生依赖,请自行修改makefile中INCLUDE变量,添加头文件搜索路径。 15 | 测试代码依赖于源代码生成的.o文件,所以需要先编译源代码后再编译执行测试代码。正因如此,原始代码生成的.o文件中不应当含有main函数的定义(会和测试代码冲突)。建议将main函数单独放在一个独立的文件中,如Main.cpp。 16 | 17 | ## 代码覆盖率统计 18 | 代码覆盖率统计采用gcov和lcov配合完成。run_lcov.sh脚本用于统计模块代码覆盖率。 19 | 使用方法:执行run_lcov.sh并指定要统计覆盖率的模块名称,如 20 | > ./run_lcov.sh Router 21 | 22 | 此命令会重新编译原始代码(src/Router)和测试代码(test/Router)并执行所有测试用例以统计覆盖率,最终在test/Router目录下生成覆盖率统计结果html目录和打包好的html.tar。 23 | 另外,由于DCache中有很多由.tars文件自动生成的代码,测试覆盖率时一般要将其去掉,只需将要去掉统计的文件名添加到.lcov-ignore文件中即可。 -------------------------------------------------------------------------------- /test/Router/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | aux_source_directory(../../src/Router DIR_SRC) 3 | 4 | list(REMOVE_ITEM DIR_SRC "../../src/Router/main.cpp") 5 | 6 | add_library(libRouter ${DIR_SRC}) 7 | 8 | file(GLOB_RECURSE TEST_CPPS *.cpp) 9 | 10 | link_directories(/usr/local/tars/cpp/thirdparty/lib64) 11 | 12 | foreach(TEST_CPP ${TEST_CPPS}) 13 | get_filename_component(TEST_NAME ${TEST_CPP} NAME_WE) 14 | 15 | add_executable(test-${TEST_NAME} ${TEST_CPP}) 16 | 17 | target_link_libraries(test-${TEST_NAME} gtest gmock libRouter cache_comm tarsservant tarsutil mysqlclient) 18 | 19 | add_dependencies(test-${TEST_NAME} libRouter cache_comm TarsComm ProxyServer RouterServer KVCacheServer MKVCacheServer) 20 | 21 | endforeach() 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/run_lcov.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ ! -n "$1" ] ;then 4 | echo -e "please input a module name. Example : \n\t$0 Router" 5 | exit 1 6 | fi 7 | module_name=$1 8 | if [ ! -d $module_name ] ;then 9 | echo "directory "$module_name" doesn't exist" 10 | exit 1 11 | fi 12 | base_dir=$(dirname `pwd`) 13 | src_dir=$base_dir"/src/"$module_name"/" 14 | test_dir=$base_dir"/test/"$module_name"/" 15 | 16 | # 利用gcov编译原代码和测试代码 17 | export INCLUDE="-fprofile-arcs -ftest-coverage" 18 | export LIB="-lgcov -fprofile-arcs" 19 | make -C $src_dir clean 20 | make -C $src_dir 21 | make -C $test_dir clean 22 | make -C $test_dir 23 | 24 | cd $test_dir 25 | # 会为所有.cpp文件生成.gcno,并将覆盖率信息初始化为0 26 | lcov -b $src_dir -c -i -d $src_dir -o .coverage.wtest.base 27 | 28 | # 执行测试用例 29 | for t in $test_dir/*Test ; do $t ; done 30 | 31 | # 根据测试结果生成覆盖率 32 | lcov -b $src_dir -c -d $src_dir -o .coverage.wtest.run 33 | # 合并原始覆盖率和测试覆盖率,.coverage.total中包含了.coverage.wtest.base中没有跑到的部分(覆盖率为0) 34 | lcov -a .coverage.wtest.base -a .coverage.wtest.run -o .coverage.total 35 | # 筛选出原始代码(去掉诸如第三方代码和/usr/include/c++/中的文件等) 36 | lcov -e .coverage.total $src_dir"*" -o .coverage.total.filtered 37 | # 去掉指定文件的覆盖率 38 | while read ignorefile 39 | do 40 | echo "goindg to exclude $base_dir$ignorefile" 41 | lcov -r .coverage.total.filtered $base_dir"$ignorefile" -o .coverage.total.filtered 42 | done < ../.lcov-ignore 43 | 44 | if [ -d html ] ; then 45 | rm -rf ./html/* 46 | else 47 | mkdir html 48 | fi 49 | 50 | # 生成覆盖率信息的web页面并打包 51 | genhtml -o ./html/ .coverage.total.filtered 52 | if [ -e "./html.tar" ] ; then 53 | rm ./html.tar 54 | fi 55 | tar czvf html.tar html 56 | rm .coverage.* 57 | rm $src_dir*.gcda $src_dir*.gcno $test_dir*.gcno $test_dir*.gcda 58 | rm $src_dir*.o $test_dir*.o -------------------------------------------------------------------------------- /test/run_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ ! -n "$1" ] ;then 4 | echo -e "please input a module name. Example : \n\t$0 Router" 5 | exit 1 6 | fi 7 | 8 | module_name=$1 9 | if [ ! -d $module_name ] ;then 10 | echo "directory "$module_name" doesn't exist" 11 | exit 1 12 | fi 13 | 14 | test_case_num=0 15 | failed_test="" 16 | # 执行测试用例 17 | for t in ./$module_name/*Test ; do 18 | ((test_case_num=test_case_num+1)) 19 | echo "run test case : $t" 20 | ./$t 21 | if [ $? -ne 0 ]; then 22 | failed_test="$t" 23 | break; 24 | fi 25 | done 26 | 27 | if [ $test_case_num -eq 0 ]; then 28 | echo "can't find test in folder $module_name" 29 | exit 1 30 | fi 31 | 32 | if [ -z "failed_test" ]; then 33 | echo "all test run successed" 34 | exit 1 35 | else 36 | echo "$failed_test test failed" 37 | fi -------------------------------------------------------------------------------- /web/ChangeList.md: -------------------------------------------------------------------------------- 1 | ## 20220610(v1.0.0) 2 | 3 | - 完成独立化 4 | -------------------------------------------------------------------------------- /web/README.md: -------------------------------------------------------------------------------- 1 | # 如何开发 2 | 3 | 由于dcache web是作为插件挂载tarsweb后的, 它是无法本地调试的, 如果要调试需要:准备以下几点: 4 | 5 | - 要有一套tars环境, 并安装好dcache组件 6 | - tarsweb上可以打开缓存平台 7 | - 在tarsweb上将dcacheweb的端口修改为: 8188 8 | - 开终端, 进入`/usr/local/app/tars/tarsnode/data/DCache.DCacheWebServer/bin/client`, 执行 npm install, 运行: export SERVER_HOST=${your host}; npm run dev 9 | - 开新终端, 进入`/usr/local/app/tars/tarsnode/data/DCache.DCacheWebServer/bin` 目录, 执行 npm install, 运行: npm run local 10 | - 可能需要重启tarsweb(pm2 restart tars-node-web) 11 | - 通过浏览器打开tarsweb, 进入缓存平台 12 | - 至此, web已经进入了开发模式, 你调整代码, 马上会生效 -------------------------------------------------------------------------------- /web/client/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | -------------------------------------------------------------------------------- /web/client/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | "postcss-nested": {}, 8 | // to edit target browsers: use "browserslist" field in package.json 9 | "postcss-cssnext": { 10 | features: { 11 | autoprefixer: { 12 | browsers: [ 13 | 'Android >= 4', 14 | 'Chrome >= 35', 15 | 'Firefox >= 31', 16 | 'Explorer >= 9', 17 | 'iOS >= 7', 18 | 'Opera >= 12', 19 | 'Safari >= 7.1', 20 | ], 21 | } 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /web/client/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /web/client/dist/index.html: -------------------------------------------------------------------------------- 1 | DCache
-------------------------------------------------------------------------------- /web/client/dist/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/dist/static/favicon.ico -------------------------------------------------------------------------------- /web/client/dist/static/fonts/element-icons.535877f5.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/dist/static/fonts/element-icons.535877f5.woff -------------------------------------------------------------------------------- /web/client/dist/static/fonts/element-icons.732389de.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/dist/static/fonts/element-icons.732389de.ttf -------------------------------------------------------------------------------- /web/client/dist/static/img/default.c68b0cc8.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/client/dist/static/img/spinner.dee5f891.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/client/dist/static/img/zoom-in.a42f35f1.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /web/client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client", 3 | "version": "2.0.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "./node_modules/.bin/vue-cli-service serve", 7 | "build": "./node_modules/.bin/vue-cli-service build" 8 | }, 9 | "dependencies": { 10 | "axios": "^0.19.2", 11 | "element-ui": "^2.15.1", 12 | "es6-promise": "^4.2.8", 13 | "events": "^3.3.0", 14 | "highlight.js": "^11.5.1", 15 | "let-ui": "^0.1.23", 16 | "lodash": "^4.17.14", 17 | "n-zepto": "^1.2.0", 18 | "request": "^2.88.0", 19 | "sha1": "^1.1.1", 20 | "uuid": "^8.3.2", 21 | "v-charts": "^1.19.0", 22 | "vue": "^2.6.11", 23 | "vue-axios": "^3.0.1", 24 | "vue-clipboard2": "^0.3.1", 25 | "vue-code-diff": "0.0.4", 26 | "vue-cookie": "^1.1.4", 27 | "vue-fullscreen": "^2.2.0", 28 | "vue-i18n": "^7.8.0", 29 | "vue-json-component": "^0.4.1", 30 | "vue-router": "^3.1.5", 31 | "vue-uuid": "^2.0.2", 32 | "vuescroll": "^4.17.3", 33 | "vuex": "^3.6.2", 34 | "whatwg-fetch": "^2.0.3" 35 | }, 36 | "devDependencies": { 37 | "@vue/cli-plugin-babel": "^4.2.0", 38 | "@vue/cli-plugin-router": "^4.2.0", 39 | "@vue/cli-service": "^4.2.0", 40 | "babel-plugin-component": "^1.1.1", 41 | "copy-webpack-plugin": "^5.1.1", 42 | "momnet": "^2.29.1", 43 | "postcss-cssnext": "^3.1.0", 44 | "postcss-import": "^11.0.0", 45 | "postcss-loader": "^2.0.8", 46 | "postcss-nested": "^3.0.0", 47 | "postcss-url": "^7.2.1", 48 | "string-random": "^0.1.3", 49 | "style-loader": "^1.1.3", 50 | "stylus": "^0.54.7", 51 | "stylus-loader": "^3.0.2", 52 | "vue-markdown-loader": "^2.4.1", 53 | "vue-template-compiler": "^2.6.11" 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /web/client/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /web/client/src/assets/css/let-ui.css: -------------------------------------------------------------------------------- 1 | .let-form { 2 | &__inline { 3 | .let-form-item { 4 | padding-left: 0 !important; 5 | margin-right: 32px; 6 | vertical-align: bottom; 7 | } 8 | 9 | .let-label__position_top { 10 | padding-right: 0; 11 | width: 100%; 12 | } 13 | } 14 | 15 | .let-input { 16 | width: 100%; 17 | } 18 | } 19 | 20 | .let_modal { 21 | position: fixed !important; 22 | } 23 | 24 | .let-loading { 25 | .loading-inner { 26 | background: rgba(0,0,0, 0.9); 27 | padding: 13px; 28 | } 29 | } 30 | 31 | .let-input_small { 32 | input { 33 | font-size: 12px; 34 | padding-left: 8px; 35 | padding-right: 8px; 36 | } 37 | } 38 | 39 | .let-select_small { 40 | .let-select__selection { 41 | padding-left: 8px; 42 | } 43 | 44 | .let-select__text_single { 45 | margin-left: 0; 46 | } 47 | 48 | .let-select__option { 49 | padding-left: 8px; 50 | padding-right: 8px; 51 | } 52 | } 53 | 54 | .let-select_disabled .let-icon-clear { 55 | z-index: -1; 56 | pointer-events: none; 57 | } 58 | .let-radio + .let-radio { 59 | margin-left: 12px; 60 | } 61 | 62 | .let-date-picker { 63 | width: 100%; 64 | } 65 | 66 | 67 | .let-table { 68 | th, 69 | td { 70 | &:last-child.right { 71 | padding-right: 15px; 72 | } 73 | } 74 | 75 | tr th .sortContainer { 76 | position: relative; 77 | 78 | .let-icon-caret-down { 79 | left: 0; 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /web/client/src/assets/css/variable.css: -------------------------------------------------------------------------------- 1 | :root { 2 | /*reset*/ 3 | --color-base: #565B66; 4 | --font-base: Lato, PingFangSC-Regular, HelveticaNeue-Light, 'Helvetica Neue Light', 'Microsoft YaHei', sans-serif; 5 | 6 | --placeholder: #ccc; 7 | --scrollbars-size: 6px; 8 | --scrollbars-bg: #ccc; 9 | --scrollbar-thumb-bg: #999; 10 | --scrollbar-thumb-border-radius: 3px; 11 | /*reset end*/ 12 | 13 | --main-width: 1440px; 14 | 15 | --border-color: #EBECEE; 16 | --gap-small: 24px; 17 | --gap-normal: 32px; 18 | --gap-big: 40px; 19 | 20 | --active-color: #49CC8F; 21 | --off-color: #E0543F; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /web/client/src/assets/icon/default.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/client/src/assets/icon/icon_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/icon/icon_active.png -------------------------------------------------------------------------------- /web/client/src/assets/icon/icon_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/icon/icon_inactive.png -------------------------------------------------------------------------------- /web/client/src/assets/icon/spinner.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/client/src/assets/icon/zoom-in.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /web/client/src/assets/img/cache-g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/img/cache-g.png -------------------------------------------------------------------------------- /web/client/src/assets/img/cache-l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/img/cache-l.png -------------------------------------------------------------------------------- /web/client/src/assets/img/create-g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/img/create-g.png -------------------------------------------------------------------------------- /web/client/src/assets/img/create-l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/img/create-l.png -------------------------------------------------------------------------------- /web/client/src/assets/img/dcache-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/img/dcache-logo.png -------------------------------------------------------------------------------- /web/client/src/assets/img/focus-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/img/focus-bg.png -------------------------------------------------------------------------------- /web/client/src/assets/img/opa-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/img/opa-icon.png -------------------------------------------------------------------------------- /web/client/src/assets/img/operator-g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/img/operator-g.png -------------------------------------------------------------------------------- /web/client/src/assets/img/operator-l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/img/operator-l.png -------------------------------------------------------------------------------- /web/client/src/assets/img/package-g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/img/package-g.png -------------------------------------------------------------------------------- /web/client/src/assets/img/package-l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/img/package-l.png -------------------------------------------------------------------------------- /web/client/src/assets/img/package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/img/package.png -------------------------------------------------------------------------------- /web/client/src/assets/img/server-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/img/server-icon.png -------------------------------------------------------------------------------- /web/client/src/assets/img/tars-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/img/tars-logo.png -------------------------------------------------------------------------------- /web/client/src/assets/img/tree-icon-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/img/tree-icon-2.png -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/alert.css: -------------------------------------------------------------------------------- 1 | .el-alert{width:100%;padding:8px 16px;margin:0;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:4px;position:relative;background-color:#FFF;overflow:hidden;opacity:1;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-transition:opacity .2s;transition:opacity .2s}.el-alert.is-light .el-alert__closebtn{color:#C0C4CC}.el-alert.is-dark .el-alert__closebtn,.el-alert.is-dark .el-alert__description{color:#FFF}.el-alert.is-center{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.el-alert--success.is-light{background-color:#f0f9eb;color:#67C23A}.el-alert--success.is-light .el-alert__description{color:#67C23A}.el-alert--success.is-dark{background-color:#67C23A;color:#FFF}.el-alert--info.is-light{background-color:#f4f4f5;color:#909399}.el-alert--info.is-dark{background-color:#909399;color:#FFF}.el-alert--info .el-alert__description{color:#909399}.el-alert--warning.is-light{background-color:#fdf6ec;color:#E6A23C}.el-alert--warning.is-light .el-alert__description{color:#E6A23C}.el-alert--warning.is-dark{background-color:#E6A23C;color:#FFF}.el-alert--error.is-light{background-color:#fef0f0;color:#F56C6C}.el-alert--error.is-light .el-alert__description{color:#F56C6C}.el-alert--error.is-dark{background-color:#F56C6C;color:#FFF}.el-alert__content{display:table-cell;padding:0 8px}.el-alert__icon{font-size:16px;width:16px}.el-alert__icon.is-big{font-size:28px;width:28px}.el-alert__title{font-size:13px;line-height:18px}.el-alert__title.is-bold{font-weight:700}.el-alert .el-alert__description{font-size:12px;margin:5px 0 0}.el-alert__closebtn{font-size:12px;opacity:1;position:absolute;top:12px;right:15px;cursor:pointer}.el-alert__closebtn.is-customed{font-style:normal;font-size:13px;top:9px}.el-alert-fade-enter,.el-alert-fade-leave-active{opacity:0} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/aside.css: -------------------------------------------------------------------------------- 1 | .el-aside{overflow:auto;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-negative:0;flex-shrink:0} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/avatar.css: -------------------------------------------------------------------------------- 1 | .el-avatar{display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box;text-align:center;overflow:hidden;color:#fff;background:#C0C4CC;width:40px;height:40px;line-height:40px;font-size:14px}.el-avatar>img{display:block;height:100%;vertical-align:middle}.el-avatar--circle{border-radius:50%}.el-avatar--square{border-radius:4px}.el-avatar--icon{font-size:18px}.el-avatar--large{width:40px;height:40px;line-height:40px}.el-avatar--medium{width:36px;height:36px;line-height:36px}.el-avatar--small{width:28px;height:28px;line-height:28px} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/backtop.css: -------------------------------------------------------------------------------- 1 | .el-backtop{position:fixed;background-color:#FFF;width:40px;height:40px;border-radius:50%;color:#3F5AE0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;font-size:20px;-webkit-box-shadow:0 0 6px rgba(0,0,0,.12);box-shadow:0 0 6px rgba(0,0,0,.12);cursor:pointer;z-index:5}.el-backtop:hover{background-color:#F2F6FC} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/badge.css: -------------------------------------------------------------------------------- 1 | .el-badge{position:relative;vertical-align:middle;display:inline-block}.el-badge__content{background-color:#F56C6C;border-radius:10px;color:#FFF;display:inline-block;font-size:12px;height:18px;line-height:18px;padding:0 6px;text-align:center;white-space:nowrap;border:1px solid #FFF}.el-badge__content.is-fixed{position:absolute;top:0;right:10px;-webkit-transform:translateY(-50%) translateX(100%);transform:translateY(-50%) translateX(100%)}.el-badge__content.is-fixed.is-dot{right:5px}.el-badge__content.is-dot{height:8px;width:8px;padding:0;right:0;border-radius:50%}.el-badge__content--primary{background-color:#3F5AE0}.el-badge__content--success{background-color:#67C23A}.el-badge__content--warning{background-color:#E6A23C}.el-badge__content--info{background-color:#909399}.el-badge__content--danger{background-color:#F56C6C} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/breadcrumb-item.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/theme/element-to-let/breadcrumb-item.css -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/breadcrumb.css: -------------------------------------------------------------------------------- 1 | .el-breadcrumb{font-size:14px;line-height:1}.el-breadcrumb::after,.el-breadcrumb::before{display:table;content:""}.el-breadcrumb::after{clear:both}.el-breadcrumb__separator{margin:0 9px;font-weight:700;color:#C0C4CC}.el-breadcrumb__separator[class*=icon]{margin:0 6px;font-weight:400}.el-breadcrumb__item{float:left}.el-breadcrumb__inner{color:#606266}.el-breadcrumb__inner a,.el-breadcrumb__inner.is-link{font-weight:700;text-decoration:none;-webkit-transition:color .2s cubic-bezier(.645,.045,.355,1);transition:color .2s cubic-bezier(.645,.045,.355,1);color:#303133}.el-breadcrumb__inner a:hover,.el-breadcrumb__inner.is-link:hover{color:#3F5AE0;cursor:pointer}.el-breadcrumb__item:last-child .el-breadcrumb__inner,.el-breadcrumb__item:last-child .el-breadcrumb__inner a,.el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover,.el-breadcrumb__item:last-child .el-breadcrumb__inner:hover{font-weight:400;color:#606266;cursor:text}.el-breadcrumb__item:last-child .el-breadcrumb__separator{display:none} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/button-group.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/theme/element-to-let/button-group.css -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/card.css: -------------------------------------------------------------------------------- 1 | .el-card{border-radius:4px;border:1px solid #EBEEF5;background-color:#FFF;overflow:hidden;color:#303133;-webkit-transition:.3s;transition:.3s}.el-card.is-always-shadow,.el-card.is-hover-shadow:focus,.el-card.is-hover-shadow:hover{-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1)}.el-card__header{padding:18px 20px;border-bottom:1px solid #EBEEF5;-webkit-box-sizing:border-box;box-sizing:border-box}.el-card__body{padding:20px} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/carousel-item.css: -------------------------------------------------------------------------------- 1 | .el-carousel__item,.el-carousel__mask{position:absolute;height:100%;top:0;left:0}.el-carousel__item{width:100%;display:inline-block;overflow:hidden;z-index:0}.el-carousel__item.is-active{z-index:2}.el-carousel__item.is-animating{-webkit-transition:-webkit-transform .4s ease-in-out;transition:-webkit-transform .4s ease-in-out;transition:transform .4s ease-in-out;transition:transform .4s ease-in-out,-webkit-transform .4s ease-in-out}.el-carousel__item--card{width:50%;-webkit-transition:-webkit-transform .4s ease-in-out;transition:-webkit-transform .4s ease-in-out;transition:transform .4s ease-in-out;transition:transform .4s ease-in-out,-webkit-transform .4s ease-in-out}.el-carousel__item--card.is-in-stage{cursor:pointer;z-index:1}.el-carousel__item--card.is-in-stage.is-hover .el-carousel__mask,.el-carousel__item--card.is-in-stage:hover .el-carousel__mask{opacity:.12}.el-carousel__item--card.is-active{z-index:2}.el-carousel__mask{width:100%;background-color:#FFF;opacity:.24;-webkit-transition:.2s;transition:.2s} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/checkbox-button.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/theme/element-to-let/checkbox-button.css -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/checkbox-group.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/theme/element-to-let/checkbox-group.css -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/collapse-item.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/theme/element-to-let/collapse-item.css -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/container.css: -------------------------------------------------------------------------------- 1 | .el-container{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-flex:1;-ms-flex:1;flex:1;-ms-flex-preferred-size:auto;flex-basis:auto;-webkit-box-sizing:border-box;box-sizing:border-box;min-width:0}.el-container.is-vertical{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/display.css: -------------------------------------------------------------------------------- 1 | @media only screen and (max-width:767px){.hidden-xs-only{display:none!important}}@media only screen and (min-width:768px){.hidden-sm-and-up{display:none!important}}@media only screen and (min-width:768px) and (max-width:991px){.hidden-sm-only{display:none!important}}@media only screen and (max-width:991px){.hidden-sm-and-down{display:none!important}}@media only screen and (min-width:992px){.hidden-md-and-up{display:none!important}}@media only screen and (min-width:992px) and (max-width:1199px){.hidden-md-only{display:none!important}}@media only screen and (max-width:1199px){.hidden-md-and-down{display:none!important}}@media only screen and (min-width:1200px){.hidden-lg-and-up{display:none!important}}@media only screen and (min-width:1200px) and (max-width:1919px){.hidden-lg-only{display:none!important}}@media only screen and (max-width:1919px){.hidden-lg-and-down{display:none!important}}@media only screen and (min-width:1920px){.hidden-xl-only{display:none!important}} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/divider.css: -------------------------------------------------------------------------------- 1 | .el-divider{background-color:#DCDFE6;position:relative}.el-divider--horizontal{display:block;height:1px;width:100%;margin:24px 0}.el-divider--vertical{display:inline-block;width:1px;height:1em;margin:0 8px;vertical-align:middle;position:relative}.el-divider__text{position:absolute;background-color:#FFF;padding:0 20px;font-weight:500;color:#303133;font-size:14px}.el-divider__text.is-left{left:20px;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.el-divider__text.is-center{left:50%;-webkit-transform:translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%)}.el-divider__text.is-right{right:20px;-webkit-transform:translateY(-50%);transform:translateY(-50%)} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/dropdown-item.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/theme/element-to-let/dropdown-item.css -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/dropdown-menu.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/theme/element-to-let/dropdown-menu.css -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/fonts/element-icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/theme/element-to-let/fonts/element-icons.ttf -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/fonts/element-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/theme/element-to-let/fonts/element-icons.woff -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/footer.css: -------------------------------------------------------------------------------- 1 | .el-footer{padding:0 20px;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-negative:0;flex-shrink:0} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/form-item.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/theme/element-to-let/form-item.css -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/header.css: -------------------------------------------------------------------------------- 1 | .el-header{padding:0 20px;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-negative:0;flex-shrink:0} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/infinite-scroll.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/theme/element-to-let/infinite-scroll.css -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/infiniteScroll.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/theme/element-to-let/infiniteScroll.css -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/loading.css: -------------------------------------------------------------------------------- 1 | .el-loading-parent--relative{position:relative!important}.el-loading-parent--hidden{overflow:hidden!important}.el-loading-mask{position:absolute;z-index:2000;background-color:rgba(255,255,255,.9);margin:0;top:0;right:0;bottom:0;left:0;-webkit-transition:opacity .3s;transition:opacity .3s}.el-loading-mask.is-fullscreen{position:fixed}.el-loading-mask.is-fullscreen .el-loading-spinner{margin-top:-25px}.el-loading-mask.is-fullscreen .el-loading-spinner .circular{height:50px;width:50px}.el-loading-spinner{top:50%;margin-top:-21px;width:100%;text-align:center;position:absolute}.el-loading-spinner .el-loading-text{color:#3F5AE0;margin:3px 0;font-size:14px}.el-loading-spinner .circular{height:42px;width:42px;-webkit-animation:loading-rotate 2s linear infinite;animation:loading-rotate 2s linear infinite}.el-loading-spinner .path{-webkit-animation:loading-dash 1.5s ease-in-out infinite;animation:loading-dash 1.5s ease-in-out infinite;stroke-dasharray:90,150;stroke-dashoffset:0;stroke-width:2;stroke:#3F5AE0;stroke-linecap:round}.el-loading-spinner i{color:#3F5AE0}.el-loading-fade-enter,.el-loading-fade-leave-active{opacity:0}@-webkit-keyframes loading-rotate{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes loading-rotate{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}100%{stroke-dasharray:90,150;stroke-dashoffset:-120px}}@keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}100%{stroke-dasharray:90,150;stroke-dashoffset:-120px}} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/main.css: -------------------------------------------------------------------------------- 1 | .el-main{display:block;-webkit-box-flex:1;-ms-flex:1;flex:1;-ms-flex-preferred-size:auto;flex-basis:auto;overflow:auto;-webkit-box-sizing:border-box;box-sizing:border-box;padding:20px} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/menu-item-group.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/theme/element-to-let/menu-item-group.css -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/menu-item.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/theme/element-to-let/menu-item.css -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/notification.css: -------------------------------------------------------------------------------- 1 | .el-notification{display:-webkit-box;display:-ms-flexbox;display:flex;width:330px;padding:14px 26px 14px 13px;border-radius:8px;-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid #EBEEF5;position:fixed;background-color:#FFF;-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1);-webkit-transition:opacity .3s,left .3s,right .3s,top .4s,bottom .3s,-webkit-transform .3s;transition:opacity .3s,left .3s,right .3s,top .4s,bottom .3s,-webkit-transform .3s;transition:opacity .3s,transform .3s,left .3s,right .3s,top .4s,bottom .3s;transition:opacity .3s,transform .3s,left .3s,right .3s,top .4s,bottom .3s,-webkit-transform .3s;overflow:hidden}.el-notification.right{right:16px}.el-notification.left{left:16px}.el-notification__group{margin-left:13px;margin-right:8px}.el-notification__title{font-weight:700;font-size:16px;color:#303133;margin:0}.el-notification__content{font-size:14px;line-height:21px;margin:6px 0 0;color:#606266;text-align:justify}.el-notification__content p{margin:0}.el-notification__icon{height:24px;width:24px;font-size:24px}.el-notification__closeBtn{position:absolute;top:18px;right:15px;cursor:pointer;color:#909399;font-size:16px}.el-notification__closeBtn:hover{color:#606266}.el-notification .el-icon-success{color:#67C23A}.el-notification .el-icon-error{color:#F56C6C}.el-notification .el-icon-info{color:#909399}.el-notification .el-icon-warning{color:#E6A23C}.el-notification-fade-enter.right{right:0;-webkit-transform:translateX(100%);transform:translateX(100%)}.el-notification-fade-enter.left{left:0;-webkit-transform:translateX(-100%);transform:translateX(-100%)}.el-notification-fade-leave-active{opacity:0} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/option-group.css: -------------------------------------------------------------------------------- 1 | .el-select-group{margin:0;padding:0}.el-select-group__wrap{position:relative;list-style:none;margin:0;padding:0}.el-select-group__wrap:not(:last-of-type){padding-bottom:24px}.el-select-group__wrap:not(:last-of-type)::after{content:'';position:absolute;display:block;left:20px;right:20px;bottom:12px;height:1px;background:#E4E7ED}.el-select-group__title{padding-left:20px;font-size:12px;color:#909399;line-height:30px}.el-select-group .el-select-dropdown__item{padding-left:20px} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/option.css: -------------------------------------------------------------------------------- 1 | .el-select-dropdown__item{font-size:14px;padding:0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#606266;height:34px;line-height:34px;-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer}.el-select-dropdown__item.is-disabled{color:#C0C4CC;cursor:not-allowed}.el-select-dropdown__item.is-disabled:hover{background-color:#FFF}.el-select-dropdown__item.hover,.el-select-dropdown__item:hover{background-color:#F5F7FA}.el-select-dropdown__item.selected{color:#3F5AE0;font-weight:700} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/page-header.css: -------------------------------------------------------------------------------- 1 | .el-page-header{display:-webkit-box;display:-ms-flexbox;display:flex;line-height:24px}.el-page-header__left{display:-webkit-box;display:-ms-flexbox;display:flex;cursor:pointer;margin-right:40px;position:relative}.el-page-header__left::after{content:"";position:absolute;width:1px;height:16px;right:-20px;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);background-color:#DCDFE6}.el-page-header__left .el-icon-back{font-size:18px;margin-right:6px;-ms-flex-item-align:center;align-self:center}.el-page-header__title{font-size:14px;font-weight:500}.el-page-header__content{font-size:18px;color:#303133} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/popconfirm.css: -------------------------------------------------------------------------------- 1 | .el-popconfirm__main{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.el-popconfirm__icon{margin-right:5px}.el-popconfirm__action{text-align:right;margin:0} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/popper.css: -------------------------------------------------------------------------------- 1 | .el-popper .popper__arrow,.el-popper .popper__arrow::after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.el-popper .popper__arrow{border-width:6px;-webkit-filter:drop-shadow(0 2px 12px rgba(0, 0, 0, .03));filter:drop-shadow(0 2px 12px rgba(0, 0, 0, .03))}.el-popper .popper__arrow::after{content:" ";border-width:6px}.el-popper[x-placement^=top]{margin-bottom:12px}.el-popper[x-placement^=top] .popper__arrow{bottom:-6px;left:50%;margin-right:3px;border-top-color:#EBEEF5;border-bottom-width:0}.el-popper[x-placement^=top] .popper__arrow::after{bottom:1px;margin-left:-6px;border-top-color:#FFF;border-bottom-width:0}.el-popper[x-placement^=bottom]{margin-top:12px}.el-popper[x-placement^=bottom] .popper__arrow{top:-6px;left:50%;margin-right:3px;border-top-width:0;border-bottom-color:#EBEEF5}.el-popper[x-placement^=bottom] .popper__arrow::after{top:1px;margin-left:-6px;border-top-width:0;border-bottom-color:#FFF}.el-popper[x-placement^=right]{margin-left:12px}.el-popper[x-placement^=right] .popper__arrow{top:50%;left:-6px;margin-bottom:3px;border-right-color:#EBEEF5;border-left-width:0}.el-popper[x-placement^=right] .popper__arrow::after{bottom:-6px;left:1px;border-right-color:#FFF;border-left-width:0}.el-popper[x-placement^=left]{margin-right:12px}.el-popper[x-placement^=left] .popper__arrow{top:50%;right:-6px;margin-bottom:3px;border-right-width:0;border-left-color:#EBEEF5}.el-popper[x-placement^=left] .popper__arrow::after{right:1px;bottom:-6px;margin-left:-6px;border-right-width:0;border-left-color:#FFF} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/radio-group.css: -------------------------------------------------------------------------------- 1 | .el-radio-group{display:inline-block;line-height:1;vertical-align:middle;font-size:0} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/rate.css: -------------------------------------------------------------------------------- 1 | .el-rate__icon,.el-rate__item{position:relative;display:inline-block}.el-rate{height:20px;line-height:1}.el-rate:active,.el-rate:focus{outline-width:0}.el-rate__item{font-size:0;vertical-align:middle}.el-rate__icon{font-size:18px;margin-right:6px;color:#C0C4CC;-webkit-transition:.3s;transition:.3s}.el-rate__decimal,.el-rate__icon .path2{position:absolute;top:0;left:0}.el-rate__icon.hover{-webkit-transform:scale(1.15);transform:scale(1.15)}.el-rate__decimal{display:inline-block;overflow:hidden}.el-rate__text{font-size:14px;vertical-align:middle} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/reset.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8";body{font-family:"Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;font-weight:400;font-size:14px;color:#000;-webkit-font-smoothing:antialiased}a{color:#3F5AE0;text-decoration:none}a:focus,a:hover{color:rgb(101, 123, 230)}a:active{color:rgb(57, 81, 202)}h1,h2,h3,h4,h5,h6{color:#606266;font-weight:inherit}h1:first-child,h2:first-child,h3:first-child,h4:first-child,h5:first-child,h6:first-child,p:first-child{margin-top:0}h1:last-child,h2:last-child,h3:last-child,h4:last-child,h5:last-child,h6:last-child,p:last-child{margin-bottom:0}h1{font-size:20px}h2{font-size:18px}h3{font-size:16px}h4,h5,h6,p{font-size:inherit}p{line-height:1.8}sub,sup{font-size:13px}small{font-size:12px}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/row.css: -------------------------------------------------------------------------------- 1 | .el-row{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box}.el-row::after,.el-row::before{display:table;content:""}.el-row::after{clear:both}.el-row--flex{display:-webkit-box;display:-ms-flexbox;display:flex}.el-row--flex:after,.el-row--flex:before{display:none}.el-row--flex.is-justify-center{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.el-row--flex.is-justify-end{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.el-row--flex.is-justify-space-between{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.el-row--flex.is-justify-space-around{-ms-flex-pack:distribute;justify-content:space-around}.el-row--flex.is-align-middle{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.el-row--flex.is-align-bottom{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/scrollbar.css: -------------------------------------------------------------------------------- 1 | .el-scrollbar{overflow:hidden;position:relative}.el-scrollbar:active>.el-scrollbar__bar,.el-scrollbar:focus>.el-scrollbar__bar,.el-scrollbar:hover>.el-scrollbar__bar{opacity:1;-webkit-transition:opacity 340ms ease-out;transition:opacity 340ms ease-out}.el-scrollbar__wrap{overflow:scroll;height:100%}.el-scrollbar__wrap--hidden-default{scrollbar-width:none}.el-scrollbar__wrap--hidden-default::-webkit-scrollbar{width:0;height:0}.el-scrollbar__thumb{position:relative;display:block;width:0;height:0;cursor:pointer;border-radius:inherit;background-color:rgba(144,147,153,.3);-webkit-transition:.3s background-color;transition:.3s background-color}.el-scrollbar__thumb:hover{background-color:rgba(144,147,153,.5)}.el-scrollbar__bar{position:absolute;right:2px;bottom:2px;z-index:1;border-radius:4px;opacity:0;-webkit-transition:opacity 120ms ease-out;transition:opacity 120ms ease-out}.el-scrollbar__bar.is-vertical{width:6px;top:2px}.el-scrollbar__bar.is-vertical>div{width:100%}.el-scrollbar__bar.is-horizontal{height:6px;left:2px}.el-scrollbar__bar.is-horizontal>div{height:100%} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/spinner.css: -------------------------------------------------------------------------------- 1 | .el-time-spinner{width:100%;white-space:nowrap}.el-spinner{display:inline-block;vertical-align:middle}.el-spinner-inner{-webkit-animation:rotate 2s linear infinite;animation:rotate 2s linear infinite;width:50px;height:50px}.el-spinner-inner .path{stroke:#ececec;stroke-linecap:round;-webkit-animation:dash 1.5s ease-in-out infinite;animation:dash 1.5s ease-in-out infinite}@-webkit-keyframes rotate{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/steps.css: -------------------------------------------------------------------------------- 1 | .el-steps{display:-webkit-box;display:-ms-flexbox;display:flex}.el-steps--simple{padding:13px 8%;border-radius:4px;background:#F5F7FA}.el-steps--horizontal{white-space:nowrap}.el-steps--vertical{height:100%;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-flow:column;flex-flow:column} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/submenu.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/theme/element-to-let/submenu.css -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/switch.css: -------------------------------------------------------------------------------- 1 | .el-switch{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;position:relative;font-size:14px;line-height:20px;height:20px;vertical-align:middle}.el-switch.is-disabled .el-switch__core,.el-switch.is-disabled .el-switch__label{cursor:not-allowed}.el-switch__core,.el-switch__label{display:inline-block;cursor:pointer;vertical-align:middle}.el-switch__label{-webkit-transition:.2s;transition:.2s;height:20px;font-size:14px;font-weight:500;color:#303133}.el-switch__label.is-active{color:#3F5AE0}.el-switch__label--left{margin-right:10px}.el-switch__label--right{margin-left:10px}.el-switch__label *{line-height:1;font-size:14px;display:inline-block}.el-switch__input{position:absolute;width:0;height:0;opacity:0;margin:0}.el-switch__core{margin:0;position:relative;width:40px;height:20px;border:1px solid #DCDFE6;outline:0;border-radius:10px;-webkit-box-sizing:border-box;box-sizing:border-box;background:#DCDFE6;-webkit-transition:border-color .3s,background-color .3s;transition:border-color .3s,background-color .3s}.el-switch__core:after{content:"";position:absolute;top:1px;left:1px;border-radius:100%;-webkit-transition:all .3s;transition:all .3s;width:16px;height:16px;background-color:#FFF}.el-switch.is-checked .el-switch__core{border-color:#3F5AE0;background-color:#3F5AE0}.el-switch.is-checked .el-switch__core::after{left:100%;margin-left:-17px}.el-switch.is-disabled{opacity:.6}.el-switch--wide .el-switch__label.el-switch__label--left span{left:10px}.el-switch--wide .el-switch__label.el-switch__label--right span{right:10px}.el-switch .label-fade-enter,.el-switch .label-fade-leave-active{opacity:0} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/tab-pane.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/src/assets/theme/element-to-let/tab-pane.css -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/timeline-item.css: -------------------------------------------------------------------------------- 1 | .el-timeline-item{position:relative;padding-bottom:20px}.el-timeline-item__wrapper{position:relative;padding-left:28px;top:-3px}.el-timeline-item__tail{position:absolute;left:4px;height:100%;border-left:2px solid #E4E7ED}.el-timeline-item__icon{color:#FFF;font-size:13px}.el-timeline-item__node{position:absolute;background-color:#E4E7ED;border-radius:50%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.el-timeline-item__node--normal{left:-1px;width:12px;height:12px}.el-timeline-item__node--large{left:-2px;width:14px;height:14px}.el-timeline-item__node--primary{background-color:#3F5AE0}.el-timeline-item__node--success{background-color:#67C23A}.el-timeline-item__node--warning{background-color:#E6A23C}.el-timeline-item__node--danger{background-color:#F56C6C}.el-timeline-item__node--info{background-color:#909399}.el-timeline-item__dot{position:absolute;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.el-timeline-item__content{color:#303133}.el-timeline-item__timestamp{color:#909399;line-height:1;font-size:13px}.el-timeline-item__timestamp.is-top{margin-bottom:8px;padding-top:4px}.el-timeline-item__timestamp.is-bottom{margin-top:8px} -------------------------------------------------------------------------------- /web/client/src/assets/theme/element-to-let/timeline.css: -------------------------------------------------------------------------------- 1 | .el-timeline{margin:0;font-size:14px;list-style:none}.el-timeline .el-timeline-item:last-child .el-timeline-item__tail{display:none} -------------------------------------------------------------------------------- /web/client/src/components/app/dcache-header.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 50 | 51 | 77 | -------------------------------------------------------------------------------- /web/client/src/components/icon.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 18 | 19 | 27 | -------------------------------------------------------------------------------- /web/client/src/components/section-wrappper.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 15 | -------------------------------------------------------------------------------- /web/client/src/components/tars-form-item.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 19 | 20 | 29 | -------------------------------------------------------------------------------- /web/client/src/dcache/dcache/operationManage/index.vue: -------------------------------------------------------------------------------- 1 | 13 | 33 | 58 | 59 | -------------------------------------------------------------------------------- /web/client/src/dcache/dcacheOperation/apply/index.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 50 | 51 | 58 | -------------------------------------------------------------------------------- /web/client/src/dcache/dcacheOperation/index.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 23 | 24 | 47 | -------------------------------------------------------------------------------- /web/client/src/dcache/dcacheOperation/module/index.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 54 | 55 | 62 | -------------------------------------------------------------------------------- /web/client/src/dcache/releasePackage/index.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 24 | 25 | 35 | -------------------------------------------------------------------------------- /web/client/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | import Vue from 'vue'; 18 | import VueCookie from 'vue-cookie'; 19 | 20 | import ElementUI from 'element-ui'; 21 | import "./assets/theme/element-to-let/index.css" 22 | 23 | import './plugins/ui'; 24 | import './plugins/ajax'; 25 | import './plugins/tars'; 26 | import './plugins/common'; 27 | 28 | import indexApp from './indexApp'; 29 | import router from './router'; 30 | import { 31 | i18n, 32 | loadLang 33 | } from './locale/i18n' 34 | 35 | Vue.config.productionTip = false; 36 | 37 | 38 | /* eslint-disable no-new */ 39 | loadLang.call(this).then(() => { 40 | 41 | Vue.use(ElementUI, { 42 | i18n: (key, value) => i18n.t(key, value) 43 | }); 44 | 45 | Vue.use(VueCookie); 46 | 47 | new Vue({ 48 | i18n: i18n, 49 | el: '#app', 50 | router, 51 | components: { 52 | indexApp 53 | }, 54 | template: '' 55 | }); 56 | }) -------------------------------------------------------------------------------- /web/client/src/lib/axios.js: -------------------------------------------------------------------------------- 1 | import Axios from 'axios' 2 | import qs from 'qs' 3 | 4 | const axios = Axios.create({ 5 | baseURL: '/plugins/dcache/server/api', 6 | timeout: 25000, 7 | // headers: { 'content-type': 'application/json;charset=UTF-8' }, 8 | transformRequest: [function (data, headers) { 9 | 10 | // 上传数据不序列化 11 | if (headers['Content-Type'] === 'multipart/form-data') { 12 | return data 13 | } 14 | if (headers['Content-Type'] === 'application/json') { 15 | return JSON.stringify(data) 16 | } 17 | return qs.stringify(data); 18 | }] 19 | }); 20 | 21 | axios.interceptors.request.use((config) => { 22 | 23 | return config 24 | }, err => { 25 | 26 | throw new Error(err) 27 | }); 28 | 29 | axios.interceptors.response.use((response) => { 30 | let { 31 | data 32 | } = response; 33 | 34 | if (data.ret_code === 200) { 35 | return data.data; 36 | } else { 37 | throw new Error(data.err_msg) 38 | } 39 | 40 | }, err => { 41 | 42 | throw new Error(err) 43 | }); 44 | 45 | export default axios -------------------------------------------------------------------------------- /web/client/src/plugins/ajax.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | import 'whatwg-fetch'; 18 | import Vue from 'vue'; 19 | 20 | import AjaxUtil from '@/lib/ajax'; 21 | 22 | let Ajax = new AjaxUtil(); 23 | 24 | Ajax.ServerUrl.set('/plugins/dcache'); 25 | 26 | Ajax.ResultHandler.set((result) => { 27 | 28 | if (result && result.ret_code === 200 && result.data != null) { 29 | return true; 30 | } 31 | return false; 32 | }); 33 | 34 | ['getJSON', 'postJSON'].forEach((method) => { 35 | const originHandler = Ajax[method]; 36 | Ajax[`_${method}`] = originHandler; 37 | Ajax[method] = (...args) => originHandler.call(null, ...args).then(res => res.data); 38 | }); 39 | 40 | Object.defineProperty(Vue.prototype, '$ajax', { 41 | get() { 42 | Ajax.Headers.set("X-Token", window.localStorage.ticket || ''); 43 | return Ajax; 44 | }, 45 | }); 46 | 47 | export default Ajax; -------------------------------------------------------------------------------- /web/client/src/plugins/charts.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | import Vue from 'vue'; 18 | 19 | import 'echarts/lib/component/title'; 20 | import 'echarts/lib/component/dataZoom'; 21 | import VeLine from 'v-charts/lib/line'; 22 | 23 | Vue.component(VeLine.name, VeLine); 24 | -------------------------------------------------------------------------------- /web/client/src/plugins/tars.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | import 'whatwg-fetch'; 18 | import Vue from 'vue'; 19 | 20 | import AjaxUtil from '@/lib/ajax'; 21 | 22 | let Ajax = new AjaxUtil(); 23 | 24 | Ajax.ServerUrl.set('/pages'); 25 | Ajax.ResultHandler.set((result) => { 26 | 27 | if (result && result.ret_code === 200 && result.data != null) { 28 | return true; 29 | } 30 | return false; 31 | }); 32 | 33 | ['getJSON', 'postJSON'].forEach((method) => { 34 | const originHandler = Ajax[method]; 35 | Ajax[`_${method}`] = originHandler; 36 | Ajax[method] = (...args) => originHandler.call(null, ...args).then(res => res.data); 37 | }); 38 | 39 | Object.defineProperty(Vue.prototype, '$tars', { 40 | get() { 41 | return Ajax; 42 | }, 43 | }); 44 | 45 | export default Ajax; -------------------------------------------------------------------------------- /web/client/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/client/static/favicon.ico -------------------------------------------------------------------------------- /web/client/vue.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path") 2 | const CopyWebpackPlugin = require('copy-webpack-plugin') 3 | const server_host = process.env.SERVER_HOST || '127.0.0.1' 4 | const server_port = process.env.SERVER_PORT || '16535' 5 | 6 | process.setMaxListeners(0); 7 | 8 | // require('events').EventEmitter.setMaxListeners(0); 9 | 10 | module.exports = { 11 | outputDir: "./dist", 12 | assetsDir: "./static", 13 | productionSourceMap: false, 14 | runtimeCompiler: true, 15 | publicPath: "/plugins/dcache", 16 | pages: { 17 | index: { 18 | entry: 'src/index.js', 19 | template: 'public/index.html', 20 | filename: 'index.html', 21 | title: "DCache", 22 | }, 23 | }, 24 | configureWebpack: { 25 | plugins: [new CopyWebpackPlugin([{ 26 | from: path.resolve(__dirname, './static'), 27 | to: path.resolve(__dirname, './dist/static'), 28 | ignore: ['.*'] 29 | }])] 30 | }, 31 | devServer: { 32 | //是否自动在浏览器中打开 33 | disableHostCheck: true, 34 | open: true, 35 | host: '0.0.0.0', 36 | //web-dev-server地址 37 | port: 8188, 38 | //ajax请求代理 39 | proxy: { 40 | "/plugins/*": { 41 | target: `http://${server_host}:${server_port}`, 42 | changeOrigin: false 43 | }, 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /web/dev.config.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | enableset=n 4 | setdivision=NULL 5 | 6 | app=Base 7 | server=TarsGatewayWeb 8 | localip=127.0.0.1 9 | local=tcp -h 127.0.0.1 -p 3032 -t 3000 10 | basepath=/usr/local/app/tars/tarsnode/data/Base.TarsGatewayWeb/bin/ 11 | datapath=/usr/local/app/tars/tarsnode/data/Base.TarsGatewayWeb/data/ 12 | logpath=/usr/local/app/tars/app_log/ 13 | logsize=10M 14 | config=tars.tarsconfig.ConfigObj 15 | notify=tars.tarsnotify.NotifyObj 16 | log=tars.tarslog.LogObj 17 | deactivating-timeout=3000 18 | logLevel=DEBUG 19 | 20 | allow 21 | endpoint=tcp -h 0.0.0.0 -p 21040 -t 60000 22 | maxconns=200000 23 | protocol=tars 24 | queuecap=10000 25 | queuetimeout=60000 26 | servant=Base.TarsGatewayWeb.WebObj 27 | threads=5 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /web/publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TARS_K8S_WEB_HOST="http://127.0.0.1:3000" 4 | TARS_K8S_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiJhZG1pbiIsImlhdCI6MTYzMjQ2MTg3NywiZXhwIjoxNzE4MDg0Mjc3fQ.2WqnAoNWS0qYXbSn_OuL18a59R4nkxrjwIeDjGii3QU" 5 | TARS_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiJhZG1pbiIsImlhdCI6MTY0NjcyMTcxOCwiZXhwIjoxNzM5MjU2MTE4fQ.k6m3q4J3bR48vlkig3-T4QJvgJOwUyrlEyMS39xk554" 6 | TARS_K8S_BASE_IMAGE="tarscloud/tars.nodejsbase" 7 | 8 | APP=Base 9 | 10 | TARGET=TarsBenchmarkWeb 11 | 12 | TARGET_PATH=tmp/${TARGET} 13 | 14 | mkdir -p tmp 15 | 16 | echo "mkdir -p ${TARGET_PATH}" 17 | mkdir -p ${TARGET_PATH} 18 | 19 | echo "rm old build & copy new build" 20 | rm -rf ${TARGET_PATH}/dist 21 | 22 | echo "copy package.json" 23 | cp package.json ${TARGET_PATH}/ 24 | cp -rf src ${TARGET_PATH}/ 25 | 26 | mkdir -p ${TARGET_PATH}/client 27 | 28 | cp -rf client/dist ${TARGET_PATH}/client 29 | 30 | cd ${TARGET_PATH} 31 | echo "npm install --omit=dev" 32 | npm install --omit=dev 33 | 34 | mkdir tars_nodejs 35 | 36 | cp -rf /Users/jarod/.nvm/versions/node/v16.13.0/lib/node_modules/@tars/node-agent tars_nodejs 37 | 38 | cd .. 39 | 40 | echo "tar czf ${TARGET}.tgz" 41 | tar czf ${TARGET}.tgz ${TARGET} 42 | 43 | # curl --progress-bar ${TARS_K8S_WEB_HOST}/pages/k8s/api/upload_and_publish?ticket=${TARS_K8S_TOKEN} -Fsuse=@${TARGET}.tgz -Fapplication=${APP} -Fmodule_name=${TARGET} -Fserver_type=nodejs -Fbase_image=${TARS_K8S_BASE_IMAGE} -Fcomment=upload 44 | curl --progress-bar ${TARS_K8S_WEB_HOST}/pages/server/api/upload_and_publish?ticket=${TARS_TOKEN} -Fsuse=@${TARGET}.tgz -Fapplication=${APP} -Fmodule_name=${TARGET} -Fcomment=upload 45 | 46 | echo "" 47 | 48 | cd .. -------------------------------------------------------------------------------- /web/src/common/rpc/getservant/lib/EndpointF.tars: -------------------------------------------------------------------------------- 1 | 2 | module tars 3 | { 4 | /** 5 | * 端口信息 6 | */ 7 | struct EndpointF 8 | { 9 | 0 require string host; 10 | 1 require int port; 11 | 2 require int timeout; 12 | 3 require int istcp; 13 | 5 optional int groupworkid; 14 | 6 optional int grouprealid; 15 | 7 optional string setId; 16 | 9 optional int bakFlag; 17 | }; 18 | key[EndpointF, host, port, timeout, istcp]; 19 | }; 20 | 21 | 22 | -------------------------------------------------------------------------------- /web/src/common/rpc/getservant/lib/config.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Tars config 读取 3 | */ 4 | 'use strict'; 5 | const ConfigParser = require('@tars/tars-utils').Config; 6 | let tarsConfigHelper = require("@tars/tars-config"); 7 | const fs = require("fs"); 8 | let config = {}; 9 | 10 | 11 | //在tars环境 会在全局变量里面存入 服务配置 CONFIG 与 tars框架配置 TARSCONFIG 本地环境 则直接读取传入的服务配置 12 | config.loadConfig = async function (config, configFormat) { 13 | if (process.env.TARS_CONFIG) { 14 | let tarsdata = fs.readFileSync(process.env.TARS_CONFIG, { encoding: 'utf-8' }); 15 | if (tarsdata) { 16 | tarsdata = parseConf(tarsdata, configFormat); 17 | global.TARSCONFIG = tarsdata; 18 | console.log(`TARSCONFIG ReadAnd Parse Sucesss!`); 19 | } 20 | ////////////////////////////////// 上面是解析TARS框架配置 下面是解析服务配置 21 | let helper = new tarsConfigHelper(); 22 | let data = await helper.loadConfig(config, configFormat); 23 | data = parseConf(data, configFormat); 24 | global.CONFIG = data; 25 | return data; 26 | } else { 27 | let data = fs.readFileSync(config, { encoding: 'utf-8' }); 28 | if (data) data = parseConf(data, configFormat); 29 | global.CONFIG = data; 30 | return data; 31 | } 32 | } 33 | function parseConf(content, configFormat) { 34 | let ret = content; 35 | if (configFormat === 'c') { 36 | let configParser = new ConfigParser(); 37 | configParser.parseText(content, 'utf8'); 38 | ret = configParser.data; 39 | } else if (configFormat == 'json') { 40 | ret = JSON.parse(content); 41 | } 42 | return ret; 43 | } 44 | 45 | module.exports = config; 46 | 47 | -------------------------------------------------------------------------------- /web/src/common/rpc/getservant/lib/create.sh: -------------------------------------------------------------------------------- 1 | /usr/local/tars/cpp/tools/tars2node --with-tars --client QueryF.tars 2 | /usr/local/tars/cpp/tools/tars2node --with-tars EndpointF.tars 3 | 4 | -------------------------------------------------------------------------------- /web/src/common/rpc/getservant/lib/getEndpoint.js: -------------------------------------------------------------------------------- 1 | const Tars = require("@tars/rpc"); 2 | const QueryEndpoint = require("./QueryFProxy").tars 3 | 4 | function EndpointManager(locator) { 5 | this.locator = locator; 6 | this.QueryEndpointPrx = Tars.client.stringToProxy(QueryEndpoint.QueryFProxy, this.locator); 7 | } 8 | 9 | EndpointManager.prototype.getQueryPrx = function () { 10 | return this.QueryEndpointPrx; 11 | } 12 | 13 | EndpointManager.prototype.getActiveEndpointFromLocator = async function (obj) { 14 | const self = this; 15 | let Res = await self.QueryEndpointPrx.findObjectById(obj).catch(err => { 16 | throw err; 17 | }); 18 | let endArr = Res.response.return.value; 19 | let ObjList = []; 20 | for (let v of endArr) { 21 | ObjList.push(`${obj}@${v.istcp?"tcp":"udp"} -h ${v.host} -p ${v.port}`); 22 | } 23 | return ObjList; 24 | } 25 | module.exports = EndpointManager; -------------------------------------------------------------------------------- /web/src/common/rpc/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | const client = require("@tars/rpc/protal.js").client; 18 | const AdminRegProxy = require("./proxy/AdminRegProxy"); 19 | const DCacheOptProxy = require("./proxy/DCacheOptProxy"); 20 | const { 21 | RPCClientPrx 22 | } = require('./service'); 23 | 24 | 25 | module.exports = { 26 | 27 | adminRegPrx: RPCClientPrx(client, AdminRegProxy, 'tars', 'AdminReg', 'tars.tarsAdminRegistry.AdminRegObj'), 28 | 29 | DCacheOptPrx: RPCClientPrx(client, DCacheOptProxy, 'DCache', 'DCacheOpt', 'DCache.DCacheOptServer.DCacheOptObj'), 30 | 31 | client: client, 32 | }; -------------------------------------------------------------------------------- /web/src/common/rpc/proxy/create.sh: -------------------------------------------------------------------------------- 1 | /usr/local/tars/cpp/tools/tars2node --with-tars --client AdminReg.tars 2 | 3 | -------------------------------------------------------------------------------- /web/src/common/rpc/struct.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | const AdminRegProxy = require("./proxy/AdminRegProxy"); 18 | const DCacheOptProxy = require("./proxy/DCacheOptProxy"); 19 | const { 20 | RPCStruct 21 | } = require('./service'); 22 | 23 | module.exports = { 24 | 25 | adminRegStruct: RPCStruct(AdminRegProxy, 'tars'), 26 | 27 | DCacheOptStruct: RPCStruct(DCacheOptProxy, 'DCache'), 28 | }; -------------------------------------------------------------------------------- /web/src/config/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "webConf": { 3 | "port": 6000, 4 | "alter": true 5 | }, 6 | "dbConf": { 7 | "host": "127.0.0.1", 8 | "port": "3306", 9 | "user": "tarsAdmin", 10 | "password": "Tars@2019", 11 | "database": "db_cache_web", 12 | "charset": "utf8", 13 | "pool": { 14 | "max": 10, 15 | "min": 0, 16 | "idle": 10000 17 | } 18 | }, 19 | "relationDb": { 20 | "host": "127.0.0.1", 21 | "port": "3306", 22 | "user": "tarsAdmin", 23 | "database": "db_dcache_relation", 24 | "password": "Tars@2019", 25 | "charset": "utf8", 26 | "pool": { 27 | "max": 10, 28 | "min": 0, 29 | "idle": 10000 30 | } 31 | }, 32 | "path": "/plugins/dcache" 33 | } -------------------------------------------------------------------------------- /web/src/dcache/db/db_cache_web_models/t_module_operation.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | /* jshint indent: 2 */ 17 | 18 | module.exports = function(sequelize, DataTypes) { 19 | return sequelize.define('t_module_operation', { 20 | id: { 21 | autoIncrement: true, 22 | type: DataTypes.INTEGER(11), 23 | allowNull: false, 24 | primaryKey: true 25 | }, 26 | type: { 27 | type: DataTypes.STRING(50), 28 | allowNull: false 29 | }, 30 | status: { 31 | type: DataTypes.STRING(50), 32 | allowNull: false 33 | }, 34 | appName: { 35 | type: DataTypes.STRING(128), 36 | allowNull: false 37 | }, 38 | moduleName: { 39 | type: DataTypes.STRING(128), 40 | defaultValue: DataTypes.NOW, 41 | }, 42 | cache_version: { 43 | type: DataTypes.INTEGER(4), 44 | allowNull: true, 45 | defaultValue: 0 46 | } 47 | }, { 48 | sequelize, 49 | tableName: 't_module_operation', 50 | timestamps: false 51 | }); 52 | }; -------------------------------------------------------------------------------- /web/src/dcache/db/db_cache_web_models/t_region.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | module.exports = function (sequelize, DataTypes) { 18 | return sequelize.define('t_region', { 19 | id: { 20 | type: DataTypes.INTEGER(11), 21 | allowNull: false, 22 | primaryKey: true, 23 | autoIncrement: true, 24 | }, 25 | region: { 26 | type: DataTypes.STRING(50), 27 | allowNull: false, 28 | unique: 'region', 29 | }, 30 | label: { 31 | type: DataTypes.STRING(50), 32 | allowNull: false, 33 | unique: 'label', 34 | }, 35 | }, { 36 | tableName: 't_region', 37 | timestamps: false, 38 | }); 39 | }; 40 | -------------------------------------------------------------------------------- /web/src/dcache/db/db_dcache_relation_models/t_config_appMod.js: -------------------------------------------------------------------------------- 1 | const Sequelize = require('sequelize'); 2 | module.exports = function(sequelize, DataTypes) { 3 | return sequelize.define('t_config_appMod', { 4 | id: { 5 | autoIncrement: true, 6 | type: DataTypes.INTEGER, 7 | allowNull: false, 8 | primaryKey: true 9 | }, 10 | appName: { 11 | type: DataTypes.STRING(128), 12 | allowNull: true 13 | }, 14 | moduleName: { 15 | type: DataTypes.STRING(128), 16 | allowNull: true 17 | }, 18 | cacheType: { 19 | type: DataTypes.STRING(16), 20 | allowNull: true 21 | } 22 | }, { 23 | sequelize, 24 | tableName: 't_config_appMod', 25 | timestamps: false, 26 | indexes: [ 27 | { 28 | name: "PRIMARY", 29 | unique: true, 30 | using: "BTREE", 31 | fields: [ 32 | { name: "id" }, 33 | ] 34 | }, 35 | { 36 | name: "app_module", 37 | unique: true, 38 | using: "BTREE", 39 | fields: [ 40 | { name: "appName" }, 41 | { name: "moduleName" }, 42 | ] 43 | }, 44 | ] 45 | }); 46 | }; 47 | -------------------------------------------------------------------------------- /web/src/dcache/db/db_dcache_relation_models/t_config_item.js: -------------------------------------------------------------------------------- 1 | const Sequelize = require('sequelize'); 2 | module.exports = function(sequelize, DataTypes) { 3 | return sequelize.define('t_config_item', { 4 | id: { 5 | autoIncrement: true, 6 | type: DataTypes.INTEGER, 7 | allowNull: false, 8 | primaryKey: true 9 | }, 10 | remark: { 11 | type: DataTypes.STRING(128), 12 | allowNull: true 13 | }, 14 | item: { 15 | type: DataTypes.STRING(128), 16 | allowNull: true 17 | }, 18 | path: { 19 | type: DataTypes.STRING(128), 20 | allowNull: true 21 | }, 22 | reload: { 23 | type: DataTypes.STRING(4), 24 | allowNull: true 25 | }, 26 | period: { 27 | type: DataTypes.STRING(4), 28 | allowNull: true, 29 | defaultValue: "U" 30 | } 31 | }, { 32 | sequelize, 33 | tableName: 't_config_item', 34 | timestamps: false, 35 | indexes: [ 36 | { 37 | name: "PRIMARY", 38 | unique: true, 39 | using: "BTREE", 40 | fields: [ 41 | { name: "id" }, 42 | ] 43 | }, 44 | { 45 | name: "item_path", 46 | unique: true, 47 | using: "BTREE", 48 | fields: [ 49 | { name: "item" }, 50 | { name: "path" }, 51 | ] 52 | }, 53 | ] 54 | }); 55 | }; 56 | -------------------------------------------------------------------------------- /web/src/dcache/db/db_dcache_relation_models/t_config_reference.js: -------------------------------------------------------------------------------- 1 | const Sequelize = require('sequelize'); 2 | module.exports = function(sequelize, DataTypes) { 3 | return sequelize.define('t_config_reference', { 4 | id: { 5 | autoIncrement: true, 6 | type: DataTypes.INTEGER, 7 | allowNull: false, 8 | primaryKey: true 9 | }, 10 | reference_id: { 11 | type: DataTypes.INTEGER, 12 | allowNull: true 13 | }, 14 | server_name: { 15 | type: DataTypes.STRING(128), 16 | allowNull: true 17 | }, 18 | host: { 19 | type: DataTypes.STRING(20), 20 | allowNull: true 21 | } 22 | }, { 23 | sequelize, 24 | tableName: 't_config_reference', 25 | timestamps: false, 26 | indexes: [ 27 | { 28 | name: "PRIMARY", 29 | unique: true, 30 | using: "BTREE", 31 | fields: [ 32 | { name: "id" }, 33 | ] 34 | }, 35 | { 36 | name: "reference_id", 37 | unique: true, 38 | using: "BTREE", 39 | fields: [ 40 | { name: "server_name" }, 41 | { name: "host" }, 42 | ] 43 | }, 44 | ] 45 | }); 46 | }; 47 | -------------------------------------------------------------------------------- /web/src/dcache/db/db_dcache_relation_models/t_dbaccess_app.js: -------------------------------------------------------------------------------- 1 | const Sequelize = require('sequelize'); 2 | module.exports = function(sequelize, DataTypes) { 3 | return sequelize.define('t_dbaccess_app', { 4 | id: { 5 | autoIncrement: true, 6 | type: DataTypes.INTEGER, 7 | allowNull: false, 8 | primaryKey: true 9 | }, 10 | dbaccess_name: { 11 | type: DataTypes.STRING(128), 12 | allowNull: false, 13 | defaultValue: "" 14 | }, 15 | app_name: { 16 | type: DataTypes.STRING(64), 17 | allowNull: false, 18 | defaultValue: "" 19 | } 20 | }, { 21 | sequelize, 22 | tableName: 't_dbaccess_app', 23 | timestamps: false, 24 | indexes: [ 25 | { 26 | name: "PRIMARY", 27 | unique: true, 28 | using: "BTREE", 29 | fields: [ 30 | { name: "id" }, 31 | ] 32 | }, 33 | { 34 | name: "ro_app", 35 | unique: true, 36 | using: "BTREE", 37 | fields: [ 38 | { name: "dbaccess_name" }, 39 | { name: "app_name" }, 40 | ] 41 | }, 42 | ] 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /web/src/dcache/db/db_dcache_relation_models/t_expand_status.js: -------------------------------------------------------------------------------- 1 | const Sequelize = require('sequelize'); 2 | module.exports = function(sequelize, DataTypes) { 3 | return sequelize.define('t_expand_status', { 4 | id: { 5 | autoIncrement: true, 6 | type: DataTypes.INTEGER, 7 | allowNull: false, 8 | primaryKey: true 9 | }, 10 | app_name: { 11 | type: DataTypes.STRING(50), 12 | allowNull: false 13 | }, 14 | module_name: { 15 | type: DataTypes.STRING(50), 16 | allowNull: false 17 | }, 18 | status: { 19 | type: DataTypes.TINYINT, 20 | allowNull: false 21 | }, 22 | router_transfer_id: { 23 | type: DataTypes.TEXT, 24 | allowNull: true 25 | }, 26 | auto_updatetime: { 27 | type: DataTypes.DATE, 28 | allowNull: false, 29 | defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP') 30 | }, 31 | type: { 32 | type: DataTypes.INTEGER, 33 | allowNull: true, 34 | defaultValue: 0 35 | }, 36 | expand_start_time: { 37 | type: DataTypes.STRING(32), 38 | allowNull: true 39 | }, 40 | modify_group_name: { 41 | type: DataTypes.TEXT, 42 | allowNull: true 43 | } 44 | }, { 45 | sequelize, 46 | tableName: 't_expand_status', 47 | timestamps: false, 48 | indexes: [ 49 | { 50 | name: "PRIMARY", 51 | unique: true, 52 | using: "BTREE", 53 | fields: [ 54 | { name: "id" }, 55 | ] 56 | }, 57 | ] 58 | }); 59 | }; 60 | -------------------------------------------------------------------------------- /web/src/dcache/db/db_dcache_relation_models/t_idc_map.js: -------------------------------------------------------------------------------- 1 | const Sequelize = require('sequelize'); 2 | module.exports = function(sequelize, DataTypes) { 3 | return sequelize.define('t_idc_map', { 4 | id: { 5 | autoIncrement: true, 6 | type: DataTypes.INTEGER, 7 | allowNull: false, 8 | primaryKey: true 9 | }, 10 | city: { 11 | type: DataTypes.STRING(255), 12 | allowNull: false, 13 | comment: "city name" 14 | }, 15 | idc: { 16 | type: DataTypes.STRING(32), 17 | allowNull: false, 18 | comment: "idc area" 19 | } 20 | }, { 21 | sequelize, 22 | tableName: 't_idc_map', 23 | timestamps: false, 24 | indexes: [ 25 | { 26 | name: "PRIMARY", 27 | unique: true, 28 | using: "BTREE", 29 | fields: [ 30 | { name: "id" }, 31 | ] 32 | }, 33 | ] 34 | }); 35 | }; 36 | -------------------------------------------------------------------------------- /web/src/dcache/db/db_dcache_relation_models/t_proxy_app.js: -------------------------------------------------------------------------------- 1 | const Sequelize = require('sequelize'); 2 | module.exports = function(sequelize, DataTypes) { 3 | return sequelize.define('t_proxy_app', { 4 | id: { 5 | autoIncrement: true, 6 | type: DataTypes.INTEGER, 7 | allowNull: false, 8 | primaryKey: true 9 | }, 10 | proxy_name: { 11 | type: DataTypes.STRING(128), 12 | allowNull: false, 13 | defaultValue: "" 14 | }, 15 | app_name: { 16 | type: DataTypes.STRING(128), 17 | allowNull: false, 18 | defaultValue: "" 19 | } 20 | }, { 21 | sequelize, 22 | tableName: 't_proxy_app', 23 | timestamps: false, 24 | indexes: [ 25 | { 26 | name: "PRIMARY", 27 | unique: true, 28 | using: "BTREE", 29 | fields: [ 30 | { name: "id" }, 31 | ] 32 | }, 33 | { 34 | name: "proxy_app", 35 | unique: true, 36 | using: "BTREE", 37 | fields: [ 38 | { name: "proxy_name" }, 39 | { name: "app_name" }, 40 | ] 41 | }, 42 | ] 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /web/src/dcache/db/db_dcache_relation_models/t_proxy_cache.js: -------------------------------------------------------------------------------- 1 | const Sequelize = require('sequelize'); 2 | module.exports = function(sequelize, DataTypes) { 3 | return sequelize.define('t_proxy_cache', { 4 | id: { 5 | autoIncrement: true, 6 | type: DataTypes.INTEGER, 7 | allowNull: false, 8 | primaryKey: true 9 | }, 10 | proxy_name: { 11 | type: DataTypes.STRING(128), 12 | allowNull: false, 13 | defaultValue: "" 14 | }, 15 | cache_name: { 16 | type: DataTypes.STRING(128), 17 | allowNull: false, 18 | defaultValue: "" 19 | }, 20 | modify_time: { 21 | type: DataTypes.DATE, 22 | allowNull: false, 23 | defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP') 24 | } 25 | }, { 26 | sequelize, 27 | tableName: 't_proxy_cache', 28 | timestamps: false, 29 | indexes: [ 30 | { 31 | name: "PRIMARY", 32 | unique: true, 33 | using: "BTREE", 34 | fields: [ 35 | { name: "id" }, 36 | ] 37 | }, 38 | { 39 | name: "proxy_cache", 40 | unique: true, 41 | using: "BTREE", 42 | fields: [ 43 | { name: "proxy_name" }, 44 | { name: "cache_name" }, 45 | ] 46 | }, 47 | ] 48 | }); 49 | }; 50 | -------------------------------------------------------------------------------- /web/src/dcache/db/db_dcache_relation_models/t_proxy_router.js: -------------------------------------------------------------------------------- 1 | const Sequelize = require('sequelize'); 2 | module.exports = function(sequelize, DataTypes) { 3 | return sequelize.define('t_proxy_router', { 4 | id: { 5 | autoIncrement: true, 6 | type: DataTypes.INTEGER, 7 | allowNull: false, 8 | primaryKey: true 9 | }, 10 | proxy_name: { 11 | type: DataTypes.STRING(128), 12 | allowNull: false, 13 | defaultValue: "" 14 | }, 15 | router_name: { 16 | type: DataTypes.STRING(128), 17 | allowNull: false, 18 | defaultValue: "" 19 | }, 20 | db_name: { 21 | type: DataTypes.STRING(64), 22 | allowNull: false, 23 | defaultValue: "" 24 | }, 25 | db_ip: { 26 | type: DataTypes.STRING(64), 27 | allowNull: false, 28 | defaultValue: "" 29 | }, 30 | modulename_list: { 31 | type: DataTypes.TEXT, 32 | allowNull: false 33 | }, 34 | modify_time: { 35 | type: DataTypes.DATE, 36 | allowNull: false, 37 | defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP') 38 | } 39 | }, { 40 | sequelize, 41 | tableName: 't_proxy_router', 42 | timestamps: false, 43 | indexes: [ 44 | { 45 | name: "PRIMARY", 46 | unique: true, 47 | using: "BTREE", 48 | fields: [ 49 | { name: "id" }, 50 | ] 51 | }, 52 | { 53 | name: "proxy_router", 54 | unique: true, 55 | using: "BTREE", 56 | fields: [ 57 | { name: "proxy_name" }, 58 | { name: "router_name" }, 59 | ] 60 | }, 61 | ] 62 | }); 63 | }; 64 | -------------------------------------------------------------------------------- /web/src/dcache/db/db_dcache_relation_models/t_router_app.js: -------------------------------------------------------------------------------- 1 | const Sequelize = require('sequelize'); 2 | module.exports = function(sequelize, DataTypes) { 3 | return sequelize.define('t_router_app', { 4 | id: { 5 | autoIncrement: true, 6 | type: DataTypes.INTEGER, 7 | allowNull: false, 8 | primaryKey: true 9 | }, 10 | router_name: { 11 | type: DataTypes.STRING(128), 12 | allowNull: false, 13 | defaultValue: "" 14 | }, 15 | app_name: { 16 | type: DataTypes.STRING(128), 17 | allowNull: false, 18 | defaultValue: "" 19 | }, 20 | host: { 21 | type: DataTypes.CHAR(50), 22 | allowNull: true 23 | }, 24 | port: { 25 | type: DataTypes.CHAR(10), 26 | allowNull: true 27 | }, 28 | user: { 29 | type: DataTypes.CHAR(50), 30 | allowNull: true 31 | }, 32 | password: { 33 | type: DataTypes.CHAR(50), 34 | allowNull: true 35 | }, 36 | charset: { 37 | type: DataTypes.CHAR(10), 38 | allowNull: true, 39 | defaultValue: "utf8mb4" 40 | }, 41 | db_name: { 42 | type: DataTypes.CHAR(50), 43 | allowNull: true 44 | } 45 | }, { 46 | sequelize, 47 | tableName: 't_router_app', 48 | timestamps: false, 49 | indexes: [ 50 | { 51 | name: "PRIMARY", 52 | unique: true, 53 | using: "BTREE", 54 | fields: [ 55 | { name: "id" }, 56 | ] 57 | }, 58 | { 59 | name: "router_app", 60 | unique: true, 61 | using: "BTREE", 62 | fields: [ 63 | { name: "router_name" }, 64 | { name: "app_name" }, 65 | ] 66 | }, 67 | ] 68 | }); 69 | }; 70 | -------------------------------------------------------------------------------- /web/src/dcache/dbaccess/controller.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | const cwd = process.cwd(); 18 | const path = require('path'); 19 | const assert = require('assert'); 20 | 21 | const logger = require('../../logger'); 22 | 23 | const DbAccessService = require('./service.js'); 24 | 25 | const DbAccessController = { 26 | // 服务名 DCache.xxx, 不填表示查询模块下所有服务合并统计数据,填"*"表示列出所有服务的独立数据 27 | async loadAccessDb(ctx) { 28 | try { 29 | const access = await DbAccessService.getAccessDb(); 30 | 31 | let data = []; 32 | 33 | access.forEach((item) => { 34 | data.push({ 35 | id: item.dataValues.id, 36 | access_db_flag: item.dataValues.access_db_flag 37 | }); 38 | }) 39 | 40 | ctx.makeResObj(200, '', data); 41 | } catch (err) { 42 | logger.error('[loadAccessDb]:', err); 43 | ctx.makeResObj(500, err.message); 44 | } 45 | }, 46 | }; 47 | 48 | module.exports = DbAccessController; -------------------------------------------------------------------------------- /web/src/dcache/module/dao.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | const { tApplyCacheModuleBase } = require('./../db').db_cache_web; 18 | 19 | const moduleDao = {}; 20 | 21 | 22 | moduleDao.addModuleBaseInfo = function ({ 23 | apply_id, module_name, follower, update, create_person, modify_time, 24 | }) { 25 | return tApplyCacheModuleBase.create({ 26 | apply_id, module_name, follower, update, create_person, modify_time, 27 | }); 28 | }; 29 | 30 | moduleDao.findOne = function ({ where = {}, attributes = [] }) { 31 | const option = { 32 | where, 33 | }; 34 | if (attributes.length) option.attributes = attributes; 35 | return tApplyCacheModuleBase.findOne(option); 36 | }; 37 | 38 | moduleDao.destroy = function (option) { 39 | return tApplyCacheModuleBase.destroy(option); 40 | }; 41 | 42 | module.exports = moduleDao; 43 | -------------------------------------------------------------------------------- /web/src/dcache/proxy/controller.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | const cwd = process.cwd(); 18 | const path = require('path'); 19 | 20 | const logger = require('../../logger'); 21 | // const util = require(path.join(cwd, './tools/util')); 22 | 23 | const service = require('./service'); 24 | 25 | const Controller = { 26 | removeProxy: async (ctx) => { 27 | try { 28 | const { 29 | server_name 30 | } = ctx.paramsObj; 31 | const item = await service.removeProxy({ 32 | server_name 33 | }); 34 | ctx.makeResObj(200, '', item); 35 | } catch (err) { 36 | logger.error('[removeProxy]:', err); 37 | ctx.makeResObj(500, err.message); 38 | } 39 | }, 40 | removeProxyById: async (ctx) => { 41 | try { 42 | const { 43 | id 44 | } = ctx.paramsObj; 45 | const item = await service.removeProxyById({ 46 | id 47 | }); 48 | ctx.makeResObj(200, '', item); 49 | } catch (err) { 50 | logger.error('[removeProxy]:', err); 51 | ctx.makeResObj(500, err.message); 52 | } 53 | }, 54 | }; 55 | 56 | module.exports = Controller; -------------------------------------------------------------------------------- /web/src/dcache/region/dao.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | const { tRegion } = require('./../db').db_cache_web; 18 | 19 | const RegionDao = {}; 20 | 21 | RegionDao.getRegion = async function ({ where = {}, attributes = ['id'] }) { 22 | const data = await tRegion.findOne({ where, attributes }); 23 | if (!data) throw new Error('地区不存在'); 24 | return data; 25 | }; 26 | 27 | RegionDao.getRegionList = function () { 28 | return tRegion.findAll(); 29 | }; 30 | 31 | RegionDao.addRegion = function ({ region, label }) { 32 | return tRegion.create({ region, label }); 33 | }; 34 | 35 | RegionDao.deleteRegion = async function ({ id }) { 36 | return tRegion.destroy({ where: { id } }); 37 | }; 38 | 39 | RegionDao.updateRegion = function ({ id, region, label }) { 40 | return tRegion.update({ region, label }, { where: { id } }); 41 | }; 42 | 43 | 44 | module.exports = RegionDao; 45 | -------------------------------------------------------------------------------- /web/src/dcache/region/service.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | const RegionDao = require('./dao'); 18 | 19 | const RegionService = {}; 20 | 21 | RegionService.getRegion = function () { 22 | return RegionDao.getRegion({}); 23 | }; 24 | 25 | RegionService.getRegionList = function () { 26 | return RegionDao.getRegionList(); 27 | }; 28 | 29 | RegionService.addRegion = function ({ region, label }) { 30 | return RegionDao.addRegion({ region, label }); 31 | }; 32 | 33 | RegionService.deleteRegion = function ({ id }) { 34 | return RegionDao.deleteRegion({ id }); 35 | }; 36 | 37 | RegionService.updateRegion = function ({ id, region, label }) { 38 | return RegionDao.updateRegion({ id, region, label }); 39 | }; 40 | 41 | 42 | module.exports = RegionService; 43 | -------------------------------------------------------------------------------- /web/src/dcache/router/controller.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | const cwd = process.cwd(); 18 | const path = require('path'); 19 | 20 | const logger = require('../../logger'); 21 | // const util = require(path.join(cwd, './tools/util')); 22 | 23 | const service = require('./service'); 24 | 25 | const Controller = { 26 | removeRouter: async (ctx) => { 27 | try { 28 | const { 29 | server_name 30 | } = ctx.paramsObj; 31 | const item = await service.removeRouter({ 32 | server_name 33 | }); 34 | ctx.makeResObj(200, '', item); 35 | } catch (err) { 36 | logger.error('[removeRouter]:', err); 37 | ctx.makeResObj(500, err.message); 38 | } 39 | }, 40 | }; 41 | 42 | module.exports = Controller; -------------------------------------------------------------------------------- /web/src/dcache/test/serverConfig.test.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tencent/DCache/2c5df8de4406f16a00dd216ad12c85bd63ad42c8/web/src/dcache/test/serverConfig.test.js -------------------------------------------------------------------------------- /web/src/index/controller/locale/LocaleController.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | const fs = require('fs-extra'); 18 | const util = require('../../../tools/util'); 19 | const path = require('path'); 20 | 21 | let fileNames = fs.readdirSync(path.join(__dirname, '../../json')); 22 | let locale = {}; 23 | fileNames.forEach((fileName) => { 24 | let content = require(path.join(__dirname, '../../json/', fileName)); 25 | locale[content.localeCode] = content; 26 | }); 27 | 28 | const LocaleController = {}; 29 | LocaleController.getLocale = async (ctx) => { 30 | ctx.makeResObj(200, '', locale || {}); 31 | }; 32 | 33 | module.exports = LocaleController; -------------------------------------------------------------------------------- /web/src/index/controller/page/PageController.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | const PageController = {} 18 | const WebConf = require("../../../config/webConf"); 19 | 20 | PageController.index = async (ctx) => { 21 | 22 | const treeid = ctx.paramsObj.treeid; 23 | 24 | let redirect = `${WebConf.path}/index.html?treeid=${treeid}`; 25 | 26 | // console.log(redirect); 27 | 28 | await ctx.redirect(redirect); 29 | }; 30 | 31 | module.exports = PageController; -------------------------------------------------------------------------------- /web/src/index/index.js: -------------------------------------------------------------------------------- 1 | const LocaleController = require('./controller/locale/LocaleController'); 2 | const PageController = require('./controller/page/PageController'); 3 | const localeApiConf = [ 4 | //语言包接口 5 | ['get', '/get_locale', LocaleController.getLocale] 6 | ]; 7 | 8 | const pageApiConf = [ 9 | //首页 10 | ['get', '/', PageController.index], 11 | ]; 12 | 13 | module.exports = { 14 | pageApiConf, 15 | localeApiConf, 16 | }; -------------------------------------------------------------------------------- /web/src/logger/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | const tarsLogs = require("@tars/logs"); 18 | 19 | var logger = new tarsLogs("TarsRotate"); 20 | 21 | module.exports = logger; -------------------------------------------------------------------------------- /web/src/midware/loginMidware.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | const _ = require('lodash'); 17 | const WebConf = require('../config/webConf'); 18 | const AdminService = require('../common/AdminService'); 19 | 20 | let ignore = [`${WebConf.path}/get_locale`]; 21 | 22 | module.exports = async (ctx, next) => { 23 | 24 | if (ignore.indexOf(ctx.request.path) == -1) { 25 | 26 | let ticket = ctx.paramsObj.ticket || ctx.cookies.get("ticket") || ctx.request.header["x-token"]; 27 | 28 | console.log(ticket); 29 | 30 | if (!ticket) { 31 | ctx.makeResObj(403, "no ticket cause no auth", {}); 32 | return; 33 | } 34 | 35 | let uid = await AdminService.checkTicket(ticket); 36 | 37 | if (!uid) { 38 | ctx.makeResObj(403, "check ticket error, no auth", {}); 39 | return; 40 | } 41 | 42 | ctx.uid = uid; 43 | } 44 | 45 | await next(); 46 | 47 | }; -------------------------------------------------------------------------------- /web/src/midware/noCacheMidware.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Tencent is pleased to support the open source community by making Tars available. 3 | * 4 | * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. 5 | * 6 | * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 7 | * in compliance with the License. You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSD-3-Clause 10 | * 11 | * Unless required by applicable law or agreed to in writing, software distributed 12 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 13 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the 14 | * specific language governing permissions and limitations under the License. 15 | */ 16 | 17 | module.exports = async (ctx, next) => { 18 | if (ctx && ctx.set) { 19 | ctx.set('Surrogate-Control', 'no-store'); 20 | ctx.set('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate'); 21 | ctx.set('Pragma', 'no-cache'); 22 | ctx.set('Expires', '0'); 23 | } 24 | await next(); 25 | }; -------------------------------------------------------------------------------- /yaml/config.yaml: -------------------------------------------------------------------------------- 1 | cloud: 2 | group: DCache 3 | name: ConfigServer 4 | logo: logo/DCache-Config.png 5 | version: latest 6 | changelist: Changelist.md 7 | lang: cpp 8 | description: >- 9 | DCache is a distributed cache based on tars. Configserver mainly provides an interface to the cache module to facilitate the cache module to obtain relevant configuration 10 | description_cn: DCache是一套基于tars的分布式缓存, ConfigServer主要给Cache模块提供接口, 以方便Cache模块获取相关的配置 11 | collaborators: 12 | - ruanshudong@qq.com 13 | repository: https://github.com/Tencent/DCache.git 14 | readme: README-EN.md 15 | readme_cn: README.md 16 | protocols: [] 17 | independent: false 18 | container: tars.cppbase 19 | assets: 20 | - docs 21 | - docs-en 22 | app: DCache 23 | server: ConfigServer 24 | template: DCache.Cache 25 | profile: "" 26 | servants: 27 | - name: ConfigObj 28 | port: 11772 29 | isTars: true 30 | isTcp: true 31 | thread: 5 32 | capacity: 100000 33 | connection: 100000 34 | timeout: 60000 35 | replicas: 1 36 | hostNetwork: false 37 | hostIPC: false 38 | hostPorts: [] 39 | repo: 40 | id: 41 | image: docker.tarsyun.com/tarscloud/dcache.configserver 42 | secret: cloud-market-secret 43 | config: 44 | - name: ConfigServer.conf 45 | content: | 46 |
47 | 48 | dbhost= 127.0.0.1 49 | dbuser= root 50 | dbpass= 51 | dbname= db_dcache_relation 52 | charset=utf8mb4 53 | dbport= 3306 54 | 55 |
56 | -------------------------------------------------------------------------------- /yaml/dbaccess.yaml: -------------------------------------------------------------------------------- 1 | cloud: 2 | group: DCache 3 | name: CombinDbAccessServer 4 | logo: logo/DCache-DbAccess.png 5 | version: latest 6 | changelist: Changelist.md 7 | lang: cpp 8 | description: >- 9 | Database operation service of DCache. 10 | description_cn: DCache的数据库操作服务. 11 | collaborators: 12 | - ruanshudong@qq.com 13 | repository: https://github.com/Tencent/DCache.git 14 | readme: README-EN.md 15 | readme_cn: README.md 16 | independent: false 17 | container: tars.cppbase 18 | protocols: [] 19 | assets: 20 | - docs 21 | - docs-en 22 | app: DCache 23 | server: CombinDbAccessServer 24 | template: DCache.Cache 25 | profile: "" 26 | servants: 27 | - name: DbAccessObj 28 | port: 13773 29 | isTars: true 30 | isTcp: true 31 | thread: 5 32 | capacity: 100000 33 | connection: 100000 34 | timeout: 60000 35 | replicas: 1 36 | hostNetwork: false 37 | hostIPC: false 38 | hostPorts: [] 39 | repo: 40 | id: 41 | image: docker.tarsyun.com/dcache/combinedbaccessserver:latest 42 | secret: cloud-market-secret 43 | -------------------------------------------------------------------------------- /yaml/dcache.yaml: -------------------------------------------------------------------------------- 1 | cloud: 2 | group: dcache 3 | name: dcache-system 4 | type: product 5 | logo: logo/DCache.png 6 | version: latest 7 | readme: README-EN.md 8 | readme_cn: README.md 9 | env: native 10 | description: DCache is a distributed cache based on tars. 11 | description_cn: DCache是一套基于tars的分布式缓存 12 | changelist: Changelist.md 13 | collaborators: 14 | - ruanshudong@qq.com 15 | repository: https://github.com/Tencent/DCache.git 16 | assets: 17 | - docs 18 | - docs-en 19 | servers: 20 | - DCache/DCacheOptServer 21 | - DCache/PropertyServer 22 | - DCache/ConfigServer 23 | - DCache/DCacheWebServer 24 | uploads: 25 | - DCache/ProxyServer 26 | - DCache/RouterServer 27 | - DCache/KVCacheServer 28 | - DCache/MKVCacheServer 29 | - DCache/CombinDbAccessServer -------------------------------------------------------------------------------- /yaml/proxy.yaml: -------------------------------------------------------------------------------- 1 | cloud: 2 | group: DCache 3 | name: ProxyServer 4 | logo: logo/DCache-Proxy.png 5 | version: latest 6 | changelist: Changelist.md 7 | lang: cpp 8 | description: >- 9 | Proxy of DCache 10 | description_cn: DCache的服务入口, 请求直接访问ProxyServer 11 | collaborators: 12 | - ruanshudong@qq.com 13 | repository: https://github.com/Tencent/DCache.git 14 | readme: README-EN.md 15 | readme_cn: README.md 16 | container: tars.cppbase 17 | independent: false 18 | protocols: [] 19 | assets: 20 | - docs 21 | - docs-en 22 | app: DCache 23 | server: ProxyServer 24 | template: DCache.Cache 25 | profile: "" 26 | servants: 27 | - name: ProxyObj 28 | port: 12773 29 | isTars: true 30 | isTcp: true 31 | thread: 5 32 | capacity: 100000 33 | connection: 100000 34 | timeout: 60000 35 | replicas: 1 36 | hostNetwork: false 37 | hostIPC: false 38 | hostPorts: [] 39 | repo: 40 | id: 41 | image: docker.tarsyun.com/dcache/proxyserver:latest 42 | secret: cloud-market-secret 43 | -------------------------------------------------------------------------------- /yaml/router.yaml: -------------------------------------------------------------------------------- 1 | cloud: 2 | group: DCache 3 | name: RouterServer 4 | logo: logo/DCache-Router.png 5 | version: latest 6 | changelist: Changelist.md 7 | lang: cpp 8 | description: >- 9 | Management router data of DCache. Note that it can only be deployed at a single point. 10 | description_cn: 管理DCache的路有数据, 注意只能单点部署. 11 | collaborators: 12 | - ruanshudong@qq.com 13 | repository: https://github.com/Tencent/DCache.git 14 | readme: README-EN.md 15 | readme_cn: README.md 16 | container: tars.cppbase 17 | independent: false 18 | protocols: [] 19 | assets: 20 | - docs 21 | - docs-en 22 | app: DCache 23 | server: RouterServer 24 | template: DCache.Cache 25 | profile: "" 26 | servants: 27 | - name: RouterObj 28 | port: 11793 29 | isTars: true 30 | isTcp: true 31 | thread: 5 32 | capacity: 100000 33 | connection: 100000 34 | timeout: 60000 35 | replicas: 1 36 | hostNetwork: false 37 | hostIPC: false 38 | hostPorts: [] 39 | repo: 40 | id: 41 | image: docker.tarsyun.com/dcache/routerserver:latest 42 | secret: cloud-market-secret 43 | --------------------------------------------------------------------------------