chore: remove unused error codes

This commit is contained in:
anatawa12 2024-02-05 15:54:26 +09:00
commit 8aad1663b2
No known key found for this signature in database
GPG key ID: 9CA909848B8E4EA6
7 changed files with 174 additions and 47 deletions

168
.github/workflows/publish-litedb.yml vendored Normal file
View file

@ -0,0 +1,168 @@
name: Publish
on:
workflow_dispatch:
inputs:
release_kind:
type: choice
description: The type of release.
default: prerelease
required: true
options:
- prerelease
- start-rc
- stable
jobs:
pre-build:
name: Update version name
runs-on: ubuntu-latest
outputs:
litedb-version: ${{ env.LITEDB_VERSION }}
prerelease: ${{ steps.update-version.outputs.prerelease }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: anatawa12/something-releaser@v3
- uses: snow-actions/git-config-user@v1.0.0
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Update Version Name
id: update-version
run: |
# set version name in properties file
case "$RELEASE_KIND_IN" in
"prerelease" )
get-version -t litedb | version-next | set-version -t litedb
gh-export-variable PRERELEASE true
gh-set-output prerelease true
;;
"start-rc" )
get-version -t litedb | version-set-channel - rc 0 | set-version -t litedb
gh-export-variable PRERELEASE true
gh-set-output prerelease true
;;
"stable" )
get-version -t litedb | version-set-channel - stable | set-version -t litedb
gh-export-variable PRERELEASE false
gh-set-output prerelease '' # empty string for false
;;
* )
echo "invalid release kind: $RELEASE_KIND_IN"
exit 255
;;
esac
case "$GITHUB_REF_NAME" in
master | master-* )
echo "head is master or master-*"
;;
* )
echo "invalid release kind: $RELEASE_KIND_IN is not allowd for $GITHUB_REF_NAME"
exit 255
;;
esac
gh-export-variable LITEDB_VERSION "$(get-version -t litedb)"
env:
RELEASE_KIND_IN: ${{ github.event.inputs.release_kind }}
# check for unexpected breaking ABI changes
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
package: vrc-get-litedb
- name: Commit
id: update
run: |-
# commit & tag
git commit -am "litedb v$LITEDB_VERSION"
git branch releasing
git push -f -u origin releasing
publish-crates-io:
name: Publish to crates.io
environment:
name: crates.io
url: https://crates.io/crates/vrc-get
runs-on: ubuntu-latest
needs: [pre-build, build-rust]
steps:
- uses: actions/checkout@v3
with:
ref: 'releasing'
fetch-depth: 1
submodules: recursive
- name: Publish CARGO
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: cargo publish --package vrc-get-litedb
publish-to-github:
name: Publish to GitHub
environment:
name: master branch
url: https://github.com/anatawa12/vrc-get/releases/litedb-v${{ needs.pre-build.outputs.litedb-version }}
permissions:
contents: write
runs-on: ubuntu-latest
needs: [pre-build, publish-crates-io]
env:
LITEDB_VERSION: ${{ needs.pre-build.outputs.litedb-version }}
steps:
- uses: actions/checkout@v3
with:
ref: 'releasing'
fetch-depth: 2
submodules: recursive
token: ${{ secrets.MASTER_GITHUB_PAT }}
# tools
- uses: anatawa12/something-releaser@v3
- uses: snow-actions/git-config-user@v1.0.0
- uses: dtolnay/rust-toolchain@stable
- name: Push tag
run: |-
# set tag and publish current version
git tag "litedb-v$LITEDB_VERSION"
git push --tags
# create master and push
git switch -c master
git fetch origin master --depth=1
git log --all --graph
git push -u origin master
sleep 1
- name: prepare next release & push
if: ${{ !needs.pre-build.outputs.prerelease }}
run: |
get-version -t litedb | version-next | version-set-channel - beta 0 | set-version -t litedb
LITEDB_NEXT="$(get-version -t litedb | version-stable)"
git commit -am "chore: prepare for next version: litedb $LITEDB_NEXT"
git push
cleanup:
name: Cleanup
if: ${{ !failure() && !cancelled() }}
permissions:
contents: write
runs-on: ubuntu-latest
needs:
- pre-build
- publish-crates-io
- publish-to-github
steps:
- uses: actions/checkout@v3
with:
ref: 'releasing'
fetch-depth: 2
- name: remove releasing branch
run: git push --delete origin releasing

View file

@ -3,3 +3,6 @@ release_changer = ["cargo:vrc-get"]
[target.vpm]
release_changer = ["cargo:vrc-get-vpm"]
[target.litedb]
release_changer = ["cargo:vrc-get-litedb"]

2
Cargo.lock generated
View file

@ -1685,7 +1685,7 @@ dependencies = [
[[package]]
name = "vrc-get-litedb"
version = "0.1.0"
version = "0.1.0-beta.0"
dependencies = [
"ar",
"hex",

View file

@ -1,6 +1,6 @@
[package]
name = "vrc-get-litedb"
version = "0.1.0"
version = "0.1.0-beta.0"
edition.workspace = true
license.workspace = true
authors.workspace = true

@ -1 +1 @@
Subproject commit 7c546647379735a0a094858a8caa7eb0cc0b42be
Subproject commit 459c979d6c168d48dc64fc05ea2067f258befc76

View file

@ -27,46 +27,24 @@ public struct LiteDbError
#region LiteDB
//UNKNOWN = LiteException.LiteErrorCode.UNKNOWN,
FILE_NOT_FOUND = LiteException.LiteErrorCode.FILE_NOT_FOUND, // note: file means file in litedb storage
DATABASE_SHUTDOWN = LiteException.LiteErrorCode.DATABASE_SHUTDOWN,
INVALID_DATABASE = LiteException.LiteErrorCode.INVALID_DATABASE,
FILE_SIZE_EXCEEDED = LiteException.LiteErrorCode.FILE_SIZE_EXCEEDED,
COLLECTION_LIMIT_EXCEEDED = LiteException.LiteErrorCode.COLLECTION_LIMIT_EXCEEDED,
INDEX_DROP_ID = LiteException.LiteErrorCode.INDEX_DROP_ID,
INDEX_DUPLICATE_KEY = LiteException.LiteErrorCode.INDEX_DUPLICATE_KEY,
INVALID_INDEX_KEY = LiteException.LiteErrorCode.INVALID_INDEX_KEY,
INDEX_NOT_FOUND = LiteException.LiteErrorCode.INDEX_NOT_FOUND,
INVALID_DBREF = LiteException.LiteErrorCode.INVALID_DBREF,
LOCK_TIMEOUT = LiteException.LiteErrorCode.LOCK_TIMEOUT,
INVALID_COMMAND = LiteException.LiteErrorCode.INVALID_COMMAND,
ALREADY_EXISTS_COLLECTION_NAME = LiteException.LiteErrorCode.ALREADY_EXISTS_COLLECTION_NAME,
ALREADY_OPEN_DATAFILE = LiteException.LiteErrorCode.ALREADY_OPEN_DATAFILE,
INVALID_TRANSACTION_STATE = LiteException.LiteErrorCode.INVALID_TRANSACTION_STATE,
INDEX_NAME_LIMIT_EXCEEDED = LiteException.LiteErrorCode.INDEX_NAME_LIMIT_EXCEEDED,
INVALID_INDEX_NAME = LiteException.LiteErrorCode.INVALID_INDEX_NAME,
INVALID_COLLECTION_NAME = LiteException.LiteErrorCode.INVALID_COLLECTION_NAME,
TEMP_ENGINE_ALREADY_DEFINED = LiteException.LiteErrorCode.TEMP_ENGINE_ALREADY_DEFINED,
INVALID_EXPRESSION_TYPE = LiteException.LiteErrorCode.INVALID_EXPRESSION_TYPE,
COLLECTION_NOT_FOUND = LiteException.LiteErrorCode.COLLECTION_NOT_FOUND,
COLLECTION_ALREADY_EXIST = LiteException.LiteErrorCode.COLLECTION_ALREADY_EXIST,
INDEX_ALREADY_EXIST = LiteException.LiteErrorCode.INDEX_ALREADY_EXIST,
INVALID_UPDATE_FIELD = LiteException.LiteErrorCode.INVALID_UPDATE_FIELD,
INVALID_FORMAT = LiteException.LiteErrorCode.INVALID_FORMAT,
DOCUMENT_MAX_DEPTH = LiteException.LiteErrorCode.DOCUMENT_MAX_DEPTH,
INVALID_CTOR = LiteException.LiteErrorCode.INVALID_CTOR,
UNEXPECTED_TOKEN = LiteException.LiteErrorCode.UNEXPECTED_TOKEN,
INVALID_DATA_TYPE = LiteException.LiteErrorCode.INVALID_DATA_TYPE,
PROPERTY_NOT_MAPPED = LiteException.LiteErrorCode.PROPERTY_NOT_MAPPED,
INVALID_TYPED_NAME = LiteException.LiteErrorCode.INVALID_TYPED_NAME,
PROPERTY_READ_WRITE = LiteException.LiteErrorCode.PROPERTY_READ_WRITE,
INITIALSIZE_CRYPTO_NOT_SUPPORTED = LiteException.LiteErrorCode.INITIALSIZE_CRYPTO_NOT_SUPPORTED,
INVALID_INITIALSIZE = LiteException.LiteErrorCode.INVALID_INITIALSIZE,
INVALID_NULL_CHAR_STRING = LiteException.LiteErrorCode.INVALID_NULL_CHAR_STRING,
INVALID_FREE_SPACE_PAGE = LiteException.LiteErrorCode.INVALID_FREE_SPACE_PAGE,
DATA_TYPE_NOT_ASSIGNABLE = LiteException.LiteErrorCode.DATA_TYPE_NOT_ASSIGNABLE,
AVOID_USE_OF_PROCESS = LiteException.LiteErrorCode.AVOID_USE_OF_PROCESS,
NOT_ENCRYPTED = LiteException.LiteErrorCode.NOT_ENCRYPTED,
INVALID_PASSWORD = LiteException.LiteErrorCode.INVALID_PASSWORD,
UNSUPPORTED = LiteException.LiteErrorCode.UNSUPPORTED,
UNKNOWN = 400,

View file

@ -42,46 +42,24 @@ pub enum ErrorKind {
PermissionDenied = -3,
InvalidFilename = -4,
OtherIO = -5,
FileNotFound = 101,
DatabaseShutdown = 102,
InvalidDatabase = 103,
FileSizeExceeded = 105,
CollectionLimitExceeded = 106,
IndexDropId = 108,
IndexDuplicateKey = 110,
InvalidIndexKey = 111,
IndexNotFound = 112,
InvalidDbref = 113,
LockTimeout = 120,
InvalidCommand = 121,
AlreadyExistsCollectionName = 122,
AlreadyOpenDatafile = 124,
InvalidTransactionState = 126,
IndexNameLimitExceeded = 128,
InvalidIndexName = 129,
InvalidCollectionName = 130,
TempEngineAlreadyDefined = 131,
InvalidExpressionType = 132,
CollectionNotFound = 133,
CollectionAlreadyExist = 134,
IndexAlreadyExist = 135,
InvalidUpdateField = 136,
InvalidFormat = 200,
DocumentMaxDepth = 201,
InvalidCtor = 202,
UnexpectedToken = 203,
InvalidDataType = 204,
PropertyNotMapped = 206,
InvalidTypedName = 207,
PropertyReadWrite = 209,
InitialSizeCryptoNotSupported = 210,
InvalidInitialSize = 211,
InvalidNullCharString = 212,
InvalidFreeSpacePage = 213,
DataTypeNotAssignable = 214,
AvoidUseOfProcess = 215,
NotEncrypted = 216,
InvalidPassword = 217,
Unsupported = 300,
Uncategorized = 400,
}