Documentation
¶
Index ¶
- func RegisterDriver(name string, factory Factory)
- type ConnState
- type ConnectionManager
- func (cm *ConnectionManager) AttemptHalfOpen(success bool)
- func (cm *ConnectionManager) CanRetry() (canRetry bool, waitTime time.Duration)
- func (cm *ConnectionManager) Close()
- func (cm *ConnectionManager) GetState() ConnState
- func (cm *ConnectionManager) GetStatus() (state ConnState, retryCount int, maxRetries int, ...)
- func (cm *ConnectionManager) RecordFailure() (shouldRetry bool, backoff time.Duration)
- func (cm *ConnectionManager) RecordSuccess()
- func (cm *ConnectionManager) ResetDaily()
- func (cm *ConnectionManager) SetBackoffParams(base, max time.Duration, factor float64)
- func (cm *ConnectionManager) SetMaxFailCount(max int)
- func (cm *ConnectionManager) SetMaxRetries(max int)
- func (cm *ConnectionManager) SetState(state ConnState)
- type Driver
- type Factory
- type HealthStatus
- type ObjectScanner
- type Scanner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterDriver ¶
RegisterDriver registers a driver factory for a given protocol name
Types ¶
type ConnectionManager ¶
type ConnectionManager struct {
// contains filtered or unexported fields
}
func NewConnectionManager ¶
func NewConnectionManager(driverName string) *ConnectionManager
func (*ConnectionManager) AttemptHalfOpen ¶
func (cm *ConnectionManager) AttemptHalfOpen(success bool)
func (*ConnectionManager) CanRetry ¶
func (cm *ConnectionManager) CanRetry() (canRetry bool, waitTime time.Duration)
func (*ConnectionManager) Close ¶
func (cm *ConnectionManager) Close()
func (*ConnectionManager) GetState ¶
func (cm *ConnectionManager) GetState() ConnState
func (*ConnectionManager) RecordFailure ¶
func (cm *ConnectionManager) RecordFailure() (shouldRetry bool, backoff time.Duration)
func (*ConnectionManager) RecordSuccess ¶
func (cm *ConnectionManager) RecordSuccess()
func (*ConnectionManager) ResetDaily ¶
func (cm *ConnectionManager) ResetDaily()
func (*ConnectionManager) SetBackoffParams ¶
func (cm *ConnectionManager) SetBackoffParams(base, max time.Duration, factor float64)
func (*ConnectionManager) SetMaxFailCount ¶
func (cm *ConnectionManager) SetMaxFailCount(max int)
func (*ConnectionManager) SetMaxRetries ¶
func (cm *ConnectionManager) SetMaxRetries(max int)
func (*ConnectionManager) SetState ¶
func (cm *ConnectionManager) SetState(state ConnState)
type Driver ¶
type Driver interface {
Init(cfg model.DriverConfig) error
Connect(ctx context.Context) error
Disconnect() error
ReadPoints(ctx context.Context, points []model.Point) (map[string]model.Value, error)
WritePoint(ctx context.Context, point model.Point, value any) error
Health() HealthStatus
// SetSlaveID sets the slave/unit ID for protocols that support multiple slaves (optional)
SetSlaveID(slaveID uint8) error
// SetDeviceConfig sets device specific configuration (optional, for protocols needing per-device connection info like BACnet IP)
SetDeviceConfig(config map[string]any) error
// GetConnectionMetrics returns transport-level connection metrics
GetConnectionMetrics() (connectionSeconds int64, reconnectCount int64, localAddr string, remoteAddr string, lastDisconnectTime time.Time)
}
Driver is the unified interface for all protocol drivers
type HealthStatus ¶
type HealthStatus int
HealthStatus represents the health of the driver connection
const ( HealthStatusUnknown HealthStatus = iota HealthStatusGood HealthStatusBad )
Click to show internal directories.
Click to hide internal directories.