├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── feature_request.md │ └── general_question.md └── workflows │ ├── deploy.yml │ └── test-deploy.yml ├── .gitignore ├── LICENSE ├── LICENSE-docs ├── README.md ├── babel.config.js ├── community └── main.md ├── docs ├── 00-about-stonedb │ ├── _category_.json │ ├── architecture.md │ ├── intro.md │ ├── limits.md │ └── terms.md ├── 01-environment-requirements │ ├── _category_.json │ ├── server-configuration-requirements.md │ └── supported-servers-and-oss.md ├── 02-getting-started │ ├── _category_.json │ ├── basic-operations.md │ ├── quick-deployment.md │ └── quick-start.md ├── 03-O&M-Guide │ ├── 00-monitoring-and-alerting │ │ ├── _category_.json │ │ └── prometheus+grafana-monitor.md │ ├── 01-backup-and-recovery │ │ ├── _category_.json │ │ ├── use-mydumper-full-backup.md │ │ └── use-mysqldump-backup-and-restore.md │ ├── _category_.json │ └── regular-change-operations.md ├── 04-developer-guide │ ├── 00-compiling-methods │ │ ├── _category_.json │ │ ├── compile-overview.md │ │ ├── compile-using-centos7.md │ │ ├── compile-using-docker.md │ │ ├── compile-using-redhat7.md │ │ └── compile-using-ubuntu2004.md │ ├── 01-connect-to-stonedb │ │ ├── _category_.json │ │ ├── use-mysql-client.md │ │ └── use-navicat.md │ ├── 04-create-and-manage-database-objects │ │ ├── _category_.json │ │ ├── create-and-manage-database.md │ │ ├── create-and-manage-stored-procedure.md │ │ ├── create-and-manage-table.md │ │ └── create-and-manage-view.md │ ├── 05-appendix │ │ ├── _category_.json │ │ ├── configuration-parameters.md │ │ └── error-codes.md │ ├── DML-starements.md │ ├── _category_.json │ └── statements-for-queries.md ├── 05-SQL-reference │ ├── 03-operators │ │ ├── _category_.json │ │ ├── arithmetic-operators.md │ │ ├── assignment-operators.md │ │ ├── bitwise-operators.md │ │ ├── comparison-operators.md │ │ └── logical-operators.md │ ├── 04-functions │ │ ├── _category_.json │ │ ├── advanced-functions.md │ │ ├── aggregate-functions.md │ │ ├── date-and-time-functions.md │ │ ├── mathematical-functions.md │ │ └── string-functions.md │ ├── _category_.json │ ├── character-sets.md │ └── data-types.md ├── 06-performance-tuning │ ├── 02-performance-monitoring-commands │ │ ├── _category_.json │ │ ├── cpu-monitor.md │ │ ├── disk-io-monitor.md │ │ ├── mem-monitor.md │ │ ├── network-monitor.md │ │ └── top-commands.md │ ├── 04-database-tuning │ │ ├── _category_.json │ │ ├── parameter-tuning.md │ │ ├── sql-best-practices.md │ │ └── sql-tuning.md │ ├── 05-architecture-tuning │ │ ├── _category_.json │ │ └── read_write-splitting.md │ ├── 06-performance-tests │ │ ├── 00-OLAP │ │ │ ├── _category_.json │ │ │ ├── olap-performance-test-method.md │ │ │ └── tcph-test-report.md │ │ ├── 01-OLTP │ │ │ ├── _category_.json │ │ │ └── oltp-performance-test-method.md │ │ └── _category_.json │ ├── _category_.json │ ├── os-tuning.md │ └── overview.md ├── 07-data-migration-to-stonedb │ ├── _category_.json │ ├── use-gravity-to-migrate.md │ └── use-otter-to-migrate.md ├── 08-troubleshooting │ ├── _category_.json │ ├── excessive-large-directory.md │ ├── failed-to-connect.md │ ├── failed-to-operate-table.md │ ├── failed-to-start-in-kvm.md │ ├── failed-to-start.md │ ├── mdl-wait.md │ ├── resource-bottleneck.md │ ├── slow-query.md │ └── stonedb-crashed.md ├── 09-FAQ │ ├── _category_.json │ ├── install-faq.md │ ├── stonedb-faq.md │ └── troubleshoot-faq.md ├── download.md └── release-notes.md ├── docusaurus.config.js ├── i18n ├── en │ └── code.json └── zh │ ├── code.json │ ├── docusaurus-plugin-content-blog-community │ ├── main.md │ └── options.json │ ├── docusaurus-plugin-content-blog │ └── options.json │ ├── docusaurus-plugin-content-docs │ ├── current.json │ └── current │ │ ├── 00-about-stonedb │ │ ├── architecture.md │ │ ├── intro.md │ │ ├── limits.md │ │ └── terms.md │ │ ├── 01-environment-requirements │ │ └── supported-servers-and-oss.md │ │ ├── 02-getting-started │ │ ├── quick-deployment.md │ │ └── quick-start.md │ │ ├── 03-O&M-Guide │ │ └── regular-change-operations.md │ │ └── download.md │ └── docusaurus-theme-classic │ ├── footer.json │ └── navbar.json ├── package.json ├── plugins ├── community │ ├── index.js │ └── theme │ │ └── CommunityItem │ │ ├── index.tsx │ │ └── styles.module.css └── fetch-repo │ └── index.js ├── scripts ├── config.theme.js ├── css.js ├── styles.jsx ├── theme.less └── var.less ├── sidebars.js ├── src ├── components │ ├── Link │ │ ├── index.tsx │ │ ├── interface.ts │ │ └── styles.ts │ ├── contact │ │ ├── index.tsx │ │ └── styles.ts │ ├── default.interface.ts │ ├── docLinks │ │ ├── index.tsx │ │ └── styles.ts │ ├── download │ │ ├── index.tsx │ │ └── styles.ts │ ├── emailModal │ │ ├── index.tsx │ │ └── styles.ts │ ├── events │ │ ├── index.tsx │ │ └── styles.ts │ ├── feature │ │ ├── index.tsx │ │ └── styles.ts │ ├── footLink │ │ ├── index.tsx │ │ └── styles.tsx │ ├── github │ │ ├── fork.tsx │ │ ├── index.tsx │ │ ├── interface.ts │ │ ├── star.tsx │ │ └── styles.ts │ ├── icon │ │ ├── index.tsx │ │ └── styles.ts │ ├── image │ │ ├── index.tsx │ │ ├── interface.ts │ │ └── styles.ts │ ├── index.ts │ ├── join │ │ ├── index.tsx │ │ └── styles.ts │ ├── omit │ │ ├── index.tsx │ │ └── interface.ts │ ├── seeMore │ │ ├── index.tsx │ │ ├── interface.ts │ │ └── styles.ts │ ├── social │ │ ├── index.tsx │ │ └── interface.ts │ ├── styles.ts │ ├── subscribe │ │ ├── index.tsx │ │ └── styles.ts │ ├── subscribeMail │ │ ├── form.tsx │ │ ├── index.tsx │ │ ├── interface.ts │ │ ├── message.tsx │ │ ├── styles.ts │ │ └── tip.tsx │ ├── switchLocale │ │ ├── index.tsx │ │ └── styles.ts │ └── team │ │ ├── index.tsx │ │ └── styles.ts ├── css │ ├── custom.less │ └── theme.css ├── pages │ ├── index.tsx │ └── styles │ │ └── panel.ts ├── remark │ ├── imageList │ │ ├── index.js │ │ └── list.js │ ├── remark-math │ │ ├── block copy │ │ ├── block.js │ │ └── index.js │ ├── table.js │ ├── ul.js │ └── util.js ├── theme │ ├── BlogLayout │ │ ├── index.tsx │ │ └── styles.ts │ ├── BlogPostItem │ │ ├── index.tsx │ │ └── styles.module.css │ ├── Footer │ │ └── LinkItem │ │ │ ├── index.tsx │ │ │ └── styles.tsx │ ├── IconLanguage │ │ └── index.tsx │ ├── Logo │ │ └── index.tsx │ ├── MDXComponents │ │ ├── A │ │ │ └── index.tsx │ │ ├── Image.tsx │ │ ├── Pre.tsx │ │ └── index.tsx │ ├── Navbar │ │ └── MobileSidebar │ │ │ ├── Header │ │ │ └── index.tsx │ │ │ ├── Layout │ │ │ └── index.tsx │ │ │ ├── PrimaryMenu │ │ │ └── index.tsx │ │ │ ├── SecondaryMenu │ │ │ └── index.tsx │ │ │ ├── Toggle │ │ │ └── index.tsx │ │ │ └── index.tsx │ ├── NavbarItem │ │ └── ComponentTypes.tsx │ ├── NotFound.tsx │ └── TOCItems │ │ ├── Tree.tsx │ │ └── index.tsx └── utils │ ├── getRepoDetail.ts │ ├── index.ts │ ├── loadScript.ts │ ├── modifyKeyName.ts │ ├── pickWhen.ts │ ├── postSubscribe.ts │ └── regs.ts ├── static ├── .nojekyll ├── CNAME ├── img │ ├── favicon.ico │ ├── icons │ │ ├── 128x128.png │ │ ├── 144x144.png │ │ ├── 152x152.png │ │ ├── 192x192.png │ │ ├── 200x200.png │ │ ├── 384x384.png │ │ ├── 512x512.png │ │ ├── 72x72.png │ │ └── 96x96.png │ ├── logo_stonedb.svg │ └── stoneDB.png └── manifest.json ├── tsconfig.json └── yarn.lock /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: "\U0001F41B Bug or Crash Report" 2 | title: "bug: " 3 | description: Unexpected behavior with StoneDB. 4 | labels: ["bug"] 5 | body: 6 | - type: textarea 7 | attributes: 8 | label: Describe the problem 9 | placeholder: > 10 | Please describe the problem you observed. 11 | 12 | - type: textarea 13 | attributes: 14 | label: Expected behavior 15 | placeholder: > 16 | Expected behavior you want to see. 17 | 18 | - type: textarea 19 | attributes: 20 | label: How To Reproduce 21 | placeholder: > 22 | Provide minimal steps to reproduce the behavior: 23 | 24 | - type: textarea 25 | attributes: 26 | label: Environment 27 | placeholder: > 28 | Please describe your environment. 29 | 1. Server OS [e.g. Linux/MacOS/Distrib ...] 30 | 2. StoneDB Version [e.g. 1.0.x] 31 | 32 | - type: checkboxes 33 | attributes: 34 | label: Are you interested in submitting a PR to solve the problem? 35 | description: > 36 | We are looking forward to working with you to make a better StoneDB community. 37 | options: 38 | - label: Yes, I will! 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F680 Feature request" 3 | title: "feature: " 4 | about: Suggest an idea for StoneDB Docs 5 | labels: ["feature"] 6 | --- 7 | 8 | **Is your feature request related to a problem? Please describe.** 9 | 10 | 11 | **Describe the solution you'd like** 12 | 13 | 14 | **Describe alternatives you've considered** 15 | 16 | 17 | **Additional context** 18 | 19 | 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/general_question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F914 Ask a Question" 3 | title: "question: " 4 | about: Need support & not sure if this a bug? You can ask a question. 5 | labels: ["question"] 6 | --- 7 | 8 | ## General Question 9 | 10 | Before asking a question, make sure you have: 11 | 12 | - Searched existing Stack Overflow questions. 13 | - Googled your question. 14 | - Searched open and closed [GitHub issues](https://github.com/stoneatom/stonedb-docs/issues) 15 | - Searched our discussions [Discussion](https://github.com/stoneatom/stonedb-docs/discussions) 16 | - Read the documentation: 17 | - [StoneDB Readme](https://github.com/stoneatom/stonedb) 18 | - [StoneDB Documentation Readme](https://github.com/stoneatom/stonedb-docs) 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | name: Deploy to GitHub Pages 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | # Review gh actions docs if you want to further define triggers, paths, etc 8 | # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on 9 | 10 | jobs: 11 | deploy: 12 | name: Deploy to GitHub Pages 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | - uses: actions/setup-node@v3 17 | with: 18 | node-version: 16.x 19 | cache: yarn 20 | 21 | - name: Install dependencies 22 | run: yarn install --frozen-lockfile 23 | - name: Build website 24 | run: yarn build 25 | 26 | # Popular action to deploy to GitHub Pages: 27 | # Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus 28 | - name: Deploy to GitHub Pages 29 | uses: peaceiris/actions-gh-pages@v3 30 | with: 31 | github_token: ${{ secrets.GITHUB_TOKEN }} 32 | # Build output to publish to the `gh-pages` branch: 33 | publish_dir: ./build 34 | # The following lines assign commit authorship to the official 35 | # GH-Actions bot for deploys to `gh-pages` branch: 36 | # https://github.com/actions/checkout/issues/13#issuecomment-724415212 37 | # The GH actions bot is used by default if you didn't specify the two fields. 38 | # You can swap them out with your own user credentials. 39 | user_name: stoneatomadmin 40 | user_email: github@stoneatom.com 41 | permissions: 42 | actions: write 43 | checks: write 44 | contents: write 45 | deployments: write 46 | pages: write 47 | repository-projects: write 48 | security-events: write 49 | statuses: write 50 | -------------------------------------------------------------------------------- /.github/workflows/test-deploy.yml: -------------------------------------------------------------------------------- 1 | name: Test deployment 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | # Review gh actions docs if you want to further define triggers, paths, etc 8 | # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on 9 | 10 | jobs: 11 | test-deploy: 12 | name: Test deployment 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | - uses: actions/setup-node@v3 17 | with: 18 | node-version: 16.x 19 | cache: yarn 20 | 21 | - name: Install dependencies 22 | run: yarn install --frozen-lockfile 23 | - name: Test build website 24 | run: yarn build 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | /node_modules 3 | 4 | # Production 5 | /build 6 | 7 | # Generated files 8 | .docusaurus 9 | .cache-loader 10 | 11 | # Misc 12 | .DS_Store 13 | .env.local 14 | .env.development.local 15 | .env.test.local 16 | .env.production.local 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 StoneAtom Ltd. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # stonedb 2 | StoneDB is a MySQL HTAP database developed by StoneAtom Technology Co.,Ltd. 3 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')], 3 | plugins: [ 4 | "babel-plugin-styled-components", 5 | ["import", { "libraryName": "antd", "libraryDirectory": "es", "style": true }], 6 | ] 7 | }; 8 | -------------------------------------------------------------------------------- /docs/00-about-stonedb/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 1, 3 | "label": "About StoneDB", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/00-about-stonedb/architecture.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: architecture 3 | sidebar_position: 1.2 4 | --- 5 | 6 | # Architecture 7 | -------------------------------------------------------------------------------- /docs/00-about-stonedb/intro.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: intro 3 | sidebar_position: 1.1 4 | --- 5 | # StoneDB Introduction 6 | 7 | StoneDB is an open-source hybrid transaction/analytical processing (HTAP) database designed and developed by StoneAtom based on the MySQL kernel. It is the first database of this type launched in China. StoneDB can be seamlessly switched from MySQL. It provides features such as optimal performance and real-time analytics, offering you a one-stop solution to process online transaction processing (OLTP), online analytical processing (OLAP), and HTAP workloads. 8 | 9 | StoneDB is fully compatible with the MySQL 5.6 and 5.7 protocols, the MySQL ecosystem, and common MySQL features and syntaxes. You can use tools and clients in the MySQL ecosystem on StoneDB, such as Navicat, Workbench, mysqldump, and mydumper. In addition, all workloads on StoneDB can be run on MySQL. 10 | 11 | StoneDB is optimized for OLAP applications. StoneDB that runs on a common server can process complex queries on tens of billions of data records, while ensuring high performance. Compared to databases that use MySQL Community Edition, StoneDB is at least 10 times faster in processing queries. 12 | 13 | StoneDB uses the knowledge grid technology and a column-based storage engine. This storage engine is designed for OLAP applications and uses techniques such as column-based storage, knowledge grid-based filtering, and high-efficiency data compression. With such storage engine, StoneDB provides application systems with high-performance and reduces the total cost of ownership (TCO). 14 | 15 | ## Advantages 16 | ### Integration of MySQL 17 | StoneDB is an HTAP database built on MySQL. To enhance analytics capabilities, it integrates a self-developed engine also named StoneDB. (In this topic, StoneDB refers to the database, if not otherwise specified.) For this reason, StoneDB is fully compatible with MySQL. You can use standard interfaces, such as Open Database Connectivity (ODBC) and Java Database Connectivity (JDBC) to connect to StoneDB. In addition, you can create local connections to connect to StoneDB. StoneDB supports APIs written in various programming languages, such as C, C++, C#, Java, PHP, and Perl. StoneDB is fully compatible with views and stored procedures that comply with the ANSI SQL-92 standard and the SQL-99 standard. In this way, your application systems that can run on MySQL can directly run on StoneDB, without the need to modify the code. This allows you to seamlessly switch MySQL to StoneDB. 18 | 19 | ### Real-time HTAP 20 | StoneDB provides two engines: row-based storage engine InnoDB and column-based storage engine StoneDB. StoneDB uses binlogs to replicate data from the row-based storage engine to the column-based storage engine in real time. This ensures strong data consistency between the two storage engines. 21 | 22 | ## Key techniques 23 | ### Column-based storage engine 24 | A column-based storage engine stores data to disks column by column. When you query data, only the required fields are retrieved, which greatly reduces memory bandwidth traffic and disk I/O. In addition, in a column-based storage engine, columns do not need to be indexed, freeing the database from maintaining such indexes. 25 | 26 | ### High-efficiency data compression 27 | In a relational database, values in the same column are of the same data type. More duplicate values stored in a column indicate a higher data compression ratio and a smaller data volume. By virtue of this, less data is retrieved for queries, and thus memory bandwidth traffic and disk I/O are reduced. 28 | 29 | StoneDB saves storage space by using column-based storage. The data compression ratio of a column-oriented database is at least 10 times higher than that of a row-oriented database. 30 | ### Knowledge grid 31 | A knowledge grid can filter data packs based on metadata, and then decompress the data packs to obtain the data that meets the query conditions. This greatly reduces I/O, and improves response speed and network utilization. 32 | ### Push-based vectorized query execution 33 | When processing a query, StoneDB pushes column-based data packs from one operator to another based on the execution plan. Compared to the execution model used by row-oriented databases, push-based execution prevents in-depth calls of stacks and saves resources. 34 | 35 | -------------------------------------------------------------------------------- /docs/00-about-stonedb/limits.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: limits 3 | sidebar_position: 1.3 4 | --- 5 | 6 | # Limits 7 | As a conlumn-based storage engine, StoneDB is built on MySQL. Therefore, StoneDB is highly compatible with the MySQL 5.6 and 5.7 protocols, and the ecosystem, common features, and common syntaxes of MySQL. However, due to characteristics of column-based storage, StoneDB is incompatible with certain MySQL operations and features. 8 | ## Unsupported DDL operations 9 | StoneDB does not support the following DDL operations: 10 | 11 | - Modify the data type of a field. 12 | - Modify the length of a field. 13 | - Change the character set of a table or a field. 14 | - Convert the character set for a table. 15 | - Optimize a table. 16 | - Analyze a table. 17 | - Lock a table. 18 | - Repair a table. 19 | - Execute a CREATE TABLE… AS SELECT statement. 20 | - Reorganize a table. 21 | - Rename a field. 22 | - Configure the default value for a field. 23 | - Specify the default value of a field to null. 24 | - Specify the default value of a field to non-null. 25 | - Add a unique constraint. 26 | - Delete a unique constraint. 27 | - Create an index. 28 | - Remove an index. 29 | - Modify a table comment. 30 | 31 | Data stored in StoneDB is highly compressed. For this reason, table attributes and column attributes are difficult to modify. The character sets, data types, constraints, and indexes must be properly defined when tables are being created. 32 | ## Unsupported DML operations 33 | StoneDB does not support the following DML operations: 34 | 35 | - Execute a DELETE statement. 36 | - Use subqueries in an UPDATE statement. 37 | - Execute an UPDATE… JOIN statement to update multiple tables. 38 | - Execute a REPLACE… INTO statement. 39 | 40 | StoneDB is not suitable for applications that are frequently updated. It supports only single-table update and insert operations. This is because a column-oriented database needs to find each corresponding column and update the value in the row when processing an update operation. However, a row-oriented database stores data by row. When processing an update operation, the row-oriented database only needs to find the corresponding page or block and update the data directly in the row. 41 | ## Unsupported objects 42 | StoneDB does not support the following objects: 43 | 44 | - Global indexes 45 | - Unique constraints 46 | - Triggers 47 | - Temporary tables 48 | - Stored procedures containing dynamic SQL statements 49 | - User-defined functions containing nested SQL statements 50 | 51 | If you want to use user-defined functions that contain nested SQL statements, set the **stonedb_ini_allowmysqlquerypath** parameter to **1** in the **stonedb.cnf** configuration file. 52 | ## Unsupported data types 53 | StoneDB does not support the following data types: 54 | 55 | - bit 56 | - enum 57 | - set 58 | - decimal whose precision is higher than 18, for example, decimal(19,x) 59 | - Data types that contain keyword **unsigned** or **zerofill** 60 | ## Unsupported binary log formats 61 | StoneDB does not support the following binary log formats: 62 | 63 | - row 64 | - mixed 65 | 66 | Column-based storage engines support only statement-based binary logs. Row-based binary logs and mixed binary logs are not supported. 67 | ## Join queries across storage engines not supported 68 | By default, StoneDB does not support join queries across storage engines. If a join query involves tables in both InnoDB and StoneDB, an error will be reported. You can set the **stonedb_ini_allowmysqlquerypath** parameter to **1** in the **stonedb.cnf** configuration file to remove this limit. 69 | ## Transactions not supported 70 | Transactions must strictly comply with the ACID attributes. However, StoneDB does not support redo and undo logs and thus does not support transactions. 71 | ## Partitions not supported 72 | Column-based storage engines do not support partitioning. 73 | ## Column locking and table locking not supported 74 | Column-based storage engines do not support column locking or table locking. 75 | 76 | -------------------------------------------------------------------------------- /docs/00-about-stonedb/terms.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: terms 3 | sidebar_position: 1.4 4 | --- 5 | 6 | # Terms 7 | 8 | | **Term** | **Description** | 9 | | :-- | :-- | 10 | | **row** | A series of data that makes up a record. | 11 | | **column** | Also referred to as field. In a relational database, a field must be associated with a data type when the field is being created. | 12 | | **table** | Consists of rows and columns. Databases use tables to store data. Tables are essential objects in databases. | 13 | | **view** | A virtual table that does not store actual data. It is based on the result set of an SQL statement. | 14 | | **stored procedure** | A collection of one or more SQL statements that are compiled and then stored in a database to execute a specific operation. To execute a stored procedure, you need to specify the name and required parameters of the stored procedure. | 15 | | **database** | A collection of database objects such as tables, views, and stored procedures. | 16 | | **instance** | A collection of databases. | 17 | | **data page** | The basic unit for database management. The default size for a data page is 16 KB. | 18 | | **data file** | Used for storing data. By default, one table corresponds to one data file. | 19 | | **tablespace** | A logical storage unit. By default, one table corresponds to one tablespace. | 20 | | **transaction** | A sequence of DML operations. This sequence satisfies the atomicity, consistency, isolation, and durability (ACID) properties. A transaction must end with a submission or rollback. Implicit submission by using DDL statements are supported. | 21 | | **character set** | A collection of symbols and encodings. | 22 | | **collation** | A collation is a collection of rules for comparing and sorting character strings. | 23 | | **column-based storage** | Stores data by column to disks. | 24 | | **data compression** | A process performed to reduce the size of data files. The data compression ratio is determined by the data type, degree of duplication, and compression algorithm. | 25 | | **OLTP** | The acronym of online transaction processing. OLTP features quick response for interactions and high concurrency of small transactions. Typical applications are transaction systems of banks. | 26 | | **OLAP** | The acronym of online analytical processing. OLAP features complex analytical querying on a large amount of data. Typical applications are data warehouses. | 27 | | **HTAP** | The acronym of hybrid transaction/analytical processing. HTAP is an emerging application architecture built to allow one system for both transactions and analytics. | -------------------------------------------------------------------------------- /docs/01-environment-requirements/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 2, 3 | "label": "Environment Requirements", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/01-environment-requirements/server-configuration-requirements.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: server-configuration-requirements 3 | sidebar_position: 2.2 4 | --- 5 | # Server Configuration Requirements 6 | 7 | This topic describes the configuration requirements for a development or test environment and a production environment. 8 | 9 | 10 | # Configuration requirements for a development or test environment 11 | 12 | The following table describes the configuration requirements for a development or test environment. 13 | 14 | | **CPU** | **Memory** | **Storage** | **Network** | 15 | | --- | --- | --- | --- | 16 | | 2 cores+ | 2 GB+ | 10 GB+ | Megabit network card | 17 | 18 | :::caution 19 | 20 | If the development or test environment is deployed on a virtual machine, the AVX instruction set must be enabled. Otherwise, StoneDB cannot be installed. 21 | 22 | ::: 23 | 24 | # Configuration requirements for a production environment 25 | 26 | The following table describes the configuration requirements for a production environment. 27 | 28 | | **CPU** | **Memory** | **Storage** | **Network** | 29 | | --- | --- | --- | --- | 30 | | 8 cores+ | 8 GB+ | 100 GB+ | Gigabit network card | 31 | 32 | :::tip 33 | 34 | We recommend you use higher configuration in your production environment. 35 | 36 | ::: 37 | -------------------------------------------------------------------------------- /docs/01-environment-requirements/supported-servers-and-oss.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: supported-servers-and-OSs 3 | sidebar_position: 2.1 4 | --- 5 | # Support Servers and OSs 6 | 7 | StoneDB is an open-source hybrid transaction/analytical processing (HTAP) database designed and developed by StoneAtom based on the MySQL kernel. It can be deployed and run on 64-bit x86 servers and supports most mainstream network hardware and Linux OSs. 8 | 9 | # Supported servers 10 | The following table lists the servers on which StoneDB can run. 11 | 12 | | **Architecture** | **Supported server** | 13 | | --- | --- | 14 | | x86_64 architecture | Common x86_64 servers with AVX instruction sets enabled | 15 | 16 | :::info 17 | 18 | Support for the ARM64 or Power architecture is under testing. 19 | 20 | ::: 21 | 22 | # Supported OSs 23 | The following table lists the OSs supported by StoneDB. 24 | 25 | | **OS** | **Version** | 26 | | --- | --- | 27 | | CentOS | 7.x | 28 | | Red Hat Enterprise | 7.x | 29 | | Ubuntu LTS | 20.04 or higher | 30 | 31 | :::info 32 | 33 | Compatibilities with other OSs such as Debian and Fedora are under testing. 34 | 35 | ::: 36 | 37 | -------------------------------------------------------------------------------- /docs/02-getting-started/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 3, 3 | "label": "Getting Started", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/02-getting-started/quick-deployment.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: quick-deployment 3 | sidebar_position: 3.1 4 | --- 5 | 6 | # Quick Deployment 7 | 8 | ## 1. Download the latest package 9 | Click [here](https://static.stoneatom.com/stonedb-ce-5.6-v1.0.0.el7.x86_64.tar.gz) to download the latest installation package of StoneDB. 10 | ## 2. Upload and decompress the TAR package 11 | ```shell 12 | tar -zxvf stonedb-ce-5.6-v1.0.0.el7.x86_64.tar.gz 13 | ``` 14 | Upload the installation package to the directory. The name of the folder extracted from the package is **stonedb56**. 15 | ## 3. Check dependencies 16 | ```bash 17 | cd /stonedb56/install/bin 18 | ldd mysqld 19 | ldd mysql 20 | ``` 21 | If the command output contains keywords **not found**, some dependencies are missing and must be installed. 22 | ## 4. Modify the configuration file 23 | ```bash 24 | cd /stonedb56/install/ 25 | cp stonedb.cnf stonedb.cnf.bak 26 | vi stonedb.cnf 27 | ``` 28 | Modify the path and parameters. If the installation folder is **stonedb**, you only need to modify the parameters. 29 | ## 5. Create an account 30 | ```bash 31 | groupadd mysql 32 | useradd -g mysql mysql 33 | passwd mysql 34 | ``` 35 | ## 6. Execute reinstall.sh 36 | ```bash 37 | cd /stonedb56/install 38 | ./reinstall.sh 39 | ``` 40 | The process of executing the script is to initialize and start the StoneDB. 41 | ## 7. Log in to StoneDB 42 | ```shell 43 | /stonedb56/install/bin/mysql -uroot -p -S /stonedb56/install/tmp/mysql.sock 44 | Enter password: 45 | Welcome to the MySQL monitor. Commands end with ; or \g. 46 | Your MySQL connection id is 1 47 | Server version: 5.6.24-StoneDB-log build- 48 | 49 | Copyright (c) 2000, 2022 StoneAtom Group Holding Limited 50 | No entry for terminal type "xterm"; 51 | using dumb terminal settings. 52 | Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 53 | 54 | mysql> show databases; 55 | +--------------------+ 56 | | Database | 57 | +--------------------+ 58 | | information_schema | 59 | | cache | 60 | | innodb | 61 | | mysql | 62 | | performance_schema | 63 | | sys_stonedb | 64 | | test | 65 | +--------------------+ 66 | 7 rows in set (0.00 sec) 67 | ``` 68 | ## 8. Stop StoneDB 69 | ```shell 70 | /stonedb56/install/bin/mysqladmin -uroot -p -S /stonedb56/install/tmp/mysql.sock shutdown 71 | ``` -------------------------------------------------------------------------------- /docs/03-O&M-Guide/00-monitoring-and-alerting/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 4.2, 3 | "label": "Monitoring and Alerting", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/03-O&M-Guide/00-monitoring-and-alerting/prometheus+grafana-monitor.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: prometheus+grafana-monitor 3 | sidebar_position: 4.21 4 | --- 5 | 6 | # Use Prometheus and Grafana to Monitor MySQL or StoneDB Databases -------------------------------------------------------------------------------- /docs/03-O&M-Guide/01-backup-and-recovery/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 4.3, 3 | "label": "Backup and Recovery", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/03-O&M-Guide/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 4, 3 | "label": "O&M Guide", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/03-O&M-Guide/regular-change-operations.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: regular-change-operations 3 | sidebar_position: 4.1 4 | --- 5 | 6 | # Regular Change Operations 7 | 8 | ## Change operations on schemas and data of tables 9 | This section describes the supported change operations on schemas and data of tables. 10 | 11 | ### Create tables using the same schema 12 | 13 | 1. Execute a `CREATE TABLE` statement to create a StoneDB table. 14 | 15 | Code example: 16 | ```sql 17 | CREATE TABLE t_name( 18 | col1 INT NOT NULL AUTO_INCREMENT, 19 | col2 VARCHAR(10) NOT NULL, 20 | ...... 21 | PRIMARY KEY (`id`) 22 | ) engine=STONEDB; 23 | ``` 24 | 25 | 2. Execute a `CREATE TABLE... LIKE `statement to create another table that uses the same schema as the table created in the step 1. 26 | 27 | Code example: 28 | ```sql 29 | create table t_other like t_name; 30 | ``` 31 | 32 | ### Clear data in a table 33 | Execute a `TRUNCATE TABLE` statement to clear data in a table and retain the table schema. 34 | 35 | Code example: 36 | ```sql 37 | truncate table t_name; 38 | ``` 39 | 40 | ### Add a field 41 | Execute an `ALTER TABLE... ADD COLUMN` statement to add a field in a given table. The added field is the last field, by default. 42 | Code example: 43 | 44 | ```sql 45 | alter table t_name add column c_name varchar(10); 46 | ``` 47 | 48 | ### Drop a field 49 | Execute an `ALTER TABLE... DROP` statement to drop a field from a table.
Code example: 50 | ```sql 51 | alter table t_name drop c_name; 52 | ``` 53 | 54 | ### Rename a table 55 | Execute an `ALTER TABLE... RENAME TO` statement to rename a given table.
Code example: 56 | ```sql 57 | alter table t_name rename to t_name_new; 58 | ``` 59 | 60 | ## Change operations on user permissions 61 | 62 | ### Create a user 63 | Code example: 64 | ```sql 65 | create user 'u_name'@'hostname' identified by 'xxx'; 66 | ``` 67 | 68 | ### Grant user permissions 69 | Code example: 70 | ```sql 71 | grant all on *.* to 'u_name'@'hostname'; 72 | grant select on db_name.* to 'u_name'@'hostname'; 73 | grant select(column_name) on db_name.t_name to 'u_name'@'hostname'; 74 | ``` 75 | 76 | ### Revoke permissions 77 | 78 | Code example: 79 | 80 | ```sql 81 | revoke all privileges on *.* from 'u_name'@'hostname'; 82 | revoke select on db_name.* from 'u_name'@'hostname'; 83 | revoke select(column_name) on db_name.t_name from 'u_name'@'hostname'; 84 | ``` 85 | 86 | ### Drop a user 87 | Code example: 88 | 89 | ```sql 90 | drop user 'u_name'@'hostname'; 91 | ``` 92 | -------------------------------------------------------------------------------- /docs/04-developer-guide/00-compiling-methods/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 5.1, 3 | "label": "Compiling Methods", 4 | "collapsible": true, 5 | "link": { 6 | "type": "generated-index", 7 | "slug": "/compiling-methods" 8 | } 9 | } -------------------------------------------------------------------------------- /docs/04-developer-guide/00-compiling-methods/compile-overview.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: compile-overview 3 | sidebar_position: 5.11 4 | --- 5 | 6 | # Overview 7 | 8 | The method to compile StoneDB varies with the environment. Choose the compiling method that suits your environment. 9 | 10 | - [Compile StoneDB on CentOS 7](compile-using-centos7.md) 11 | - [Compile StoneDB on RHEL 7](compile-using-redhat7.md) 12 | - [Compile StoneDB on Ubuntu 20.04](compile-using-ubuntu2004.md) 13 | - [Compile StoneDB Using a Docker Container](compile-using-docker.md) 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/04-developer-guide/01-connect-to-stonedb/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 5.2, 3 | "label": "Connect to StoneDB", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/04-developer-guide/01-connect-to-stonedb/use-mysql-client.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: use-mysql-client 3 | sidebar_position: 5.21 4 | --- 5 | 6 | # Use mysql to Connect to StoneDB 7 | 8 | This topic describes how to use the MySQL command-line client named mysql to connect to StoneDB. 9 | ## Prerequisites 10 | 11 | - mysql has been installed and its version is 5.5, 5.6, or 5.7. 12 | - The value of environment variable **PATH** contains the directory that stores mysql. 13 | ## Procedure 14 | 15 | 1. Open mysql. 16 | 2. Specify required parameters according to the following format. 17 | ```shell 18 | mysql -u -p -h -P -S -A 19 | ``` 20 | ## Parameter description 21 | The following table describes required parameters. 22 | 23 | | **Parameter** | **Description** | 24 | | --- | --- | 25 | | -h | The IP address of StoneDB. | 26 | | -u | The username of the account. | 27 | | -p | The password of the account. You can skip this parameter for security purposes and enter the password as prompted later. | 28 | | -P | The port used to connect to StoneDB. By default, the port 3306 is used. You can specify another port as needed. | 29 | | -A | The name of the database. | 30 | | -S | The name of the .sock file that is used to connect to StoneDB. | 31 | 32 | 33 | :::tip 34 | 35 | - If you want to exit the command-line client, enter** exit** and press **Enter.** 36 | - For more information about parameters, run `mysql --help`. 37 | 38 | ::: 39 | -------------------------------------------------------------------------------- /docs/04-developer-guide/01-connect-to-stonedb/use-navicat.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: use-navicat 3 | sidebar_position: 5.22 4 | --- 5 | 6 | # Use Navicat to Connect to StoneDB 7 | 8 | Navicat is a database management tool that allows you to connect to databases. You can use Navicat to connect to StoneDB and other relational databases such as Oracle, MySQL, and PostgreSQL. After you connect to StoneDB using Navicat, you can create, manage and maintain StoneDB on the Navicat graphical user interface (GUI). 9 | 10 | This topic shows you how to use Navicat to connect to StoneDB. 11 | ## Prerequisites 12 | Navicat has been installed. 13 | 14 | ## Procedure 15 | 16 | 1. Open Navicat and choose **File** > **New Connection** > **MySQL**. 17 | 18 | *Here's a picture to add* 19 | 20 | 2. In the dialog box that appears, click the **General** tab, and enter the connection name, server IP address, port, username, and password. The following figure provides an example. 21 | 22 | *Here's a picture to add* 23 | 24 | 3. Click **Test Connection**. If message "Connection successful" appears, the connection to StoneDB is established. 25 | 26 | *Here's a picture to add* 27 | 28 | :::info 29 | You cannot use Navicat to connect to StoneDB as a super administrator ('root'@'localhost'). 30 | ::: 31 | -------------------------------------------------------------------------------- /docs/04-developer-guide/04-create-and-manage-database-objects/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 5.5, 3 | "label": "Create and Manage Database Objects", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/04-developer-guide/04-create-and-manage-database-objects/create-and-manage-database.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: create-and-manage-database 3 | sidebar_position: 5.51 4 | --- 5 | 6 | # Create and Manage a Database 7 | 8 | Create a database. For example, execute the following SQL statement to create a database named **test_db** that uses **utf8mb4** as the default character set: 9 | 10 | ```sql 11 | create database test_db DEFAULT CHARACTER SET utf8mb4; 12 | ``` 13 | 14 | List databases by executing the following SQL statement: 15 | 16 | ```sql 17 | show databases; 18 | ``` 19 | 20 | Use a database. For example, execute the following SQL statement to use database **test_db**: 21 | 22 | ```sql 23 | use test_db; 24 | ``` 25 | 26 | Drop a datable. For example, execute the following SQL statement to drop database **test_db**: 27 | 28 | ```sql 29 | drop database test_db; 30 | ``` 31 | -------------------------------------------------------------------------------- /docs/04-developer-guide/04-create-and-manage-database-objects/create-and-manage-stored-procedure.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: create-and-manage-stored-procedure 3 | sidebar_position: 5.54 4 | --- 5 | 6 | # Create and Manage a View 7 | 8 | Create a stored procedure. For example, perform the following two steps to create a stored procedure named **add_user**, used to insert 1,000,000 random data records. 9 | 10 | 1. Execute the following SQL statement to create a table: 11 | ```sql 12 | CREATE TABLE t_test( 13 | id INT NOT NULL AUTO_INCREMENT, 14 | first_name VARCHAR(10) NOT NULL, 15 | last_name VARCHAR(10) NOT NULL, 16 | sex VARCHAR(5) NOT NULL, 17 | score INT NOT NULL, 18 | copy_id INT NOT NULL, 19 | PRIMARY KEY (`id`) 20 | ) engine=STONEDB; 21 | ``` 22 | 23 | 2. Execute the following SQL statement to create the stored procedure: 24 | ```sql 25 | DELIMITER // 26 | create PROCEDURE add_user(in num INT) 27 | BEGIN 28 | DECLARE rowid INT DEFAULT 0; 29 | DECLARE firstname VARCHAR(10); 30 | DECLARE name1 VARCHAR(10); 31 | DECLARE name2 VARCHAR(10); 32 | DECLARE lastname VARCHAR(10) DEFAULT ''; 33 | DECLARE sex CHAR(1); 34 | DECLARE score CHAR(2); 35 | WHILE rowid < num DO 36 | SET firstname = SUBSTRING(md5(rand()),1,4); 37 | SET name1 = SUBSTRING(md5(rand()),1,4); 38 | SET name2 = SUBSTRING(md5(rand()),1,4); 39 | SET sex=FLOOR(0 + (RAND() * 2)); 40 | SET score= FLOOR(40 + (RAND() *60)); 41 | SET rowid = rowid + 1; 42 | IF ROUND(RAND())=0 THEN 43 | SET lastname =name1; 44 | END IF; 45 | IF ROUND(RAND())=1 THEN 46 | SET lastname = CONCAT(name1,name2); 47 | END IF; 48 | insert INTO t_user(first_name,last_name,sex,score,copy_id) VALUES (firstname,lastname,sex,score,rowid); 49 | END WHILE; 50 | END // 51 | DELIMITER ; 52 | ``` 53 | Call a stored procedure. For example, execute the following SQL statement to call stored procedure **add_user**: 54 | 55 | ```sql 56 | call add_user(1000000); 57 | ``` 58 | 59 | Drop a stored procedure. For example, execute the following SQL statement to drop stored procedure **add_user**: 60 | 61 | ```sql 62 | drop PROCEDURE add_user; 63 | ``` 64 | -------------------------------------------------------------------------------- /docs/04-developer-guide/04-create-and-manage-database-objects/create-and-manage-table.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: create-and-manage-table 3 | sidebar_position: 5.52 4 | --- 5 | 6 | # Create and Manage a Table 7 | 8 | Create a table. For example, execute the following SQL statement to create a table which is named **student** and consists of the **id**, **name**, **age**, and **birthday** fields: 9 | 10 | ```sql 11 | create table student( 12 | id int(11) primary key, 13 | name varchar(255), 14 | age smallint, 15 | birthday DATE 16 | ) engine=stonedb; 17 | ``` 18 | 19 | Query the schema of a table. For example, execute the following SQL statement to query the schema of table **student**: 20 | 21 | ```sql 22 | show create table student\G 23 | ``` 24 | 25 | Drop a table. For example, execute the following SQL statement to drop table **student**: 26 | 27 | ```sql 28 | drop table student; 29 | ``` -------------------------------------------------------------------------------- /docs/04-developer-guide/04-create-and-manage-database-objects/create-and-manage-view.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: create-and-manage-view 3 | sidebar_position: 5.53 4 | --- 5 | 6 | # Create and Manage a View 7 | 8 | Create a view. For example, execute the following SQL statement to create a view named **v_s**, used to query teachers aged over 18: 9 | 10 | ```sql 11 | create view v_s as select name from teachers where age>18; 12 | ``` 13 | 14 | Check the statement used for creating a view. For example, execute the following SQL statement to check the statement used for creating view **v_s**: 15 | 16 | ```sql 17 | show create view v_s\G 18 | ``` 19 | 20 | Drop a view. For example, execute the following SQL statement to drop view **v_s**: 21 | 22 | ```sql 23 | drop view v_s; 24 | ``` 25 | -------------------------------------------------------------------------------- /docs/04-developer-guide/05-appendix/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 5.6, 3 | "label": "Appendix", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/04-developer-guide/05-appendix/error-codes.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: error-codes 3 | sidebar_position: 5.63 4 | --- 5 | 6 | # Error Codes 7 | 8 | This topic describes the common error codes that may be returned in StoneDB. 9 | 10 | 11 | | **Error code** | **Error message** | **Description** | 12 | | --- | --- | --- | 13 | | 2233 (HY000) | Be disgraceful to storage engine, operating is forbidden! | The error message is returned because the DDL operation is not supported. | 14 | | 1031 (HY000) | Table storage engine for 'xxx' doesn't have this option | The error message is because the DML operation is not supported. | 15 | | 1040 (HY000) | Too many connections | The error message is because the number of connections has reached the maximum number. | 16 | | 1045 (28000) | Access denied for user 'u_test'@'%' (using password: YES) | The error message is because the username or password is incorrect or the permissions are insufficient. | 17 | 18 | -------------------------------------------------------------------------------- /docs/04-developer-guide/DML-starements.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: regular-change-operations 3 | sidebar_position: 5.3 4 | --- 5 | 6 | # DML Statements 7 | 8 | This topic describes the DML statements supported by StoneDB. 9 | 10 | In this topic, table **t_test** created by executing the following statement is used in all code examples. 11 | 12 | ```sql 13 | CREATE TABLE t_test( 14 | id INT NOT NULL AUTO_INCREMENT, 15 | first_name VARCHAR(10) NOT NULL, 16 | last_name VARCHAR(10) NOT NULL, 17 | sex VARCHAR(5) NOT NULL, 18 | score INT NOT NULL, 19 | copy_id INT NOT NULL, 20 | PRIMARY KEY (`id`) 21 | ) engine=STONEDB; 22 | ``` 23 | 24 | ## INSERT 25 | ```sql 26 | insert into t_test values(1,'jack','rose','0',58,1); 27 | ``` 28 | ## UPDATE 29 | ```sql 30 | update t_test set score=200 where id=1; 31 | ``` 32 | ## INSERT INTO ... SELECT 33 | ```sql 34 | create table t_test2 like t_test; 35 | insert into t_test2 select * from t_test; 36 | ``` 37 | ## INSERT INTO ... ON DUPLICATE KEY UPDATE 38 | ```sql 39 | insert into t_test1 values(1,'Bond','Jason','1',47,10) on duplicate key update last_name='James'; 40 | ``` 41 | :::info 42 | The logic of this syntax is to insert a row of data. The UPDATE statement is executed only if a primary key constraint or unique constraint conflict occurs. 43 | ::: 44 | -------------------------------------------------------------------------------- /docs/04-developer-guide/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 5, 3 | "label": "Developer Guide", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/04-developer-guide/statements-for-queries.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: statements-for-queries 3 | sidebar_position: 5.4 4 | --- 5 | 6 | # Statements for Queries 7 | 8 | ## Statements for common queries 9 | 10 | ### UNION/UNION ALL 11 | ```sql 12 | select first_name from t_test1 13 | union all 14 | select first_name from t_test2; 15 | ``` 16 | ### DISTINCT 17 | ```sql 18 | select distinct first_name from t_test1; 19 | ``` 20 | ### LIKE 21 | ```sql 22 | select * from t_test where first_name like 'zhou%'; 23 | ``` 24 | ### GROUP BY/ORDER BY 25 | ```sql 26 | select first_name,count(*) from t_test1 group by first_name order by 2; 27 | ``` 28 | ### HAVING 29 | ```sql 30 | select e.id, count(e.id), round(avg(e.score), 2) 31 | from t_test1 e 32 | group by e.id 33 | having avg(e.score) > (select avg(score) from t_test1); 34 | ``` 35 | ## Statements used for aggregate queries 36 | ```sql 37 | select first_name,count(*) from t_test group by first_name; 38 | select sum(score) from t_test; 39 | ``` 40 | ## Statements used for pagination queries 41 | ```sql 42 | select * from t_test1 limit 10; 43 | select * from t_test1 limit 10,10; 44 | ``` 45 | ## Statements used for correlated queries 46 | ### INNER JOIN 47 | ```sql 48 | select t1.id,t1.first_name,t2.last_name from t_test1 t1,t_test2 t2 where t1.id = t2.id; 49 | ``` 50 | ### LEFT JOIN 51 | ```sql 52 | select t1.id,t1.first_name,t2.last_name from t_test1 t1 left join t_test2 t2 on t1.id = t2.id and t1.id=100; 53 | ``` 54 | ### RIGHT JOIN 55 | ```sql 56 | select t1.id,t1.first_name,t2.last_name from t_test1 t1 right join t_test2 t2 on t1.id = t2.id and t1.id=100; 57 | ``` 58 | ## Statements used for subqueries 59 | ### Statement for scalar subqueries 60 | ```sql 61 | select e.id, 62 | e.first_name, 63 | (select d.first_name from t_test2 d where d.id = e.id) as first_name 64 | from t_test1 e; 65 | ``` 66 | ### Statement for derived subqueries 67 | ```sql 68 | select a.first_name, b.last_name 69 | from t_test1 a, (select id,last_name from t_test2) b 70 | where a.id = b.id; 71 | ``` 72 | ### IN/NOT IN 73 | ```sql 74 | select * from t_test1 where id in(select id from t_test2); 75 | ``` 76 | ### EXISTS/NOT EXISTS 77 | ```sql 78 | select * from t_test1 A where exists (select 1 from t_test2 B where B.id = A.id); 79 | ``` 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /docs/05-SQL-reference/03-operators/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 6.3, 3 | "label": "Operators", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/05-SQL-reference/03-operators/arithmetic-operators.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: arithmetic-operators 3 | sidebar_position: 6.31 4 | --- 5 | 6 | # Arithmetic Operators 7 | 8 | This topic describes the arithmetic operators supported by StoneDB. 9 | 10 | | **Operator** | **Description** | 11 | | --- | --- | 12 | | `+` | Addition operator | 13 | | `-` | Minus operator | 14 | | `*` | Multiplication operator | 15 | | `/`, `div` | Division operator | 16 | | `%`, `mod` | Modulo operator | 17 | 18 | The following code provides an example of using each operator. 19 | 20 | ```sql 21 | > select 10+2 from dual; 22 | +------+ 23 | | 10+2 | 24 | +------+ 25 | | 12 | 26 | +------+ 27 | 1 row in set (0.00 sec) 28 | 29 | > select 10-2 from dual; 30 | +------+ 31 | | 10-2 | 32 | +------+ 33 | | 8 | 34 | +------+ 35 | 1 row in set (0.00 sec) 36 | 37 | > select 10*2 from dual; 38 | +------+ 39 | | 10*2 | 40 | +------+ 41 | | 20 | 42 | +------+ 43 | 1 row in set (0.00 sec) 44 | 45 | > select 10/2 from dual; 46 | +--------+ 47 | | 10/2 | 48 | +--------+ 49 | | 5.0000 | 50 | +--------+ 51 | 1 row in set (0.00 sec) 52 | 53 | > select 10 div 2 from dual; 54 | +----------+ 55 | | 10 div 2 | 56 | +----------+ 57 | | 5 | 58 | +----------+ 59 | 1 row in set (0.00 sec) 60 | 61 | > select 10 mod 3 from dual; 62 | +----------+ 63 | | 10 mod 3 | 64 | +----------+ 65 | | 1 | 66 | +----------+ 67 | 1 row in set (0.00 sec) 68 | 69 | > select 10 % 3 from dual; 70 | +--------+ 71 | | 10 % 3 | 72 | +--------+ 73 | | 1 | 74 | +--------+ 75 | 1 row in set (0.00 sec) 76 | 77 | > select 10 mod 0 from dual; 78 | +----------+ 79 | | 10 mod 0 | 80 | +----------+ 81 | | NULL | 82 | +----------+ 83 | 1 row in set (0.00 sec) 84 | 85 | > select 10 / 0 from dual; 86 | +--------+ 87 | | 10 / 0 | 88 | +--------+ 89 | | NULL | 90 | +--------+ 91 | 1 row in set (0.00 sec) 92 | ``` 93 | :::tip 94 | If the divisor is 0 in a division operation or a modulo operation, the operation is invalid and NULL is returned. 95 | ::: 96 | -------------------------------------------------------------------------------- /docs/05-SQL-reference/03-operators/assignment-operators.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: assignment-operators 3 | sidebar_position: 6.35 4 | --- 5 | 6 | # Assignment Operators 7 | 8 | In the SET clause of an UPDATE statement, the equal sign (`=`) functions as an assignment operator. In this case, the value on the right side of the operator is assigned to the variable on the right side, provided that any WHERE conditions specified in the UPDATE statement are met. 9 | 10 | The following code provides an example. 11 | 12 | ```sql 13 | mysql> select * from t; 14 | +------+------+ 15 | | col1 | col2 | 16 | +------+------+ 17 | | 100 | 100 | 18 | +------+------+ 19 | 1 row in set (0.00 sec) 20 | 21 | mysql> update t set col1=col1+100,col2=col1+100; 22 | Query OK, 1 row affected (0.00 sec) 23 | Rows matched: 1 Changed: 1 Warnings: 0 24 | 25 | mysql> select * from t; 26 | +------+------+ 27 | | col1 | col2 | 28 | +------+------+ 29 | | 200 | 300 | 30 | +------+------+ 31 | 1 row in set (0.00 sec) 32 | ``` -------------------------------------------------------------------------------- /docs/05-SQL-reference/03-operators/bitwise-operators.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: bitwise-operators 3 | sidebar_position: 6.32 4 | --- 5 | 6 | # Bitwise Operators 7 | 8 | This topic describes the bitwise operators supported by StoneDB. 9 | 10 | | **Operator** | **Description** | 11 | | --- | --- | 12 | | `&` | Bitwise AND | 13 | | | | Bitwise OR | 14 | | `^` | Bitwise XOR | 15 | | `!` | Bitwise inversion | 16 | | `<<` | Left shift | 17 | | `>>` | Right shift | 18 | 19 | Bitwise operators are used to operate on binary numbers. In a bitwise operation, the involved numbers are first converted to binary numbers to compute the result, and then the result is converted back to a decimal value. 20 | 21 | The following code provides an example of using each operator. 22 | 23 | ```sql 24 | > select 3&5; 25 | +-----+ 26 | | 3&5 | 27 | +-----+ 28 | | 1 | 29 | +-----+ 30 | 1 row in set (0.00 sec) 31 | 32 | > select 3|5; 33 | +-----+ 34 | | 3|5 | 35 | +-----+ 36 | | 7 | 37 | +-----+ 38 | 1 row in set (0.00 sec) 39 | 40 | > select 3^5; 41 | +-----+ 42 | | 3^5 | 43 | +-----+ 44 | | 6 | 45 | +-----+ 46 | 1 row in set (0.00 sec) 47 | 48 | > select ~18446744073709551612; 49 | +-----------------------+ 50 | | ~18446744073709551612 | 51 | +-----------------------+ 52 | | 3 | 53 | +-----------------------+ 54 | 1 row in set (0.00 sec) 55 | 56 | > select 3>>1; 57 | +------+ 58 | | 3>>1 | 59 | +------+ 60 | | 1 | 61 | +------+ 62 | 1 row in set (0.00 sec) 63 | 64 | > select 3<<1; 65 | +------+ 66 | | 3<<1 | 67 | +------+ 68 | | 6 | 69 | +------+ 70 | 1 row in set (0.00 sec) 71 | ``` -------------------------------------------------------------------------------- /docs/05-SQL-reference/03-operators/comparison-operators.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: comparison-operators 3 | sidebar_position: 6.33 4 | --- 5 | 6 | # Comparison Operators 7 | 8 | This topic describes the comparison operators supported StoneDB. 9 | 10 | | **Operator** | **Description** | 11 | | --- | --- | 12 | | `=` | Equal operator | 13 | | `>` | Greater than operator | 14 | | `<` | Less than operator | 15 | | `>=` | Greater than or equal operator | 16 | | `<=` | Less than or equal operator | 17 | | `!=`, `<>` | Not equal operator | 18 | | `<=>` | NULL-safe equal operator | 19 | | `BETWEEN… AND…` | Whether a value is within a value range | 20 | | `IN` | Whether a value is within a set of values | 21 | | `NOT IN` | Whether a value is not within a set of values | 22 | | `LIKE` | Simple pattern matching | 23 | | `regexp` | Regular expression | 24 | | `IS NULL` | NULL value test | 25 | | `IS NOT NULL` | NOT NULL value test | 26 | 27 | The following code provides an example of using each operator. 28 | 29 | ```sql 30 | > select 2=3; 31 | +-----+ 32 | | 2=3 | 33 | +-----+ 34 | | 0 | 35 | +-----+ 36 | 1 row in set (0.00 sec) 37 | 38 | > select 2>3; 39 | +-----+ 40 | | 2>3 | 41 | +-----+ 42 | | 0 | 43 | +-----+ 44 | 1 row in set (0.00 sec) 45 | 46 | > select 2<3; 47 | +-----+ 48 | | 2<3 | 49 | +-----+ 50 | | 1 | 51 | +-----+ 52 | 1 row in set (0.00 sec) 53 | 54 | > select 2>=3; 55 | +------+ 56 | | 2>=3 | 57 | +------+ 58 | | 0 | 59 | +------+ 60 | 1 row in set (0.00 sec) 61 | 62 | > select 2<=3; 63 | +------+ 64 | | 2<=3 | 65 | +------+ 66 | | 1 | 67 | +------+ 68 | 1 row in set (0.00 sec) 69 | 70 | > select 2<>3; 71 | +------+ 72 | | 2<>3 | 73 | +------+ 74 | | 1 | 75 | +------+ 76 | 1 row in set (0.00 sec) 77 | 78 | > select 2<=>3; 79 | +-------+ 80 | | 2<=>3 | 81 | +-------+ 82 | | 0 | 83 | +-------+ 84 | 1 row in set (0.01 sec) 85 | 86 | > select 5 between 1 and 10; 87 | +--------------------+ 88 | | 5 between 1 and 10 | 89 | +--------------------+ 90 | | 1 | 91 | +--------------------+ 92 | 1 row in set (0.00 sec) 93 | 94 | > select 5 in (1,2,3,4,5); 95 | +------------------+ 96 | | 5 in (1,2,3,4,5) | 97 | +------------------+ 98 | | 1 | 99 | +------------------+ 100 | 1 row in set (0.00 sec) 101 | 102 | > select 5 not in (1,2,3,4,5); 103 | +----------------------+ 104 | | 5 not in (1,2,3,4,5) | 105 | +----------------------+ 106 | | 0 | 107 | +----------------------+ 108 | 1 row in set (0.00 sec) 109 | 110 | > select '12345' like '12%'; 111 | +--------------------+ 112 | | '12345' like '12%' | 113 | +--------------------+ 114 | | 1 | 115 | +--------------------+ 116 | 1 row in set (0.00 sec) 117 | 118 | > select 'beijing' REGEXP 'jing'; 119 | +-------------------------+ 120 | | 'beijing' REGEXP 'jing' | 121 | +-------------------------+ 122 | | 1 | 123 | +-------------------------+ 124 | 1 row in set (0.00 sec) 125 | 126 | > select 'beijing' REGEXP 'xi'; 127 | +-----------------------+ 128 | | 'beijing' REGEXP 'xi' | 129 | +-----------------------+ 130 | | 0 | 131 | +-----------------------+ 132 | 1 row in set (0.00 sec) 133 | 134 | > select 'a' is NULL; 135 | +-------------+ 136 | | 'a' is NULL | 137 | +-------------+ 138 | | 0 | 139 | +-------------+ 140 | 1 row in set (0.00 sec) 141 | 142 | > select 'a' IS NOT NULL; 143 | +-----------------+ 144 | | 'a' IS NOT NULL | 145 | +-----------------+ 146 | | 1 | 147 | +-----------------+ 148 | 1 row in set (0.00 sec) 149 | ``` -------------------------------------------------------------------------------- /docs/05-SQL-reference/03-operators/logical-operators.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: logical-operators 3 | sidebar_position: 6.34 4 | --- 5 | 6 | # Logical Operators 7 | 8 | This topic describes the logical operators supported by StoneDB. 9 | 10 | | **Operator** | **Description** | 11 | | --- | --- | 12 | | NOT | Logical NOT | 13 | | AND | Logical AND | 14 | | OR | Logical OR | 15 | | XOR | Logical XOR | 16 | 17 | The following code provides an example of using each operator. 18 | 19 | ```sql 20 | > select not 1; 21 | +-------+ 22 | | not 1 | 23 | +-------+ 24 | | 0 | 25 | +-------+ 26 | 1 row in set (0.00 sec) 27 | 28 | > select !0; 29 | +----+ 30 | | !0 | 31 | +----+ 32 | | 1 | 33 | +----+ 34 | 1 row in set (0.00 sec) 35 | 36 | > select 2 and 0; 37 | +---------+ 38 | | 2 and 0 | 39 | +---------+ 40 | | 0 | 41 | +---------+ 42 | 1 row in set (0.00 sec) 43 | 44 | > select 2 and 1; 45 | +---------+ 46 | | 2 and 1 | 47 | +---------+ 48 | | 1 | 49 | +---------+ 50 | 1 row in set (0.00 sec) 51 | 52 | > select 2 or 0; 53 | +--------+ 54 | | 2 or 0 | 55 | +--------+ 56 | | 1 | 57 | +--------+ 58 | 1 row in set (0.00 sec) 59 | 60 | > select 2 or 1; 61 | +--------+ 62 | | 2 or 1 | 63 | +--------+ 64 | | 1 | 65 | +--------+ 66 | 1 row in set (0.00 sec) 67 | 68 | > select 1 xor 1; 69 | +---------+ 70 | | 1 xor 1 | 71 | +---------+ 72 | | 0 | 73 | +---------+ 74 | 1 row in set (0.00 sec) 75 | 76 | > select 0 xor 0; 77 | +---------+ 78 | | 0 xor 0 | 79 | +---------+ 80 | | 0 | 81 | +---------+ 82 | 1 row in set (0.00 sec) 83 | 84 | > select 1 xor 0; 85 | +---------+ 86 | | 1 xor 0 | 87 | +---------+ 88 | | 1 | 89 | +---------+ 90 | 1 row in set (0.00 sec) 91 | 92 | > select null or 1; 93 | +-----------+ 94 | | null or 1 | 95 | +-----------+ 96 | | 1 | 97 | +-----------+ 98 | 1 row in set (0.00 sec) 99 | ``` -------------------------------------------------------------------------------- /docs/05-SQL-reference/04-functions/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 6.4, 3 | "label": "Functions", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/05-SQL-reference/04-functions/advanced-functions.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: advanced-functions 3 | sidebar_position: 6.44 4 | --- 5 | 6 | # Advanced Functions -------------------------------------------------------------------------------- /docs/05-SQL-reference/04-functions/aggregate-functions.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: aggregate-functions 3 | sidebar_position: 6.45 4 | --- 5 | 6 | # Aggregate Functions -------------------------------------------------------------------------------- /docs/05-SQL-reference/04-functions/date-and-time-functions.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: date-and-time-functions 3 | sidebar_position: 6.41 4 | --- 5 | 6 | # Date and Time Functions -------------------------------------------------------------------------------- /docs/05-SQL-reference/04-functions/mathematical-functions.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: mathematical-functions 3 | sidebar_position: 6.43 4 | --- 5 | 6 | # Mathematical Functions -------------------------------------------------------------------------------- /docs/05-SQL-reference/04-functions/string-functions.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: string-functions 3 | sidebar_position: 6.42 4 | --- 5 | 6 | # String Functions -------------------------------------------------------------------------------- /docs/05-SQL-reference/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 6, 3 | "label": "SQL Reference", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/05-SQL-reference/data-types.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: data-types 3 | sidebar_position: 6.2 4 | --- 5 | 6 | # Data Types 7 | 8 | The following table lists the data types supported by StoneDB. 9 | 10 | | **Category** | **Data type** | 11 | | --- | --- | 12 | | Integer | TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT | 13 | | Floating point | FLOAT, DOUBLE | 14 | | Fixed point | DECIMAL | 15 | | Date and time | YEAR, TIME, DATE, DATETIME, TIMESTAMP | 16 | | String | CHAR, VARCHAR, TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT | 17 | | Binary string | BINARY, VARBINARY, TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB | 18 | 19 | :::caution 20 | 21 | When you create a StoneDB table, do not include keyword **unsigned** or **zerofill**. 22 | 23 | ::: 24 | 25 | 26 | ## Integer data types 27 | The following table provides the value range of each integer data type. 28 | 29 | | **Data type** | **Bytes of storage** | **Min. value** | **Max. value** | 30 | | --- | --- | --- | --- | 31 | | TINYINT | 1 | -128 | 127 | 32 | | SMALLINT | 2 | -32768 | 32767 | 33 | | MEDIUMINT | 3 | -8388608 | 8388607 | 34 | | INT | 4 | -2147483647 | 2147483647 | 35 | | BIGINT | 8 | -9223372036854775808 | 9223372036854775807 | 36 | 37 | On StoneDB, the precision for DECIMAL numbers cannot be higher than 18. For example, if you specify **decimal(19)** in your code, an error will be reported. **DECIMAL(6, 2)** indicates that up to 6 places are supported at the left of the decimal and up to 2 at the right, and thus the value range is [-9999.99, 9999.99]. 38 | 39 | ## String data types 40 | The storage required for a string varies according to the character set in use. The length range also differs. The following table describes the length range of each string data type when character set latin1 is in use. 41 | 42 | | **Data type** | **Size** | 43 | | --- | --- | 44 | | CHAR(M) | [0,255] | 45 | | VARCHAR(M) | [0,65535] | 46 | | TINYTEXT | [0,255] | 47 | | TEXT | [0,65535] | 48 | | MEDIUMTEXT | [0,16777215] | 49 | | LONGTEXT | [0,4294967295] | 50 | 51 | ## Date and time data types 52 | The following table describes the value range of each date and time data type. 53 | 54 | | **Data type** | **Format** | **Min. value** | **Max. value** | 55 | | --- | --- | --- | --- | 56 | | YEAR | YYYY | 1901 | 2155 | 57 | | TIME | HH:MM:SS | -838:59:59 | 838:59:59 | 58 | | DATE | YYYY-MM-DD | 0001-01-01 | 9999-12-31 | 59 | | DATETIME | YYYY-MM-DD HH:MM:SS | 0001-01-01 00:00:00 | 9999-12-31 23:59:59 | 60 | | TIMESTAMP | YYYY-MM-DD HH:MM:SS | 1970-01-01 08:00:01 | 2038-01-19 11:14:07 | 61 | -------------------------------------------------------------------------------- /docs/06-performance-tuning/02-performance-monitoring-commands/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 7.2, 3 | "label": "Performance Monitoring Commands", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/06-performance-tuning/02-performance-monitoring-commands/cpu-monitor.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: cpu-monitor 3 | sidebar_position: 7.22 4 | --- 5 | 6 | # Commands for CPU Monitoring -------------------------------------------------------------------------------- /docs/06-performance-tuning/02-performance-monitoring-commands/disk-io-monitor.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: disk-io-monitor 3 | sidebar_position: 7.24 4 | --- 5 | 6 | # Commands for I/O Monitoring 7 | 8 | This topic describes common commands used for I/O monitoring. 9 | ## iostat 10 | The `iostat` command is used to monitor the performance of system I/O devices. 11 | 12 | Command output example: 13 | 14 | ```shell 15 | # iostat -x 1 1 16 | Linux 3.10.0-957.el7.x86_64 (htap2) 06/13/2022 _x86_64_ (64 CPU) 17 | 18 | avg-cpu: %user %nice %system %iowait %steal %idle 19 | 0.06 0.00 0.03 0.01 0.00 99.90 20 | 21 | Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util 22 | sda 0.00 0.00 0.00 0.00 0.04 0.00 85.75 0.00 0.25 0.25 0.00 0.15 0.00 23 | sdb 0.06 0.11 7.61 1.10 1849.41 50.81 436.48 0.36 40.93 46.75 0.48 1.56 1.35 24 | dm-0 0.00 0.00 0.28 0.19 8.25 12.05 87.01 0.00 4.81 7.37 0.94 1.61 0.08 25 | ``` 26 | Parameter description: 27 | 28 | | **Parameter** | **Description** | 29 | | --- | --- | 30 | | rrqm/s | The number of read requests merged per second. | 31 | | wrqm/s | The number of write requests merged per second. | 32 | | r/s | The number (after merges) of read requests completed per second. | 33 | | w/s | The number (after merges) of write requests completed per second. | 34 | | rkB/s | The number of kilobytes read per second. | 35 | | wkB/s | The number of kilobytes written per second. | 36 | | avgrq-sz | The average size of the requests, expressed in sectors (512 bytes). | 37 | | avgqu-sz | The average queue length of the I/O requests. | 38 | | await | The average time for I/O requests to be served. | 39 | | r_await | The average time for read requests to be served. | 40 | | w_await | The average time for write requests to be served. | 41 | | svctm | The average service time for I/O requests. | 42 | | %util | The percentage of CPU time spent on I/O requests. | 43 | 44 | ## dstat 45 | 46 | The `dstat` command is used to collect performance statistics about CPUs and I/O devices. 47 | 48 | Command output example: 49 | 50 | ```shell 51 | # dstat 1 5 52 | --total-cpu-usage-- -dsk/total- -net/total- ---paging-- ---system-- 53 | usr sys idl wai stl| read writ| recv send| in out | int csw 54 | 0 0 99 0 0|9133B 1260k| 0 0 | 0 5B|1059 1009 55 | 2 0 98 0 0| 0 212k| 572B 2258B| 0 0 |1099 761 56 | 2 0 98 0 0| 0 0 | 320B 1456B| 0 0 | 919 674 57 | 2 0 98 0 0| 0 0 | 256B 1448B| 0 0 | 949 665 58 | 2 0 98 0 0| 0 0 |1366B 2190B| 0 0 |1031 812 59 | ``` 60 | 61 | Parameter description: 62 | 63 | | **Parameter** | **Description** | 64 | | --- | --- | 65 | | usr | The percentage of CPU time spent in running user space processes. | 66 | | sys | The percentage of CPU time spent in running system processes. | 67 | | idl | The percentage of CPU time spent idle. | 68 | | wai | The percentage of CPU time spent in wait. | 69 | | stl | The percentage of CPU time spent on the hypervisor. | 70 | | read | The number of read requests completed per second. | 71 | | writ | The number of write requests completed per second. | 72 | | recv | The number of packets received per second. | 73 | | send | The number of packets sent per second. | 74 | | in | The number of times information is copied into memory. | 75 | | out | The number of times information is moved out of memory. | 76 | | int | The number of interruptions occurred per second. | 77 | | csw | The number of context switchover per second. | -------------------------------------------------------------------------------- /docs/06-performance-tuning/02-performance-monitoring-commands/mem-monitor.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: mem-monitor 3 | sidebar_position: 7.23 4 | --- 5 | # Command for Memory Monitoring 6 | 7 | The `free` command can be used to monitor memory usage. 8 | 9 | Command output example: 10 | 11 | ```shell 12 | # free -g 13 | total used free shared buff/cache available 14 | Mem: 251 44 1 0 205 205 15 | Swap: 7 0 7 16 | ``` 17 | 18 | Parameter description: 19 | 20 | | **Parameter** | **Description** | 21 | | --- | --- | 22 | | total | The amount of memory.
**total** = **used** + **free** + **buff/cache** | 23 | | used | The amount of used memory. | 24 | | free | The amount of free memory. | 25 | | shared | The amount of shared memory. | 26 | | buff/cache | The amount of memory used as buffers and cache. | 27 | | available | The amount of available memory.
**available** = **free** + **buff/cache** | -------------------------------------------------------------------------------- /docs/06-performance-tuning/02-performance-monitoring-commands/network-monitor.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: network-monitor 3 | sidebar_position: 7.25 4 | --- 5 | # Command for Network Monitoring 6 | 7 | The topic describes the `netstat` command that is used to monitor network status. 8 | 9 | Command output example: 10 | ```shell 11 | # netstat -i 12 | Kernel Interface table 13 | Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg 14 | docker0 1500 70712 0 0 0 131086 0 0 0 BMRU 15 | eno1 1500 124457829 0 101794 0 57907365 0 0 0 BMRU 16 | eno2 1500 0 0 0 0 0 0 0 0 BMU 17 | eno3 1500 0 0 0 0 0 0 0 0 BMU 18 | eno4 1500 0 0 0 0 0 0 0 0 BMU 19 | enp130s0 1500 0 0 0 0 0 0 0 0 BMU 20 | lo 65536 1123 0 0 0 1123 0 0 0 LRU 21 | vethed74 1500 269 0 0 0 407 0 0 0 BMRU 22 | ``` 23 | Parameter description: 24 | 25 | | **Parameter** | **Description** | 26 | | --- | --- | 27 | | Iface | The name of the network adapter. | 28 | | MTU | The maximum transmission unit. Default value: 1500. | 29 | | OK | The number of error-free packets. | 30 | | ERR | The number of damaged packets. | 31 | | DRP | The number of dropped packets. | 32 | | OVR | The number of packets that exceeds the threshold. | 33 | | Flg | The flag set for the interface. The value can be:
- **B**: A broadcast address is configured.
- **L**: The interface is a loopback device.
- **M**: All packets are received.
- **R**: The interface is running.
- **U**: The interface is active.
| 34 | 35 | :::info 36 | **RX** indicates received. **TX** indicates sent. 37 | ::: -------------------------------------------------------------------------------- /docs/06-performance-tuning/02-performance-monitoring-commands/top-commands.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: top-commands 3 | sidebar_position: 7.21 4 | --- 5 | 6 | # The top command -------------------------------------------------------------------------------- /docs/06-performance-tuning/04-database-tuning/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 7.4, 3 | "label": "Database Tuning", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/06-performance-tuning/04-database-tuning/parameter-tuning.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: parameter-tuning 3 | sidebar_position: 7.43 4 | --- 5 | 6 | # Database parameter tuning -------------------------------------------------------------------------------- /docs/06-performance-tuning/04-database-tuning/sql-best-practices.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: sql-best-practices 3 | sidebar_position: 7.41 4 | --- 5 | 6 | # Best Practices for SQL Coding -------------------------------------------------------------------------------- /docs/06-performance-tuning/04-database-tuning/sql-tuning.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: sql-tuning 3 | sidebar_position: 7.42 4 | --- 5 | 6 | # Optimize SQL Statements -------------------------------------------------------------------------------- /docs/06-performance-tuning/05-architecture-tuning/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 7.5, 3 | "label": "Architecture Tuning", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/06-performance-tuning/05-architecture-tuning/read_write-splitting.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: read_write-splitting 3 | sidebar_position: 7.51 4 | --- 5 | 6 | # Read/Write Splitting -------------------------------------------------------------------------------- /docs/06-performance-tuning/06-performance-tests/00-OLAP/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 7.61, 3 | "label": "OLAP", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/06-performance-tuning/06-performance-tests/00-OLAP/olap-performance-test-method.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: olap-performance-test-method 3 | sidebar_position: 7.611 4 | --- 5 | 6 | # OLAP Performance Test Method -------------------------------------------------------------------------------- /docs/06-performance-tuning/06-performance-tests/00-OLAP/tcph-test-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: tcph-test-report 3 | sidebar_position: 7.612 4 | --- 5 | 6 | # TCP-H Test Report -------------------------------------------------------------------------------- /docs/06-performance-tuning/06-performance-tests/01-OLTP/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 7.62, 3 | "label": "OLTP", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/06-performance-tuning/06-performance-tests/01-OLTP/oltp-performance-test-method.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: oltp-performance-test-method 3 | sidebar_position: 7.621 4 | --- 5 | 6 | # OLTP Performance Test Method -------------------------------------------------------------------------------- /docs/06-performance-tuning/06-performance-tests/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 7.6, 3 | "label": "Performance Tests", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/06-performance-tuning/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 7, 3 | "label": "Performance Tuning", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/06-performance-tuning/os-tuning.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: os-tuning 3 | sidebar_position: 7.3 4 | --- 5 | 6 | # OS Tuning -------------------------------------------------------------------------------- /docs/06-performance-tuning/overview.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: overview 3 | sidebar_position: 7.1 4 | --- 5 | 6 | # Overview -------------------------------------------------------------------------------- /docs/07-data-migration-to-stonedb/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 8, 3 | "label": "Data Migration to StoneDB", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/07-data-migration-to-stonedb/use-otter-to-migrate.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: use-outter-to-migrate 3 | sidebar_position: 8.1 4 | --- 5 | 6 | # Use Outter to Migrate Data to StoneDB 7 | 8 | -------------------------------------------------------------------------------- /docs/08-troubleshooting/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 9, 3 | "label": "Troubleshooting", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/08-troubleshooting/excessive-large-directory.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: excessive-large-directory 3 | sidebar_position: 9.2 4 | --- 5 | 6 | # Excessively Large Data Directory 7 | 8 | The data directory contains data files, binlogs, and error logs. If the data directory is run out of capacity, the database will be suspended and cannot provide services. To prevent this issue, monitoring on capacity usage must be strengthened in routine maintenance. This topic describes common causes of this issue. 9 | ## Big transactions 10 | If big transactions exist, a large amount of binlogs are generated. If the binlog cache is insufficient, excessive binlogs will be temporarily stored to temporary files on disks. Big transactions not only occupy too much disk space, but result in long primary/secondary replication latency. Therefore, we recommend that you split each big transactions into multiple small transactions in your production environment. 11 | ## CARTESIAN JOIN 12 | When SQL statements do not strictly follow syntaxes, for example, no condition is specified during table association, Cartesian products are generated. If the tables to associate are large, the table space will be used up. Therefore, we recommend that you check the execution plan each time you finish writing an SQL statement. If "Using join buffer (Block Nested Loop)" exists in the execution plan, check the two associated tables to see whether the association condition of the driven table is not indexed or no association condition exists. 13 | 14 | :::info 15 | You can start StoneDB to release the temporary table space. 16 | ::: 17 | ## Subqueries and grouped orderings 18 | Subqueries and grouped orderings use temporary tables to cache intermediate result sets. If the temporary files run out of space, the intermediate result sets will be temporarily stored to temporary files on disks. 19 | -------------------------------------------------------------------------------- /docs/08-troubleshooting/failed-to-connect.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: failed-to-connect 3 | sidebar_position: 9.7 4 | --- 5 | 6 | # Failed to Connect to StoneDB -------------------------------------------------------------------------------- /docs/08-troubleshooting/failed-to-operate-table.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: failed-to-operate-table 3 | sidebar_position: 9.5 4 | --- 5 | 6 | # Failed to Operate on Data in StoneDB Tables -------------------------------------------------------------------------------- /docs/08-troubleshooting/failed-to-start-in-kvm.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: failed-to-start-in-kvm 3 | sidebar_position: 9.6 4 | --- 5 | 6 | # Failed to Start StoneDB in a KVM -------------------------------------------------------------------------------- /docs/08-troubleshooting/failed-to-start.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: failed-to-start 3 | sidebar_position: 9.1 4 | --- 5 | 6 | # Failed to Start StoneDB 7 | 8 | Many issues will cause start failures of StoneDB. If StoneDB cannot be started, we recommend you check whether any error information is recorded in **mysqld.log**. This topic describes common causes of a start failure of StoneDB. 9 | ## Improper parameter settings 10 | If the failure is caused by improper parameter settings, check **mysqld.log** to see which parameters are improperly configured. 11 | 12 | The following example indicates that parameter **datadir** is improperly configured. 13 | 14 | ```bash 15 | [ERROR] failed to set datadir to /stonedb/install/dataxxx/ 16 | ``` 17 | ## Denial to access resources 18 | If the port is occupied, the directory owner is incorrect, or the permission on the directory is insufficient, you cannot access the directory. 19 | ```bash 20 | Error: unable to create temporary file; errno: 13 21 | ``` 22 | ## Damaged data pages 23 | If a relevant data page is damaged, StoneDB cannot be started. In this case, you must restore the data page from a backup. 24 | -------------------------------------------------------------------------------- /docs/08-troubleshooting/mdl-wait.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: mdl-wait 3 | sidebar_position: 9.3 4 | --- 5 | 6 | # Metadata Lock Waits -------------------------------------------------------------------------------- /docs/08-troubleshooting/resource-bottleneck.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: resource-bottleneck 3 | sidebar_position: 9.9 4 | --- 5 | 6 | # Diagnose System Resource Bottlenecks -------------------------------------------------------------------------------- /docs/08-troubleshooting/slow-query.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: slow-query 3 | sidebar_position: 9.8 4 | --- 5 | 6 | # Diagnose Slow SQL Queries -------------------------------------------------------------------------------- /docs/08-troubleshooting/stonedb-crashed.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: stonedb-crashed 3 | sidebar_position: 9.4 4 | --- 5 | 6 | # StoneDB Crashed -------------------------------------------------------------------------------- /docs/09-FAQ/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "position": 10, 3 | "label": "FAQ", 4 | "collapsible": true 5 | } -------------------------------------------------------------------------------- /docs/09-FAQ/install-faq.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: install-faq 3 | sidebar_position: 10.1 4 | --- 5 | 6 | # Installation FAQ -------------------------------------------------------------------------------- /docs/09-FAQ/stonedb-faq.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: stonedb-faq 3 | sidebar_position: 10.2 4 | --- 5 | 6 | # StoneDB FAQ -------------------------------------------------------------------------------- /docs/09-FAQ/troubleshoot-faq.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: troubleshoot-faq 3 | sidebar_position: 10.3 4 | --- 5 | 6 | # Other FAQ -------------------------------------------------------------------------------- /docs/download.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: download 3 | sidebar_position: 100 4 | --- 5 | 6 | # Downloads 7 | 8 | ## StoneDB 9 | 10 | Click here to download the latest installation package of StoneDB. 11 | 12 | | Version | Release Date | Installation Package | MD5 | 13 | | --- | --- | --- | --- | 14 | | 1.0 | 2022-6-29 | [Download](https://static.stoneatom.com/stonedb-ce-5.6-v1.0.0.el7.x86_64.tar.gz) | 831f5799034fbb388f6ff26675b7951e | 15 | | Next Version | Coming soon~ | | 16 | 17 | -------------------------------------------------------------------------------- /docs/release-notes.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: release-notes 3 | sidebar_position: 11.0 4 | --- 5 | 6 | # Release Notes 7 | 8 | Release time: June 30, 2022 9 | 10 | -------------------------------------------------------------------------------- /i18n/zh/docusaurus-plugin-content-blog-community/main.md: -------------------------------------------------------------------------------- 1 | ## 社区 {#community} 2 | StoneDB 社区由用户、贡献者和社区独有的文化所组成。他们将我们的社区团结起来,激发了许多新想法的诞生与社区成员间的协作和学习。StoneDB 是一个开放且活跃的社区,我们鼓励社区成员提交 issue 和 PR、向外宣传 StoneDB,并做出其他有利他人的贡献。 3 | 4 | 请继续往下阅读,了解你可以如何参与并成为 StoneDB 社区的一份子。 5 | 6 | ## 贡献团队 {#team} 7 | ```custom-teamList 8 | - ![RingsC](https://avatars.githubusercontent.com/u/5336722?v=4 "title:RingsC,to://github.com/ringsc") 9 | - ![hustjieke](https://avatars.githubusercontent.com/u/18331104?v=4 "title:hustjieke,to://github.com/hustjieke") 10 | - ![dupeiliang](https://avatars.githubusercontent.com/u/39800914?v=4 "title:dupeiliang,to://github.com/dupeiliang") 11 | - ![SPzhang](https://avatars.githubusercontent.com/u/31213457?v=4 "title:SPzhang,to://github.com/zsp108") 12 | - ![CodingSuen](https://avatars.githubusercontent.com/u/69141572?v=4 "title:CodingSuen,to://github.com/CodingSuen") 13 | - ![jun-lihaijun](https://avatars.githubusercontent.com/u/103155258?v=4 "title:jun-lihaijun,to://github.com/jun-lihaijun") 14 | - ![XueDong-Chen](https://avatars.githubusercontent.com/u/34465107?v=4 "title:XueDong-Chen,to://github.com/XueDong-Chen") 15 | - ![zhx8817](https://avatars.githubusercontent.com/u/63028664?v=4 "title:zhx8817,to://github.com/zhx8817") 16 | - ![konghaiya](https://avatars.githubusercontent.com/u/106147765?v=4 "title:konghaiya,to://github.com/konghaiya") 17 | - ![Nliver](https://avatars.githubusercontent.com/u/34496563?v=4 "title:Nliver,to://github.com/Nliver") 18 | - ![Yeekin-](https://avatars.githubusercontent.com/u/101704468?v=4 "title:Yeekin-,to://github.com/Yeekin-GYJ") 19 | - ![MaJun](https://avatars.githubusercontent.com/u/64419837?v=4 "title:MaJun,to://github.com/leizzboy") 20 | - ![LuiciferYi](https://avatars.githubusercontent.com/u/24913493?v=4 "title:LuiciferYi,to://github.com/LuiciferYi") 21 | - ![litaihong](https://avatars.githubusercontent.com/u/79444526?v=4 "title:litaihong,to://github.com/lylth") 22 | - ![haitaoguan](https://avatars.githubusercontent.com/u/105625912?v=4 "title:haitaoguan,to://github.com/haitaoguan") 23 | ``` 24 | 25 | 26 | ## 加入社区 {#join} 27 | ```custom-joinList 28 | - [Github Discussion](https://github.com/stoneatom/stonedb-docs/discussions "icon:icon-a-bianzu16beifen1") 29 | - [Slack Channel](https://stonedb.slack.com/join/shared_invite/zt-1ba2lpvbo-Vqq62DJcxViyxCZmp7Rimw#/shared-invite/email "icon:icon-a-bianzu18beifen2") 30 | - [Reddit](https://www.reddit.com/user/StoneDBTeam "icon:icon-a-bianzu3") 31 | - [新浪微博](https://weibo.com/u/7756824587 "icon:icon-a-bianzu31,local:zh") 32 | - [Twitter](https://twitter.com/StoneDB2022 "icon:icon-a-bianzu2") 33 | ``` 34 | 35 | 36 | 46 | 47 | ```custom-subscribe 48 | ``` 49 | 50 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /i18n/zh/docusaurus-plugin-content-blog-community/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": { 3 | "message": "Blog", 4 | "description": "The title for the blog used in SEO" 5 | }, 6 | "description": { 7 | "message": "Blog", 8 | "description": "The description for the blog used in SEO" 9 | }, 10 | "sidebar.title": { 11 | "message": "Recent posts", 12 | "description": "The label for the left sidebar" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /i18n/zh/docusaurus-plugin-content-blog/options.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": { 3 | "message": "Blog", 4 | "description": "The title for the blog used in SEO" 5 | }, 6 | "description": { 7 | "message": "Blog", 8 | "description": "The description for the blog used in SEO" 9 | }, 10 | "sidebar.title": { 11 | "message": "Recent posts", 12 | "description": "The label for the left sidebar" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /i18n/zh/docusaurus-plugin-content-docs/current.json: -------------------------------------------------------------------------------- 1 | { 2 | "version.label": { 3 | "message": "Next", 4 | "description": "The label for version current" 5 | }, 6 | "sidebar.autoSidebar.category.About StoneDB": { 7 | "message": "关于StoneDB", 8 | "description": "The label for category About StoneDB in sidebar autoSidebar" 9 | }, 10 | "sidebar.autoSidebar.category.Environment Requirements": { 11 | "message": "环境要求", 12 | "description": "The label for category Environment Requirements in sidebar autoSidebar" 13 | }, 14 | "sidebar.autoSidebar.category.Getting Started": { 15 | "message": "快速上手", 16 | "description": "The label for category Getting Started in sidebar autoSidebar" 17 | }, 18 | "sidebar.autoSidebar.category.O&M Guide": { 19 | "message": "运维管理", 20 | "description": "The label for category O&M Guide in sidebar autoSidebar" 21 | }, 22 | "sidebar.autoSidebar.category.Monitoring and Alerting": { 23 | "message": "监控警告", 24 | "description": "The label for category Monitoring and Alerting in sidebar autoSidebar" 25 | }, 26 | "sidebar.autoSidebar.category.Backup and Recovery": { 27 | "message": "备份与恢复", 28 | "description": "The label for category Backup and Recovery in sidebar autoSidebar" 29 | }, 30 | "sidebar.autoSidebar.category.Developer Guide": { 31 | "message": "开发者指南", 32 | "description": "The label for category Developer Guide in sidebar autoSidebar" 33 | }, 34 | "sidebar.autoSidebar.category.Compiling Methods": { 35 | "message": "编译方法", 36 | "description": "The label for category Compiling Methods in sidebar autoSidebar" 37 | }, 38 | "sidebar.autoSidebar.category.Connect to StoneDB": { 39 | "message": "连接 StoneDB 数据库", 40 | "description": "The label for category Connect to StoneDB in sidebar autoSidebar" 41 | }, 42 | "sidebar.autoSidebar.category.Create and Manage Database Objects": { 43 | "message": "创建和管理数据库对象", 44 | "description": "The label for category Connect to StoneDB in sidebar autoSidebar" 45 | }, 46 | "sidebar.autoSidebar.category.Appendix": { 47 | "message": "附录", 48 | "description": "The label for category Connect to StoneDB in sidebar autoSidebar" 49 | }, 50 | "sidebar.autoSidebar.category.SQL Reference": { 51 | "message": "SQL 参考", 52 | "description": "The label for category Connect to StoneDB in sidebar autoSidebar" 53 | }, 54 | "sidebar.autoSidebar.category.Operators": { 55 | "message": "运算符", 56 | "description": "The label for category Connect to StoneDB in sidebar autoSidebar" 57 | }, 58 | "sidebar.autoSidebar.category.Functions": { 59 | "message": "函数", 60 | "description": "The label for category Connect to StoneDB in sidebar autoSidebar" 61 | }, 62 | "sidebar.autoSidebar.category.Performance Tuning": { 63 | "message": "性能优化", 64 | "description": "The label for category Connect to StoneDB in sidebar autoSidebar" 65 | }, 66 | "sidebar.autoSidebar.category.Performance Monitoring Tools": { 67 | "message": "性能相关工具", 68 | "description": "The label for category Connect to StoneDB in sidebar autoSidebar" 69 | }, 70 | "sidebar.autoSidebar.category.Database Tuning": { 71 | "message": "数据库优化", 72 | "description": "The label for category Connect to StoneDB in sidebar autoSidebar" 73 | }, 74 | "sidebar.autoSidebar.category.Architecture Tuning": { 75 | "message": "架构优化", 76 | "description": "The label for category Connect to StoneDB in sidebar autoSidebar" 77 | }, 78 | "sidebar.autoSidebar.category.Performance Tests": { 79 | "message": "性能测试", 80 | "description": "The label for category Connect to StoneDB in sidebar autoSidebar" 81 | }, 82 | "sidebar.autoSidebar.category.Data Migration to StoneDB": { 83 | "message": "向StoneDB迁移数据", 84 | "description": "The label for category Connect to StoneDB in sidebar autoSidebar" 85 | }, 86 | "sidebar.autoSidebar.category.Troubleshooting": { 87 | "message": "故障诊断", 88 | "description": "The label for category Connect to StoneDB in sidebar autoSidebar" 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /i18n/zh/docusaurus-plugin-content-docs/current/00-about-stonedb/architecture.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: architecture 3 | sidebar_position: 1.2 4 | --- 5 | 6 | # 整体架构 7 | -------------------------------------------------------------------------------- /i18n/zh/docusaurus-plugin-content-docs/current/00-about-stonedb/intro.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: intro 3 | sidebar_position: 1.1 4 | --- 5 | 6 | # StoneDB 简介 7 | 8 | StoneDB 是由石原子科技公司自主设计、研发的国内首款基于 MySQL 内核打造的开源 HTAP(Hybrid Transactional and Analytical Processing)融合型数据库,可实现与 MySQL 的无缝切换。StoneDB 具备超高性能、实时分析等特点,为用户提供一站式HTAP解决方案。 9 | 10 | StoneDB 是 100% 兼容 MySQL 5.6、5.7协议和 MySQL 生态等重要特性,支持 MySQL 常用的功能及语法,支持 MySQL 生态中的系统工具和客户端,如 Navicat、Workbench、mysqldump、mydumper。由于 100% 兼容 MySQL,因此 StoneDB 的所有工作负载都可以继续使用 MySQL 数据库体系运行。 11 | 12 | StoneDB 专门针对 OLAP 应用程序进行了设计和优化,支持百亿数据场景下进行高性能、多维度字段组合的复杂查询,相对比社区版的 MySQL,其查询速度提升了十倍以上。 13 | 14 | StoneDB 采用基于知识网格技术和列式存储引擎,该存储引擎为海量数据背景下 OLAP 应用而设计,通过列式存储数据、知识网格过滤、高效数据压缩等技术,为应用系统提供低成本和高性能的数据查询支持。 15 | 16 | ## 产品优势 17 | 18 | - 完全兼容 MySQL 19 | 20 | StoneDB 是在原生的 MySQL 中加入的存储引擎,最终集成为 HTAP 数据库,因此是 100% 兼容 MySQL 的。支持标准数据库接口,包括 ODBC、JDBC 和本地连接。支持 API 接口,包括 C、C++、C#、Java、PHP、Perl 等。StoneDB 全面支持 ANSI SQL-92 标准和 SQL-99 扩展标准中视图和存储过程,这种支持使得现有应用程序无需修改应用代码即可使用 StoneDB,从而可实现与 MySQL 的无缝切换。 21 | 22 | - 实时HTAP 23 | 24 | 同时提供行式存储引擎 InnoDB 和列式存储引擎 StoneDB,通过 binlog 从 InnoDB 复制数据,保证行式存储引擎 InnoDB 和列式存储引擎 StoneDB 之间的数据强一致性。 25 | 26 | - 高性能查询 27 | 28 | 在千万、亿级甚至更多数据量下进行复杂查询时,相比 MySQL,其查询速度提升了十倍以上。 29 | 30 | - 低存储成本 31 | 32 | 对数据最高可实现 40 倍压缩,极大的节省了数据存储空间和企业的成本。 33 | 34 | ## 核心技术 35 | 36 | - 列式存储 37 | 38 | 列式存储在存储数据时是按照列模式将数据存储到磁盘上的,读取数据时,只需要读取需要的字段,极大减少了网络带宽和磁盘 IO 的压力。基于列式存储无需为列再创建索引和维护索引。 39 | 40 | - 高效的数据压缩比 41 | 42 | 在关系型数据库中,同一列中的数据属于同一种数据类型,如果列中的重复值越多,则压缩比越高,而压缩比越高,数据量就越小,数据被读取时,对网络带宽和磁盘 IO 的压力也就越小。由于列式存储比行式存储有着十倍甚至更高的压缩比,StoneDB 节省了大量的存储空间,降低了存储成本。 43 | 44 | - 知识网格 45 | 46 | 知识网格根据元数据信息进行粗糙集过滤查询中不符合条件的数据,最后只需要对可疑的数据包进行解压获取符合查询条件的数据,大量减少读取 IO 操作,提高查询响应时间和网络利用率。 47 | 48 | - 基于推送的矢量化查询处理 49 | 50 | StoneDB通过执行计划将矢量块(列式数据切片)从一个运算符推送到另一个运算符来处理查询,与基于元组的处理模型相比,基于推送的执行模型避免了深度调用堆栈,并节省了资源。 51 | -------------------------------------------------------------------------------- /i18n/zh/docusaurus-plugin-content-docs/current/00-about-stonedb/limits.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: limits 3 | sidebar_position: 1.3 4 | --- 5 | 6 | # 使用限制 7 | 由于StoneDB是在原生的MySQL中加入的存储引擎,因此是高度兼容MySQL 5.6、5.7协议和MySQL生态等重要特性,支持MySQL常用的功能及语法,但由于StoneDB本身的一些特性,部分操作和功能尚未得到支持,以下列出的是不兼容MySQL的操作和功能。 8 | ## 不支持的DDL 9 | 1. 修改字段的数据类型 10 | 2. 修改字段的长度 11 | 3. 修改表/字段的字符集 12 | 4. 转换表的字符集 13 | 5. optimize table 14 | 6. analyze table 15 | 7. lock table 16 | 8. repair table 17 | 9. CTAS 18 | 10. 重组表 19 | 11. 重命名字段 20 | 12. 设置字段的默认值 21 | 13. 设置字段为空 22 | 14. 设置字段非空 23 | 15. 添加唯一约束 24 | 16. 删除唯一约束 25 | 17. 创建索引 26 | 18. 删除索引 27 | 19. 表修改注释 28 | 29 | StoneDB是列式存储,数据是被高度压缩的,因此表和列的相关属性不易被修改,在表设计阶段尽可能定义好字符集、数据类型、约束和索引等。 30 | ## 不支持的DML 31 | 1. delete 32 | 2. update关联子查询 33 | 3. update多表关联 34 | 4. replace into 35 | 36 | StoneDB不适用于有频繁的更新操作,因为对列式存储来说,更新需要找到对应的每一列,然后分多次更新,而行式存储由于一行紧挨着一行,找到对应的page或者block就可直接在行上更新,因此StoneDB只支持了常规用的单表update和insert。 37 | ## 不支持跨存储引擎关联查询 38 | StoneDB默认不支持跨存储引擎关联查询,也就是说InnoDB存储引擎下的表和StoneDB存储引擎下的表进行关联查询会报错。可在stonedb.cnf参数文件里定义stonedb_ini_allowmysqlquerypath=1,这样就支持跨存储引擎表之间的关联查询了。 39 | ## 不支持的对象 40 | 1. 全文索引 41 | 2. 唯一约束 42 | 3. 触发器 43 | 4. 临时表 44 | 5. 含有自定义函数的存储过程 45 | 6. 含有SQL的自定义函数 46 | ## 不支持的数据类型 47 | 1. 位类型bit 48 | 2. 枚举型enum 49 | 3. 集合型set 50 | 4. decimal精度必须小于或等于18,否则不支持,如decimal(18,x) 51 | 5. 创建表时不支持使用关键字unsigned、zerofill 52 | ## 不支持事务 53 | 只有严格遵守ACID四大属性,才能真正的支持事务。而StoneDB由于没有redo和undo,是不支持事务的。 54 | ## 不支持分区 55 | 列式存储不支持分区。 56 | ## 不支持行锁、表锁 57 | 列式存储不支持行锁、表锁。 58 | ## 只支持statement的binlog格式 59 | 列式存储不支持row、mixed格式的binlog。 60 | -------------------------------------------------------------------------------- /i18n/zh/docusaurus-plugin-content-docs/current/00-about-stonedb/terms.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: terms 3 | sidebar_position: 1.4 4 | --- 5 | 6 | # 常见术语介绍 7 | -------------------------------------------------------------------------------- /i18n/zh/docusaurus-plugin-content-docs/current/01-environment-requirements/supported-servers-and-oss.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: supported-servers-and-oss 3 | sidebar_position: 2.1 4 | --- 5 | 6 | # 软硬件环境推荐 7 | -------------------------------------------------------------------------------- /i18n/zh/docusaurus-plugin-content-docs/current/02-getting-started/quick-deployment.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: quick-deployment 3 | sidebar_position: 3.1 4 | --- 5 | 6 | # 快速部署 7 | 8 | 为方便用户快速上手,安装包是已经编译好的,只需要检查自己的环境是否缺少依赖。 9 | ## 下载安装包 10 | 点击[此处](https://static.stoneatom.com/stonedb-ce-5.6-v1.0.0.el7.x86_64.tar.gz)下载最新的安装包。 11 | ## 上传tar包并解压 12 | ```shell 13 | tar -zxvf stonedb-ce-5.6-v1.0.0.el7.x86_64.tar.gz 14 | ``` 15 | 上传至安装目录,解压出来的文件夹名是stonedb56。 16 | ## 检查依赖文件 17 | ```shell 18 | cd /stonedb56/install/bin 19 | ldd mysqld 20 | ldd mysql 21 | ``` 22 | 如果检查返回有关键字"not found",说明缺少文件,需要安装对应的依赖包。 23 | ## 修改配置文件 24 | ```shell 25 | cd /stonedb56/install/ 26 | cp stonedb.cnf stonedb.cnf.bak 27 | vi stonedb.cnf 28 | ``` 29 | 主要修改路径,如果安装目录就是stonedb56,只需要修改其它参数。 30 | ## 创建用户 31 | ```shell 32 | groupadd mysql 33 | useradd -g mysql mysql 34 | passwd mysql 35 | ``` 36 | ## 执行脚本reinstall.sh 37 | ```shell 38 | cd /stonedb56/install 39 | ./reinstall.sh 40 | ``` 41 | 执行脚本的过程就是初始化实例和启动实例。 42 | ## 登录 43 | ```shell 44 | /stonedb56/install/bin/mysql -uroot -p -S /stonedb56/install/tmp/mysql.sock 45 | Enter password: 46 | Welcome to the MySQL monitor. Commands end with ; or \g. 47 | Your MySQL connection id is 1 48 | Server version: 5.6.24-StoneDB-log build- 49 | 50 | Copyright (c) 2000, 2022 StoneAtom Group Holding Limited 51 | No entry for terminal type "xterm"; 52 | using dumb terminal settings. 53 | Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 54 | 55 | mysql> show databases; 56 | +--------------------+ 57 | | Database | 58 | +--------------------+ 59 | | information_schema | 60 | | cache | 61 | | innodb | 62 | | mysql | 63 | | performance_schema | 64 | | sys_stonedb | 65 | | test | 66 | +--------------------+ 67 | 7 rows in set (0.00 sec) 68 | ``` 69 | ## 关闭实例 70 | ```shell 71 | /stonedb56/install/bin/mysqladmin -uroot -p -S /stonedb56/install/tmp/mysql.sock shutdown 72 | ``` 73 | 74 | -------------------------------------------------------------------------------- /i18n/zh/docusaurus-plugin-content-docs/current/02-getting-started/quick-start.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: quick-start 3 | sidebar_position: 3.2 4 | --- 5 | 6 | # 快速上手 7 | 8 | 本文的目的是通过简单的演示,让使用者体验StoneDB在大批量数据插入、数据压缩比和分析查询方面与InnoDB相比具有较高的性能。 9 | ## 第一步. 部署试用环境 10 | 在试用 StoneDB 功能前,请按照[快速部署](quick-deployment.md)中的步骤准备 StoneDB 测试环境并启动实例。 11 | ## 第二步. 准备测试数据 12 | 通过以下步骤,将生成一个测试数据集用于体验 StoneDB 功能。 13 | ### 1) 前提条件 14 | 在同一个测试环境,分别创建StoneDB和InnoDB存储引擎的表,并且以下三个参数也是相同的。 15 | autocommit=1 16 | innodb_flush_log_at_trx_commit=1 17 | sync_binlog=0 18 | ### 2)创建数据库 19 | 创建名为test的数据库 20 | ``` 21 | create database test DEFAULT CHARACTER SET utf8mb4; 22 | ``` 23 | ### 3) 创建表 24 | 在test数据库内创建名为t_user的表 25 | ``` 26 | use test 27 | CREATE TABLE t_user( 28 | id INT NOT NULL AUTO_INCREMENT, 29 | first_name VARCHAR(20) NOT NULL, 30 | last_name VARCHAR(20) NOT NULL, 31 | sex VARCHAR(5) NOT NULL, 32 | score INT NOT NULL, 33 | copy_id INT NOT NULL, 34 | PRIMARY KEY (`id`) 35 | ) engine=STONEDB; 36 | ``` 37 | ### 4) 创建存储过程 38 | 执行以下 SQL 语句创建存储过程 39 | ``` 40 | DELIMITER // 41 | create PROCEDURE add_user(in num INT) 42 | BEGIN 43 | DECLARE rowid INT DEFAULT 0; 44 | DECLARE firstname VARCHAR(10); 45 | DECLARE name1 VARCHAR(10); 46 | DECLARE name2 VARCHAR(10); 47 | DECLARE lastname VARCHAR(10) DEFAULT ''; 48 | DECLARE sex CHAR(1); 49 | DECLARE score CHAR(2); 50 | WHILE rowid < num DO 51 | SET firstname = SUBSTRING(md5(rand()),1,4); 52 | SET name1 = SUBSTRING(md5(rand()),1,4); 53 | SET name2 = SUBSTRING(md5(rand()),1,4); 54 | SET sex=FLOOR(0 + (RAND() * 2)); 55 | SET score= FLOOR(40 + (RAND() *60)); 56 | SET rowid = rowid + 1; 57 | IF ROUND(RAND())=0 THEN 58 | SET lastname =name1; 59 | END IF; 60 | IF ROUND(RAND())=1 THEN 61 | SET lastname = CONCAT(name1,name2); 62 | END IF; 63 | insert INTO t_user(first_name,last_name,sex,score,copy_id) VALUES (firstname,lastname,sex,score,rowid); 64 | END WHILE; 65 | END // 66 | DELIMITER ; 67 | ``` 68 | 此存储过程用于随机生成一张人员信息表。 69 | ## 第三步. 插入性能测试 70 | 执行以下SQL语句调用存储过程 71 | ``` 72 | > call add_user_innodb(10000000); 73 | Query OK, 1 row affected (24 min 46.62 sec) 74 | 75 | > call add_user(10000000); 76 | Query OK, 1 row affected (9 min 21.14 sec) 77 | ``` 78 | 结果显示:插入1千万数据行,在StoneDB需要9分钟21秒,在InnoDB需要24分钟46秒。 79 | ## 第四步. 数据压缩测试 80 | 通过以下SQL语句验证数据压缩性能 81 | ``` 82 | > select count(*) from t_user_innodb; 83 | +----------+ 84 | | count(*) | 85 | +----------+ 86 | | 10000000 | 87 | +----------+ 88 | 1 row in set (1.83 sec) 89 | 90 | > select count(*) from t_user; 91 | +----------+ 92 | | count(*) | 93 | +----------+ 94 | | 10000000 | 95 | +----------+ 96 | 1 row in set (0.00 sec) 97 | 98 | +--------------+---------------+------------+-------------+--------------+------------+---------+ 99 | | table_schema | table_name | table_rows | data_length | index_length | total_size | engine | 100 | +--------------+---------------+------------+-------------+--------------+------------+---------+ 101 | | test | t_user | 10000000 | 119.99M | 0.00M | 119.99M | STONEDB | 102 | | test | t_user_innodb | 9995867 | 454.91M | 0.00M | 454.91M | InnoDB | 103 | +--------------+---------------+------------+-------------+--------------+------------+---------+ 104 | ``` 105 | 结果显示:相同的数据行,在StoneDB大小为120M,在InnoDB大小为455M。 106 | ## 第五步. 聚合查询测试 107 | 通过以下语句执行聚合查询测试 108 | ``` 109 | > select first_name,count(*) from t_user group by first_name order by 1; 110 | +------------+----------+ 111 | | first_name | count(*) | 112 | +------------+----------+ 113 | ..... 114 | | fffb | 142 | 115 | | fffc | 140 | 116 | | fffd | 156 | 117 | | fffe | 140 | 118 | | ffff | 132 | 119 | +------------+----------+ 120 | 65536 rows in set (0.98 sec) 121 | 122 | > select first_name,count(*) from t_user_innodb group by first_name order by 1; 123 | +------------+----------+ 124 | | first_name | count(*) | 125 | +------------+----------+ 126 | ...... 127 | | fffb | 178 | 128 | | fffc | 161 | 129 | | fffd | 170 | 130 | | fffe | 156 | 131 | | ffff | 139 | 132 | +------------+----------+ 133 | 65536 rows in set (9.00 sec) 134 | ``` 135 | 结果显示:执行相同的聚合查询,在StoneDB需要0.98s,在InnoDB需要9s。 136 | -------------------------------------------------------------------------------- /i18n/zh/docusaurus-plugin-content-docs/current/03-O&M-Guide/regular-change-operations.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: regular-change-operations 3 | sidebar_position: 4.1 4 | --- 5 | 6 | # 常规变更 7 | 8 | ## 表结构变更 9 | StoneDB只支持以下表结构变更和数据变更操作,其它没有说明的表示不支持。 10 | ### 创建相似表 11 | 1)创建一张引擎为 stonedb 、名为t_name的表; 12 | ```sql 13 | CREATE TABLE t_name( 14 | col1 INT NOT NULL AUTO_INCREMENT, 15 | col2 VARCHAR(10) NOT NULL, 16 | ...... 17 | PRIMARY KEY (`id`) 18 | ) engine=STONEDB; 19 | ``` 20 | 2)创建一张与t_name结构相同的表t_other 21 | 使用 Create table like 语句 22 | ``` 23 | create table t_other like t_name; 24 | ``` 25 | ### 清空表数据 26 | 使用truncate table 语句可以实现保留表结构,仅清空表中的数据 27 | ``` 28 | truncate table t_name; 29 | ``` 30 | ### 添加字段 31 | 使用 alter table ... add column 语句实现向指定表中添加字段,新增加的字段默认置于最后一个字段。 32 | ``` 33 | alter table t_name add column c_name varchar(10); 34 | ``` 35 | ### 删除字段 36 | 使用 alter table ... drop 语句实现删除表中指定字段。 37 | ``` 38 | alter table t_name drop c_name; 39 | ``` 40 | ### 重命名表 41 | 使用 alter table ... rename to 语句实现对指定表的重命名。 42 | ``` 43 | alter table t_name rename to t_name_new; 44 | ``` 45 | ## 用户权限变更 46 | ### 创建用户 47 | ``` 48 | create user 'u_name'@'hostname' identified by 'xxx'; 49 | ``` 50 | ### 给用户赋权 51 | ``` 52 | grant all on *.* to 'u_name'@'hostname'; 53 | grant select on db_name.* to 'u_name'@'hostname'; 54 | grant select(column_name) on db_name.t_name to 'u_name'@'hostname'; 55 | ``` 56 | ### 回收用户权限 57 | ``` 58 | revoke all privileges on *.* from 'u_name'@'hostname'; 59 | revoke select on db_name.* from 'u_name'@'hostname'; 60 | revoke select(column_name) on db_name.t_name from 'u_name'@'hostname'; 61 | ``` 62 | ### 删除用户 63 | ``` 64 | drop user 'u_name'@'hostname'; 65 | ``` 66 | 67 | -------------------------------------------------------------------------------- /i18n/zh/docusaurus-plugin-content-docs/current/download.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: download 3 | sidebar_position: 100 4 | --- 5 | 6 | # 下载 7 | 8 | ## StoneDB 9 | 10 | 在这里您可以下载最新的 StoneDB 安装包: 11 | 12 | | 版本 | 发布日期 | 安装包 | MD5 | 13 | | --- | --- | --- | --- | 14 | | 1.0 | 2022-6-29 | [Download](https://static.stoneatom.com/stonedb-ce-5.6-v1.0.0.el7.x86_64.tar.gz) | 831f5799034fbb388f6ff26675b7951e | 15 | | Next Version | Coming soon~ | | 16 | -------------------------------------------------------------------------------- /i18n/zh/docusaurus-theme-classic/footer.json: -------------------------------------------------------------------------------- 1 | { 2 | "copyright": { 3 | "message": "Copyright © The StoneAtom-tech ALL Rights Reserved", 4 | "description": "The footer copyright" 5 | }, 6 | "link.item.label.@StoneDB2022": { 7 | "message": "@StoneDB2022", 8 | "description": "The label of footer link with label=@StoneDB2022 linking to https://twitter.com/StoneDataBase" 9 | }, 10 | "link.item.label.dev@stonedb.io": { 11 | "message": "dev@stonedb.io", 12 | "description": "The label of footer link with label=dev@stonedb.io linking to #" 13 | }, 14 | "link.item.label. ": { 15 | "message": " ", 16 | "description": "The label of footer link with label= linking to https://stonedb.slack.com/join/shared_invite/zt-1ba2lpvbo-Vqq62DJcxViyxCZmp7Rimw#/shared-invite/email" 17 | }, 18 | "link.item.label.StoneAtom/stonedb": { 19 | "message": "StoneAtom/stonedb", 20 | "description": "The label of footer link with label=StoneAtom/stonedb linking to https://github.com/StoneAtom/stonedb" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /i18n/zh/docusaurus-theme-classic/navbar.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": { 3 | "message": "首页", 4 | "description": "The title in the navbar" 5 | }, 6 | "item.label.Download": { 7 | "message": "下载", 8 | "description": "Navbar item with label Download" 9 | }, 10 | "item.label.Docs": { 11 | "message": "文档", 12 | "description": "Navbar item with label Docs" 13 | }, 14 | "item.label.Community": { 15 | "message": "社区", 16 | "description": "Navbar item with label Community" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stoneDB", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "css": "node ./scripts/css.js", 7 | "docusaurus": "docusaurus", 8 | "start": "docusaurus start", 9 | "build": "NODE_ENV=development && docusaurus build", 10 | "swizzle": "docusaurus swizzle", 11 | "deploy": "docusaurus deploy", 12 | "clear": "docusaurus clear", 13 | "serve": "docusaurus serve", 14 | "write-translations": "docusaurus write-translations", 15 | "write-heading-ids": "docusaurus write-heading-ids", 16 | "typecheck": "tsc" 17 | }, 18 | "dependencies": { 19 | "@docusaurus/core": "2.0.0-beta.21", 20 | "@docusaurus/plugin-pwa": "2.0.0-beta.21", 21 | "@docusaurus/preset-classic": "2.0.0-beta.21", 22 | "@mdx-js/react": "^1.6.22", 23 | "antd": "^4.20.5", 24 | "clsx": "^1.1.1", 25 | "emailjs": "^4.0.0", 26 | "gsap": "^3.10.4", 27 | "hast-util-to-text": "^3.1.1", 28 | "js-md5": "^0.7.3", 29 | "katex": "^0.15.6", 30 | "libpag": "^4.0.5-release.7", 31 | "lottie-web": "^5.9.4", 32 | "md5": "^2.3.0", 33 | "mdast-util-definition-list": "^1.1.1", 34 | "mdast-util-math": "^2.0.1", 35 | "micromark-extension-math": "^2.0.2", 36 | "mockjs": "^1.1.0", 37 | "prism-react-renderer": "^1.3.1", 38 | "ramda": "^0.28.0", 39 | "react": "^17.0.2", 40 | "react-dom": "^17.0.2", 41 | "react-markdown": "^8.0.3", 42 | "rehype-katex": "^4.0.0", 43 | "rehype-stringify": "^9.0.3", 44 | "remark-html": "^15.0.1", 45 | "remark-math": "^3.0.1", 46 | "remark-rehype": "^10.1.0", 47 | "styled-components": "^5.3.5", 48 | "unist-util-select": "^2.0.2", 49 | "uuid": "^8.3.2" 50 | }, 51 | "devDependencies": { 52 | "@docusaurus/plugin-client-redirects": "^2.0.0-beta.21", 53 | "@tsconfig/docusaurus": "^1.0.5", 54 | "@types/styled-components": "^5.1.25", 55 | "babel-plugin-import": "^1.13.5", 56 | "babel-plugin-styled-components": "^2.0.7", 57 | "docusaurus-plugin-less": "^2.0.2", 58 | "less": "^4.1.2", 59 | "less-loader": "^11.0.0", 60 | "less-vars-to-js": "^1.3.0", 61 | "style-loader": "^3.3.1", 62 | "typescript": "^4.6.4" 63 | }, 64 | "browserslist": { 65 | "production": [ 66 | ">0.5%", 67 | "not dead", 68 | "not op_mini all" 69 | ], 70 | "development": [ 71 | "last 1 chrome version", 72 | "last 1 firefox version", 73 | "last 1 safari version" 74 | ] 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /plugins/community/index.js: -------------------------------------------------------------------------------- 1 | const pluginContentDoc = require('@docusaurus/plugin-content-docs'); 2 | 3 | async function CommunityPlugin(context, options) { 4 | const communityPlugin = await pluginContentDoc.default(context, { 5 | ...options, 6 | }); 7 | return { 8 | ...communityPlugin, 9 | name: 'community', 10 | docItemComponent: '@theme/CommunityItem', 11 | getThemePath() { 12 | return './theme'; 13 | }, 14 | } 15 | } 16 | 17 | CommunityPlugin.validateOptions = pluginContentDoc.validateOptions; 18 | 19 | module.exports = CommunityPlugin; 20 | 21 | -------------------------------------------------------------------------------- /plugins/community/theme/CommunityItem/index.tsx: -------------------------------------------------------------------------------- 1 | 2 | import React from 'react'; 3 | import type {Props} from '@theme/DocItem'; 4 | 5 | 6 | export default function DocItem(props: Props): JSX.Element { 7 | const {content: DocContent, versionMetadata} = props; 8 | 9 | return ( 10 | <> 11 |

888

12 | 13 | 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /plugins/community/theme/CommunityItem/styles.module.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | /* ********************* */ 9 | /* DO NOT EDIT THIS FILE */ 10 | /* ********************* */ 11 | 12 | .docItemContainer article > *:first-child, 13 | .docItemContainer header + * { 14 | margin-top: 0; 15 | } 16 | 17 | @media (min-width: 997px) { 18 | .docItemCol { 19 | max-width: 75% !important; 20 | } 21 | 22 | /* Prevent hydration FOUC, as the mobile TOC needs to be server-rendered */ 23 | .tocMobile { 24 | display: none; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /plugins/fetch-repo/index.js: -------------------------------------------------------------------------------- 1 | const nodeFetch = require("node-fetch") 2 | 3 | module.exports = () => ({ 4 | name: "fetch-repo", 5 | async loadContent() { 6 | const response = await nodeFetch( 7 | `https://api.github.com/repos/StoneAtom/stonedb`, 8 | ) 9 | 10 | const data = await response.json(); 11 | 12 | return data.message === 'Not Found' ? {} : data; 13 | }, 14 | async contentLoaded({ content, actions }) { 15 | const { setGlobalData } = actions 16 | setGlobalData({ repo: content }) 17 | }, 18 | }) 19 | -------------------------------------------------------------------------------- /scripts/config.theme.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'layout-header-height': '100px', 3 | 'layout-footer-height': '133px', 4 | 'layout-header-background': '#ffffff', 5 | 'layout-body-background': '#ffffff', 6 | 'text-color-dark': '#646A7D', 7 | 'text-color-secondary-dark': '#CBCDD3', 8 | 'text-color': '#373c43', 9 | 'text-color-secondary': '#646A7D', 10 | 'tooltip-bg': '#ffffff', 11 | 'tooltip-color': '@text-color-secondary', 12 | 'border-radius-base': '10px', 13 | 'primary-color': '#00A6FB', 14 | 'height-base': '40px', 15 | 'height-lg': '65px', 16 | 'input-bg': '#F2F3F7', 17 | 'alert-info-bg-color': '#F2F3F7', 18 | 'alert-text-color': 'text-color-dark', 19 | 'menu-bg': 'transparent', 20 | 'btn-default-bg': '#F2F3F7', 21 | 'border-color-base': '#E5E8F0', 22 | 'btn-default-color': '#646A7D', 23 | 'btn-primary-bg': '#373C43', 24 | 'select-border-color': 'transparent', 25 | } 26 | -------------------------------------------------------------------------------- /scripts/css.js: -------------------------------------------------------------------------------- 1 | 2 | const fs = require('fs'); 3 | const path = require('path'); 4 | const lessToJs = require('less-vars-to-js'); 5 | const webpack = require('webpack'); 6 | const MiniCssExtractPlugin = require('mini-css-extract-plugin'); 7 | const themes = require('./config.theme.js'); 8 | const srcPath = path.join(__dirname, '..', 'src', 'css'); 9 | const stylePath = path.join(__dirname, '..', 'node_modules', 'antd', 'lib', 'style'); 10 | const colorLess = fs.readFileSync(path.join(stylePath, 'color', 'colors.less'), 'utf8'); 11 | const defaultLess = fs.readFileSync(path.join(stylePath, 'themes', 'default.less'), 'utf8'); 12 | 13 | const allPaletteLess = lessToJs(`${colorLess}${defaultLess}`, { 14 | stripPrefix: true, 15 | resolveVariables: false, 16 | }); 17 | 18 | const defaultPaletteLess = lessToJs(`${defaultLess}`, { 19 | stripPrefix: true, 20 | resolveVariables: false, 21 | }); 22 | 23 | const lessFinaly = Object.assign(allPaletteLess, themes); 24 | 25 | let less = ''; 26 | for (let key in lessFinaly) { 27 | const value = lessFinaly[key]; 28 | // if (value.indexOf('@') === 0) { 29 | // value = `var(--safe-${value.replace('@', '')})`; 30 | // } else if (value.indexOf('colorPalette') >= 0) { 31 | // value = value.replace('@{', 'var(--safe-').replace('}', ')'); 32 | // } 33 | // if(key === 'alert-info-bg-color') { 34 | // console.log(key, value); 35 | // } 36 | less += `@${key}: ${value};\n` 37 | } 38 | fs.writeFileSync('scripts/var.less', `@import '~antd/lib/style/color/colorPalette.less';\n${less}`); 39 | 40 | const themeFinaly = Object.assign(defaultPaletteLess, themes); 41 | 42 | let theme = ''; 43 | for (let key in themeFinaly) { 44 | theme += `--safe-${key}: @${key};\n` 45 | } 46 | 47 | fs.writeFileSync('scripts/theme.less', `@import './var.less';\n :root{\n${theme}\n}`); 48 | 49 | 50 | module.exports = webpack({ 51 | "mode": 'development', 52 | "output": { 53 | "path": srcPath, 54 | "filename": "[name].js", 55 | 'library': 'safeTheme' 56 | }, 57 | "entry": { 58 | "theme": ['./scripts/styles.jsx'] 59 | }, 60 | "module": { 61 | "rules": [ 62 | { 63 | test: /\.less$/, 64 | exclude: /node_modules/, 65 | use: [ 66 | MiniCssExtractPlugin.loader, 67 | { 68 | loader: 'css-loader', 69 | }, { 70 | loader: 'less-loader', 71 | options: { 72 | lessOptions: { 73 | javascriptEnabled: true, 74 | } 75 | } 76 | }] 77 | } 78 | ] 79 | }, 80 | plugins: [ 81 | new MiniCssExtractPlugin({ 82 | filename: '[name].css', 83 | }), 84 | 85 | ], 86 | }, async (err, stats) => { 87 | if (err || stats.hasErrors()) { 88 | console.log('构建过程出错', stats.compilation.errors) 89 | } 90 | fs.rm('src/css/theme.js', {force: true}, (err) => {}); 91 | }); 92 | 93 | -------------------------------------------------------------------------------- /scripts/styles.jsx: -------------------------------------------------------------------------------- 1 | import './theme.less'; 2 | -------------------------------------------------------------------------------- /sidebars.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Creating a sidebar enables you to: 3 | - create an ordered group of docs 4 | - render a sidebar for each doc of that group 5 | - provide next/previous navigation 6 | 7 | The sidebars can be generated from the filesystem, or explicitly defined here. 8 | 9 | Create as many sidebars as you want. 10 | */ 11 | 12 | // @ts-check 13 | 14 | /** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ 15 | const sidebars = { 16 | // By default, Docusaurus generates a sidebar from the docs folder structure 17 | autoSidebar: [{type: 'autogenerated', dirName: '.'}], 18 | 19 | // But you can create a sidebar manually 20 | // DocsSidebar: [ 21 | // { 22 | // type: 'category', 23 | // label: 'About StoneDB', 24 | // items: ['intro', 'architecture', 'limits', 'terms'], 25 | // }, 26 | // { 27 | // type: 'category', 28 | // label: 'System requirements', 29 | // items: ['supported-servers-and-oss', 'download'], 30 | // }, 31 | // { 32 | // type: 'doc', 33 | // id: 'download', // doc ID 34 | // label: 'Download', // sidebar label 35 | // }, 36 | // ], 37 | }; 38 | 39 | module.exports = sidebars; 40 | -------------------------------------------------------------------------------- /src/components/Link/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { useHistory } from '@docusaurus/router'; 3 | import { IconFont } from '../icon'; 4 | import {ILink} from './interface'; 5 | import {LinkStyle, LinkIconStyle, LinkBtnStyle, LinkSocialStyle} from './styles'; 6 | 7 | 8 | const checkInterLink = (to: string) => { 9 | return to ? to.indexOf('://') < 0 : true 10 | } 11 | 12 | export const Link: React.FC = ({to, children, className}) => { 13 | const history = useHistory(); 14 | const isInterLink = checkInterLink(to); 15 | let options = isInterLink ? { 16 | onClick: () => { 17 | history.push(to); 18 | } 19 | } : { 20 | href: to, 21 | target:"_blank" 22 | } 23 | return ( 24 | 28 | {children} 29 | 30 | ) 31 | } 32 | 33 | export const LinkIcon: React.FC = ({to, children, className}) => { 34 | const history = useHistory(); 35 | const isInterLink = checkInterLink(to); 36 | let options = isInterLink ? { 37 | onClick: () => { 38 | history.push(to); 39 | } 40 | } : { 41 | href: to, 42 | target:"_blank" 43 | } 44 | return ( 45 | 49 | {children as string} 50 | 51 | 52 | ) 53 | } 54 | 55 | export const LinkBtn: React.FC = ({to, children}) => { 56 | const history = useHistory(); 57 | return ( 58 | history.push(to)}> 59 | {children as string} 60 | 61 | 62 | ); 63 | } 64 | 65 | export const LinkSocial: React.FC = ({to, icon, children, className}) => { 66 | const history = useHistory(); 67 | const isInterLink = checkInterLink(to); 68 | let options = isInterLink ? { 69 | onClick: () => { 70 | history.push(to); 71 | } 72 | } : { 73 | href: to, 74 | target:"_blank" 75 | } 76 | return ( 77 | 81 | 82 | {children} 83 | 84 | 85 | ) 86 | } -------------------------------------------------------------------------------- /src/components/Link/interface.ts: -------------------------------------------------------------------------------- 1 | import { ReactNode } from "react"; 2 | import { IBase } from "../default.interface"; 3 | 4 | export interface ILink extends IBase { 5 | children: ReactNode; 6 | to?: string; 7 | icon?: ReactNode; 8 | } 9 | -------------------------------------------------------------------------------- /src/components/Link/styles.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import styled from 'styled-components'; 3 | import {Button} from 'antd'; 4 | 5 | export const LinkStyle = styled.a` 6 | color: #373C43; 7 | &:hover{ 8 | color: #00A6FB; 9 | text-decoration: underline; 10 | } 11 | ` 12 | 13 | export const LinkIconStyle = styled.a` 14 | height: 50px; 15 | padding-bottom: 20px; 16 | line-height: 30px; 17 | color: #373C43; 18 | border-bottom: 1px solid #E5E8F0; 19 | display: flex; 20 | flex-direction: row; 21 | justify-content: space-between; 22 | align-items: center; 23 | &:hover{ 24 | color: #00A6FB; 25 | border-color: #00A6FB; 26 | } 27 | .icon{ 28 | margin-left: 6px; 29 | } 30 | ` 31 | 32 | export const LinkBtnStyle = styled(Button)` 33 | width: 98px; 34 | height: 36px; 35 | border-radius: 10px; 36 | border: 1px solid #00A6FB; 37 | display: inline-block; 38 | background-color: #fff; 39 | line-height: 34px; 40 | text-align: center; 41 | padding: 0; 42 | margin-right: 0; 43 | margin-left: auto; 44 | float: right; 45 | ` 46 | export const LinkSocialStyle = styled.a` 47 | margin: 10px; 48 | height: 100px; 49 | border-radius: 10px; 50 | border: 1px solid #00A6FB; 51 | width: 30%; 52 | display: flex; 53 | flex-direction: row; 54 | justify-content: flex-start; 55 | align-items: center; 56 | font-size: 22px; 57 | color: var(--safe-text-color); 58 | padding: 20px; 59 | span{ 60 | margin-left: 10px; 61 | } 62 | @media (max-width: 996px){ 63 | width: auto; 64 | margin: 10px 14px; 65 | } 66 | ` -------------------------------------------------------------------------------- /src/components/contact/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {Row, Divider, Image} from 'antd'; 3 | import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; 4 | import Translate from '@docusaurus/Translate'; 5 | import { useHistory } from '@docusaurus/router'; 6 | import { IconFont } from "../icon"; 7 | import {EmailModal} from '../emailModal'; 8 | import {Title, Context} from '../styles' 9 | import {DL, DT, DD, Item, US, Link, FT} from './styles'; 10 | 11 | const Concat = () => { 12 | const history = useHistory(); 13 | const { 14 | i18n: {currentLocale} 15 | } = useDocusaurusContext(); 16 | const linkToSlack = () => { 17 | window.open("https://stonedb.slack.com/join/shared_invite/zt-1ba2lpvbo-Vqq62DJcxViyxCZmp7Rimw#/shared-invite/email", 'blank'); 18 | } 19 | const linkToDowload = () => { 20 | history.push("/docs/download"); 21 | } 22 | 23 | return ( 24 | 25 | 26 | <Translate id="home.contact.title"> 27 | Stay tuned with StoneDB 28 | </Translate> 29 | 30 | 31 | 32 |
33 |
34 | 35 | 36 | Questions/bugs? 37 | 38 |
39 |
40 | 41 | 想要提出功能需求, 42 | 43 | 44 | 使用求助 45 | 或者反馈bug? 46 |
47 |
48 |
49 | 50 |
51 | 52 | 53 | 订阅邮件 54 | 55 |
56 |
57 |
58 | 59 | 接受最新功能更新、开源社区活动消息 60 | 61 |
62 |
63 | 64 | { 65 | currentLocale === 'en' ? ( 66 | 67 |
68 |
69 | 70 | 71 | Join our slack workspace! 72 | 73 |
74 |
75 | 76 | . We will invite you in. 77 | 78 |
79 |
80 |
81 |
82 | 83 | 84 | Release AtomStore 1.0.0 85 | 86 |
87 |
88 | 89 | is released. Go to downloads page to find … 90 | 91 |
92 |
93 | 94 | ) : ( 95 | 96 | 97 | 98 | 99 | 关注公众号 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 联系我们 108 | 109 | 110 | dev-subscribe@stonedb.io 111 | 112 | 113 | 114 | ) 115 | } 116 |
117 |
118 | ) 119 | } 120 | export default Concat; -------------------------------------------------------------------------------- /src/components/contact/styles.ts: -------------------------------------------------------------------------------- 1 | import { Col } from 'antd'; 2 | import styled from 'styled-components'; 3 | import { IconFont } from "../icon"; 4 | 5 | export const DL = styled.dl` 6 | border-bottom: 1px solid var(--safe-border-color-base); 7 | cursor: pointer; 8 | position: relative; 9 | ` 10 | 11 | export const DD = styled.dd` 12 | width: 100%; 13 | font-size: 14px; 14 | font-weight: 300; 15 | line-height: 30px; 16 | height: 60px; 17 | color: var(--safe-text-color-secondary); 18 | padding: 0 32px; 19 | @media (max-width: 996px){ 20 | width: 100%; 21 | } 22 | a: hover{ 23 | text-decoration: underline; 24 | } 25 | ` 26 | 27 | export const DT = styled.dt` 28 | height: 30px; 29 | font-size: 22px; 30 | font-weight: 400; 31 | line-height: 30px; 32 | .icon{ 33 | margin-right: 10px; 34 | } 35 | ` 36 | 37 | export const FT = styled(IconFont)` 38 | position: absolute; 39 | right: 0; 40 | top: 10px; 41 | ` 42 | 43 | export const Item = styled.div` 44 | display: flex; 45 | flex-direction: row; 46 | justify-content: flex-start; 47 | align-items: center; 48 | 49 | .icon{ 50 | margin-right: 10px; 51 | } 52 | 53 | .more, .ant-image{ 54 | margin-right: 0; 55 | margin-left: auto; 56 | } 57 | ` 58 | 59 | export const US = styled(Col)` 60 | padding: 30px; 61 | background: var(--safe-alert-info-bg-color); 62 | border-radius: 10px; 63 | @media (max-width: 996px){ 64 | background: none; 65 | width: 100%; 66 | margin-left: 0; 67 | flex: 1; 68 | max-width: 100%; 69 | padding: 0; 70 | } 71 | ` 72 | 73 | export const Link = styled(Col)` 74 | width: 50%; 75 | &:nth-child(1){ 76 | padding-right: 20px; 77 | } 78 | &:nth-child(2){ 79 | padding-left: 20px; 80 | } 81 | @media (max-width: 996px){ 82 | width: 100%; 83 | &:nth-child(1), &:nth-child(2){ 84 | padding: 0; 85 | } 86 | } 87 | ` -------------------------------------------------------------------------------- /src/components/default.interface.ts: -------------------------------------------------------------------------------- 1 | export interface IBase { 2 | className?: string; 3 | } 4 | -------------------------------------------------------------------------------- /src/components/docLinks/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from 'react'; 2 | import {unified} from 'unified'; 3 | import remarkParse from 'remark-parse'; 4 | import { v4 as uuidv4 } from 'uuid'; 5 | import {pickWhen} from '@site/src/utils'; 6 | import MDXA from '@site/src/theme/MDXComponents/A'; 7 | import {First, Second, Third, Fourth} from './styles'; 8 | 9 | const DocLinks: React.FC = ({children, type}) => { 10 | const [list, setList] = useState(null); 11 | function init() { 12 | const node = unified().use(remarkParse).parse(children); 13 | const reduceParagraph = (list: any[]) => { 14 | if(!list.length) { 15 | return []; 16 | } 17 | return pickWhen('paragraph', (acc, cur) => { 18 | const {url, children, title} = cur.children[0]; 19 | acc.push({ 20 | title, 21 | url, 22 | text: children[0].value 23 | }); 24 | return acc; 25 | }, list); 26 | } 27 | const reduceList = (list: any[]) => { 28 | return pickWhen('list', (acc, cur) => { 29 | const children = pickWhen('listItem', (acc, cur) => { 30 | let children = []; 31 | const ps = cur.children.filter(({type}) => type === 'paragraph'); 32 | const lists = cur.children.filter(({type}) => type === 'list'); 33 | if(ps?.length === lists?.length && lists?.length === 1) { 34 | const {url, title, ...current} = ps[0]?.children[0]; 35 | children.push({ 36 | title, 37 | url, 38 | text: current.children[0].value, 39 | children: reduceList(lists), 40 | }); 41 | } else { 42 | children = reduceParagraph(cur.children) 43 | } 44 | return acc.concat(children); 45 | }, cur.children); 46 | return acc.concat(children); 47 | }, list); 48 | } 49 | const list = reduceList([node]); 50 | setList(list) 51 | } 52 | 53 | useEffect(() => { 54 | init(); 55 | }, []); 56 | 57 | if(type && type === 'fourth') { 58 | return ( 59 | 60 | { 61 | list && list.length && list.map(({text, url, title}) => ( 62 | {text} 63 | )) 64 | } 65 | 66 | ) 67 | } 68 | 69 | return ( 70 | 71 | { 72 | list && list.length && list.map(({children, text, url, title}) => { 73 | return ( 74 |
75 | {text} 76 | { 77 | children && children.length ? ( 78 | 79 | { 80 | children.map(({children, text, url, title}) => ( 81 |
82 | {text} 83 | { 84 | children && children.length ? ( 85 | 86 | { 87 | children.map(({text, url, title}) => ( 88 | {text} 89 | )) 90 | } 91 | 92 | ) : null 93 | } 94 |
95 | )) 96 | } 97 |
98 | ) : null 99 | } 100 |
101 | ) 102 | }) 103 | } 104 |
105 | ) 106 | 107 | // return ( 108 | // 109 | // { 110 | // list && list.length && list.map(({children, text, url, title}) => { 111 | // return ( 112 | // 113 | // {text} 114 | // 115 | // { 116 | // children && children.length && children.map(({text, url, title}) => { 117 | // return ( 118 | // 119 | // {text} 120 | // 121 | // ) 122 | // }) 123 | // } 124 | // 125 | // 126 | // ) 127 | // }) 128 | // } 129 | // 130 | // ); 131 | }; 132 | export default DocLinks; -------------------------------------------------------------------------------- /src/components/docLinks/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | 3 | export const First = styled.div` 4 | display: flex; 5 | flex-direction: row; 6 | flex-wrap: wrap; 7 | justify-content: flex-start; 8 | overflow: hidden; 9 | position: relative; 10 | margin: 10px -20px; 11 | @media (max-width: 996px){ 12 | margin: 10px 0; 13 | } 14 | a{ 15 | padding-top: 20px; 16 | font-size: 22px; 17 | font-weight: 400; 18 | color: #373C43; 19 | } 20 | > div { 21 | width: 50%; 22 | padding: 0 20px; 23 | @media (max-width: 996px){ 24 | width: 100%; 25 | padding: 0; 26 | } 27 | } 28 | 29 | ` 30 | 31 | export const Second = styled.div` 32 | display: flex; 33 | flex-direction: column; 34 | overflow: hidden; 35 | padding-left: 20px; 36 | > div{ 37 | width: 100%; 38 | display: flex; 39 | flex-direction: column; 40 | } 41 | a{ 42 | font-size: 18px; 43 | font-weight: 400; 44 | color: #646A7D; 45 | } 46 | ` 47 | 48 | export const Third = styled.div` 49 | display: flex; 50 | flex-direction: row; 51 | flex-wrap: wrap; 52 | justify-content: flex-start; 53 | overflow: hidden; 54 | a{ 55 | display: inline-block; 56 | margin: 0 20px; 57 | border-width: 0; 58 | font-size: 14px; 59 | font-weight: 300; 60 | color: #646A7D; 61 | @media (max-width: 996px){ 62 | display: flex; 63 | width: 100%; 64 | margin: 0; 65 | margin-left: 20px; 66 | border-width: 1px; 67 | } 68 | span{ 69 | opacity: 0; 70 | @media (max-width: 996px){ 71 | opacity: 1; 72 | } 73 | } 74 | &:hover{ 75 | border-width: 1px; 76 | span{ 77 | opacity: 1; 78 | } 79 | } 80 | } 81 | ` 82 | 83 | export const Fourth = styled.div` 84 | display: flex; 85 | flex-direction: row; 86 | flex-wrap: wrap; 87 | justify-content: flex-start; 88 | overflow: hidden; 89 | margin: 10px -20px; 90 | @media (max-width: 996px){ 91 | margin: 10px 0; 92 | } 93 | > a { 94 | width: 20%; 95 | margin: 0 20px; 96 | padding-top: 20px; 97 | @media (max-width: 996px){ 98 | width: 100%; 99 | margin: 0; 100 | } 101 | } 102 | `; -------------------------------------------------------------------------------- /src/components/download/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from 'react'; 2 | import { Button, Space } from 'antd'; 3 | import { DownloadOutlined, RightOutlined } from '@ant-design/icons'; 4 | import Translate from '@docusaurus/Translate'; 5 | import { useHistory, useLocation } from '@docusaurus/router'; 6 | import {loadScript} from '@site/src/utils'; 7 | import { Context } from '../styles'; 8 | import { Item, DownLoadBtn } from './styles'; 9 | 10 | const Download: React.FC = () => { 11 | const history = useHistory(); 12 | const location = useLocation() 13 | const renderAd = async () => { 14 | // 实例化 PAG 15 | const PAG = await (window as any).libpag.PAGInit(); 16 | // 获取 PAG 素材数据 17 | const buffer = await fetch("https://static.stoneatom.com/assets/12342342424331324.pag").then( 18 | (response) => response.arrayBuffer() 19 | ); 20 | // 加载 PAG 素材为 PAGFile 对象 21 | const pagFile = await PAG.PAGFile.load(buffer); 22 | // 将画布尺寸设置为 PAGFile的尺寸 23 | const canvas = document.getElementById("pag"); 24 | canvas.width = pagFile.width(); 25 | canvas.height = pagFile.height(); 26 | // 实例化 PAGView 对象 27 | const pagView = await PAG.PAGView.init(pagFile, canvas); 28 | pagView.setRepeatCount(0); 29 | // 播放 PAGView 30 | await pagView.play(); 31 | 32 | } 33 | 34 | const gotoDownload = () => { 35 | history.push('docs/download'); 36 | } 37 | 38 | const gotoStart = () => { 39 | history.push('docs/getting-started/quick-start'); 40 | } 41 | 42 | useEffect(() => { 43 | if(location.pathname === '/' || location.pathname === '/zh/') { 44 | loadScript('//static.stoneatom.com/libpag.4.0.5.min.js' , {id: 'libpag'}).then((res) => { 45 | renderAd(); 46 | }); 47 | } 48 | 49 | }, [location.pathname]); 50 | 51 | return ( 52 | 53 | 54 | 55 |

56 | StoneDB for MySQL 57 |

58 |

59 | 一个基于MySQL的开源实时HTAP数据库 60 |

61 | 62 | 63 | 下载 64 | 65 | 66 | 70 | 71 |
72 | 73 | 74 | {/* */} 75 | 76 |
77 |
78 | ); 79 | }; 80 | export default Download; -------------------------------------------------------------------------------- /src/components/download/styles.ts: -------------------------------------------------------------------------------- 1 | import { Button } from 'antd'; 2 | import styled from 'styled-components'; 3 | 4 | 5 | export const Item = styled.div` 6 | flex: 1; 7 | padding: 14px; 8 | h2 { 9 | font-size: 55px; 10 | font-weight: 400; 11 | line-height: 67px; 12 | color: var(--safe-text-color); 13 | @media (max-width: 996px){ 14 | line-height: 24px; 15 | font-size: 20px; 16 | } 17 | } 18 | p{ 19 | height: 25px; 20 | font-size: 18px; 21 | font-weight: 400; 22 | color: var(--safe-text-color-secondary); 23 | line-height: 22px; 24 | margin-bottom: 90px; 25 | @media (max-width: 996px){ 26 | font-size: 12px; 27 | font-weight: 400; 28 | line-height: 20px; 29 | } 30 | } 31 | ` 32 | 33 | export const DownLoadBtn = styled(Button)` 34 | width: 174px; 35 | @media (max-width: 996px){ 36 | display: none; 37 | } 38 | ` 39 | -------------------------------------------------------------------------------- /src/components/emailModal/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Alert } from 'antd'; 3 | import { CloseCircleOutlined } from '@ant-design/icons'; 4 | import {SubscribeMail} from '../subscribeMail' 5 | import {EmailModalStyle, EmailModalContext} from './styles'; 6 | 7 | export const EmailModal = ({children}) => { 8 | const [isModalVisible, setIsModalVisible] = useState(false); 9 | const showModal = () => { 10 | setIsModalVisible(true); 11 | }; 12 | 13 | const handleCancel = () => { 14 | setIsModalVisible(false); 15 | }; 16 | 17 | const childs = React.Children.map(children, (child) => React.cloneElement(child, { 18 | onClick: showModal 19 | })) 20 | 21 | return ( 22 | <> 23 | {childs} 24 | } 29 | footer={null} 30 | onCancel={handleCancel} 31 | > 32 | 33 | 34 | } type="info" /> 35 | 36 | 37 | 38 | ); 39 | } -------------------------------------------------------------------------------- /src/components/emailModal/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import {Modal} from 'antd'; 3 | 4 | export const EmailModalStyle = styled(Modal)` 5 | height: 385px; 6 | .ant-modal-close{ 7 | margin-top: -40px; 8 | margin-right: -40px; 9 | color: #fff; 10 | .ant-modal-close-x{ 11 | font-size: 22px; 12 | } 13 | } 14 | @media (max-width: 996px){ 15 | .ant-modal-close{ 16 | margin-top: -50px; 17 | margin-right: -20px; 18 | color: #fff; 19 | .ant-modal-close-x{ 20 | font-size: 22px; 21 | } 22 | } 23 | } 24 | `; 25 | 26 | export const EmailModalContext = styled.div` 27 | display: flex; 28 | flex-direction: row; 29 | @media (max-width: 996px){ 30 | flex-direction: column; 31 | .message{ 32 | margin-top: 20px; 33 | } 34 | } 35 | ` -------------------------------------------------------------------------------- /src/components/events/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from 'react'; 2 | import {unified} from 'unified'; 3 | import remarkParse from 'remark-parse'; 4 | import { v4 as uuidv4 } from 'uuid'; 5 | import {pickWhen} from '@site/src/utils'; 6 | import {Image} from '../image'; 7 | import {Row, Col, Title, Desc, LinkStyle} from './styles'; 8 | 9 | const Events: React.FC = ({children}) => { 10 | const [list, setList] = useState(null); 11 | 12 | function init() { 13 | const node = unified().use(remarkParse).parse(children); 14 | const list = pickWhen('listItem', (acc, cur) => { 15 | return acc.concat(cur.children); 16 | }, [node]); 17 | setList(list) 18 | } 19 | 20 | useEffect(() => { 21 | init(); 22 | }, []); 23 | 24 | const renderItem = (children) => { 25 | const id = uuidv4(); 26 | const image = children[0]?.type === 'image' ? children[0] : null; 27 | const texts = children[1]?.type === 'text' ? children[1].value.split('\n') : []; 28 | const link = children[2]?.type === 'link' ? children[2].url : ''; 29 | return ( 30 | 31 | { 32 | image && image.type ? ( 33 | 34 | {texts[0]} 35 | {texts[1]} 36 | More 37 | 38 | ) : null 39 | } 40 | 41 | ) 42 | } 43 | 44 | return ( 45 | 46 | { 47 | list && list.length && list.map(({children}) => renderItem(children)) 48 | } 49 | 50 | ); 51 | }; 52 | export default Events; -------------------------------------------------------------------------------- /src/components/events/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | import Link from '@docusaurus/Link'; 3 | import {Image} from '../image'; 4 | 5 | export const Row = styled.div` 6 | display: flex; 7 | flex-direction: row; 8 | flex-wrap: wrap; 9 | justify-content: flex-start; 10 | margin: 0 -8px; 11 | overflow: hidden; 12 | position: relative; 13 | @media (max-width: 996px){ 14 | margin: 0 14px; 15 | } 16 | ` 17 | export const Col = styled.div` 18 | width: 50%; 19 | padding: 8px; 20 | display: flex; 21 | justify-content: center; 22 | align-items: center; 23 | position: relative; 24 | overflow: hidden; 25 | > div { 26 | width: 100%; 27 | height: 100%; 28 | border-radius: 10px; 29 | } 30 | @media (max-width: 996px){ 31 | width: 100%; 32 | } 33 | ` 34 | export const Title = styled.h4` 35 | height: 27px; 36 | font-size: 22px; 37 | font-weight: 400; 38 | color: #FFFFFF; 39 | line-height: 27px; 40 | ` 41 | 42 | export const Desc = styled.p` 43 | height: 30px; 44 | font-size: 16px; 45 | font-weight: 300; 46 | color: #FFFFFF; 47 | line-height: 30px; 48 | ` 49 | 50 | export const LinkStyle = styled(Link)` 51 | height: 19px; 52 | font-size: 16px; 53 | font-weight: 400; 54 | color: #FFFFFF; 55 | line-height: 19px; 56 | ` 57 | -------------------------------------------------------------------------------- /src/components/feature/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {Space} from 'antd'; 3 | import Translate from '@docusaurus/Translate'; 4 | import { IconFont } from '../icon'; 5 | import {Title, Context} from '../styles'; 6 | import {Item, List} from './styles'; 7 | 8 | const Feature = () => { 9 | return ( 10 | 11 | 12 | <Translate id="home.feat.title">版本特性</Translate> 13 | 14 | 15 | 16 | 17 | 18 | 100%兼容MySQL 5.7 19 | 20 |

21 | 基于MySQL5.7版本开发,完全兼容所有MySQL语法与接口,支持从MySQL直接更新升级 22 |

23 |
24 | 25 | 26 | 27 | 混合事务和分析处理 28 | 29 |

30 | 在MySQL事务处理(TP)功能的基础上,增加分析处理(AP)功能 31 |

32 |
33 | 34 | 35 | 36 | 实时分析,低时延 37 | 38 |

39 | 无需数据提取,直接实时分析,分析操作几乎无延时 40 |

41 |
42 | 43 | 44 | 45 | 10倍查询速度 46 | 47 |

48 | 复杂query查询速度可提升10倍 49 |

50 |
51 | 52 | 53 | 54 | 10倍初始导入速度 55 | 56 |

57 | 数据库初始导入速度可提升10倍 58 |

59 |
60 | 61 | 62 | 63 | 1/10 存储占用 64 | 65 |

66 | 高效压缩算法,节省大量存储空间 67 |

68 |
69 |
70 |
71 | ) 72 | } 73 | export default Feature; -------------------------------------------------------------------------------- /src/components/feature/styles.ts: -------------------------------------------------------------------------------- 1 | import { Space } from 'antd'; 2 | import styled from 'styled-components'; 3 | 4 | export const List = styled(Space)` 5 | .ant-space-item{ 6 | padding: 45px; 7 | } 8 | @media (max-width: 996px){ 9 | padding: 0; 10 | .ant-space-item{ 11 | width: 100%; 12 | padding: 0 45px; 13 | } 14 | } 15 | ` 16 | 17 | export const Item = styled.div` 18 | display: flex; 19 | flex-direction: column; 20 | justify-content: flex-start; 21 | align-items: center; 22 | width: 300px; 23 | text-align: center; 24 | .icon{ 25 | font-size: 150px; 26 | width: 150px; 27 | height: 200px; 28 | } 29 | @media (max-width: 996px){ 30 | width: 100%; 31 | padding: 14px; 32 | } 33 | ` 34 | -------------------------------------------------------------------------------- /src/components/footLink/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {useState} from 'react'; 3 | import { Tooltip, Space, Alert } from 'antd'; 4 | import { TwitterOutlined, MailOutlined, SlackOutlined, GithubOutlined, CloseCircleOutlined } from '@ant-design/icons'; 5 | import {SubscribeMail} from '../subscribeMail/'; 6 | import {Link, EmailModal, EmailModalContext} from './styles'; 7 | 8 | export const FooterLink = () => { 9 | const [isModalVisible, setIsModalVisible] = useState(false); 10 | 11 | const showModal = () => { 12 | setIsModalVisible(true); 13 | }; 14 | 15 | const handleCancel = () => { 16 | setIsModalVisible(false); 17 | }; 18 | return ( 19 | <> 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | } 45 | footer={null} 46 | onCancel={handleCancel} 47 | > 48 | 49 | 50 | } type="info" /> 51 | 52 | 53 | 54 | ) 55 | } 56 | -------------------------------------------------------------------------------- /src/components/footLink/styles.tsx: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import {Modal} from 'antd'; 3 | import ULink from '@docusaurus/Link'; 4 | 5 | export const Link = styled(ULink)` 6 | font-size: 30px; 7 | color: var(--safe-text-color-secondary-dark); 8 | &:hover{ 9 | color: var(--safe-text-color-dark); 10 | } 11 | `; 12 | 13 | export const EmailModal = styled(Modal)` 14 | height: 385px; 15 | .ant-modal-close{ 16 | margin-top: -40px; 17 | margin-right: -40px; 18 | color: #fff; 19 | .ant-modal-close-x{ 20 | font-size: 22px; 21 | } 22 | } 23 | `; 24 | 25 | export const EmailModalContext = styled.div` 26 | display: flex; 27 | flex-direction: row; 28 | background-color: red;; 29 | @media (max-width: 996px){ 30 | flex-direction: column; 31 | } 32 | ` -------------------------------------------------------------------------------- /src/components/github/fork.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {ForkOutlined} from '@ant-design/icons'; 3 | import {IFork} from './interface'; 4 | import {Social} from '../social'; 5 | 6 | export const Fork: React.FC = ({value}) => { 7 | return ( 8 | 9 | 10 | 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /src/components/github/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {getRepoDetail} from '@site/src/utils'; 3 | import {Fork} from './fork'; 4 | import {Star} from './star'; 5 | import {IGithub} from './interface'; 6 | import GithubStyle from './styles'; 7 | 8 | const GithubContext = React.createContext({ 9 | star: '', 10 | forks: '' 11 | }); 12 | 13 | 14 | export class Github extends React.Component { 15 | constructor(props: any) { 16 | super(props); 17 | this.state = { 18 | star: '', 19 | forks: '' 20 | }; 21 | this.getData(); 22 | } 23 | 24 | async getData() { 25 | const {forks_count, stargazers_count} = await getRepoDetail('StoneAtom/stonedb'); 26 | this.setState({ 27 | star: stargazers_count, 28 | forks: forks_count 29 | }) 30 | } 31 | 32 | static Fork() { 33 | return ( 34 | 35 | { 36 | ({forks}) => ( 37 | 38 | ) 39 | } 40 | 41 | ) 42 | } 43 | 44 | static Star() { 45 | return ( 46 | 47 | { 48 | ({star}) => ( 49 | 50 | ) 51 | } 52 | 53 | ) 54 | } 55 | 56 | render() { 57 | return ( 58 | 59 | 60 | {this.props.children} 61 | 62 | 63 | ); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/components/github/interface.ts: -------------------------------------------------------------------------------- 1 | export interface IFork{ 2 | value: string; 3 | } 4 | 5 | export interface IStar{ 6 | value: string; 7 | } 8 | 9 | 10 | export interface IGithub{ 11 | forks: string; 12 | star: string; 13 | children?: any; 14 | className?: string; 15 | } 16 | -------------------------------------------------------------------------------- /src/components/github/star.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {GithubOutlined} from '@ant-design/icons'; 3 | import {Social} from '../social'; 4 | import {IStar} from './interface' 5 | 6 | export const Star: React.FC = ({value}) => { 7 | 8 | return ( 9 | 10 | 11 | 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /src/components/github/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import { Space } from 'antd'; 3 | 4 | const GithubStyle = styled(Space)` 5 | margin: 0 30px; 6 | .link{ 7 | height: auto; 8 | line-height: auto; 9 | border: none; 10 | padding: 0; 11 | } 12 | ` 13 | 14 | export default GithubStyle; -------------------------------------------------------------------------------- /src/components/icon/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from 'react'; 2 | import lottie from 'lottie-web' 3 | import { createFromIconfontCN } from '@ant-design/icons'; 4 | import md5 from 'js-md5'; 5 | import {Span} from './styles'; 6 | 7 | const Icon = createFromIconfontCN({ 8 | scriptUrl: [ 9 | '//static.stoneatom.com/assets/rc-upload-1656646066193-4_iconfont.js' 10 | ], 11 | }); 12 | 13 | 14 | 15 | 16 | export const IconFont = ({type, className}: any) => { 17 | const [lotties, setLotties] = useState({}); 18 | const id = md5(type); 19 | const onMouseEnter = () => { 20 | lotties[id].play(); 21 | } 22 | 23 | const onMouseLeave = () => { 24 | lotties[id].stop(); 25 | 26 | } 27 | useEffect(() => { 28 | if(type.indexOf('lottie-') >= 0) { 29 | const instance = lottie.loadAnimation({ 30 | container: document.getElementById(id), 31 | renderer: 'svg', 32 | loop: true, 33 | autoplay: false, 34 | path: `https://stoneatom-static.oss-cn-hangzhou.aliyuncs.com/assets/${type}.json` 35 | }); 36 | setLotties(Object.assign(lotties, {[id]: instance})) 37 | return () => { 38 | lotties[id].destroy(); 39 | } 40 | } 41 | }, []); 42 | 43 | return ( 44 | <> 45 | { 46 | type.indexOf('lottie-') >= 0 ? ( 47 | 48 | ) : ( 49 | 50 | ) 51 | } 52 | 53 | ) 54 | } -------------------------------------------------------------------------------- /src/components/icon/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | 3 | export const Span = styled.div` 4 | display: inline-block; 5 | overflow: hidden; 6 | ` -------------------------------------------------------------------------------- /src/components/image/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { useHistory } from '@docusaurus/router'; 3 | import {IImage} from './interface'; 4 | import {ImageStyle, Title, Mask} from './styles'; 5 | 6 | export const Image: React.FC = ({src, children, className, alt, to}) => { 7 | const history = useHistory(); 8 | const linkTo = () => { 9 | if(to.indexOf('//') === 0) { 10 | window.open(to, 'blank') 11 | } else { 12 | history.push(to); 13 | } 14 | } 15 | return ( 16 | 17 | {children} 18 | 19 | 20 | ) 21 | } -------------------------------------------------------------------------------- /src/components/image/interface.ts: -------------------------------------------------------------------------------- 1 | import { ReactNode } from "react"; 2 | 3 | export interface IImage { 4 | src: string; 5 | className?: string; 6 | children?: ReactNode; 7 | width?: number; 8 | height?: number; 9 | alt?: string; 10 | to?: string 11 | } 12 | -------------------------------------------------------------------------------- /src/components/image/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import {IImage} from './interface'; 3 | 4 | 5 | 6 | export const ImageStyle = styled.div.attrs(({width, height, src}: IImage) => { 7 | const size = width || height || 'auto'; 8 | return { 9 | height: height ? `${height}px` : size, 10 | width: width ? `${width}px` : size, 11 | src: src || 'none', 12 | } 13 | })` 14 | background-image: url(${props => props.src}); 15 | background-repeat: no-repeat; 16 | background-size: cover; 17 | width: ${props => props.width}; 18 | height: ${props => props.height}; 19 | overflow: hidden; 20 | padding: 16px; 21 | position: relative; 22 | padding-top: 100%; 23 | cursor: pointer; 24 | &:hover{ 25 | .mask { 26 | background-color: transparent; 27 | } 28 | } 29 | ` 30 | 31 | export const Mask = styled.div` 32 | background-color: rgba(0,0,0,0.6); 33 | position: absolute; 34 | left: 0; 35 | right: 0; 36 | top: 0; 37 | bottom: 0; 38 | z-index: 0; 39 | ` 40 | 41 | export const Title = styled.div` 42 | position: absolute; 43 | bottom: 16px; 44 | z-index: 1; 45 | color: #fff; 46 | `; 47 | -------------------------------------------------------------------------------- /src/components/index.ts: -------------------------------------------------------------------------------- 1 | export * from './footLink' 2 | export * from './social'; 3 | export * from './github'; 4 | export * from './styles'; 5 | export * from './image'; 6 | export * from './seeMore'; 7 | export * from './subscribeMail'; 8 | export * from './Link'; 9 | export * from './icon'; 10 | export * from './switchLocale' 11 | export * from './omit'; 12 | export * from './emailModal' -------------------------------------------------------------------------------- /src/components/join/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | import {unified} from 'unified'; 3 | import remarkParse from 'remark-parse'; 4 | import { v4 as uuidv4 } from 'uuid'; 5 | import {pickWhen} from '@site/src/utils'; 6 | import MDXA from '@site/src/theme/MDXComponents/A'; 7 | import {LinkList} from './styles'; 8 | 9 | const Join: React.FC = ({children}) => { 10 | const [list, setList] = useState(null) 11 | function init() { 12 | const node = unified().use(remarkParse).parse(children); 13 | 14 | const list = pickWhen('link', (acc, cur) => { 15 | acc.push(cur); 16 | return acc; 17 | }, [node]); 18 | setList(list); 19 | } 20 | 21 | useEffect(() => { 22 | init(); 23 | }, []); 24 | 25 | return ( 26 | 27 | { 28 | list && list.length && list.map(({children, ...props}) => ( 29 | {children[0].value} 30 | )) 31 | } 32 | 33 | ); 34 | }; 35 | export default Join; -------------------------------------------------------------------------------- /src/components/join/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | import Link from '@docusaurus/Link'; 3 | 4 | export const LinkList = styled.div` 5 | margin: 0 -10px; 6 | width: 100%; 7 | display: flex; 8 | flex-direction: row; 9 | flex-wrap: wrap; 10 | @media (max-width: 996px){ 11 | margin: 0; 12 | flex-direction: column; 13 | } 14 | ` 15 | 16 | export const LinkStyle = styled(Link)` 17 | margin: 10px; 18 | height: 100px; 19 | border-radius: 10px; 20 | border: 1px solid #00A6FB; 21 | width: 30%; 22 | display: flex; 23 | flex-direction: row; 24 | justify-content: flex-start; 25 | align-items: center; 26 | font-size: 22px; 27 | color: var(--safe-text-color); 28 | padding: 20px; 29 | span{ 30 | margin-left: 10px; 31 | } 32 | @media (max-width: 996px){ 33 | width: 100%; 34 | margin: 10px 0; 35 | } 36 | ` 37 | -------------------------------------------------------------------------------- /src/components/omit/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Tooltip } from 'antd'; 3 | import {IOmitText} from './interface'; 4 | 5 | export const OmitText: React.FC = ({ children, size }) => { 6 | const value = children as string || ''; 7 | return ( 8 | size ? value : null}> 9 | 10 | {value.substring(0, size)} 11 | {size < value.length ? '...' : ''} 12 | 13 | 14 | ); 15 | }; 16 | -------------------------------------------------------------------------------- /src/components/omit/interface.ts: -------------------------------------------------------------------------------- 1 | import { ReactNode } from "react"; 2 | 3 | export interface IOmitText { 4 | size: number; 5 | children: ReactNode; 6 | } 7 | -------------------------------------------------------------------------------- /src/components/seeMore/index.tsx: -------------------------------------------------------------------------------- 1 | import React, {ReactNode, useState} from 'react'; 2 | import {DownOutlined, UpOutlined} from '@ant-design/icons'; 3 | import Translate from '@docusaurus/Translate'; 4 | import {ISeeMore} from './interface'; 5 | import {Button} from './styles'; 6 | 7 | export const SeeMore: React.FC = ({children = [], size}) => { 8 | const [more, setMore] = useState(false); 9 | const childs = children as ReactNode[]; 10 | const show = childs?.slice(0, size); 11 | const hide = childs?.slice(size); 12 | const toggleMore = () => { 13 | setMore(!more); 14 | } 15 | const Less = Less; 16 | const More = More; 17 | return ( 18 | <> 19 | {show} 20 | { 21 | more ? hide : null 22 | } 23 | 24 | 25 | ) 26 | } 27 | -------------------------------------------------------------------------------- /src/components/seeMore/interface.ts: -------------------------------------------------------------------------------- 1 | import { ReactNode } from "react"; 2 | 3 | export interface ISeeMore { 4 | size: number; 5 | children: ReactNode; 6 | } 7 | -------------------------------------------------------------------------------- /src/components/seeMore/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components' 2 | 3 | export const Button = styled.div` 4 | display: block; 5 | width: 100%; 6 | text-align: center; 7 | margin: 30px 0; 8 | cursor: pointer; 9 | ` 10 | -------------------------------------------------------------------------------- /src/components/social/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Button, Divider } from "antd"; 3 | import {ISocial} from './interface'; 4 | 5 | function formatNumber(num: number, unit = 'K') { 6 | let numStr = ''; 7 | if(num < 1000) { 8 | numStr = String(num); 9 | } else { 10 | numStr = `${(num / 1000).toFixed(2)}${unit}` 11 | } 12 | return numStr 13 | } 14 | 15 | export const Social: React.FC = ({title, value, children, to}) => { 16 | const goto = () => { 17 | if(!to){ 18 | return false; 19 | } 20 | window.open(to, 'blank'); 21 | } 22 | 23 | return ( 24 | <> 25 | { 26 | value ? ( 27 | 33 | ) : null 34 | } 35 | 36 | ) 37 | } 38 | -------------------------------------------------------------------------------- /src/components/social/interface.ts: -------------------------------------------------------------------------------- 1 | import { ReactNode } from "react"; 2 | 3 | export interface ISocial { 4 | title: ReactNode; 5 | value: string; 6 | children: ReactNode; 7 | to?: string; 8 | } 9 | -------------------------------------------------------------------------------- /src/components/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | 3 | export const Title = styled.div` 4 | font-size: 36px; 5 | font-weight: 500; 6 | line-height: 50px; 7 | margin-bottom: 38px; 8 | &::after{ 9 | content: '.'; 10 | } 11 | @media (max-width: 996px){ 12 | font-size: 16px; 13 | padding: 14px; 14 | margin-bottom: 0; 15 | } 16 | `; 17 | 18 | export const Context = styled.div` 19 | width: var(--safe-screen-xl); 20 | margin: 0 auto; 21 | overflow: hidden; 22 | @media (max-width: 996px){ 23 | width: 100%; 24 | } 25 | @media (max-width: 1200px){ 26 | padding: 14px; 27 | } 28 | ` 29 | 30 | export const DocContext = styled.div` 31 | width: var(--ifm-container-width); 32 | margin: 0 auto; 33 | overflow: hidden; 34 | @media (max-width: 996px){ 35 | width: 100%; 36 | } 37 | ` 38 | 39 | export const SubTitle = styled.div` 40 | height: 34px; 41 | font-size: 28px; 42 | font-weight: 400; 43 | line-height: 34px; 44 | margin-bottom: 20px; 45 | margin-top: 80px; 46 | display: flex; 47 | flex-direction: row; 48 | justify-content: space-between; 49 | ` 50 | -------------------------------------------------------------------------------- /src/components/subscribe/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import BrowserOnly from '@docusaurus/BrowserOnly'; 3 | import {SubscribeStyle, Message, TipStyle, Doc, Mail} from './styles'; 4 | 5 | const Subscribe: React.FC = () => { 6 | 7 | return ( 8 | 9 | { 10 | () => ( 11 | 12 | 13 | 14 | 15 | 16 | 17 | ) 18 | } 19 | 20 | ); 21 | }; 22 | export default Subscribe; -------------------------------------------------------------------------------- /src/components/subscribe/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | import {Space} from 'antd'; 3 | import {SubscribeMail} from '../subscribeMail' 4 | import {DocContext} from '../styles'; 5 | 6 | export const SubscribeStyle = styled.div` 7 | width: 100%; 8 | height: 400px; 9 | background-image: url(https://static.stoneatom.com/assets/rc-upload-1652691483537-2_subscribeBg.png); 10 | background-repeat: no-repeat; 11 | background-position: right center; 12 | background-size: 100% 100%; 13 | margin: 60px auto; 14 | @media (max-width: 996px){ 15 | width: 100%; 16 | margin-left: 0; 17 | background-image: none; 18 | height: auto; 19 | } 20 | ` 21 | 22 | export const Message = styled(SubscribeMail.Message)` 23 | color: #fff; 24 | .br { 25 | border-color: #fff; 26 | min-width: 30px; 27 | max-width: 30px; 28 | } 29 | @media (max-width: 996px){ 30 | background-color: #00A6FB; 31 | padding: var(--ifm-spacing-horizontal); 32 | } 33 | ` 34 | 35 | export const FormStyle = styled(SubscribeMail.Form)` 36 | width: 300px; 37 | height: 300px; 38 | background: #FFFFFF; 39 | box-shadow: 0px 30px 50px 0px rgba(55, 60, 67, 0.2); 40 | border-radius: 10px; 41 | padding: 20px; 42 | 43 | .ant-btn{ 44 | width: 100%; 45 | } 46 | ` 47 | 48 | export const TipStyle = styled(SubscribeMail.Tip)` 49 | width: 300px; 50 | height: 300px; 51 | background: #FFFFFF; 52 | box-shadow: 0px 30px 50px 0px rgba(55, 60, 67, 0.2); 53 | border-radius: 10px; 54 | padding: 20px; 55 | margin-top: 20px; 56 | .ant-btn{ 57 | width: 100%; 58 | } 59 | @media (max-width: 996px){ 60 | width: 90%; 61 | height: auto; 62 | flex: 1; 63 | margin-top: -20px; 64 | margin-bottom: 20px; 65 | margin-left: var(--ifm-spacing-horizontal); 66 | margin-right: var(--ifm-spacing-horizontal); 67 | } 68 | ` 69 | 70 | export const Mail = styled.div` 71 | height: 100%; 72 | width: 100%; 73 | display: flex; 74 | flex-direction: row; 75 | padding: 30px 0 30px 30px; 76 | @media (max-width: 996px){ 77 | flex-direction: column; 78 | padding: 0; 79 | width: 120%; 80 | height: 120%; 81 | margin: -10%; 82 | > div:first-child { 83 | width: 100%; 84 | padding: 30px; 85 | } 86 | } 87 | ` 88 | -------------------------------------------------------------------------------- /src/components/subscribeMail/form.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from 'react'; 2 | import { message, Input } from 'antd'; 3 | import { SendOutlined } from '@ant-design/icons'; 4 | import {EMAIL} from '@site/src/utils'; 5 | import { ISubscribeForm } from './interface'; 6 | import { FormStyle, SubscribeBtn } from './styles'; 7 | 8 | export const Form: React.FC = ({ onSubmit, className }) => { 9 | const doSunscribe = async(values: any) => { 10 | 11 | }; 12 | 13 | return ( 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 订阅 25 | 26 | 27 | 28 | ); 29 | }; 30 | -------------------------------------------------------------------------------- /src/components/subscribeMail/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {Form} from './form'; 3 | import {Message} from './message'; 4 | import {Tip} from './tip'; 5 | import { ISubscribeForm } from './interface'; 6 | import {IBase} from '../default.interface'; 7 | 8 | 9 | export class SubscribeMail extends React.Component { 10 | 11 | static Form (props: ISubscribeForm) { 12 | return ( 13 |
14 | ) 15 | } 16 | 17 | static Message({className}: IBase) { 18 | return ( 19 | 20 | ) 21 | } 22 | 23 | static Tip({className}: IBase) { 24 | return ( 25 | 26 | ) 27 | } 28 | 29 | render() { 30 | return null; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/components/subscribeMail/interface.ts: -------------------------------------------------------------------------------- 1 | import {IBase} from '../default.interface'; 2 | 3 | export interface ISubscribeForm extends IBase { 4 | onSubmit?: Function; 5 | } 6 | -------------------------------------------------------------------------------- /src/components/subscribeMail/message.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Space, Divider } from "antd"; 3 | import Translate from '@docusaurus/Translate'; 4 | import {IBase} from '../default.interface'; 5 | 6 | export const Message: React.FC = ({className}) => ( 7 | 8 |
9 |
10 | 加入邮件列表 11 |
12 |
13 |
14 | 邮件列表是我们公开讨论并记录的地方。如果你希望: 15 |
16 |
17 | 参与讨论开发计划或特定的问题 18 |
19 |
20 | 帮助通过邮件提问的人 21 |
22 |
23 | 帮助通过邮件提问的人 24 |
25 |
26 | 27 |

28 | 如果你有一个特定的问题要问,建议使用 GitHub Issue 报 Bug 或提需求,这是一种更有效率的方式。 29 |

30 |
31 | ); 32 | -------------------------------------------------------------------------------- /src/components/subscribeMail/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import {Button, Form, Divider} from 'antd'; 3 | 4 | 5 | export const SubscribeBtn = styled(Button)` 6 | width: 150px; 7 | margin-top: -10px; 8 | `; 9 | 10 | export const FormStyle = styled(Form)` 11 | width: 420px; 12 | ` 13 | 14 | export const BR = styled(Divider)` 15 | margin-bottom: 20px; 16 | margin-top: -10px; 17 | ` -------------------------------------------------------------------------------- /src/components/subscribeMail/tip.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Space, Divider } from "antd"; 3 | import { SendOutlined } from '@ant-design/icons'; 4 | import Translate from '@docusaurus/Translate'; 5 | import {IBase} from '../default.interface'; 6 | import { SubscribeBtn, BR } from './styles'; 7 | 8 | export const Tip: React.FC = ({className}) => { 9 | const onSubscribe = () => { 10 | window.open('mailto:dev-subscribe@stonedb.io?subject=Subscribe to the mailing list', 'blank'); 11 | } 12 | return ( 13 | 14 |
15 |
16 | 如何加入 17 |
18 |
19 |
20 | 给 contact@stonedb.io 发送任意主题的邮件。 21 |
22 |
23 | 你会收到一封回信,请照着邮件内容操作。 24 |
25 |
26 |
27 | 28 | 29 | 马上订阅 30 | 31 |
32 | ); 33 | 34 | } -------------------------------------------------------------------------------- /src/components/switchLocale/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from 'react'; 2 | import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; 3 | import { IconFont } from '../icon'; 4 | import {SelectStyle} from './styles'; 5 | 6 | export const SwitchLocal = () => { 7 | const { 8 | i18n: {currentLocale, defaultLocale, localeConfigs} 9 | } = useDocusaurusContext(); 10 | const [locale, setLocale] = useState(defaultLocale); 11 | const changeLocale = (value: string) => { 12 | setLocale(value) 13 | } 14 | 15 | useEffect(() => { 16 | setLocale(currentLocale) 17 | }, []); 18 | 19 | return ( 20 | 21 | { 22 | Object.keys(localeConfigs).map((lan) => ( 23 | {localeConfigs[lan].label} 24 | )) 25 | } 26 | 27 | ) 28 | } -------------------------------------------------------------------------------- /src/components/switchLocale/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | import {Select} from 'antd'; 3 | 4 | export const SelectStyle = styled(Select)` 5 | width: 112px; 6 | ` -------------------------------------------------------------------------------- /src/components/team/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | import {unified} from 'unified'; 3 | import remarkParse from 'remark-parse'; 4 | import {reduce} from 'ramda'; 5 | import { v4 as uuidv4 } from 'uuid'; 6 | import {pickWhen} from '@site/src/utils'; 7 | import MDXImage from '@site/src/theme/MDXComponents/Image' 8 | import {SeeMore} from '../seeMore'; 9 | import {Row, Col} from './styles'; 10 | 11 | const Team: React.FC = ({children}) => { 12 | const [list, setList] = useState(null); 13 | 14 | function init() { 15 | const node = unified().use(remarkParse).parse(children); 16 | 17 | const fn = reduce((acc, cur) => { 18 | if(cur.type === 'image'){ 19 | acc.push(cur) 20 | } else if(cur.children && cur.children.length) { 21 | acc = acc.concat(fn([], cur.children)) 22 | } 23 | return acc; 24 | }); 25 | const list = pickWhen('image', (acc, cur) => { 26 | acc.push(cur) 27 | return acc; 28 | }, [node]); 29 | 30 | setList(list); 31 | } 32 | 33 | useEffect(() => { 34 | init(); 35 | }, []); 36 | 37 | return ( 38 | 39 | 40 | { 41 | list && list.length ? list.map(({url, alt, title}) => ( 42 | 43 | 44 | 45 | )) : null 46 | } 47 | 48 | 49 | ); 50 | }; 51 | export default Team; -------------------------------------------------------------------------------- /src/components/team/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | 3 | export const Row = styled.div` 4 | display: flex; 5 | flex-direction: row; 6 | flex-wrap: wrap; 7 | justify-content: flex-start; 8 | margin: 0 -8px; 9 | overflow: hidden; 10 | position: relative; 11 | @media (max-width: 996px){ 12 | margin: 0 14px; 13 | } 14 | ` 15 | export const Col = styled.div` 16 | width: 20%; 17 | padding: 8px; 18 | display: flex; 19 | justify-content: center; 20 | align-items: center; 21 | position: relative; 22 | overflow: hidden; 23 | > div { 24 | width: 100%; 25 | height: 100%; 26 | border-radius: 8px; 27 | } 28 | @media (max-width: 996px){ 29 | width: 50%; 30 | } 31 | ` 32 | -------------------------------------------------------------------------------- /src/css/custom.less: -------------------------------------------------------------------------------- 1 | @import '~antd/dist/antd.less'; 2 | @import './theme.css'; 3 | :root { 4 | --ifm-color-primary: #00A6FB; 5 | --ifm-color-primary-dark: #29784c; 6 | --ifm-color-primary-darker: #277148; 7 | --ifm-color-primary-darkest: #205d3b; 8 | --ifm-color-primary-light: #33925d; 9 | --ifm-color-primary-lighter: #359962; 10 | --ifm-color-primary-lightest: #3cad6e; 11 | --ifm-code-font-size: 95%; 12 | --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1); 13 | --ifm-navbar-height: 100px; 14 | --ifm-footer-color: #CBCDD3; 15 | } 16 | 17 | .markdown { 18 | a { 19 | color: #00A6FB; 20 | &:hover { 21 | text-decoration: underline; 22 | } 23 | } 24 | } 25 | 26 | @media (max-width: 996px){ 27 | .footer { 28 | --ifm-footer-padding-horizontal: 0; 29 | } 30 | } 31 | 32 | .communityRow{ 33 | flex-wrap: nowrap; 34 | width: 100%; 35 | @media (max-width: 996px){ 36 | flex-wrap: wrap; 37 | } 38 | } 39 | 40 | .canvas{ 41 | width: 700px; 42 | height: 700px; 43 | } 44 | 45 | .navbar__logo{ 46 | height: 50px; 47 | font-size: 50px; 48 | margin-right: 50px; 49 | width: 182px; 50 | img{ 51 | vertical-align: top; 52 | } 53 | } 54 | 55 | .navbar__link, 56 | .navbar__title{ 57 | font-size: 18px; 58 | } 59 | 60 | .navbar__link:hover, .navbar__link--active{ 61 | font-weight: bold; 62 | } 63 | 64 | @media (max-width: 996px){ 65 | .hideInMobile, .navbar__title{ 66 | display: none; 67 | &.ant-space{ 68 | display: none; 69 | } 70 | } 71 | .navbar__logo{ 72 | height: 26px; 73 | } 74 | .navbar{ 75 | height: 44px; 76 | } 77 | .canvas{ 78 | width: 100%; 79 | height: 100%; 80 | } 81 | } 82 | 83 | .ant-tooltip.ant-tooltip-hidden{ 84 | display: none; 85 | } 86 | 87 | // .ant-tooltip.ant-tooltip-placement-top.ant-zoom-big-fast-appear.ant-zoom-big-fast-appear-active.ant-zoom-big-fast, 88 | // .ant-tooltip.ant-tooltip-placement-top.ant-zoom-big-fast-enter.ant-zoom-big-fast-enter-active.ant-zoom-big-fast{ 89 | // opacity: 0; 90 | // animation-name: none; 91 | // .ant-tooltip-content{ 92 | // opacity: 0; 93 | // } 94 | // } 95 | 96 | // .ant-tooltip.ant-tooltip-placement-top.ant-zoom-big-fast-appear.ant-zoom-big-fast-appear-active.ant-zoom-big-fast, 97 | // .ant-tooltip.ant-tooltip-placement-top.ant-zoom-big-fast-enter.ant-zoom-big-fast-enter-active.ant-zoom-big-fast{ 98 | // animation-play-state: paused; 99 | // } 100 | 101 | 102 | .ant-zoom-big-appear.ant-zoom-big-appear-active, 103 | .ant-zoom-big-enter.ant-zoom-big-enter-active, 104 | .ant-zoom-big-fast-appear.ant-zoom-big-fast-appear-active, 105 | .ant-zoom-big-fast-enter.ant-zoom-big-fast-enter-active { 106 | animation-name: SafeZoomBigIn; 107 | animation-play-state: running 108 | } 109 | 110 | .ant-zoom-big-fast-leave.ant-zoom-big-fast-leave-active, 111 | .ant-zoom-big-leave.ant-zoom-big-leave-active { 112 | animation-name: SafeZoomBigOut; 113 | animation-play-state: running; 114 | pointer-events: none; 115 | .ant-tooltip-content{ 116 | opacity: 0; 117 | } 118 | } 119 | 120 | .ant-tooltip.ant-tooltip-placement-top.ant-zoom-big-fast-appear, 121 | .ant-tooltip.ant-tooltip-placement-top.ant-zoom-big-fast-enter, 122 | .ant-tooltip.ant-tooltip-placement-top.ant-zoom-big-fast-leave { 123 | animation-duration: .001s; 124 | animation-fill-mode: both; 125 | animation-play-state: paused 126 | } 127 | 128 | 129 | .ant-tooltip.ant-tooltip-placement-top{ 130 | animation-name: SafeIn; 131 | animation-play-state: running 132 | } 133 | 134 | @keyframes SafeZoomBigOut { 135 | 0% { 136 | transform: scale(1); 137 | opacity: 0; 138 | } 139 | 100% { 140 | transform: scale(0.8); 141 | opacity: 0; 142 | } 143 | } 144 | 145 | @keyframes SafeZoomBigIn { 146 | 0% { 147 | opacity: 0; 148 | transform: scale(.8) 149 | } 150 | 99% { 151 | opacity: 0; 152 | transform: scale(.8) 153 | } 154 | 155 | to { 156 | opacity: 0; 157 | transform: scale(1) 158 | } 159 | } 160 | 161 | @keyframes SafeIn { 162 | 0% { 163 | opacity: 0; 164 | transform: scale(.8) 165 | } 166 | to { 167 | opacity: 1; 168 | transform: scale(1) 169 | } 170 | } -------------------------------------------------------------------------------- /src/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import React, {useEffect, useState} from 'react'; 2 | import Layout from '@theme/Layout' 3 | import BrowserOnly from '@docusaurus/BrowserOnly'; 4 | import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; 5 | import Download from "@site/src/components/download"; 6 | import Feature from '@site/src/components/feature'; 7 | import Concat from '@site/src/components/contact'; 8 | import Panel from './styles/panel'; 9 | import { Tooltip } from 'antd'; 10 | 11 | export default function Home() { 12 | const {siteConfig} = useDocusaurusContext(); 13 | 14 | return ( 15 | 16 | 17 | { 18 | () => ( 19 | <> 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | ) 31 | } 32 | 33 | 34 | ); 35 | } 36 | -------------------------------------------------------------------------------- /src/pages/styles/panel.ts: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | 3 | 4 | const Panel: React.FC = styled.div` 5 | width: 100%; 6 | padding: 80px 0; 7 | background-color: ${props => props.color || '#fff'}; 8 | overflow: hidden; 9 | @media (max-width: 996px){ 10 | padding: 0; 11 | } 12 | ` 13 | 14 | export default Panel -------------------------------------------------------------------------------- /src/remark/imageList/index.js: -------------------------------------------------------------------------------- 1 | const imageList = require('./list'); 2 | 3 | function plugin(options) { 4 | imageList.call(this, options || {}) 5 | }; 6 | 7 | module.exports = plugin; -------------------------------------------------------------------------------- /src/remark/remark-math/index.js: -------------------------------------------------------------------------------- 1 | // const inlinePlugin = require('./inline') 2 | const blockPlugin = require('./block') 3 | 4 | 5 | 6 | function math(options) { 7 | var settings = options || {} 8 | blockPlugin.call(this, settings) 9 | // inlinePlugin.call(this, settings) 10 | } 11 | 12 | module.exports = math; -------------------------------------------------------------------------------- /src/remark/table.js: -------------------------------------------------------------------------------- 1 | const visit = require('unist-util-visit'); 2 | 3 | const checkCellNull = ({children}) => { 4 | const nullCells = children.filter((data) => data.children.length === 0); 5 | return nullCells.length === children.length; 6 | } 7 | 8 | const plugin = (options) => { 9 | const transformer = async (ast) => { 10 | visit(ast, 'table', (node) => { 11 | console.log('table', node) 12 | const index = node.children.findIndex((data) => { 13 | const res = checkCellNull(data); 14 | console.log(res, data) 15 | return res; 16 | }); 17 | }); 18 | }; 19 | return transformer; 20 | }; 21 | 22 | module.exports = plugin; -------------------------------------------------------------------------------- /src/remark/ul.js: -------------------------------------------------------------------------------- 1 | const visit = require('unist-util-visit'); 2 | const {select} = require('unist-util-select'); 3 | 4 | const plugin = (options) => { 5 | const transformer = async (ast) => { 6 | 7 | visit(ast, 'image', (node, index, parent) => { 8 | console.log('image', args) 9 | }); 10 | visit(ast, 'paragraph', (node, index, parent) => { 11 | if(parent.type === 'root'){ 12 | parent.class = 'images' 13 | } 14 | }); 15 | visit(ast, 'listItem', (node, index, parent) => { 16 | 17 | }); 18 | visit(ast, 'list', (node, index, parent) => { 19 | node.className = 'images' 20 | }); 21 | }; 22 | return transformer; 23 | }; 24 | 25 | module.exports = plugin; -------------------------------------------------------------------------------- /src/remark/util.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | function isRemarkParser(parser) { 4 | return Boolean(parser && parser.prototype && parser.prototype.blockTokenizers) 5 | } 6 | 7 | function isRemarkCompiler(compiler) { 8 | return Boolean(compiler && compiler.prototype && compiler.prototype.visitors) 9 | } 10 | 11 | exports.isRemarkParser = isRemarkParser; 12 | exports.isRemarkCompiler = isRemarkCompiler; 13 | -------------------------------------------------------------------------------- /src/theme/BlogLayout/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Layout from '@theme/Layout'; 3 | import type {Props} from '@theme/BlogLayout'; 4 | import {Nav, Container} from './styles'; 5 | 6 | export default function BlogLayout(props: Props): JSX.Element { 7 | const {sidebar, toc, children, ...layoutProps} = props; 8 | return ( 9 | 10 |
11 |
12 |
16 | {children} 17 |
18 | {toc &&
{toc}
} 19 |
20 |
21 |
22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /src/theme/BlogLayout/styles.ts: -------------------------------------------------------------------------------- 1 | import styled from "styled-components"; 2 | 3 | export const Container = styled.div` 4 | position: relative; 5 | display: flex; 6 | flex-direction: row; 7 | main{ 8 | padding-right: 10px; 9 | } 10 | @media (max-width: 996px){ 11 | margin: 0; 12 | margin-top: 0; 13 | width: 100%; 14 | max-width: 100%; 15 | padding: 0; 16 | main{ 17 | padding-right: 0; 18 | } 19 | .markdown{ 20 | > h2, > p { 21 | padding: 0 var(--ifm-spacing-horizontal); 22 | } 23 | } 24 | 25 | } 26 | ` 27 | 28 | export const Nav = styled.div` 29 | 30 | ` -------------------------------------------------------------------------------- /src/theme/BlogPostItem/styles.module.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | .blogPostTitle { 9 | font-size: 3rem; 10 | } 11 | 12 | /** 13 | Blog post title should be smaller on smaller devices 14 | **/ 15 | @media (max-width: 576px) { 16 | .blogPostTitle { 17 | font-size: 2rem; 18 | } 19 | } 20 | 21 | .blogPostData { 22 | font-size: 0.9rem; 23 | } 24 | 25 | .blogPostDetailsFull { 26 | flex-direction: column; 27 | } 28 | -------------------------------------------------------------------------------- /src/theme/Footer/LinkItem/index.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, { useState } from 'react'; 9 | import { Tooltip } from 'antd'; 10 | import type {Props} from '@theme/Footer/LinkItem'; 11 | import {IconFont, EmailModal} from '@site/src/components'; 12 | import {Link, LinkItemStyle} from './styles'; 13 | 14 | export default function FooterLinkItem({item}: Props): JSX.Element { 15 | const {to, href, label, icon, onclick, ...props} = item; 16 | return ( 17 | 18 | { 19 | label && label !== ' ' ? ( 20 | <> 21 | { 22 | onclick && onclick === 'subscribe' ? ( 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | ) : ( 31 | 32 | 33 | 34 | 35 | 36 | ) 37 | } 38 | 39 | 40 | ) : ( 41 | 42 | 43 | 44 | ) 45 | } 46 | 47 | ); 48 | } 49 | -------------------------------------------------------------------------------- /src/theme/Footer/LinkItem/styles.tsx: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | import ULink from '@docusaurus/Link'; 3 | 4 | export const LinkItemStyle = styled.div` 5 | margin: 0 5px; 6 | display: inline-block; 7 | ` 8 | 9 | export const Link = styled(ULink)` 10 | font-size: 30px; 11 | color: #CBCDD3; 12 | &:hover{ 13 | color: #646A7D; 14 | } 15 | `; 16 | 17 | -------------------------------------------------------------------------------- /src/theme/IconLanguage/index.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import { IconFont } from '@site/src/components/icon'; 10 | 11 | export default function IconLanguage(): JSX.Element { 12 | return ( 13 | 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /src/theme/Logo/index.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import Link from '@docusaurus/Link'; 10 | import {useLocation} from '@docusaurus/router'; 11 | import useBaseUrl from '@docusaurus/useBaseUrl'; 12 | import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; 13 | import {useThemeConfig} from '@docusaurus/theme-common'; 14 | import ThemedImage from '@theme/ThemedImage'; 15 | import type {Props} from '@theme/Logo'; 16 | 17 | export default function Logo(props: Props): JSX.Element { 18 | const { 19 | siteConfig: {title}, 20 | } = useDocusaurusContext(); 21 | const { 22 | navbar: {title: navbarTitle, logo = {src: ''}}, 23 | } = useThemeConfig(); 24 | 25 | const {imageClassName, titleClassName, ...propsRest} = props; 26 | const logoLink = useBaseUrl(logo.href || '/'); 27 | const sources = { 28 | light: useBaseUrl(logo.src), 29 | dark: useBaseUrl(logo.srcDark || logo.src), 30 | }; 31 | const themedImage = ( 32 | 38 | ); 39 | 40 | const location = useLocation(); 41 | 42 | const isActive = location.pathname === '/' || location.pathname === '/zh/' 43 | 44 | return ( 45 | 50 | {logo.src && 51 | (imageClassName ? ( 52 |
{themedImage}
53 | ) : ( 54 | themedImage 55 | ))} 56 | {navbarTitle != null && {navbarTitle}} 57 | 58 | ); 59 | } 60 | -------------------------------------------------------------------------------- /src/theme/MDXComponents/A/index.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import {pipe, split, map, fromPairs, trim, isEmpty} from 'ramda'; 10 | import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; 11 | import {modifyKeyName} from '@site/src/utils'; 12 | import {LinkSocial, Link, LinkIcon, LinkBtn} from '@site/src/components'; 13 | 14 | export default function MDXA({url = '', children, title, href, ...props}: any): JSX.Element { 15 | const { 16 | i18n: {currentLocale} 17 | } = useDocusaurusContext(); 18 | const data = title && title.indexOf(':') >= 0 ? pipe( 19 | split(','), 20 | map(split(':')), 21 | fromPairs, 22 | modifyKeyName(trim) 23 | )(title) : title ? {title} : {}; 24 | const isLinkSocial = !!data.icon; 25 | const isLink = isEmpty(data); 26 | const isLinkIcon = data.type === 'export'; 27 | const isLinkBtnMore = data.type === 'btnMore'; 28 | data.local = data.local || currentLocale; 29 | return ( 30 | <> 31 | { 32 | isLink && currentLocale === data.local ? ( 33 | {children} 34 | ) : null 35 | } 36 | { 37 | isLinkSocial && currentLocale === data.local ? ( 38 | {children} 39 | ) : null 40 | } 41 | { 42 | isLinkIcon && currentLocale === data.local ? ( 43 | {children} 44 | ) : null 45 | } 46 | { 47 | isLinkBtnMore && currentLocale === data.local ? ( 48 | {children} 49 | ) : null 50 | } 51 | 52 | ); 53 | } 54 | -------------------------------------------------------------------------------- /src/theme/MDXComponents/Image.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {pipe, split, map, fromPairs, trim, isEmpty} from 'ramda'; 3 | import {Image, OmitText} from '@site/src/components'; 4 | import {modifyKeyName} from '@site/src/utils'; 5 | 6 | export default function MDXImage({className, alt, src, title, ...props}: any): JSX.Element { 7 | const data = title && title.indexOf(':') >= 0 ? pipe( 8 | split(','), 9 | map(split(':')), 10 | fromPairs, 11 | modifyKeyName(trim) 12 | )(title) : title ? {title} : {}; 13 | return ( 14 | {alt} 15 | {data.title} 16 | 17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /src/theme/MDXComponents/Pre.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, {isValidElement, useEffect, useState} from 'react'; 9 | import CodeBlock from '@theme/CodeBlock'; 10 | import Team from '@site/src/components/team'; 11 | import Join from '@site/src/components/join'; 12 | import Events from '@site/src/components/events'; 13 | import Subscribe from '@site/src/components/subscribe'; 14 | import DocLinks from '@site/src/components/docLinks'; 15 | 16 | const CustomComponentMap = { 17 | 'language-custom-eventList': Events, 18 | 'language-custom-subscribe': Subscribe, 19 | 'language-custom-joinList': Join, 20 | 'language-custom-teamList': Team, 21 | 'language-custom-docLinksList': DocLinks, 22 | } 23 | 24 | export default function MDXPre(props: any): JSX.Element { 25 | const {children, className, originalType, metastring} = props.children.props; 26 | const isOrigin = className ? className.indexOf('custom') < 0 : true; 27 | const CustomComponent = CustomComponentMap[className]; 28 | return ( 29 | <> 30 | { 31 | isOrigin ? ( 32 | 38 | ) : ( 39 | 40 | { 41 | children 42 | } 43 | 44 | ) 45 | } 46 | 47 | ); 48 | } 49 | -------------------------------------------------------------------------------- /src/theme/MDXComponents/index.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import MDXComponentsOriginal from '@theme-original/MDXComponents'; 10 | import type {MDXComponentsObject} from '@theme/MDXComponents'; 11 | import MDXImage from './Image'; 12 | import MDXA from './A'; 13 | import MDXPre from './Pre'; 14 | 15 | const MDXComponents: MDXComponentsObject = { 16 | ...MDXComponentsOriginal, 17 | img: MDXImage, 18 | a: MDXA, 19 | pre: MDXPre 20 | }; 21 | 22 | export default MDXComponents; 23 | -------------------------------------------------------------------------------- /src/theme/Navbar/MobileSidebar/Header/index.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import {useNavbarMobileSidebar} from '@docusaurus/theme-common'; 10 | import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle'; 11 | import IconClose from '@theme/IconClose'; 12 | import NavbarLogo from '@theme/Navbar/Logo'; 13 | 14 | function CloseButton() { 15 | const mobileSidebar = useNavbarMobileSidebar(); 16 | return ( 17 | 23 | ); 24 | } 25 | 26 | export default function NavbarMobileSidebarHeader(): JSX.Element { 27 | return ( 28 |
29 | 30 | 31 | 32 |
33 | ); 34 | } 35 | -------------------------------------------------------------------------------- /src/theme/Navbar/MobileSidebar/Layout/index.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import clsx from 'clsx'; 10 | import {useNavbarSecondaryMenu} from '@docusaurus/theme-common'; 11 | import type {Props} from '@theme/Navbar/MobileSidebar/Layout'; 12 | import {useThemeConfig} from '@docusaurus/theme-common'; 13 | 14 | export default function NavbarMobileSidebarLayout({ 15 | header, 16 | primaryMenu, 17 | secondaryMenu, 18 | }: Props): JSX.Element { 19 | const {shown: secondaryMenuShown} = useNavbarSecondaryMenu(); 20 | const { 21 | navbar: {title}, 22 | } = useThemeConfig(); 23 | 24 | return ( 25 |
26 | {header} 27 |
31 |
32 | 37 | {primaryMenu} 38 |
39 |
{secondaryMenu}
40 |
41 |
42 | ); 43 | } 44 | -------------------------------------------------------------------------------- /src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import {useNavbarMobileSidebar, useThemeConfig} from '@docusaurus/theme-common'; 10 | import NavbarItem from '@theme/NavbarItem'; 11 | import type {Props as NavbarItemConfig} from '@theme/NavbarItem'; 12 | 13 | function useNavbarItems() { 14 | // TODO temporary casting until ThemeConfig type is improved 15 | return useThemeConfig().navbar.items as NavbarItemConfig[]; 16 | } 17 | 18 | // The primary menu displays the navbar items 19 | export default function NavbarMobilePrimaryMenu(): JSX.Element { 20 | const mobileSidebar = useNavbarMobileSidebar(); 21 | 22 | // TODO how can the order be defined for mobile? 23 | // Should we allow providing a different list of items? 24 | const items = useNavbarItems(); 25 | 26 | return ( 27 |
    28 | {items.map((item, i) => ( 29 | mobileSidebar.toggle()} 33 | key={i} 34 | /> 35 | ))} 36 |
37 | ); 38 | } 39 | -------------------------------------------------------------------------------- /src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, {type ComponentProps} from 'react'; 9 | import {useNavbarSecondaryMenu, useThemeConfig} from '@docusaurus/theme-common'; 10 | import Translate from '@docusaurus/Translate'; 11 | 12 | function SecondaryMenuBackButton(props: ComponentProps<'button'>) { 13 | return ( 14 | 21 | ); 22 | } 23 | 24 | // The secondary menu slides from the right and shows contextual information 25 | // such as the docs sidebar 26 | export default function NavbarMobileSidebarSecondaryMenu(): JSX.Element | null { 27 | const isPrimaryMenuEmpty = useThemeConfig().navbar.items.length === 0; 28 | const secondaryMenu = useNavbarSecondaryMenu(); 29 | return ( 30 | <> 31 | {/* edge-case: prevent returning to the primaryMenu when it's empty */} 32 | {!isPrimaryMenuEmpty && ( 33 | secondaryMenu.hide()} /> 34 | )} 35 | {secondaryMenu.content} 36 | 37 | ); 38 | } 39 | -------------------------------------------------------------------------------- /src/theme/Navbar/MobileSidebar/Toggle/index.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import {useNavbarMobileSidebar} from '@docusaurus/theme-common'; 10 | import IconMenu from '@theme/IconMenu'; 11 | 12 | export default function MobileSidebarToggle(): JSX.Element { 13 | const mobileSidebar = useNavbarMobileSidebar(); 14 | return ( 15 | 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /src/theme/Navbar/MobileSidebar/index.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import { 10 | useLockBodyScroll, 11 | useNavbarMobileSidebar, 12 | } from '@docusaurus/theme-common'; 13 | import NavbarMobileSidebarLayout from '@theme/Navbar/MobileSidebar/Layout'; 14 | import NavbarMobileSidebarHeader from '@theme/Navbar/MobileSidebar/Header'; 15 | import NavbarMobileSidebarPrimaryMenu from '@theme/Navbar/MobileSidebar/PrimaryMenu'; 16 | import NavbarMobileSidebarSecondaryMenu from '@theme/Navbar/MobileSidebar/SecondaryMenu'; 17 | 18 | export default function NavbarMobileSidebar(): JSX.Element | null { 19 | const mobileSidebar = useNavbarMobileSidebar(); 20 | useLockBodyScroll(mobileSidebar.shown); 21 | 22 | if (!mobileSidebar.shouldRender) { 23 | return null; 24 | } 25 | 26 | return ( 27 | } 29 | primaryMenu={} 30 | secondaryMenu={} 31 | /> 32 | ); 33 | } 34 | -------------------------------------------------------------------------------- /src/theme/NavbarItem/ComponentTypes.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ComponentTypes from '@theme-original/NavbarItem/ComponentTypes'; 3 | import {Github, SwitchLocal} from '@site/src/components'; 4 | 5 | 6 | export default { 7 | ...ComponentTypes, 8 | 'custom-github': () => ( 9 | 10 | 11 | 12 | 13 | ), 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /src/theme/NotFound.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import Translate, {translate} from '@docusaurus/Translate'; 10 | import {PageMetadata} from '@docusaurus/theme-common'; 11 | import Layout from '@theme/Layout'; 12 | 13 | export default function NotFound(): JSX.Element { 14 | return ( 15 | <> 16 | 22 | 23 |
24 |
25 |
26 |

27 | 30 | Page Not Found 31 | 32 |

33 |

34 | 37 | We could not find what you were looking for. 38 | 39 |

40 |

41 | 44 | Please contact the owner of the site that linked you to the 45 | original URL and let them know their link is broken. 46 | 47 |

48 |
49 |
50 |
51 |
52 | 53 | ); 54 | } 55 | -------------------------------------------------------------------------------- /src/theme/TOCItems/Tree.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React from 'react'; 9 | import type {Props} from '@theme/TOCItems/Tree'; 10 | 11 | // Recursive component rendering the toc tree 12 | function TOCItemTree({ 13 | toc, 14 | className, 15 | linkClassName, 16 | isChild, 17 | }: Props): JSX.Element | null { 18 | if (!toc.length) { 19 | return null; 20 | } 21 | return ( 22 |
    23 | {toc.map((heading) => ( 24 |
  • 25 | {/* eslint-disable-next-line jsx-a11y/control-has-associated-label */} 26 | 33 | 39 |
  • 40 | ))} 41 |
42 | ); 43 | } 44 | 45 | // Memo only the tree root is enough 46 | export default React.memo(TOCItemTree); 47 | -------------------------------------------------------------------------------- /src/theme/TOCItems/index.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | import React, {useMemo} from 'react'; 9 | import { 10 | type TOCHighlightConfig, 11 | useThemeConfig, 12 | useTOCHighlight, 13 | useFilteredAndTreeifiedTOC, 14 | } from '@docusaurus/theme-common'; 15 | import TOCItemTree from '@theme/TOCItems/Tree'; 16 | import type {Props} from '@theme/TOCItems'; 17 | 18 | export default function TOCItems({ 19 | toc, 20 | className = 'table-of-contents table-of-contents__left-border', 21 | linkClassName = 'table-of-contents__link', 22 | linkActiveClassName = undefined, 23 | minHeadingLevel: minHeadingLevelOption, 24 | maxHeadingLevel: maxHeadingLevelOption, 25 | ...props 26 | }: Props): JSX.Element | null { 27 | const themeConfig = useThemeConfig(); 28 | 29 | const minHeadingLevel = 30 | minHeadingLevelOption ?? themeConfig.tableOfContents.minHeadingLevel; 31 | const maxHeadingLevel = 32 | maxHeadingLevelOption ?? themeConfig.tableOfContents.maxHeadingLevel; 33 | 34 | const tocTree = useFilteredAndTreeifiedTOC({ 35 | toc, 36 | minHeadingLevel, 37 | maxHeadingLevel, 38 | }); 39 | 40 | const tocHighlightConfig: TOCHighlightConfig | undefined = useMemo(() => { 41 | if (linkClassName && linkActiveClassName) { 42 | return { 43 | linkClassName, 44 | linkActiveClassName, 45 | minHeadingLevel, 46 | maxHeadingLevel, 47 | }; 48 | } 49 | return undefined; 50 | }, [linkClassName, linkActiveClassName, minHeadingLevel, maxHeadingLevel]); 51 | useTOCHighlight(tocHighlightConfig); 52 | 53 | return ( 54 | 60 | ); 61 | } 62 | -------------------------------------------------------------------------------- /src/utils/getRepoDetail.ts: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | const instance = axios.create({ 4 | timeout: 30 * 1000, 5 | }); 6 | 7 | export async function getRepoDetail(name: string): Promise { 8 | try{ 9 | const res = await instance.get('https://api.github.com/repos/' + name); 10 | return res.data; 11 | } catch(err) { 12 | return {} 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './getRepoDetail'; 2 | export * from './postSubscribe'; 3 | export * from './modifyKeyName'; 4 | export * from './pickWhen'; 5 | export * from './regs'; 6 | export * from './loadScript'; -------------------------------------------------------------------------------- /src/utils/loadScript.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 仅触发一次事件 4 | * 5 | * @private 6 | * 7 | * @param node DOM 节点 8 | * @param name 事件名称 9 | * @param callback 回调函数 10 | */ 11 | function once( 12 | node: HTMLScriptElement, 13 | name: string, 14 | fn: EventListener, 15 | options?: boolean | AddEventListenerOptions, 16 | ) { 17 | function listener(event: Event) { 18 | node.removeEventListener(name, listener); 19 | fn(event); 20 | } 21 | node.addEventListener(name, listener, options); 22 | } 23 | 24 | /** 25 | * 定义IE浏览器的 HTMLScriptElement 属性 26 | */ 27 | export interface MSHTMLScriptElement extends HTMLScriptElement { 28 | readyState: 'loaded' | 'complete'; 29 | onreadystatechange: ((this: Window, ev: ProgressEvent) => any) | null; 30 | } 31 | 32 | /** 33 | * 监听脚本加载事件 - IE 兼容 34 | * 35 | * @private 36 | * 37 | * @param node DOM 节点 38 | * @param callback 回调函数 39 | */ 40 | function listenWithIE(node: MSHTMLScriptElement, callback: () => void) { 41 | node.onreadystatechange = function () { 42 | if (node.readyState === 'loaded' || node.readyState === 'complete') { 43 | node.onreadystatechange = null; 44 | callback(); 45 | } 46 | }; 47 | } 48 | 49 | /** 50 | * 监听脚本加载事件 - 其他浏览器 51 | * 52 | * @private 53 | * 54 | * @param node DOM 节点 55 | * @param callback 回调函数 56 | */ 57 | function listen( 58 | node: HTMLScriptElement, 59 | onSuccess: EventListener, 60 | onError: EventListener, 61 | ) { 62 | once(node, 'load', onSuccess); 63 | once(node, 'error', onError); 64 | } 65 | 66 | /** 67 | * 白名单属性 68 | */ 69 | export type AllowListsAttributes = { 70 | /** 设置 id */ 71 | id: string; 72 | /** 脚本类型 */ 73 | type?: string; 74 | /** 异步加载 */ 75 | async?: boolean; 76 | /** 延迟加载 */ 77 | defer?: boolean; 78 | /** 跨域属性 */ 79 | crossOrigin?: string | null; 80 | /** Subresource Integrity (SRI) */ 81 | integrity?: string; 82 | /** es6 模块回退 */ 83 | noModule?: boolean; 84 | }; 85 | 86 | // 允许的属性名单 87 | const allowLists: Array = [ 88 | 'id', 89 | 'type', 90 | 'async', 91 | 'defer', 92 | 'crossOrigin', 93 | 'integrity', 94 | 'noModule', 95 | ]; 96 | 97 | /** 98 | * 动态加载脚本 99 | * 100 | * @param src 文件地址 101 | * @param attrs 可选的属性 102 | * 103 | * @returns dom 节点 104 | * 105 | * @example 106 | * 107 | * try { 108 | * const src = 'https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js' 109 | * 110 | * await loadScript(src, { id: 'jquery.3.6.0.min' }) 111 | * } catch { 112 | * alert('加载失败') 113 | * } 114 | */ 115 | export function loadScript( 116 | src: string, 117 | attrs: Partial, 118 | ): Promise { 119 | return new Promise((resolve, reject) => { 120 | if(document.getElementById(attrs.id as string)) { 121 | resolve(document.getElementById(attrs.id as string)[0]) 122 | } 123 | const scriptNode: HTMLScriptElement = document.createElement('script'); 124 | scriptNode.id = attrs.id as string; 125 | 126 | // 监听事件 127 | if ((scriptNode as MSHTMLScriptElement).readyState) { 128 | listenWithIE(scriptNode as MSHTMLScriptElement, () => resolve(scriptNode)); 129 | } else { 130 | listen( 131 | scriptNode, 132 | () => resolve(scriptNode), 133 | () => { 134 | reject(); 135 | document.removeChild(document.getElementById(attrs.id as string) as Node); 136 | }, 137 | ); 138 | } 139 | 140 | // 设置白名单属性 141 | if (attrs) { 142 | allowLists.forEach(attrName => { 143 | if (attrName in attrs) { 144 | const value = attrs[attrName]; 145 | 146 | if (typeof value === 'string') { 147 | scriptNode.setAttribute(attrName, value); 148 | } else if (typeof value === 'boolean') { 149 | // 布尔值与字符串的设置不太一样 150 | scriptNode[attrName as 'defer' | 'async' | 'noModule'] = value; 151 | } 152 | } 153 | }); 154 | } 155 | 156 | // 设置资源地址 157 | scriptNode.src = src; 158 | 159 | // 插入到页面中 160 | document.body.appendChild(scriptNode); 161 | }); 162 | } 163 | 164 | export function unLoadScript(progectId: string) { 165 | if (document.getElementById(progectId)) { 166 | const scriptNode: any = document.getElementById(progectId); 167 | document.body.removeChild(scriptNode) 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /src/utils/modifyKeyName.ts: -------------------------------------------------------------------------------- 1 | import {curry, reduce, assoc, keys, is} from 'ramda'; 2 | 3 | interface keysMap { 4 | [key: string]: (key: string) => string; 5 | } 6 | 7 | export const modifyKeyName = curry((keysMap: keysMap | Function, obj) => { 8 | return reduce((acc, key) => { 9 | const fn = is(Function, keysMap) ? keysMap : keysMap[key]; 10 | const resultKey = fn(key); 11 | return assoc(resultKey, obj[key], acc) 12 | }, {}, keys(obj)) 13 | }) -------------------------------------------------------------------------------- /src/utils/pickWhen.ts: -------------------------------------------------------------------------------- 1 | import {curry, reduce} from 'ramda'; 2 | 3 | 4 | export const pickWhen = curry((key, reduceFn, arr) => { 5 | const fn = reduce((acc, cur) => { 6 | if(cur.type === key){ 7 | acc = reduceFn(acc, cur); 8 | } else if(cur.children && cur.children.length) { 9 | acc = acc.concat(fn([], cur.children)) 10 | } 11 | return acc; 12 | }); 13 | return fn([], arr); 14 | }) -------------------------------------------------------------------------------- /src/utils/postSubscribe.ts: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | const instance = axios.create({ 4 | timeout: 30 * 1000, 5 | headers: { 6 | 'Access-Control-Allow-Origin': '*' 7 | } 8 | }); 9 | 10 | export async function postSubscribe(params: any): Promise { 11 | const res = await instance.post('http://47.98.253.122/items/stoneDBSubscribes', params); 12 | return res.data; 13 | } 14 | 15 | export async function getSubscribes(): Promise { 16 | const res = await instance.get('http://47.98.253.122/items/stoneDBSubscribes'); 17 | return res.data; 18 | } -------------------------------------------------------------------------------- /src/utils/regs.ts: -------------------------------------------------------------------------------- 1 | export const EMAIL = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/; 2 | export const USERNAME = /^[a-zA-Z0-9]+[a-zA-Z0-9_]{3,32}$/; 3 | export const PASSWORD = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,32}$/; 4 | -------------------------------------------------------------------------------- /static/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoneatom/stonedb-docs/368ae5a17c252b0a5c34168304b0c68e9958d78f/static/.nojekyll -------------------------------------------------------------------------------- /static/CNAME: -------------------------------------------------------------------------------- 1 | stonedb.io 2 | -------------------------------------------------------------------------------- /static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoneatom/stonedb-docs/368ae5a17c252b0a5c34168304b0c68e9958d78f/static/img/favicon.ico -------------------------------------------------------------------------------- /static/img/icons/128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoneatom/stonedb-docs/368ae5a17c252b0a5c34168304b0c68e9958d78f/static/img/icons/128x128.png -------------------------------------------------------------------------------- /static/img/icons/144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoneatom/stonedb-docs/368ae5a17c252b0a5c34168304b0c68e9958d78f/static/img/icons/144x144.png -------------------------------------------------------------------------------- /static/img/icons/152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoneatom/stonedb-docs/368ae5a17c252b0a5c34168304b0c68e9958d78f/static/img/icons/152x152.png -------------------------------------------------------------------------------- /static/img/icons/192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoneatom/stonedb-docs/368ae5a17c252b0a5c34168304b0c68e9958d78f/static/img/icons/192x192.png -------------------------------------------------------------------------------- /static/img/icons/200x200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoneatom/stonedb-docs/368ae5a17c252b0a5c34168304b0c68e9958d78f/static/img/icons/200x200.png -------------------------------------------------------------------------------- /static/img/icons/384x384.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoneatom/stonedb-docs/368ae5a17c252b0a5c34168304b0c68e9958d78f/static/img/icons/384x384.png -------------------------------------------------------------------------------- /static/img/icons/512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoneatom/stonedb-docs/368ae5a17c252b0a5c34168304b0c68e9958d78f/static/img/icons/512x512.png -------------------------------------------------------------------------------- /static/img/icons/72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoneatom/stonedb-docs/368ae5a17c252b0a5c34168304b0c68e9958d78f/static/img/icons/72x72.png -------------------------------------------------------------------------------- /static/img/icons/96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoneatom/stonedb-docs/368ae5a17c252b0a5c34168304b0c68e9958d78f/static/img/icons/96x96.png -------------------------------------------------------------------------------- /static/img/stoneDB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stoneatom/stonedb-docs/368ae5a17c252b0a5c34168304b0c68e9958d78f/static/img/stoneDB.png -------------------------------------------------------------------------------- /static/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "StoneDB", 3 | "short_name": "StoneDB", 4 | "theme_color": "#2196f3", 5 | "background_color": "#424242", 6 | "display": "standalone", 7 | "scope": "./", 8 | "start_url": "./index.html", 9 | "related_applications": [ 10 | { 11 | "platform": "webapp", 12 | "url": "https://stonedb.io/manifest.json" 13 | } 14 | ], 15 | "icons": [ 16 | { 17 | "src": "img/icons/72x72.png", 18 | "sizes": "72x72", 19 | "type": "image/png" 20 | }, 21 | { 22 | "src": "img/icons/96x96.png", 23 | "sizes": "96x96", 24 | "type": "image/png" 25 | }, 26 | { 27 | "src": "img/icons/128x128.png", 28 | "sizes": "128x128", 29 | "type": "image/png" 30 | }, 31 | { 32 | "src": "img/icons/144x144.png", 33 | "sizes": "144x144", 34 | "type": "image/png" 35 | }, 36 | { 37 | "src": "img/icons/152x152.png", 38 | "sizes": "152x152", 39 | "type": "image/png" 40 | }, 41 | { 42 | "src": "img/icons/192x192.png", 43 | "sizes": "192x192", 44 | "type": "image/png" 45 | }, 46 | { 47 | "src": "img/icons/384x384.png", 48 | "sizes": "384x384", 49 | "type": "image/png" 50 | }, 51 | { 52 | "src": "img/icons/512x512.png", 53 | "sizes": "512x512", 54 | "type": "image/png" 55 | } 56 | ] 57 | } 58 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // This file is not used in compilation. It is here just for a nice editor experience. 3 | "extends": "@tsconfig/docusaurus/tsconfig.json", 4 | "compilerOptions": { 5 | "baseUrl": "." 6 | } 7 | } 8 | --------------------------------------------------------------------------------