From 18e8f74f0aa28a55c71c8d2c002f4c12a4a02413 Mon Sep 17 00:00:00 2001 From: Sayan Nandan Date: Mon, 16 Aug 2021 00:15:07 -0700 Subject: [PATCH] Add new actiondoc Also moved actiondoc rebuild to separate workflow --- .github/workflows/deploy-docs.yml | 26 +++++ .github/workflows/test-push.yml | 12 --- CONTRIBUTING.md | 2 +- actiondoc.yml | 167 ++++++++++++++++++++++++++++++ actions.jsonc | 158 ---------------------------- ci/setvars.sh | 6 +- 6 files changed, 197 insertions(+), 174 deletions(-) create mode 100644 .github/workflows/deploy-docs.yml create mode 100644 actiondoc.yml delete mode 100644 actions.jsonc diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 00000000..ba2bc751 --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,26 @@ +on: + push: + branches: + - next +env: + IS_ACTIONS_DOC: "false" + +jobs: + rebuild-docs: + name: Build new actiondoc + runs-on: ubuntu-latest + steps: + - name: Setup environment + run: | + chmod +x ci/setvars.sh + ci/setvars.sh + - name: Publish docs + env: + BOT_USER: ${{ secrets.BOT_INIT_USER }} + BOT_MAIL: ${{ secrets.BOT_INIT_MAIL }} + BOT_API: ${{ secrets.BOT_API_CALL }} + GIT_SHA: ${{ env.GITHUB_SHA }} + run: | + chmod +x ci/doc.sh + ci/doc.sh + if: env.IS_ACTIONS_DOC == 'true' diff --git a/.github/workflows/test-push.yml b/.github/workflows/test-push.yml index d3754889..b83b45e7 100644 --- a/.github/workflows/test-push.yml +++ b/.github/workflows/test-push.yml @@ -7,7 +7,6 @@ on: - "**" env: - IS_ACTIONS_DOC: "false" CARGO_TERM_COLOR: always jobs: tests-pass: @@ -88,17 +87,6 @@ jobs: rustup default stable rustup target add ${{ matrix.rust }} - - name: Publish docs - env: - BOT_USER: ${{ secrets.BOT_INIT_USER }} - BOT_MAIL: ${{ secrets.BOT_INIT_MAIL }} - BOT_API: ${{ secrets.BOT_API_CALL }} - GIT_SHA: ${{ env.GITHUB_SHA }} - run: | - chmod +x ci/doc.sh - ci/doc.sh - if: runner.os == 'Linux' && env.IS_ACTIONS_DOC == 'true' - - name: Run Tests run: make test env: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 012e4155..5a51e2f2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,7 +44,7 @@ In other cases, use the C style. Each project has its own jargon — and so do we! -- _actiondoc_ and _actions docs_ : This refers to the `actions.jsonc` file, which is used by the Skytable documentation website for automatically building documentation for the actions +- _actiondoc_ and _actions docs_ : This refers to the `actiondoc.yml` file, which is used by the Skytable documentation website for automatically building documentation for the actions ### Branches diff --git a/actiondoc.yml b/actiondoc.yml new file mode 100644 index 00000000..07eed903 --- /dev/null +++ b/actiondoc.yml @@ -0,0 +1,167 @@ +# +# Created on Thu Aug 27 2020 +# +# This file is a part of Skytable +# Skytable (formerly known as TerrabaseDB or Skybase) is a free and open-source +# NoSQL database written by Sayan Nandan ("the Author") with the +# vision to provide flexibility in data modelling without compromising +# on performance, queryability or scalability. +# +# Copyright (c) 2020, Sayan Nandan +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# +# +# This file is used by Skytable's documentation website for automatically +# generating documentation for the actions. It will also be used by the Skytable +# server in the future + +# the docbuilder expects: +# 'name': str, 'complexity': str, 'accept': [str] +# 'return': [str], 'syntax': [str], 'desc': str + +- name: GET + complexity: O(1) + accept: [AnyArray] + syntax: [GET ] + desc: Get the value of a key from the current table + return: [Rcode 1, String, Binstr] +- name: MGET + complexity: O(n) + accept: [AnyArray] + syntax: [MGET ...] + desc: Get the value of 'n' keys from the current table + return: [Typed Array] +- name: SET + complexity: O(1) + accept: [AnyArray] + syntax: [SET ] + desc: Set the value of a key in the current table + return: [Rcode 0, Rcode 2, Rcode 5] +- name: MSET + complexity: O(n) + accept: [AnyArray] + syntax: [MSET ...] + desc: Set the value of 'n' keys in the current table + return: [Integer, Rcode 5] +- name: UPDATE + complexity: O(1) + accept: [AnyArray] + syntax: [UPDATE ] + desc: Update the value of an existing key in the current table + return: [Rcode 0, Rcode 1, Rcode 5] +- name: MUPDATE + complexity: O(n) + accept: [AnyArray] + syntax: [MUPDATE ...] + desc: Update the value of 'n' keys in the current table + return: [Integer, Rcode 5] +- name: DEL + complexity: O(n) + accept: [AnyArray] + syntax: [DEL ...] + desc: Delete 'n' keys from the current table + return: [Integer, Rcode 5] +- name: EXISTS + complexity: O(n) + accept: [AnyArray] + syntax: [EXISTS ...] + desc: Check if 'n' keys exist in the current table + return: [Integer] +- name: SSET + complexity: O(n) + accept: [AnyArray] + syntax: [SSET ...] + desc: Set all keys to the given values only if all of them don't exist in the current table + return: [Rcode 0, Rcode 2, Rcode 5] +- name: SDEL + complexity: O(n) + accept: [AnyArray] + syntax: [SDEL ...] + desc: | + Delete all keys if all of the keys exist in the current table. Do note that if a single key doesn't + exist, then a `Nil` code is returned. + return: [Rcode 0, Rcode 1, Rcode 5] +- name: SUPDATE + complexity: O(n) + accept: [AnyArray] + syntax: [SUPDATE ...] + desc: | + Update all keys if all of the keys exist in the current table. Do note that if a single key doesn't + exist, then a `Nil` code is returned. + return: [Rcode 0, Rcode 1, Rcode 5] +- name: DBSIZE + complexity: O(1) + accept: [AnyArray] + syntax: [DBSIZE, DBSIZE ] + desc: Check the number of entries stored in the current table or in the provided entity + return: [Integer] +- name: FLUSHDB + complexity: O(n) + accept: [AnyArray] + syntax: [FLUSHDB, FLUSHDB ] + desc: Removes all entries stored in the current table or in the provided entity + return: [Rcode 0, Rcode 5] +- name: USET + complexity: O(n) + accept: [AnyArray] + syntax: [USET ...] + desc: SET all keys if they don't exist, or UPDATE them if they do exist. This operation performs `USET`s in the current table + return: [Integer, Rcode 5] +- name: KEYLEN + complexity: O(1) + accept: [AnyArray] + syntax: [KEYLEN ] + desc: Returns the length of the UTF-8 string, if it exists in the current table + return: [Integer, Rcode 1] +- name: MKSNAP + complexity: O(n) + accept: [AnyArray] + syntax: [MKSNAP ] + desc: | + This action can be used to create a snapshot. Do note that this action# *requires + snapshotting to be enabled on the server side**, before it can create snapshots. + \nIf you want to create snapshots# *without** snapshots being enabled on the server-side, + pass a second argument to specify a snapshot name and a snapshot will + be create in a folder called `remote` under your snapshots directory. \nFor more + information on snapshots, read [this document](/snapshots) + return: [Rcode 0, err-snapshot-disabled, err-snapshot-busy] +- name: LSKEYS + complexity: O(n) + accept: [AnyArray] + syntax: [LSKEYS , LSKEYS , LSKEYS ] + desc: | + Returns a flat string array of keys present in the current table or in the provided entity. + If no is given, then a maximum of 10 keys are returned. If a limit is specified, + then a maximum of keys are returned. The order of keys is meaningless. + return: [Typed Array] +- name: POP + complexity: O(1) + accept: [AnyArray] + syntax: [POP ] + desc: Deletes and return the value of the provided key from the current table. + return: [String, Binstr, Rcode 5] +- name: MPOP + complexity: O(n) + accept: [AnyArray] + syntax: [POP ...] + desc: | + Deletes and returns the values of the provided keys from the current table. If the database is poisoned, + this will return a server error. An exceptional scenario can arise when the database + fails in-between removing all the keys. In that case, you get the server error + response code instead of the keys. If the server recovers inbetween, then the + appropriate values (if any) will be returned. In all other cases a NIL error is + returned (code 1) + return: [Flat Array] diff --git a/actions.jsonc b/actions.jsonc deleted file mode 100644 index 141f08ba..00000000 --- a/actions.jsonc +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Created on Thu Aug 27 2020 - * - * This file is a part of Skytable - * Skytable (formerly known as TerrabaseDB or Skybase) is a free and open-source - * NoSQL database written by Sayan Nandan ("the Author") with the - * vision to provide flexibility in data modelling without compromising - * on performance, queryability or scalability. - * - * Copyright (c) 2020, Sayan Nandan - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ -/* - * This file is used by Skytable's documentation website for automatically - * generating documentation for the actions. It will also be used by the Skytable - * server in the future - */ -[ - { - "name": "GET", - "complexity": "O(1)", - "args": "GET ", - "desc": "Get the value of a key", - "return": "Value if it exists or (Code: 1) if it does not" - }, - { - "name": "MGET", - "complexity": "O(n)", - "args": "MGET ...", - "desc": "Get the value of 'n' keys", - "return": "Value if it exists or (Code: 1) if it does not" - }, - { - "name": "SET", - "complexity": "O(1)", - "args": "SET ", - "desc": "Set the value of a key", - "return": "(Code: 0) if succeeded or (Code: 2) if not" - }, - { - "name": "MSET", - "complexity": "O(n)", - "args": "MSET ...", - "desc": "Set the value of 'n' keys", - "return": "Number of keys that were set as an unsigned int" - }, - { - "name": "UPDATE", - "complexity": "O(1)", - "args": "UPDATE ", - "desc": "Update the value of an existing key", - "return": "(Code: 0) if succeeded or (Code: 1) if not" - }, - { - "name": "MUPDATE", - "complexity": "O(n)", - "args": "MUPDATE ...", - "desc": "Update the value of 'n' keys", - "return": "Number of keys that were updated as an unsigned int" - }, - { - "name": "DEL", - "complexity": "O(n)", - "args": "DEL ...", - "desc": "Delete 'n' keys", - "return": "Number of keys that were deleted as an unsigned int" - }, - { - "name": "EXISTS", - "complexity": "O(n)", - "args": "EXISTS ...", - "desc": "Check if 'n' keys exist", - "return": "Number of keys that exist as an unsigned int" - }, - { - "name": "SSET", - "complexity": "O(n)", - "args": "SSET ...", - "desc": "Set all keys to the given values only if all of them don't exist", - "return": "(Code: 0) if all keys were set, otherwise (Code: 2)" - }, - { - "name": "SDEL", - "complexity": "O(n)", - "args": "SDEL ...", - "desc": "Delete all keys if all of the keys exist. Do note that if a single key doesn't exist, then a `Nil` code is returned.", - "return": "(Code: 0) if all keys were deleted, otherwise (Code: 1)" - }, - { - "name": "SUPDATE", - "complexity": "O(n)", - "args": "SUPDATE ...", - "desc": "Update all keys if all of the keys exist. Do note that if a single key doesn't exist, then a `Nil` code is returned.", - "return": "(Code: 0) if all keys were updated, otherwise (Code: 1)" - }, - { - "name": "DBSIZE", - "complexity": "O(1)", - "args": "DBSIZE", - "desc": "Number of key/value pairs stored in the database", - "return": "Number of keys that exist in the database as an unsigned int" - }, - { - "name": "FLUSHDB", - "complexity": "O(n)", - "args": "FLUSHDB", - "desc": "Removes all the key/value pairs stored in the database", - "return": "(Code: 0) if the operation succeeded" - }, - { - "name": "USET", - "complexity": "O(n)", - "args": "USET ...", - "desc": "SET all keys if they don't exist, or UPDATE them if they do exist", - "return": "Number of keys that were `USET`ed, as an unsigned int" - }, - { - "name": "KEYLEN", - "complexity": "O(1)", - "args": "KEYLEN ", - "desc": "Returns the length of the UTF-8 string", - "return": "Length of the key as an unsigned int" - }, - { - "name": "MKSNAP", - "complexity": "O(n)", - "args": "MKSNAP ", - "desc": "This action can be used to create a snapshot. Do note that this action **requires snapshotting to be enabled on the server side**, before it can create snapshots. \nIf you want to create snapshots **without** snapshots being enabled on the server-side, pass a second argument to specify a snapshot name and a snapshot will be create in a folder called `remote` under your snapshots directory. \nFor more information on snapshots, read [this document](/snapshots)", - "return": "Okay if succeeded, otherwise it returns `err-snapshot-disabled` if snapshotting is disabled or `err-snapshot-busy` if a snapshotting operation is already in progress" - }, - { - "name": "LSKEYS", - "complexity": "O(n)", - "args": "LSKEYS ", - "desc": "Returns a flat string array of keys present in the database. If no is given, then a maximum of 10 keys are returned. If a limit is specified, then a maximum of keys are returned", - "return": "Returns a maximum of 10 keys if no limit is specified or returns a maximum number of keys for the given limit. The order of keys returned is meaningless." - }, - { - "name": "POP", - "complexity": "O(n)", - "args": "POP ...", - "desc": "Deletes and returns the values of the provided keys. If the database is poisoned, this will return a server error. An exceptional scenario can arise when the database fails in-between removing all the keys. In that case, you get the server error response code instead of the keys. If the server recovers inbetween, then the appropriate values (if any) will be returned. In all other cases a NIL error is returned (code 1)", - "return": "Returns an array with either the values or response codes as the elements" - } -] diff --git a/ci/setvars.sh b/ci/setvars.sh index 7a1fed6f..6b0a6485 100755 --- a/ci/setvars.sh +++ b/ci/setvars.sh @@ -1,13 +1,13 @@ # This script sets a couple of environment variables # If *.md files are modified, then there is no need for running the expensive # build steps, instead we just set the `IS_MD_FILE` variable to true. -# Similarly, if the `actions.jsonc` file is modified, the documentation needs to be +# Similarly, if the `actiondoc.yml` file is modified, the documentation needs to be # be updated set -euo pipefail FILES_CHANGED=$(git diff --numstat HEAD^..HEAD | wc -l) -ACTIONS_CHANGED_COUNT=$(git diff --numstat HEAD^..HEAD -- 'actions.jsonc' | wc -l) +ACTIONS_CHANGED_COUNT=$(git diff --numstat HEAD^..HEAD -- 'actiondoc.yml' | wc -l) if [ ${ACTIONS_CHANGED_COUNT} = "1" ]; then # This push changes the actions documentation - echo "This push modifies the actions.jsonc file" + echo "This push modifies the actiondoc.yml file" echo "IS_ACTIONS_DOC=true" >>$GITHUB_ENV fi