Documentation
¶
Index ¶
- Constants
- func SetLogger(l *slog.Logger)
- type AccessRights
- type ArrayValue
- func (a *ArrayValue[T]) AsBytes() []byte
- func (a *ArrayValue[T]) AsFloat() float64
- func (a *ArrayValue[T]) AsInt() int64
- func (a *ArrayValue[T]) AsString() string
- func (a *ArrayValue[T]) Count() int
- func (a *ArrayValue[T]) HasControl() bool
- func (a *ArrayValue[T]) HasGraphics() bool
- func (a *ArrayValue[T]) HasStatus() bool
- func (a *ArrayValue[T]) HasTime() bool
- func (a *ArrayValue[T]) Index(i int) Value
- func (a *ArrayValue[T]) IsArray() bool
- func (a *ArrayValue[T]) Metadata() ValueMetadata
- func (a *ArrayValue[T]) Slice() interface{}
- func (a *ArrayValue[T]) Type() DataType
- type BeaconEvent
- type ChannelInfo
- type Client
- func (c *Client) Close() error
- func (c *Client) CloseChannel(ctx context.Context, name string) error
- func (c *Client) Connect(ctx context.Context, names ...string) error
- func (c *Client) Get(ctx context.Context, name string, opts ...Option) (Value, error)
- func (c *Client) Info(ctx context.Context, name string) (*ChannelInfo, error)
- func (c *Client) Put(ctx context.Context, name string, v Value) error
- func (c *Client) PutNotify(ctx context.Context, name string, v Value) error
- func (c *Client) Subscribe(ctx context.Context, name string, opts ...Option) (<-chan Event, Subscription, error)
- type ClientMetrics
- type Conn
- func (c *Conn) Addr() string
- func (c *Conn) Attach(ctx context.Context, pv string) (uint32, error)
- func (c *Conn) ChannelInfo(cid uint32) (DataType, uint32, AccessRights, bool)
- func (c *Conn) Close()
- func (c *Conn) Detach(ctx context.Context, pv string) error
- func (c *Conn) Events() <-chan ConnEvent
- func (c *Conn) Get(ctx context.Context, pv string, cid uint32, dt DataType) (Value, error)
- func (c *Conn) Options() Options
- func (c *Conn) Put(ctx context.Context, pv string, cid uint32, v Value) error
- func (c *Conn) PutNotify(ctx context.Context, pv string, cid uint32, v Value) error
- func (c *Conn) Subscribe(ctx context.Context, cid uint32, dt DataType, cb func(Value)) (uint32, error)
- func (c *Conn) Unsubscribe(ctx context.Context, cid, subID uint32, dt DataType) error
- type ConnEvent
- type ConnEventType
- type ConnectionState
- type DataType
- type EnumValue
- func (v *EnumValue) AsBytes() []byte
- func (v *EnumValue) AsFloat() float64
- func (v *EnumValue) AsInt() int64
- func (v *EnumValue) AsString() string
- func (v *EnumValue) Count() int
- func (v *EnumValue) HasControl() bool
- func (v *EnumValue) HasGraphics() bool
- func (v *EnumValue) HasStatus() bool
- func (v *EnumValue) HasTime() bool
- func (v *EnumValue) Index(i int) Value
- func (v *EnumValue) IsArray() bool
- func (v *EnumValue) Metadata() ValueMetadata
- func (v *EnumValue) Slice() interface{}
- func (v *EnumValue) Type() DataType
- func (v *EnumValue) Values() []int64
- type Event
- type FloatValue
- func (v *FloatValue) AsBytes() []byte
- func (v *FloatValue) AsFloat() float64
- func (v *FloatValue) AsInt() int64
- func (v *FloatValue) AsString() string
- func (v *FloatValue) Count() int
- func (v *FloatValue) HasControl() bool
- func (v *FloatValue) HasGraphics() bool
- func (v *FloatValue) HasStatus() bool
- func (v *FloatValue) HasTime() bool
- func (v *FloatValue) Index(i int) Value
- func (v *FloatValue) IsArray() bool
- func (v *FloatValue) Metadata() ValueMetadata
- func (v *FloatValue) Slice() interface{}
- func (v *FloatValue) Type() DataType
- func (v *FloatValue) Values() []float64
- type Future
- type FutureStore
- type IntValue
- func (v *IntValue) AsBytes() []byte
- func (v *IntValue) AsFloat() float64
- func (v *IntValue) AsInt() int64
- func (v *IntValue) AsString() string
- func (v *IntValue) Count() int
- func (v *IntValue) HasControl() bool
- func (v *IntValue) HasGraphics() bool
- func (v *IntValue) HasStatus() bool
- func (v *IntValue) HasTime() bool
- func (v *IntValue) Index(i int) Value
- func (v *IntValue) IsArray() bool
- func (v *IntValue) Metadata() ValueMetadata
- func (v *IntValue) Slice() interface{}
- func (v *IntValue) String() string
- func (v *IntValue) Type() DataType
- func (v *IntValue) Values() []int64
- type MetadataLevel
- type Numeric
- type Option
- type Options
- type RawValue
- type Repeater
- type SearchResult
- type Searcher
- type StringValue
- func (v *StringValue) AsBytes() []byte
- func (v *StringValue) AsFloat() float64
- func (v *StringValue) AsInt() int64
- func (v *StringValue) AsString() string
- func (v *StringValue) Count() int
- func (v *StringValue) HasControl() bool
- func (v *StringValue) HasGraphics() bool
- func (v *StringValue) HasStatus() bool
- func (v *StringValue) HasTime() bool
- func (v *StringValue) Index(i int) Value
- func (v *StringValue) IsArray() bool
- func (v *StringValue) Metadata() ValueMetadata
- func (v *StringValue) Slice() interface{}
- func (v *StringValue) Type() DataType
- func (v *StringValue) Values() []string
- type Subscription
- type Value
- func NewArray[T Numeric](dataType DataType, vals []T) Value
- func NewFloatArray(vals []float64) Value
- func NewFloatValue(val float64) Value
- func NewIntArray(vals []int64) Value
- func NewIntValue(val int64) Value
- func NewStringArray(vals []string) Value
- func NewStringValue(val string) Value
- func NewValueWithMetadata[T comparable](val T, metadata ValueMetadata) Value
- func ParseValue(dataType DataType, dataCount uint32, data []byte) (Value, error)
- type ValueMetadata
Constants ¶
View Source
const ( StringSize = 40 IntSize = 2 EnumSize = 2 FloatSize = 4 CharSize = 1 LongSize = 4 DoubleSize = 8 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessRights ¶
type AccessRights uint32
const ( AccessNone AccessRights = 0 AccessRead AccessRights = 1 << 0 AccessWrite AccessRights = 1 << 1 )
type ArrayValue ¶
type ArrayValue[T Numeric] struct { // contains filtered or unexported fields }
func (*ArrayValue[T]) AsBytes ¶
func (a *ArrayValue[T]) AsBytes() []byte
func (*ArrayValue[T]) AsFloat ¶
func (a *ArrayValue[T]) AsFloat() float64
func (*ArrayValue[T]) AsInt ¶
func (a *ArrayValue[T]) AsInt() int64
func (*ArrayValue[T]) AsString ¶
func (a *ArrayValue[T]) AsString() string
func (*ArrayValue[T]) Count ¶
func (a *ArrayValue[T]) Count() int
func (*ArrayValue[T]) HasControl ¶
func (a *ArrayValue[T]) HasControl() bool
func (*ArrayValue[T]) HasGraphics ¶
func (a *ArrayValue[T]) HasGraphics() bool
func (*ArrayValue[T]) HasStatus ¶
func (a *ArrayValue[T]) HasStatus() bool
func (*ArrayValue[T]) HasTime ¶
func (a *ArrayValue[T]) HasTime() bool
func (*ArrayValue[T]) Index ¶
func (a *ArrayValue[T]) Index(i int) Value
func (*ArrayValue[T]) IsArray ¶
func (a *ArrayValue[T]) IsArray() bool
func (*ArrayValue[T]) Metadata ¶
func (a *ArrayValue[T]) Metadata() ValueMetadata
func (*ArrayValue[T]) Slice ¶
func (a *ArrayValue[T]) Slice() interface{}
func (*ArrayValue[T]) Type ¶
func (a *ArrayValue[T]) Type() DataType
type ChannelInfo ¶
type ChannelInfo struct {
Name string
State ConnectionState
Host string
Access AccessRights
NativeType DataType
ElementCount uint32
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type ClientMetrics ¶
type ClientMetrics struct {
SearchResults atomic.Uint64
AttachQueued atomic.Uint64
AttachInFlight atomic.Uint64
AttachFailures atomic.Uint64
Connections atomic.Uint64
}
ClientMetrics holds optional counters tracking high-level client activity. Attach this to Options.Metrics before creating a client to enable updates.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) ChannelInfo ¶
type ConnectionState ¶
type ConnectionState int
const ( ConnConnected ConnectionState = iota ConnDisconnected ConnReconnecting )
type DataType ¶
type DataType uint16
const ( TypeString DataType = iota TypeInt TypeFloat TypeEnum TypeChar TypeLong TypeDouble TypeStsString TypeStsInt TypeStsFloat TypeStsEnum TypeStsChar TypeStsLong TypeStsDouble TypeTimeString TypeTimeInt TypeTimeFloat TypeTimeEnum TypeTimeChar TypeTimeLong TypeTimeDouble TypeGrString TypeGrInt TypeGrFloat TypeGrEnum TypeGrChar TypeGrLong TypeGrDouble TypeCtrlString TypeCtrlInt TypeCtrlFloat TypeCtrlEnum TypeCtrlChar TypeCtrlLong TypeCtrlDouble TypeAuto DataType = 0xFFFF )
func (DataType) ElementSize ¶
type EnumValue ¶
type EnumValue struct {
// contains filtered or unexported fields
}
func (*EnumValue) HasControl ¶
func (*EnumValue) HasGraphics ¶
func (*EnumValue) Metadata ¶
func (v *EnumValue) Metadata() ValueMetadata
type Event ¶
type Event struct {
PV string
Value Value
ConnectionState ConnectionState
Timestamp time.Time
Error error
}
Event ties a value to connection state changes.
type FloatValue ¶
type FloatValue struct {
// contains filtered or unexported fields
}
func (*FloatValue) AsBytes ¶
func (v *FloatValue) AsBytes() []byte
func (*FloatValue) AsFloat ¶
func (v *FloatValue) AsFloat() float64
func (*FloatValue) AsInt ¶
func (v *FloatValue) AsInt() int64
func (*FloatValue) AsString ¶
func (v *FloatValue) AsString() string
func (*FloatValue) Count ¶
func (v *FloatValue) Count() int
func (*FloatValue) HasControl ¶
func (v *FloatValue) HasControl() bool
func (*FloatValue) HasGraphics ¶
func (v *FloatValue) HasGraphics() bool
func (*FloatValue) HasStatus ¶
func (v *FloatValue) HasStatus() bool
func (*FloatValue) HasTime ¶
func (v *FloatValue) HasTime() bool
func (*FloatValue) Index ¶
func (v *FloatValue) Index(i int) Value
func (*FloatValue) IsArray ¶
func (v *FloatValue) IsArray() bool
func (*FloatValue) Metadata ¶
func (v *FloatValue) Metadata() ValueMetadata
func (*FloatValue) Slice ¶
func (v *FloatValue) Slice() interface{}
func (*FloatValue) Type ¶
func (v *FloatValue) Type() DataType
func (*FloatValue) Values ¶
func (v *FloatValue) Values() []float64
type FutureStore ¶
type FutureStore[K comparable, T any] struct { // contains filtered or unexported fields }
type IntValue ¶
type IntValue struct {
// contains filtered or unexported fields
}
func (*IntValue) HasControl ¶
func (*IntValue) HasGraphics ¶
func (*IntValue) Metadata ¶
func (v *IntValue) Metadata() ValueMetadata
type MetadataLevel ¶
type MetadataLevel int
const ( MetadataNone MetadataLevel = iota MetadataStatus MetadataTime MetadataGraphics MetadataControl )
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
var ( WithStatus Option = optionFunc(func(cfg *requestConfig) { cfg.metadata = MetadataStatus }) WithTime Option = optionFunc(func(cfg *requestConfig) { cfg.metadata = MetadataTime }) WithGraphics Option = optionFunc(func(cfg *requestConfig) { cfg.metadata = MetadataGraphics }) WithControl Option = optionFunc(func(cfg *requestConfig) { cfg.metadata = MetadataControl }) )
func WithBufferSize ¶
func WithDataType ¶
func WithEventHandler ¶
type Options ¶
type Options struct {
SearchAddresses []string
ServerPort int
RepeaterPort int
ContextTimeout time.Duration
BeaconPeriod time.Duration
MaxArrayBytes int
ClientName string
HostName string
SearchMTU int
EventBufferSize int
EventQueueSize int
EventWorkers int
ResultQueueSize int
ResultWorkers int
AttachQueueSize int
MaxAttachPerConn int
Metrics *ClientMetrics
}
type RawValue ¶
type RawValue struct {
// contains filtered or unexported fields
}
func (*RawValue) PayloadSize ¶
type Repeater ¶
type Repeater struct {
// contains filtered or unexported fields
}
func NewRepeater ¶
type SearchResult ¶
type Searcher ¶
type Searcher struct {
// contains filtered or unexported fields
}
func NewSearcher ¶
func (*Searcher) Beacons ¶
func (s *Searcher) Beacons() <-chan BeaconEvent
func (*Searcher) Results ¶
func (s *Searcher) Results() <-chan SearchResult
type StringValue ¶
type StringValue struct {
// contains filtered or unexported fields
}
func (*StringValue) AsBytes ¶
func (v *StringValue) AsBytes() []byte
func (*StringValue) AsFloat ¶
func (v *StringValue) AsFloat() float64
func (*StringValue) AsInt ¶
func (v *StringValue) AsInt() int64
func (*StringValue) AsString ¶
func (v *StringValue) AsString() string
func (*StringValue) Count ¶
func (v *StringValue) Count() int
func (*StringValue) HasControl ¶
func (v *StringValue) HasControl() bool
func (*StringValue) HasGraphics ¶
func (v *StringValue) HasGraphics() bool
func (*StringValue) HasStatus ¶
func (v *StringValue) HasStatus() bool
func (*StringValue) HasTime ¶
func (v *StringValue) HasTime() bool
func (*StringValue) Index ¶
func (v *StringValue) Index(i int) Value
func (*StringValue) IsArray ¶
func (v *StringValue) IsArray() bool
func (*StringValue) Metadata ¶
func (v *StringValue) Metadata() ValueMetadata
func (*StringValue) Slice ¶
func (v *StringValue) Slice() interface{}
func (*StringValue) Type ¶
func (v *StringValue) Type() DataType
func (*StringValue) Values ¶
func (v *StringValue) Values() []string
type Subscription ¶
type Subscription interface {
Cancel() error
}
Subscription represents an active monitor subscription.
type Value ¶
type Value interface {
Type() DataType
Count() int
AsInt() int64
AsFloat() float64
AsString() string
AsBytes() []byte
IsArray() bool
HasStatus() bool
HasTime() bool
HasGraphics() bool
HasControl() bool
Metadata() ValueMetadata
Index(i int) Value
Slice() interface{}
}
func NewFloatArray ¶
func NewFloatValue ¶
func NewIntArray ¶
func NewIntValue ¶
func NewStringArray ¶
func NewStringValue ¶
func NewValueWithMetadata ¶
func NewValueWithMetadata[T comparable](val T, metadata ValueMetadata) Value
type ValueMetadata ¶
type ValueMetadata struct {
Status uint16
Severity uint16
Timestamp time.Time
Units string
DisplayLow float64
DisplayHigh float64
AlarmLow float64
AlarmHigh float64
WarningLow float64
WarningHigh float64
ControlLow float64
ControlHigh float64
Precision int16
// contains filtered or unexported fields
}
func ExtractControl ¶
func ExtractControl(v *RawValue) (ValueMetadata, []byte, error)
func ExtractGraphics ¶
func ExtractGraphics(v *RawValue) (ValueMetadata, []byte, error)
func ExtractStatus ¶
func ExtractStatus(v *RawValue) (ValueMetadata, []byte, error)
func ExtractTime ¶
func ExtractTime(v *RawValue) (ValueMetadata, []byte, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.