Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 11 additions & 31 deletions .air.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"

[build]
args_bin = []
bin = "./tmp/main start"
cmd = "go build -o ./tmp/main ."
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
bin = "./any-sync-bundle"
cmd = "go build -o ./any-sync-bundle"
delay = 500
exclude_dir = ["data","assets", "tmp", "vendor"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_regex = []
exclude_unchanged = false
follow_symlink = false
full_bin = ""
full_bin = "./any-sync-bundle start"
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
include_file = []
kill_delay = "0s"
include_ext = ["go", "tpl", "tmpl", "yaml", "env"]
kill_delay = "1s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = []
pre_cmd = []
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false
send_interrupt = true
stop_on_error = true

[color]
app = ""
Expand All @@ -35,18 +26,7 @@ tmp_dir = "tmp"
watcher = "cyan"

[log]
main_only = false
silent = false
time = false

[misc]
clean_on_exit = false

[proxy]
app_port = 0
enabled = false
proxy_port = 0

[screen]
clear_on_rebuild = false
keep_scroll = true
clean_on_exit = true
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@ go.work.sum
# Local build data
/dist/
/data/
/any-sync-bundle
/consensus.db*
/tmp/
/any-sync-bundle
4 changes: 2 additions & 2 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
- run: go mod verify
- run: go install tool

- uses: golangci/golangci-lint-action@v6
- uses: golangci/golangci-lint-action@v7
with:
version: v1.64.5
version: v2.0

tests:
name: tests-${{ matrix.os }}
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@ go.work.sum
# Local build data
/dist/
/data/
/any-sync-bundle
/consensus.db*
/tmp/
/any-sync-bundle
5 changes: 5 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
version: "2"

run:
timeout: 5m

linters:
default: standard
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func buildGlobalFlags() []cli.Flag {
},
&cli.StringSliceFlag{
Name: fGlobalInitExternalAddrs,
Value: cli.NewStringSlice("192.168.100.4", "example.local"),
Value: cli.NewStringSlice("192.168.8.214", "example.local"),
EnvVars: []string{"ANY_SYNC_BUNDLE_INIT_EXTERNAL_ADDRS"},
Usage: "Initial external addresses for the bundle",
},
Expand Down
22 changes: 4 additions & 18 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import (

bundleConfig "github.com/grishy/any-sync-bundle/config"
"github.com/grishy/any-sync-bundle/lightnode"
lightConsensus "github.com/grishy/any-sync-bundle/lightnode/consensus"
lightFile "github.com/grishy/any-sync-bundle/lightnode/filenode"
)

const (
Expand Down Expand Up @@ -83,24 +81,12 @@ func startAction(ctx context.Context) cli.ActionFunc {
cfgNodes := bundleCfg.NodeConfigs()

apps := []node{
{name: "consensus", app: lightConsensus.NewApp(cfgNodes.Consensus)},
{name: "filenode", app: lightFile.NewApp(cfgNodes.Filenode, cfgNodes.FilenodeStorePath)},
{name: "coordinator", app: lightnode.NewCoordinatorApp(cfgNodes.Coordinator)},
{name: "sync", app: lightnode.NewSyncApp(cfgNodes.Sync)},
{name: "consensus", app: lightnode.NewLightConsensusNode(cfgNodes.Consensus)},
{name: "filenode", app: lightnode.NewLightFileNode(cfgNodes.Filenode)},
{name: "coordinator", app: lightnode.NewLightCoordinatorNode(cfgNodes.Coordinator)},
{name: "sync", app: lightnode.NewSyncNode(cfgNodes.Sync)},
}

// // TODO: Just keep import here available
// _ = []node{
// // Light
// {name: "consensus", app: lightConsensus.NewApp(cfgNodes.Consensus)},
// {name: "filenode", app: lightFile.NewApp(cfgNodes.Filenode, cfgNodes.FilenodeStorePath)},
// // Full
// {name: "consensus", app: lightConsensus.NewConsensusApp(cfgNodes.Consensus)},
// {name: "coordinator", app: lightnode.NewCoordinatorApp(cfgNodes.Coordinator)},
// {name: "filenode", app: lightFile.NewFileNodeApp(cfgNodes.Filenode, cfgNodes.FilenodeStorePath)},
// {name: "sync", app: lightnode.NewSyncApp(cfgNodes.Sync)},
// }

if err := startServices(ctx, apps); err != nil {
return err
}
Expand Down
20 changes: 13 additions & 7 deletions lightcmp/lightconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const (

var log = logger.NewNamed("light." + CName)

// TODO: Currently each node has its own configuration and fill related to the node type fields
// After it will be possible to use only one instance
// TODO: Implify after merge DB in light node
type LightConfig struct {
// Global
Account commonaccount.Config
Expand All @@ -25,9 +28,12 @@ type LightConfig struct {
ListenUDPAddr []string
// Consensus
ConsensusDBPath string
// Coordinator
// ...
// Filenode
FilenodeStoreDir string
FilenodeDefaultLimitBytes uint64
// General
DBPath string
}

//
Expand Down Expand Up @@ -96,14 +102,14 @@ func (c *LightConfig) GetConsensusDBPath() string {
return c.ConsensusDBPath
}

func (c *LightConfig) GetFilenodeStoreDir() string {
log.Info("call GetFilenodeStoreDir")

return c.FilenodeStoreDir
}

func (c *LightConfig) GetFilenodeDefaultLimitBytes() uint64 {
log.Info("call GetFilenodeDefaultLimitBytes")

return c.FilenodeDefaultLimitBytes
}

func (c *LightConfig) GetDBDir() string {
log.Info("call GetDBDir")

return c.DBPath
}
Loading
Loading