Documentation
¶
Index ¶
- type Subscriber
- type SubscriberBase
- func (sb *SubscriberBase) ActiveSignalIndexCache() *SignalIndexCache
- func (sb *SubscriberBase) ConfigurationChanged()
- func (sb *SubscriberBase) Connect()
- func (sb *SubscriberBase) ConnectionEstablished()
- func (sb *SubscriberBase) ConnectionTerminated()
- func (sb *SubscriberBase) DataStartTime(startTime time.Time)
- func (sb *SubscriberBase) Disconnect()
- func (sb *SubscriberBase) Dispose()
- func (sb *SubscriberBase) ErrorMessage(message string)
- func (sb *SubscriberBase) HistoricalReadComplete()
- func (sb *SubscriberBase) ReceivedMetadata(metadata []byte)
- func (sb *SubscriberBase) ReceivedNewBufferBlocks(bufferBlocks []BufferBlock)
- func (sb *SubscriberBase) ReceivedNewMeasurements(measurements []Measurement)
- func (sb *SubscriberBase) ReceivedNotification(notification string)
- func (sb *SubscriberBase) StatusMessage(message string)
- func (sb *SubscriberBase) SubscriberID() guid.Guid
- func (sb *SubscriberBase) Subscription() *SubscriptionInfo
- func (sb *SubscriberBase) SubscriptionUpdated(signalIndexCache *SignalIndexCache)
- func (sb *SubscriberBase) TotalCommandChannelBytesReceived() uint64
- func (sb *SubscriberBase) TotalDataChannelBytesReceived() uint64
- func (sb *SubscriberBase) TotalMeasurementsReceived() uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Subscriber ¶
type Subscriber interface {
// StatusMessage handles informational message logging.
StatusMessage(message string)
// ErrorMessage handles error message logging.
ErrorMessage(message string)
// ReceivedMetadata handles reception of the metadata response.
ReceivedMetadata(metadata []byte)
// SubscriptionUpdated handles notifications that a new SignalIndexCache has been received.
SubscriptionUpdated(signalIndexCache *SignalIndexCache)
// DataStartTime handles notifications of first received measurement.
DataStartTime(startTime time.Time)
// ConfigurationChanged handles notifications that the publisher configuration has changed.
ConfigurationChanged()
// ReceivedNewMeasurements handles reception of new measurements.
ReceivedNewMeasurements(measurements []Measurement)
// ReceivedNewBufferBlocks handles reception of new buffer blocks.
ReceivedNewBufferBlocks(bufferBlocks []BufferBlock)
// ReceivedNotification handles reception of a notification.
ReceivedNotification(notification string)
// HistoricalReadComplete handles notification that temporal processing has completed,
// i.e., the end of a historical playback data stream has been reached.
HistoricalReadComplete()
// ConnectionEstablished handles notification that a connection has been established.
ConnectionEstablished()
// ConnectionTerminated handles notification that a connection has been terminated.
ConnectionTerminated()
}
Subscriber defines the primary functionality of an STTP data subscription.
type SubscriberBase ¶
type SubscriberBase struct {
// Hostname is the DataPublisher DNS name or IP.
Hostname string
// Port it the TCP/IP listening port of the DataPublisher.
Port uint16
// MaxRetries defines the maximum number of times to retry a connection.
// Set value to -1 to retry infinitely.
MaxRetries int32
// RetryInterval defines the base retry interval, in milliseconds. Retries will
// exponentially back-off starting from this interval.
RetryInterval int32
// MaxRetryInterval defines the maximum retry interval, in milliseconds.
MaxRetryInterval int32
// AutoReconnect defines flag that determines if connections should be
// automatically reattempted.
AutoReconnect bool
// AutoParseMetadata defines the flag that determines if metadata should be
// automatically parsed. When true, metadata will be requested upon connection
// before subscription; otherwise, metadata will not be manually requested and
// subscribe will happen upon connection.
AutoParseMetadata bool
// CompressPayloadData determines whether payload data is compressed.
CompressPayloadData bool
// CompressMetadata determines whether the metadata transfer is compressed.
CompressMetadata bool
// CompressSignalIndexCache determines whether the signal index cache is compressed.
CompressSignalIndexCache bool
// MetadataFilters defines any filters to be applied to incoming metadata to reduce total
// received metadata. Each filter expression should be separated by semi-colons.
MetadataFilters string
// contains filtered or unexported fields
}
SubscriberBase provides the default functionality for a Subscriber implementation.
func NewSubscriberBase ¶
func NewSubscriberBase(subscriber Subscriber) SubscriberBase
NewSubscriberBase creates a new SubscriberBase with specified Subscriber.
func (*SubscriberBase) ActiveSignalIndexCache ¶
func (sb *SubscriberBase) ActiveSignalIndexCache() *SignalIndexCache
GetSignalIndexCache gets the active signal index cache.
func (*SubscriberBase) ConfigurationChanged ¶
func (sb *SubscriberBase) ConfigurationChanged()
ConfigurationChanged implements the default handler for notifications that the publisher configuration has changed.
func (*SubscriberBase) Connect ¶
func (sb *SubscriberBase) Connect()
Connect starts the connection cycle to an STTP publisher. Upon connection, meta-data will be requested, when received, a subscription will be established.
func (*SubscriberBase) ConnectionEstablished ¶
func (sb *SubscriberBase) ConnectionEstablished()
ConnectionEstablished implements the default handler for notification that a connection has been established.
func (*SubscriberBase) ConnectionTerminated ¶
func (sb *SubscriberBase) ConnectionTerminated()
ConnectionTerminated implements the default handler for notification that a connection has been terminated.
func (*SubscriberBase) DataStartTime ¶
func (sb *SubscriberBase) DataStartTime(startTime time.Time)
DataStartTime implements the default handler for notifications of first received measurement.
func (*SubscriberBase) Disconnect ¶
func (sb *SubscriberBase) Disconnect()
Disconnect disconnects from an STTP publisher.
func (*SubscriberBase) Dispose ¶
func (sb *SubscriberBase) Dispose()
Dispose cleanly shuts down a DataSubscriber that is no longer being used, e.g., during a normal application exit.
func (*SubscriberBase) ErrorMessage ¶
func (sb *SubscriberBase) ErrorMessage(message string)
ErrorMessage implements the default handler for error message logging. Default implementation simply writes to stderr. Logging is recommended.
func (*SubscriberBase) HistoricalReadComplete ¶
func (sb *SubscriberBase) HistoricalReadComplete()
HistoricalReadComplete implements the default handler for notification that temporal processing has completed, i.e., the end of a historical playback data stream has been reached.
func (*SubscriberBase) ReceivedMetadata ¶
func (sb *SubscriberBase) ReceivedMetadata(metadata []byte)
ReceivedMetadata implements the default handler for reception of the metadata response.
func (*SubscriberBase) ReceivedNewBufferBlocks ¶
func (sb *SubscriberBase) ReceivedNewBufferBlocks(bufferBlocks []BufferBlock)
ReceivedNewBufferBlocks implements the default handler for reception of new buffer blocks.
func (*SubscriberBase) ReceivedNewMeasurements ¶
func (sb *SubscriberBase) ReceivedNewMeasurements(measurements []Measurement)
ReceivedNewMeasurements implements the default handler for reception of new measurements.
func (*SubscriberBase) ReceivedNotification ¶
func (sb *SubscriberBase) ReceivedNotification(notification string)
ReceivedNotification implements the default handler for reception of a notification.
func (*SubscriberBase) StatusMessage ¶
func (sb *SubscriberBase) StatusMessage(message string)
StatusMessage implements the default handler for informational message logging. Default implementation simply writes to stdio. Logging is recommended.
func (*SubscriberBase) SubscriberID ¶
func (sb *SubscriberBase) SubscriberID() guid.Guid
SubscriberID gets the subscriber ID as assigned by the DataPublisher upon receipt of the SignalIndexCache.
func (*SubscriberBase) Subscription ¶
func (sb *SubscriberBase) Subscription() *SubscriptionInfo
Subscription gets subscription related settings.
func (*SubscriberBase) SubscriptionUpdated ¶
func (sb *SubscriberBase) SubscriptionUpdated(signalIndexCache *SignalIndexCache)
SubscriptionUpdated implements the default handler for notifications that a new SignalIndexCache has been received.
func (*SubscriberBase) TotalCommandChannelBytesReceived ¶
func (sb *SubscriberBase) TotalCommandChannelBytesReceived() uint64
TotalCommandChannelBytesReceived gets the total number of bytes received via the command channel since last connection.
func (*SubscriberBase) TotalDataChannelBytesReceived ¶
func (sb *SubscriberBase) TotalDataChannelBytesReceived() uint64
TotalDataChannelBytesReceived gets the total number of bytes received via the data channel since last connection.
func (*SubscriberBase) TotalMeasurementsReceived ¶
func (sb *SubscriberBase) TotalMeasurementsReceived() uint64
TotalMeasurementsReceived gets the total number of measurements received since last subscription.