refactor: remove duplicate Server methods and clean up main.go

- Removed all duplicate Server methods from main.go (630 lines)
- Fixed import conflicts and unused imports
- main.go reduced from 3,298 to 340 lines (89% reduction)
- Clean modular structure with server package handling all server functionality
- Achieved clean build with no compilation errors

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-20 17:18:59 +03:00
parent a5ea869b28
commit 85f3aa69d2
6 changed files with 958 additions and 3355 deletions

View File

@@ -74,21 +74,6 @@ func (s *Server) startBackgroundTasks() {
// bootstrap joins cluster using seed nodes via bootstrap service
func (s *Server) bootstrap() {
if len(s.config.SeedNodes) == 0 {
s.logger.Info("No seed nodes configured, running as standalone")
return
}
s.logger.Info("Starting bootstrap process")
s.setMode("syncing")
// Use bootstrap service to join cluster
if err := s.bootstrapService.JoinCluster(); err != nil {
s.logger.WithError(err).Error("Failed to join cluster")
s.setMode("normal")
return
}
s.setMode("normal")
s.logger.Info("Successfully joined cluster")
}
s.bootstrapService.Bootstrap()
}