Documentation
¶
Index ¶
- Constants
- Variables
- type ApiConfig
- type ClusterConfig
- type ClusterMetrics
- func (m *ClusterMetrics) AddBytesReceived(bytes uint64)
- func (m *ClusterMetrics) AddBytesSent(bytes uint64)
- func (m *ClusterMetrics) ConnectionAccepted()
- func (m *ClusterMetrics) ConnectionDropped()
- func (m *ClusterMetrics) ConnectionError()
- func (m *ClusterMetrics) ConnectionOpened()
- func (m *ClusterMetrics) ConnectionRejected()
- func (m *ClusterMetrics) LeaderChanged()
- func (m *ClusterMetrics) MessageReceived()
- func (m *ClusterMetrics) MessageSent()
- func (m *ClusterMetrics) ReceiveError()
- func (m *ClusterMetrics) SendError()
- func (m *ClusterMetrics) SetLastAppliedWalIndex(index uint64)
- func (m *ClusterMetrics) WalFlush()
- type Config
- type DiscoveryKind
- type GatewayMetrics
- func (m *GatewayMetrics) ConnectionClosed()
- func (m *GatewayMetrics) ConnectionFailed()
- func (m *GatewayMetrics) ConnectionOpened()
- func (m *GatewayMetrics) MessageReceived()
- func (m *GatewayMetrics) MessageSent()
- func (m *GatewayMetrics) NetworkError()
- func (m *GatewayMetrics) ProxyConnected()
- func (m *GatewayMetrics) ProxyDisconnected()
- type LoggingConfig
- type PartitionConfig
- type PartitionMetrics
- func (m *PartitionMetrics) JobAdded(topic string, n uint64)
- func (m *PartitionMetrics) JobCompleted(topic string, n uint64)
- func (m *PartitionMetrics) JobDLQ(topic string, n uint64)
- func (m *PartitionMetrics) JobRetried(topic string, n uint64)
- func (m *PartitionMetrics) RemoveTopic(topic string)
- func (m *PartitionMetrics) SetActiveDepth(topic string, v uint32)
- type ProxyConfig
- type TopicManagerMetrics
- type WALConfig
Constants ¶
const ( DefaultDLQMaxSizeBytes = 10 << 20 // 10 MB DefaultRaftTickMs = 100 DefaultRaftHeartbeatTick = 5 DefaultRaftElectionTick = 20 )
Variables ¶
var ( ErrServiceUnavailable = errors.New("service unavailable: node is not active") // ErrUnknownCommand returned when command type is not recognized ErrUnknownCommand = errors.New("unknown command type") // ErrUnknownRequestType returned when cluster request type is not recognized ErrUnknownRequestType = errors.New("unknown request type") // ErrInvalidRaftMessage returned when Raft message decoding fails ErrInvalidRaftMessage = errors.New("invalid raft message") // ErrDeadlineExceeded returned when request exceeds deadline ErrDeadlineExceeded = errors.New("deadline exceeded") // ErrMaxRetriesExceeded returned when max retries are exhausted ErrMaxRetriesExceeded = errors.New("max retries exceeded") ErrUnknownNodeID = errors.New("unknown node ID for raft ID") ErrDuplicateJobID = errors.New("job ID already exist") ErrInvalidPayload = errors.New("invalid payload") ErrQueueFull = errors.New("queue is full") ErrTopicNotFound = errors.New("topic not found") ErrTopicExists = errors.New("topic already exists") )
var CfgFile string
Functions ¶
This section is empty.
Types ¶
type ClusterConfig ¶
type ClusterConfig struct {
InitialVoters []string `mapstructure:"initial_voters"`
ListenAddr string `mapstructure:"listen_addr"`
QUICPort uint16 `mapstructure:"quic_port"`
SnapshotIntervalSec uint64 `mapstructure:"snapshot_interval_sec"`
SnapshotTriggerCount uint64 `mapstructure:"snapshot_trigger_count"`
WALFlushThreshold int `mapstructure:"wal_flush_threshold"`
CertPath string `mapstructure:"cert_path"`
KeyPath string `mapstructure:"key_path"`
CACertPath string `mapstructure:"ca_path"`
DLQMaxSizeBytes int64 `mapstructure:"dlq_max_size_bytes"`
RaftTickMs int `mapstructure:"raft_tick_ms"`
RaftHeartbeatTick int `mapstructure:"raft_heartbeat_tick"`
RaftElectionTick int `mapstructure:"raft_election_tick"`
// Discovery configuration
DiscoveryKind string `mapstructure:"discovery_kind"`
DiscoveryYMLPath string `mapstructure:"discovery_yml_path"` // Required for DiscoveryKindStatic
DiscoveryHTTPHost string `mapstructure:"discovery_http_host"` // Required for DiscoveryKindHttp
}
ClusterConfig - matches what NewClusterAgent expects
type ClusterMetrics ¶
type ClusterMetrics struct {
// contains filtered or unexported fields
}
ClusterMetrics caches metric references for cluster-level operations
func GetClusterMetrics ¶
func GetClusterMetrics() *ClusterMetrics
GetClusterMetrics returns the singleton ClusterMetrics instance
func (*ClusterMetrics) AddBytesReceived ¶
func (m *ClusterMetrics) AddBytesReceived(bytes uint64)
func (*ClusterMetrics) AddBytesSent ¶
func (m *ClusterMetrics) AddBytesSent(bytes uint64)
func (*ClusterMetrics) ConnectionAccepted ¶
func (m *ClusterMetrics) ConnectionAccepted()
func (*ClusterMetrics) ConnectionDropped ¶
func (m *ClusterMetrics) ConnectionDropped()
func (*ClusterMetrics) ConnectionError ¶
func (m *ClusterMetrics) ConnectionError()
func (*ClusterMetrics) ConnectionOpened ¶
func (m *ClusterMetrics) ConnectionOpened()
Connection methods
func (*ClusterMetrics) ConnectionRejected ¶
func (m *ClusterMetrics) ConnectionRejected()
func (*ClusterMetrics) MessageReceived ¶
func (m *ClusterMetrics) MessageReceived()
func (*ClusterMetrics) MessageSent ¶
func (m *ClusterMetrics) MessageSent()
Request/Response methods
func (*ClusterMetrics) ReceiveError ¶
func (m *ClusterMetrics) ReceiveError()
func (*ClusterMetrics) SendError ¶
func (m *ClusterMetrics) SendError()
func (*ClusterMetrics) SetLastAppliedWalIndex ¶
func (m *ClusterMetrics) SetLastAppliedWalIndex(index uint64)
type Config ¶
type Config struct {
NodeID string `mapstructure:"node_id"`
DataDir string `mapstructure:"data_dir"`
Cluster ClusterConfig `mapstructure:"cluster"`
Proxy ProxyConfig `mapstructure:"proxy"`
WAL WALConfig `mapstructure:"wal"`
Partition PartitionConfig `mapstructure:"partition"`
Logging LoggingConfig `mapstructure:"logging"`
ApiConfig ApiConfig `mapstructure:"api"`
}
Config is the single source of truth for the whole application
func LoadConfig ¶
LoadConfig loads configuration from file, env vars, and flags
func (*Config) GetClusterAddr ¶
GetClusterAddr returns the full cluster listen address
func (*Config) GetProxyAddr ¶
GetProxyAddr returns the full proxy listen address
type DiscoveryKind ¶ added in v0.3.0
type DiscoveryKind uint8
const ( DiscoveryKindStatic DiscoveryKind = iota DiscoveryKindHttp )
func ParseDiscoveryKind ¶ added in v0.3.0
func ParseDiscoveryKind(s string) (DiscoveryKind, error)
ParseDiscoveryKind converts a string to DiscoveryKind
func (DiscoveryKind) String ¶ added in v0.3.0
func (d DiscoveryKind) String() string
String returns the string representation of DiscoveryKind
type GatewayMetrics ¶
type GatewayMetrics struct {
// contains filtered or unexported fields
}
GatewayMetrics - Only production-realistic failure modes
func GetGatewayMetrics ¶
func GetGatewayMetrics() *GatewayMetrics
func (*GatewayMetrics) ConnectionClosed ¶
func (m *GatewayMetrics) ConnectionClosed()
func (*GatewayMetrics) ConnectionFailed ¶
func (m *GatewayMetrics) ConnectionFailed()
func (*GatewayMetrics) ConnectionOpened ¶
func (m *GatewayMetrics) ConnectionOpened()
func (*GatewayMetrics) MessageReceived ¶
func (m *GatewayMetrics) MessageReceived()
func (*GatewayMetrics) MessageSent ¶
func (m *GatewayMetrics) MessageSent()
func (*GatewayMetrics) NetworkError ¶
func (m *GatewayMetrics) NetworkError()
func (*GatewayMetrics) ProxyDisconnected ¶
func (m *GatewayMetrics) ProxyDisconnected()
type LoggingConfig ¶
type PartitionConfig ¶
type PartitionConfig struct {
ActiveQueueCapacity int `mapstructure:"active_queue_capacity"`
MaxRetries int `mapstructure:"max_retries"`
MaxBackoffSec int64 `mapstructure:"max_backoff_sec"`
DispatchBatchSize int `mapstructure:"dispatch_batch_size"`
DLQMaxBytes int64 `mapstructure:"dlq_max_bytes"`
DLQMaxAgeMs int64 `mapstructure:"dlq_max_age_ms"`
PartitionTickMs int `mapstructure:"-"`
ProxyCleanupTickSec int `mapstructure:"-"`
HeartbeatTickMs int `mapstructure:"-"`
}
PartitionConfig
type PartitionMetrics ¶
type PartitionMetrics struct {
// contains filtered or unexported fields
}
============================================================================= Partition Metrics ============================================================================= PartitionMetrics - SINGLETON shared across all partitions
func GetPartitionMetrics ¶
func GetPartitionMetrics() *PartitionMetrics
func (*PartitionMetrics) JobAdded ¶
func (m *PartitionMetrics) JobAdded(topic string, n uint64)
Methods now take topic as parameter
func (*PartitionMetrics) JobCompleted ¶
func (m *PartitionMetrics) JobCompleted(topic string, n uint64)
func (*PartitionMetrics) JobDLQ ¶
func (m *PartitionMetrics) JobDLQ(topic string, n uint64)
func (*PartitionMetrics) JobRetried ¶
func (m *PartitionMetrics) JobRetried(topic string, n uint64)
func (*PartitionMetrics) RemoveTopic ¶
func (m *PartitionMetrics) RemoveTopic(topic string)
cleanup when topic is removed
func (*PartitionMetrics) SetActiveDepth ¶
func (m *PartitionMetrics) SetActiveDepth(topic string, v uint32)
type ProxyConfig ¶
type ProxyConfig struct {
Addr string `mapstructure:"addr"`
Port int `mapstructure:"port"`
CertPath string `mapstructure:"cert_path"`
KeyPath string `mapstructure:"key_path"`
CAPath string `mapstructure:"ca_path"`
}
ProxyConfig for proxy connections
type TopicManagerMetrics ¶
type TopicManagerMetrics struct {
// contains filtered or unexported fields
}
TopicManagerMetrics - tracks topic lifecycle only
func GetTopicManagerMetrics ¶
func GetTopicManagerMetrics() *TopicManagerMetrics
func (*TopicManagerMetrics) SetActiveTopics ¶
func (m *TopicManagerMetrics) SetActiveTopics(count int)
func (*TopicManagerMetrics) TopicRemoved ¶
func (m *TopicManagerMetrics) TopicRemoved()