Skip to content

Commit c920870

Browse files
committed
Improve logging and error handling
1 parent f864d39 commit c920870

21 files changed

+268
-323
lines changed

.github/workflows/release.yml

Lines changed: 100 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -58,113 +58,113 @@ jobs:
5858
exit 1
5959
fi
6060
61-
build-and-test:
62-
needs: [ get-configs, version-and-tag ]
63-
uses: ./.github/workflows/build-and-test.yml
64-
strategy:
65-
fail-fast: true
66-
matrix:
67-
os: [ ubuntu-22.04, windows-latest, macos-latest ]
68-
with:
69-
ref: ${{ needs.version-and-tag.outputs.tag }}
70-
runs-on: ${{ matrix.os }}
71-
72-
bundle-linux:
73-
needs: [ get-configs, version-and-tag, build-and-test ]
74-
strategy:
75-
fail-fast: true
76-
matrix:
77-
include:
78-
- { arch: "x64", docker-platform: "linux/amd64", go-arch: "amd64", use_qemu: false, node-version: "22" }
79-
- { arch: "arm64", docker-platform: "linux/arm64", go-arch: "arm64", use_qemu: true, node-version: "22" }
80-
runs-on: ubuntu-22.04
81-
steps:
82-
- uses: actions/checkout@v5
83-
with:
84-
ref: ${{ needs.version-and-tag.outputs.tag }}
85-
fetch-tags: true
86-
87-
- name: Set release asset name
88-
id: set-asset-name
89-
shell: bash
90-
run: |
91-
APP_NAME=${{ needs.get-configs.outputs.app-name }}
92-
VERSION=$(node -p "require('./package.json').version")
93-
NODE_VERSION=${{ matrix.node-version }}
94-
NODE_MAJOR=$(echo $NODE_VERSION | cut -d. -f1)
95-
96-
TAG=${{ needs.version-and-tag.outputs.tag }}
97-
if [[ "$TAG" =~ -alpha$ ]]; then
98-
FILE_NAME="${APP_NAME}-${VERSION}-alpha-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
99-
elif [[ "$TAG" =~ -beta$ ]]; then
100-
FILE_NAME="${APP_NAME}-${VERSION}-beta-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
101-
else
102-
FILE_NAME="${APP_NAME}-${VERSION}-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
103-
fi
104-
105-
ASSET_NAME=$(echo "$FILE_NAME" | tr '[:upper:]' '[:lower:]')
106-
echo "ASSET_NAME=${ASSET_NAME}" >> $GITHUB_OUTPUT
61+
# build-and-test:
62+
# needs: [ get-configs, version-and-tag ]
63+
# uses: ./.github/workflows/build-and-test.yml
64+
# strategy:
65+
# fail-fast: true
66+
# matrix:
67+
# os: [ ubuntu-22.04, windows-latest, macos-latest ]
68+
# with:
69+
# ref: ${{ needs.version-and-tag.outputs.tag }}
70+
# runs-on: ${{ matrix.os }}
10771

108-
- name: Set up QEMU
109-
if: matrix.use_qemu
110-
uses: docker/setup-qemu-action@v3
111-
112-
- name: Bundle (${{ matrix.docker-platform }}
113-
run: |
114-
docker run --rm -v ${{ github.workspace }}:/work -w /work \
115-
--platform ${{ matrix.docker-platform }} \
116-
amazonlinux:2023 \
117-
/bin/bash -c '
118-
set -ex
119-
yum install -y make gcc-c++ python3 tar gzip wget tree
120-
121-
wget -q https://go.dev/dl/go${{ needs.get-configs.outputs.go-version }}.linux-${{ matrix.go-arch }}.tar.gz
122-
tar -C /usr/local -xzf go${{ needs.get-configs.outputs.go-version }}.linux-${{ matrix.go-arch }}.tar.gz
123-
export PATH=$PATH:/usr/local/go/bin
124-
125-
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
126-
export NVM_DIR="$HOME/.nvm"
127-
. "$NVM_DIR/nvm.sh"
128-
nvm install ${{ matrix.node-version }}
129-
nvm use ${{ matrix.node-version }}
130-
131-
npm ci
132-
133-
TAG="${{ needs.version-and-tag.outputs.tag }}"
134-
if [[ "$TAG" =~ -alpha$ ]]; then
135-
npm run bundle:alpha
136-
elif [[ "$TAG" =~ -beta$ ]]; then
137-
npm run bundle:beta
138-
else
139-
npm run bundle:prod
140-
fi
141-
142-
tree -f bundle/production/node_modules/tree-sitter
143-
tree -f bundle/production/node_modules/tree-sitter-json
144-
145-
GOARCH=${{ matrix.go-arch }} go build -C ./cfn-init/cmd -v -o ../../bundle/production/bin/cfn-init
146-
cp ./cfn-init/THIRD-PARTY-LICENSES.txt ./bundle/production/bin/
147-
'
148-
149-
- name: Upload artifact
150-
uses: actions/upload-artifact@v4
151-
with:
152-
name: ${{ steps.set-asset-name.outputs.ASSET_NAME }}
153-
path: bundle/production/
154-
if-no-files-found: error
155-
include-hidden-files: true
156-
compression-level: 6
72+
# bundle-linux:
73+
# needs: [ get-configs, version-and-tag, build-and-test ]
74+
# strategy:
75+
# fail-fast: true
76+
# matrix:
77+
# include:
78+
# - { arch: "x64", docker-platform: "linux/amd64", go-arch: "amd64", use_qemu: false, node-version: "22" }
79+
# - { arch: "arm64", docker-platform: "linux/arm64", go-arch: "arm64", use_qemu: true, node-version: "22" }
80+
# runs-on: ubuntu-22.04
81+
# steps:
82+
# - uses: actions/checkout@v5
83+
# with:
84+
# ref: ${{ needs.version-and-tag.outputs.tag }}
85+
# fetch-tags: true
86+
#
87+
# - name: Set release asset name
88+
# id: set-asset-name
89+
# shell: bash
90+
# run: |
91+
# APP_NAME=${{ needs.get-configs.outputs.app-name }}
92+
# VERSION=$(node -p "require('./package.json').version")
93+
# NODE_VERSION=${{ matrix.node-version }}
94+
# NODE_MAJOR=$(echo $NODE_VERSION | cut -d. -f1)
95+
#
96+
# TAG=${{ needs.version-and-tag.outputs.tag }}
97+
# if [[ "$TAG" =~ -alpha$ ]]; then
98+
# FILE_NAME="${APP_NAME}-${VERSION}-alpha-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
99+
# elif [[ "$TAG" =~ -beta$ ]]; then
100+
# FILE_NAME="${APP_NAME}-${VERSION}-beta-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
101+
# else
102+
# FILE_NAME="${APP_NAME}-${VERSION}-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
103+
# fi
104+
#
105+
# ASSET_NAME=$(echo "$FILE_NAME" | tr '[:upper:]' '[:lower:]')
106+
# echo "ASSET_NAME=${ASSET_NAME}" >> $GITHUB_OUTPUT
107+
#
108+
# - name: Set up QEMU
109+
# if: matrix.use_qemu
110+
# uses: docker/setup-qemu-action@v3
111+
#
112+
# - name: Bundle (${{ matrix.docker-platform }}
113+
# run: |
114+
# docker run --rm -v ${{ github.workspace }}:/work -w /work \
115+
# --platform ${{ matrix.docker-platform }} \
116+
# amazonlinux:2023 \
117+
# /bin/bash -c '
118+
# set -ex
119+
# yum install -y make gcc-c++ python3 tar gzip wget tree
120+
#
121+
# wget -q https://go.dev/dl/go${{ needs.get-configs.outputs.go-version }}.linux-${{ matrix.go-arch }}.tar.gz
122+
# tar -C /usr/local -xzf go${{ needs.get-configs.outputs.go-version }}.linux-${{ matrix.go-arch }}.tar.gz
123+
# export PATH=$PATH:/usr/local/go/bin
124+
#
125+
# curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
126+
# export NVM_DIR="$HOME/.nvm"
127+
# . "$NVM_DIR/nvm.sh"
128+
# nvm install ${{ matrix.node-version }}
129+
# nvm use ${{ matrix.node-version }}
130+
#
131+
# npm ci
132+
#
133+
# TAG="${{ needs.version-and-tag.outputs.tag }}"
134+
# if [[ "$TAG" =~ -alpha$ ]]; then
135+
# npm run bundle:alpha
136+
# elif [[ "$TAG" =~ -beta$ ]]; then
137+
# npm run bundle:beta
138+
# else
139+
# npm run bundle:prod
140+
# fi
141+
#
142+
# tree -f bundle/production/node_modules/tree-sitter
143+
# tree -f bundle/production/node_modules/tree-sitter-json
144+
#
145+
# GOARCH=${{ matrix.go-arch }} go build -C ./cfn-init/cmd -v -o ../../bundle/production/bin/cfn-init
146+
# cp ./cfn-init/THIRD-PARTY-LICENSES.txt ./bundle/production/bin/
147+
# '
148+
#
149+
# - name: Upload artifact
150+
# uses: actions/upload-artifact@v4
151+
# with:
152+
# name: ${{ steps.set-asset-name.outputs.ASSET_NAME }}
153+
# path: bundle/production/
154+
# if-no-files-found: error
155+
# include-hidden-files: true
156+
# compression-level: 6
157157

158158
bundle-win-mac:
159-
needs: [ get-configs, version-and-tag, build-and-test ]
159+
needs: [ get-configs, version-and-tag ]
160160
strategy:
161161
fail-fast: true
162162
matrix:
163163
include:
164-
- { os: "macos-latest", arch: "x64", platform: "darwin", go-arch: "amd64", node-version: "22.x" }
165-
- { os: "macos-latest", arch: "arm64", platform: "darwin", go-arch: "arm64", node-version: "22.x" }
164+
# - { os: "macos-latest", arch: "x64", platform: "darwin", go-arch: "amd64", node-version: "22.x" }
165+
# - { os: "macos-latest", arch: "arm64", platform: "darwin", go-arch: "arm64", node-version: "22.x" }
166166
- { os: "windows-latest", arch: "x64", platform: "win32", go-arch: "amd64", node-version: "22.x" }
167-
- { os: "windows-11-arm", arch: "arm64", platform: "win32", go-arch: "arm64", node-version: "22.x" }
167+
# - { os: "windows-11-arm", arch: "arm64", platform: "win32", go-arch: "arm64", node-version: "22.x" }
168168
runs-on: ${{ matrix.os }}
169169
steps:
170170
- uses: actions/checkout@v5
@@ -249,7 +249,7 @@ jobs:
249249
compression-level: 6
250250

251251
release:
252-
needs: [ version-and-tag, bundle-linux, bundle-win-mac ]
252+
needs: [ version-and-tag, bundle-win-mac ]
253253
runs-on: ubuntu-latest
254254
permissions:
255255
contents: write

src/app/standalone.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ async function onInitialize(params: ExtendedInitializeParams) {
4646
}
4747

4848
function onInitialized(params: InitializedParams) {
49-
getLogger().info(`${ExtensionName} initialized`);
5049
(server as any).initialized(params);
50+
getLogger().info(`${ExtensionName} initialized`);
5151
}
5252

5353
function onShutdown() {

src/datastore/DataStore.ts

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ export enum Persistence {
77
local = 'local',
88
}
99

10+
export enum StoreName {
11+
public_schemas = 'public_schemas',
12+
sam_schemas = 'sam_schemas',
13+
private_schemas = 'private_schemas',
14+
combined_schemas = 'combined_schemas',
15+
}
16+
1017
export interface DataStore {
1118
get<T>(key: string): T | undefined;
1219

@@ -22,26 +29,26 @@ export interface DataStore {
2229
}
2330

2431
export interface DataStoreFactory extends Closeable {
25-
getOrCreate(store: string): DataStore;
32+
get(store: StoreName): DataStore;
2633

2734
storeNames(): ReadonlyArray<string>;
2835

2936
stats(): unknown;
3037
}
3138

3239
export interface DataStoreFactoryProvider extends Closeable {
33-
get(store: string, persistence: Persistence): DataStore;
40+
get(store: StoreName, persistence: Persistence): DataStore;
3441
}
3542

3643
export class MemoryDataStoreFactoryProvider implements DataStoreFactoryProvider {
3744
private readonly memoryStoreFactory = new MemoryStoreFactory();
3845

39-
get(store: string, _persistence: Persistence): DataStore {
46+
get(store: StoreName, _persistence: Persistence): DataStore {
4047
return this.getMemoryStore(store);
4148
}
4249

43-
getMemoryStore(store: string): DataStore {
44-
return this.memoryStoreFactory.getOrCreate(store);
50+
getMemoryStore(store: StoreName): DataStore {
51+
return this.memoryStoreFactory.get(store);
4552
}
4653

4754
close(): Promise<void> {
@@ -50,14 +57,19 @@ export class MemoryDataStoreFactoryProvider implements DataStoreFactoryProvider
5057
}
5158

5259
export class MultiDataStoreFactoryProvider implements DataStoreFactoryProvider {
53-
private readonly memoryStoreFactory = new MemoryStoreFactory();
54-
private readonly lmdbStoreFactory = new LMDBStoreFactory();
60+
private readonly memoryStoreFactory: MemoryStoreFactory;
61+
private readonly lmdbStoreFactory: LMDBStoreFactory;
62+
63+
constructor(lmdbStore?: LMDBStoreFactory, memStore?: MemoryStoreFactory) {
64+
this.lmdbStoreFactory = lmdbStore ?? new LMDBStoreFactory();
65+
this.memoryStoreFactory = memStore ?? new MemoryStoreFactory();
66+
}
5567

56-
get(store: string, persistence: Persistence): DataStore {
68+
get(store: StoreName, persistence: Persistence): DataStore {
5769
if (persistence === Persistence.memory) {
58-
return this.memoryStoreFactory.getOrCreate(store);
70+
return this.memoryStoreFactory.get(store);
5971
}
60-
return this.lmdbStoreFactory.getOrCreate(store);
72+
return this.lmdbStoreFactory.get(store);
6173
}
6274

6375
close(): Promise<void> {

0 commit comments

Comments
 (0)