Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyKey = fmt.Errorf("key is empty")
ErrEmptyKey is an error that is returned when the key is empty.
var ErrNoMessages = fmt.Errorf("topic has no messages")
ErrNoMessages is returned by Current when the topic has no messages yet.
Functions ¶
This section is empty.
Types ¶
type ChainTransport ¶ added in v1.1.0
type ChainTransport struct {
// contains filtered or unexported fields
}
ChainTransport aggregates multiple transports and merges their results. Transports later in the chain override values from earlier transports.
func NewChainTransport ¶ added in v1.1.0
func NewChainTransport(encoder sbc.Encoder, transports ...sbc.Transport) *ChainTransport
NewChainTransport creates a new ChainTransport.
type ConsulTransport ¶
type ConsulTransport struct {
// contains filtered or unexported fields
}
ConsulTransport represents a transport mechanism for accessing and manipulating data stored in Consul Key-Value store.
func NewConsulTransport ¶
func NewConsulTransport(kv *capi.KV, opts ...ConsulTransportOpt) *ConsulTransport
NewConsulTransport creates a new ConsulTransport.
type ConsulTransportOpt ¶
type ConsulTransportOpt func(*ConsulTransport)
ConsulTransportOpt is a function type that modifies the properties of a ConsulTransport. It accepts a pointer to a ConsulTransport instance and updates its properties. TODO: add Consul enterprise options, like Namespace, Partition, etc. usefully options.
func WithUpdateInterval ¶
func WithUpdateInterval(interval time.Duration) ConsulTransportOpt
WithUpdateInterval is a ConsulTransportOpt function that sets the update interval for ConsulTransport. It ensures that the update interval is at least 100 milliseconds. It accepts a duration parameter and updates the ConsulTransport's update interval.
func WithUpdateJitter ¶ added in v1.0.1
func WithUpdateJitter(jitter time.Duration) ConsulTransportOpt
WithUpdateJitter is a ConsulTransportOpt function that sets the update jitter for ConsulTransport. It accepts a duration parameter and updates the ConsulTransport's update jitter.
type DemoTransport ¶
type DemoTransport struct {
// contains filtered or unexported fields
}
func NewDemoTransport ¶
func NewDemoTransport(payload []byte, interval time.Duration) *DemoTransport
type FixedTransport ¶ added in v1.0.2
type FixedTransport struct {
// contains filtered or unexported fields
}
FixedTransport is transport that returns a predefined payload for data retrieval operations.
func NewFixedTransport ¶ added in v1.0.2
func NewFixedTransport(payload []byte) *FixedTransport
NewFixedTransport creates a FixedTransport instance with a predefined payload for retrieval operations.
type KafkaTransport ¶ added in v1.2.0
type KafkaTransport struct {
// contains filtered or unexported fields
}
KafkaTransport is a transport that reads configuration from a Kafka topic. The key argument passed to Current and Updates is used as the Kafka topic name.
func NewKafkaTransport ¶ added in v1.2.0
func NewKafkaTransport(brokers []string, opts ...KafkaTransportOpt) (*KafkaTransport, error)
NewKafkaTransport creates a KafkaTransport connecting to the given brokers.
func (*KafkaTransport) Current ¶ added in v1.2.0
Current retrieves the latest message value for the given topic (key). It fetches the newest offset and reads the message at that offset.
func (*KafkaTransport) Updates ¶ added in v1.2.0
Updates returns a channel that streams new messages from the given topic (key) using a Kafka consumer group. The channel is closed when the context is cancelled. If the consumer group session ends and the context is still active it reconnects automatically.
type KafkaTransportOpt ¶ added in v1.2.0
type KafkaTransportOpt func(*KafkaTransport)
KafkaTransportOpt is a functional option for KafkaTransport.
func WithKafkaGroupID ¶ added in v1.2.0
func WithKafkaGroupID(groupID string) KafkaTransportOpt
WithKafkaGroupID sets the consumer group ID used by Updates. Default is "streaming-based-config".
func WithKafkaPartition ¶ added in v1.2.0
func WithKafkaPartition(partition int32) KafkaTransportOpt
WithKafkaPartition sets the partition used by Current to fetch the latest message. Default is 0.
type NatsTransport ¶
type NatsTransport struct {
// contains filtered or unexported fields
}
NatsTransport represents a transport mechanism for accessing and manipulating data stored in NATS Key-Value store.
func NewNatsTransport ¶
func NewNatsTransport(kv jetstream.KeyValue) *NatsTransport
NewNatsTransport creates a new NatsTransport.
type NothingTransport ¶
type NothingTransport struct{}
NothingTransport represents a type that doesn't actually perform any transportation. It is a struct with no fields and implements the Current and Updates methods of the transport interface. Both methods return empty results or nil.
func NewNothingTransport ¶
func NewNothingTransport() *NothingTransport
NewNothingTransport creates a new NothingTransport.