Skip to content

Commit 426d535

Browse files
authored
feat: implement dual-mode export with build tags separation (#36)
* feat: implement dual-mode export with build tags separation(#35) Signed-off-by: mikkeyf <[email protected]> * fix: CI/CD completed Signed-off-by: mikkeyf <[email protected]> * chore: remove .idea files and update .gitignore Signed-off-by: mikkeyf <[email protected]> * refactor: restructure export code to 3-file architecture Signed-off-by: mikkeyf <[email protected]> * fix: add nolint annotations for offline-only code Signed-off-by: mikkeyf <[email protected]> * fix: adjust build tag position in export_offline.go Signed-off-by: mikkeyf <[email protected]> * refactor: rename offline build to full build and reorganize export code structure Signed-off-by: mikkeyf <[email protected]> * refactor: replace golang/snappy with klauspost/compress and add nolint annotations Signed-off-by: mikkeyf <[email protected]> * fix: add nolint annotation for parseDatabase method Signed-off-by: mikkeyf <[email protected]> --------- Signed-off-by: mikkeyf <[email protected]>
1 parent ef4e06c commit 426d535

File tree

15 files changed

+2854
-975
lines changed

15 files changed

+2854
-975
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
.DS_Store
33

44
# ide
5-
.idea/**
6-
.vscode/**
5+
**/.idea/
6+
.idea/
7+
.vscode/
78

89
target/*
910

.goreleaser.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,32 @@ builds:
4545
- -trimpath
4646
- -gcflags=-l -B
4747

48+
- main: ./cmd/ts-cli
49+
id: ts-cli-full
50+
binary: ts-cli-full
51+
tags: [full]
52+
env:
53+
- CGO_ENABLED=0
54+
goos:
55+
- linux
56+
- windows
57+
- darwin
58+
goarch:
59+
- amd64
60+
- arm64
61+
ignore:
62+
- goos: windows
63+
goarch: arm64
64+
ldflags:
65+
- -s -w
66+
- -X github.com/openGemini/openGemini-cli/common.Version={{.Tag}}
67+
- -X github.com/openGemini/openGemini-cli/common.GitCommit={{.ShortCommit}}
68+
- -X github.com/openGemini/openGemini-cli/common.BuildTime={{.Date}}
69+
- -X github.com/openGemini/openGemini-cli/common.GitBranch={{.Branch}}
70+
flags:
71+
- -trimpath
72+
- -gcflags=-l -B
73+
4874
archives:
4975
- formats: [ 'zip' ]
5076
# this name template makes the OS and Arch compatible with the results of `uname`.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2025 openGemini Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
//go:build !full
16+
// +build !full
17+
18+
package subcmd
19+
20+
// Run executes the export command (online mode only in default build)
21+
func (c *ExportCommand) Run(config *ExportConfig) error {
22+
return c.runOnlineExport(config)
23+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2025 openGemini Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
//go:build full
16+
// +build full
17+
18+
package subcmd
19+
20+
// Run executes the export command (supports both online and offline modes in full build)
21+
func (c *ExportCommand) Run(config *ExportConfig) error {
22+
useOffline := config.DataDir != "" || config.WalDir != ""
23+
24+
if useOffline {
25+
return c.runOfflineExport(config)
26+
}
27+
return c.runOnlineExport(config)
28+
}

0 commit comments

Comments
 (0)