distributed

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregationStrategy

type AggregationStrategy interface {
	Aggregate(results []*PartitionResult) (interface{}, error)
}

AggregationStrategy defines result aggregation

type AnalysisAggregator

type AnalysisAggregator struct{}

func (*AnalysisAggregator) Aggregate

func (a *AnalysisAggregator) Aggregate(results []*PartitionResult) (interface{}, error)

type AttackAggregator

type AttackAggregator struct{}

func (*AttackAggregator) Aggregate

func (a *AttackAggregator) Aggregate(results []*PartitionResult) (interface{}, error)

type CapacityTracker

type CapacityTracker struct {
	// contains filtered or unexported fields
}

CapacityTracker tracks node capacity

func NewCapacityTracker

func NewCapacityTracker() *CapacityTracker

func (*CapacityTracker) TrackNode

func (ct *CapacityTracker) TrackNode(node *Node)

type ChainAggregator

type ChainAggregator struct{}

func (*ChainAggregator) Aggregate

func (a *ChainAggregator) Aggregate(results []*PartitionResult) (interface{}, error)

type ConsensusManager

type ConsensusManager struct {
	// contains filtered or unexported fields
}

ConsensusManager handles distributed consensus

func NewConsensusManager

func NewConsensusManager() *ConsensusManager

Placeholder implementations

type ConsensusNode

type ConsensusNode struct {
	ID          string
	Address     string
	LastContact time.Time
	State       ConsensusState
}

ConsensusNode represents a consensus participant

type ConsensusState

type ConsensusState string

ConsensusState represents node consensus state

const (
	StateFollower  ConsensusState = "follower"
	StateCandidate ConsensusState = "candidate"
	StateLeader    ConsensusState = "leader"
)

type Coordinator

type Coordinator struct {
	// contains filtered or unexported fields
}

Coordinator manages distributed coordination

func NewCoordinator

func NewCoordinator() *Coordinator

NewCoordinator creates coordinator

type DistributedConfig

type DistributedConfig struct {
	MaxNodes            int
	TaskTimeout         time.Duration
	HeartbeatInterval   time.Duration
	ReplicationFactor   int
	PartitionStrategy   PartitionStrategy
	LoadBalancingPolicy LoadBalancingPolicy
	FaultTolerance      bool
	AutoScaling         bool
}

DistributedConfig configures distributed execution

type DistributedExecutor

type DistributedExecutor struct {
	// contains filtered or unexported fields
}

DistributedExecutor manages distributed attack execution

func NewDistributedExecutor

func NewDistributedExecutor(config DistributedConfig) *DistributedExecutor

NewDistributedExecutor creates a distributed executor

func (*DistributedExecutor) ExecuteDistributed

func (de *DistributedExecutor) ExecuteDistributed(ctx context.Context, request DistributedRequest) (*DistributedResult, error)

ExecuteDistributed runs a distributed task

func (*DistributedExecutor) RegisterNode

func (de *DistributedExecutor) RegisterNode(nodeConfig NodeConfig) (*Node, error)

RegisterNode adds a worker node

type DistributedLock

type DistributedLock struct {
	Key        string
	Owner      string
	AcquiredAt time.Time
	TTL        time.Duration
	Renewals   int
}

DistributedLock represents a distributed lock

type DistributedLockManager

type DistributedLockManager struct {
	// contains filtered or unexported fields
}

DistributedLockManager manages distributed locks

func NewDistributedLockManager

func NewDistributedLockManager() *DistributedLockManager

type DistributedRequest

type DistributedRequest struct {
	Type       TaskType
	Payload    interface{}
	Timeout    time.Duration
	Priority   int
	Partitions int
}

DistributedRequest defines a distributed execution request

type DistributedResult

type DistributedResult struct {
	TaskID              string
	Success             bool
	TotalPartitions     int
	CompletedPartitions int
	FailedPartitions    int
	AggregatedData      interface{}
	ExecutionTime       time.Duration
	NodeMetrics         map[string]*NodeMetrics
}

DistributedResult contains aggregated results

type DistributedTask

type DistributedTask struct {
	ID            string
	Type          TaskType
	Payload       interface{}
	Partitions    []TaskPartition
	Status        TaskStatus
	AssignedNodes []string
	StartTime     time.Time
	Deadline      time.Time
	RetryCount    int
	Results       map[string]*PartitionResult
	// contains filtered or unexported fields
}

DistributedTask represents a distributed task

type DynamicPartitioner

type DynamicPartitioner struct{}

func (*DynamicPartitioner) Partition

func (p *DynamicPartitioner) Partition(data interface{}, numPartitions int) []interface{}

type HashPartitioner

type HashPartitioner struct{}

func (*HashPartitioner) Partition

func (p *HashPartitioner) Partition(data interface{}, numPartitions int) []interface{}

type HealthCheck

type HealthCheck struct {
	NodeID           string
	LastCheck        time.Time
	Status           HealthStatus
	ResponseTime     time.Duration
	FailureCount     int
	ConsecutiveFails int
}

HealthCheck represents a health check

type HealthChecker

type HealthChecker struct {
	// contains filtered or unexported fields
}

HealthChecker monitors node health

func NewHealthChecker

func NewHealthChecker() *HealthChecker

func (*HealthChecker) RegisterNode

func (hc *HealthChecker) RegisterNode(node *Node)

type HealthStatus

type HealthStatus string

HealthStatus represents health state

const (
	HealthHealthy   HealthStatus = "healthy"
	HealthDegraded  HealthStatus = "degraded"
	HealthUnhealthy HealthStatus = "unhealthy"
	HealthUnknown   HealthStatus = "unknown"
)

type LoadBalancer

type LoadBalancer struct {
	// contains filtered or unexported fields
}

LoadBalancer distributes load across nodes

func NewLoadBalancer

func NewLoadBalancer(policy LoadBalancingPolicy) *LoadBalancer

NewLoadBalancer creates load balancer

func (*LoadBalancer) AssignPartitions

func (lb *LoadBalancer) AssignPartitions(partitions []TaskPartition, nodes []*Node) map[string]string

AssignPartitions assigns partitions to nodes

type LoadBalancingPolicy

type LoadBalancingPolicy string

LoadBalancingPolicy defines load distribution

const (
	LoadBalanceLeastConnections LoadBalancingPolicy = "least_connections"
	LoadBalanceRoundRobin       LoadBalancingPolicy = "round_robin"
	LoadBalanceWeighted         LoadBalancingPolicy = "weighted"
	LoadBalanceAdaptive         LoadBalancingPolicy = "adaptive"
)

type Node

type Node struct {
	ID            string
	Address       string
	Status        NodeStatus
	Capacity      NodeCapacity
	CurrentLoad   NodeLoad
	LastHeartbeat time.Time
	Tasks         map[string]*DistributedTask
	// contains filtered or unexported fields
}

Node represents a distributed worker node

type NodeCapacity

type NodeCapacity struct {
	CPU              int
	Memory           int64
	MaxConcurrency   int
	NetworkBandwidth int64
	Specializations  []string
}

NodeCapacity defines node resources

type NodeConfig

type NodeConfig struct {
	Address  string
	Capacity NodeCapacity
}

NodeConfig configures a node

type NodeGroup

type NodeGroup struct {
	ID             string
	Name           string
	Nodes          []string
	Specialization string
	LoadBalancer   *LoadBalancer
}

NodeGroup represents a group of nodes

type NodeLoad

type NodeLoad struct {
	CPUUsage       float64
	MemoryUsage    int64
	ActiveTasks    int32
	TasksCompleted int64
	AverageLatency time.Duration
}

NodeLoad tracks current usage

type NodeManager

type NodeManager struct {
	// contains filtered or unexported fields
}

NodeManager manages worker nodes

func NewNodeManager

func NewNodeManager(config DistributedConfig) *NodeManager

NewNodeManager creates node manager

func (*NodeManager) AddNode

func (nm *NodeManager) AddNode(node *Node)

AddNode registers a node

type NodeMetrics

type NodeMetrics struct {
	NodeID         string
	TasksProcessed int
	AverageLatency time.Duration
	ErrorRate      float64
	ResourceUsage  ResourceUsage
}

NodeMetrics tracks node performance

type NodeStatus

type NodeStatus string

NodeStatus represents node state

const (
	NodeStatusActive    NodeStatus = "active"
	NodeStatusDraining  NodeStatus = "draining"
	NodeStatusUnhealthy NodeStatus = "unhealthy"
	NodeStatusOffline   NodeStatus = "offline"
)

type PartitionResult

type PartitionResult struct {
	PartitionID   string
	Success       bool
	Data          interface{}
	Error         error
	ExecutionTime time.Duration
	NodeID        string
}

PartitionResult contains partition execution results

type PartitionStatus

type PartitionStatus string

PartitionStatus tracks partition state

const (
	PartitionPending   PartitionStatus = "pending"
	PartitionAssigned  PartitionStatus = "assigned"
	PartitionExecuting PartitionStatus = "executing"
	PartitionCompleted PartitionStatus = "completed"
	PartitionFailed    PartitionStatus = "failed"
)

type PartitionStrategy

type PartitionStrategy string

PartitionStrategy defines how to partition work

const (
	PartitionRoundRobin PartitionStrategy = "round_robin"
	PartitionHash       PartitionStrategy = "hash"
	PartitionRange      PartitionStrategy = "range"
	PartitionDynamic    PartitionStrategy = "dynamic"
)

type Partitioner

type Partitioner interface {
	Partition(data interface{}, numPartitions int) []interface{}
}

Partitioner defines partitioning interface

type RangePartitioner

type RangePartitioner struct{}

func (*RangePartitioner) Partition

func (p *RangePartitioner) Partition(data interface{}, numPartitions int) []interface{}

type ResourceUsage

type ResourceUsage struct {
	CPUPercent  float64
	MemoryMB    int64
	NetworkMBps float64
}

ResourceUsage tracks resource consumption

type ResultAggregator

type ResultAggregator struct {
	// contains filtered or unexported fields
}

ResultAggregator aggregates distributed results

func NewResultAggregator

func NewResultAggregator() *ResultAggregator

NewResultAggregator creates aggregator

type RoundRobinPartitioner

type RoundRobinPartitioner struct{}

Partitioner implementations

func (*RoundRobinPartitioner) Partition

func (p *RoundRobinPartitioner) Partition(data interface{}, numPartitions int) []interface{}

type ScanAggregator

type ScanAggregator struct{}

Aggregator implementations

func (*ScanAggregator) Aggregate

func (a *ScanAggregator) Aggregate(results []*PartitionResult) (interface{}, error)

type ScanPartition

type ScanPartition struct {
	Targets   []string
	Templates []string
}

ScanPartition represents scan work unit

type ScanRequest

type ScanRequest struct {
	Targets   []string
	Templates []string
	Options   map[string]interface{}
}

ScanRequest defines a scan request

type StateManager

type StateManager struct {
	// contains filtered or unexported fields
}

StateManager manages distributed state

func NewStateManager

func NewStateManager() *StateManager

type StateReplica

type StateReplica struct {
	NodeID     string
	Version    int64
	LastSync   time.Time
	Consistent bool
}

StateReplica represents state replica

type SystemMetrics

type SystemMetrics struct {
	NodeCount      int
	TotalCapacity  int
	CurrentLoad    int32
	Utilization    float64
	AverageLatency time.Duration
	PendingTasks   int
}

SystemMetrics tracks system-wide metrics

type TaskDistributor

type TaskDistributor struct {
	// contains filtered or unexported fields
}

TaskDistributor distributes tasks across nodes

func NewTaskDistributor

func NewTaskDistributor(strategy PartitionStrategy) *TaskDistributor

NewTaskDistributor creates distributor

type TaskPartition

type TaskPartition struct {
	ID         string
	TaskID     string
	Index      int
	Data       interface{}
	Size       int64
	AssignedTo string
	Status     PartitionStatus
	Result     *PartitionResult
}

TaskPartition represents a task fragment

type TaskStatus

type TaskStatus string

TaskStatus tracks task execution

const (
	TaskStatusQueued      TaskStatus = "queued"
	TaskStatusPartitioned TaskStatus = "partitioned"
	TaskStatusDistributed TaskStatus = "distributed"
	TaskStatusExecuting   TaskStatus = "executing"
	TaskStatusAggregating TaskStatus = "aggregating"
	TaskStatusCompleted   TaskStatus = "completed"
	TaskStatusFailed      TaskStatus = "failed"
)

type TaskType

type TaskType string

TaskType categorizes distributed tasks

const (
	TaskTypeMassiveScan      TaskType = "massive_scan"
	TaskTypeParallelAttack   TaskType = "parallel_attack"
	TaskTypeDistributedChain TaskType = "distributed_chain"
	TaskTypeBatchAnalysis    TaskType = "batch_analysis"
)

type TrackedCapacity

type TrackedCapacity struct {
	NodeID           string
	TotalCapacity    NodeCapacity
	UsedCapacity     NodeCapacity
	ReservedCapacity NodeCapacity
	UpdatedAt        time.Time
}

TrackedCapacity tracks node resource usage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL