Resolve import cycles and migrate to chorus.services module path

This comprehensive refactoring addresses critical architectural issues:

IMPORT CYCLE RESOLUTION:
• pkg/crypto ↔ pkg/slurp/roles: Created pkg/security/access_levels.go
• pkg/ucxl → pkg/dht: Created pkg/storage/interfaces.go
• pkg/slurp/leader → pkg/election → pkg/slurp/storage: Moved types to pkg/election/interfaces.go

MODULE PATH MIGRATION:
• Changed from github.com/anthonyrawlins/bzzz to chorus.services/bzzz
• Updated all import statements across 115+ files
• Maintains compatibility while removing personal GitHub account dependency

TYPE SYSTEM IMPROVEMENTS:
• Resolved duplicate type declarations in crypto package
• Added missing type definitions (RoleStatus, TimeRestrictions, KeyStatus, KeyRotationResult)
• Proper interface segregation to prevent future cycles

ARCHITECTURAL BENEFITS:
• Build now progresses past structural issues to normal dependency resolution
• Cleaner separation of concerns between packages
• Eliminates circular dependencies that prevented compilation
• Establishes foundation for scalable codebase growth

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-08-17 10:04:25 +10:00
parent e9252ccddc
commit d96c931a29
115 changed files with 1010 additions and 534 deletions

45
pkg/storage/interfaces.go Normal file
View File

@@ -0,0 +1,45 @@
// Package storage provides common storage interfaces for BZZZ
// This package contains shared storage interfaces to avoid circular dependencies.
package storage
import "time"
// UCXLStorage defines the interface for UCXL content storage operations
type UCXLStorage interface {
// StoreUCXLContent stores content at a UCXL address with role-based encryption
StoreUCXLContent(address string, content []byte, role string, contentType string) error
// RetrieveUCXLContent retrieves and decrypts content from a UCXL address
RetrieveUCXLContent(address string) ([]byte, *UCXLMetadata, error)
// AnnounceContent announces content availability in the network
AnnounceContent(address string) error
// SearchContent searches for content based on query parameters
SearchContent(query *SearchQuery) ([]*UCXLMetadata, error)
// GetMetrics returns storage metrics
GetMetrics() map[string]interface{}
}
// UCXLMetadata represents metadata about stored UCXL content
type UCXLMetadata struct {
Address string `json:"address"`
CreatorRole string `json:"creator_role"`
ContentType string `json:"content_type"`
CreatedAt time.Time `json:"created_at"`
Size int64 `json:"size"`
Encrypted bool `json:"encrypted"`
}
// SearchQuery represents search parameters for UCXL content
type SearchQuery struct {
Agent string `json:"agent,omitempty"`
Role string `json:"role,omitempty"`
Project string `json:"project,omitempty"`
ContentType string `json:"content_type,omitempty"`
CreatedAfter time.Time `json:"created_after,omitempty"`
CreatedBefore time.Time `json:"created_before,omitempty"`
Limit int `json:"limit,omitempty"`
}