target

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2019 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsConnErr

func IsConnErr(err error) bool

IsConnErr - To detect a connection error.

func IsConnRefusedErr

func IsConnRefusedErr(err error) bool

IsConnRefusedErr - To check fot "connection refused" error.

Types

type AMQPArgs

type AMQPArgs struct {
	Enable       bool     `json:"enable"`
	URL          xnet.URL `json:"url"`
	Exchange     string   `json:"exchange"`
	RoutingKey   string   `json:"routingKey"`
	ExchangeType string   `json:"exchangeType"`
	DeliveryMode uint8    `json:"deliveryMode"`
	Mandatory    bool     `json:"mandatory"`
	Immediate    bool     `json:"immediate"`
	Durable      bool     `json:"durable"`
	Internal     bool     `json:"internal"`
	NoWait       bool     `json:"noWait"`
	AutoDeleted  bool     `json:"autoDeleted"`
	QueueDir     string   `json:"queueDir"`
	QueueLimit   uint64   `json:"queueLimit"`
}

AMQPArgs - AMQP target arguments.

func (*AMQPArgs) Validate

func (a *AMQPArgs) Validate() error

Validate AMQP arguments

type AMQPTarget

type AMQPTarget struct {
	// contains filtered or unexported fields
}

AMQPTarget - AMQP target

func NewAMQPTarget

func NewAMQPTarget(id string, args AMQPArgs, doneCh <-chan struct{}) (*AMQPTarget, error)

NewAMQPTarget - creates new AMQP target.

func (*AMQPTarget) Close

func (target *AMQPTarget) Close() error

Close - does nothing and available for interface compatibility.

func (*AMQPTarget) ID

func (target *AMQPTarget) ID() event.TargetID

ID - returns TargetID.

func (*AMQPTarget) Save

func (target *AMQPTarget) Save(eventData event.Event) error

Save - saves the events to the store which will be replayed when the amqp connection is active.

func (*AMQPTarget) Send

func (target *AMQPTarget) Send(eventKey string) error

Send - sends event to AMQP.

type ElasticsearchArgs

type ElasticsearchArgs struct {
	Enable     bool     `json:"enable"`
	Format     string   `json:"format"`
	URL        xnet.URL `json:"url"`
	Index      string   `json:"index"`
	QueueDir   string   `json:"queueDir"`
	QueueLimit uint64   `json:"queueLimit"`
}

ElasticsearchArgs - Elasticsearch target arguments.

func (ElasticsearchArgs) Validate

func (a ElasticsearchArgs) Validate() error

Validate ElasticsearchArgs fields

type ElasticsearchTarget

type ElasticsearchTarget struct {
	// contains filtered or unexported fields
}

ElasticsearchTarget - Elasticsearch target.

func NewElasticsearchTarget

func NewElasticsearchTarget(id string, args ElasticsearchArgs, doneCh <-chan struct{}) (*ElasticsearchTarget, error)

NewElasticsearchTarget - creates new Elasticsearch target.

func (*ElasticsearchTarget) Close

func (target *ElasticsearchTarget) Close() error

Close - does nothing and available for interface compatibility.

func (*ElasticsearchTarget) ID

func (target *ElasticsearchTarget) ID() event.TargetID

ID - returns target ID.

func (*ElasticsearchTarget) Save

func (target *ElasticsearchTarget) Save(eventData event.Event) error

Save - saves the events to the store if queuestore is configured, which will be replayed when the elasticsearch connection is active.

func (*ElasticsearchTarget) Send

func (target *ElasticsearchTarget) Send(eventKey string) error

Send - reads an event from store and sends it to Elasticsearch.

type HTTPClientTarget

type HTTPClientTarget struct {
	DoneCh chan struct{}
	// contains filtered or unexported fields
}

HTTPClientTarget - HTTP client target.

func NewHTTPClientTarget

func NewHTTPClientTarget(host xnet.Host, w http.ResponseWriter) (*HTTPClientTarget, error)

NewHTTPClientTarget - creates new HTTP client target.

func (*HTTPClientTarget) Close

func (target *HTTPClientTarget) Close() error

Close - closes underneath goroutine.

func (HTTPClientTarget) ID

func (target HTTPClientTarget) ID() event.TargetID

ID - returns target ID.

func (*HTTPClientTarget) Save

func (target *HTTPClientTarget) Save(eventData event.Event) error

Save - sends event to HTTP client.

func (*HTTPClientTarget) Send

func (target *HTTPClientTarget) Send(eventKey string) error

Send - interface compatible method does no-op.

type KafkaArgs

type KafkaArgs struct {
	Enable     bool        `json:"enable"`
	Brokers    []xnet.Host `json:"brokers"`
	Topic      string      `json:"topic"`
	QueueDir   string      `json:"queueDir"`
	QueueLimit uint64      `json:"queueLimit"`
	TLS        struct {
		Enable     bool               `json:"enable"`
		SkipVerify bool               `json:"skipVerify"`
		ClientAuth tls.ClientAuthType `json:"clientAuth"`
	} `json:"tls"`
	SASL struct {
		Enable   bool   `json:"enable"`
		User     string `json:"username"`
		Password string `json:"password"`
	} `json:"sasl"`
}

KafkaArgs - Kafka target arguments.

func (KafkaArgs) Validate

func (k KafkaArgs) Validate() error

Validate KafkaArgs fields

type KafkaTarget

type KafkaTarget struct {
	// contains filtered or unexported fields
}

KafkaTarget - Kafka target.

func NewKafkaTarget

func NewKafkaTarget(id string, args KafkaArgs, doneCh <-chan struct{}) (*KafkaTarget, error)

NewKafkaTarget - creates new Kafka target with auth credentials.

func (*KafkaTarget) Close

func (target *KafkaTarget) Close() error

Close - closes underneath kafka connection.

func (*KafkaTarget) ID

func (target *KafkaTarget) ID() event.TargetID

ID - returns target ID.

func (*KafkaTarget) Save

func (target *KafkaTarget) Save(eventData event.Event) error

Save - saves the events to the store which will be replayed when the Kafka connection is active.

func (*KafkaTarget) Send

func (target *KafkaTarget) Send(eventKey string) error

Send - reads an event from store and sends it to Kafka.

type MQTTArgs

type MQTTArgs struct {
	Enable               bool           `json:"enable"`
	Broker               xnet.URL       `json:"broker"`
	Topic                string         `json:"topic"`
	QoS                  byte           `json:"qos"`
	User                 string         `json:"username"`
	Password             string         `json:"password"`
	MaxReconnectInterval time.Duration  `json:"reconnectInterval"`
	KeepAlive            time.Duration  `json:"keepAliveInterval"`
	RootCAs              *x509.CertPool `json:"-"`
	QueueDir             string         `json:"queueDir"`
	QueueLimit           uint64         `json:"queueLimit"`
}

MQTTArgs - MQTT target arguments.

func (MQTTArgs) Validate

func (m MQTTArgs) Validate() error

Validate MQTTArgs fields

type MQTTTarget

type MQTTTarget struct {
	// contains filtered or unexported fields
}

MQTTTarget - MQTT target.

func NewMQTTTarget

func NewMQTTTarget(id string, args MQTTArgs, doneCh <-chan struct{}) (*MQTTTarget, error)

NewMQTTTarget - creates new MQTT target.

func (*MQTTTarget) Close

func (target *MQTTTarget) Close() error

Close - does nothing and available for interface compatibility.

func (*MQTTTarget) ID

func (target *MQTTTarget) ID() event.TargetID

ID - returns target ID.

func (*MQTTTarget) Save

func (target *MQTTTarget) Save(eventData event.Event) error

Save - saves the events to the store if queuestore is configured, which will be replayed when the mqtt connection is active.

func (*MQTTTarget) Send

func (target *MQTTTarget) Send(eventKey string) error

Send - reads an event from store and sends it to MQTT.

type MySQLArgs

type MySQLArgs struct {
	Enable     bool     `json:"enable"`
	Format     string   `json:"format"`
	DSN        string   `json:"dsnString"`
	Table      string   `json:"table"`
	Host       xnet.URL `json:"host"`
	Port       string   `json:"port"`
	User       string   `json:"user"`
	Password   string   `json:"password"`
	Database   string   `json:"database"`
	QueueDir   string   `json:"queueDir"`
	QueueLimit uint64   `json:"queueLimit"`
}

MySQLArgs - MySQL target arguments.

func (MySQLArgs) Validate

func (m MySQLArgs) Validate() error

Validate MySQLArgs fields

type MySQLTarget

type MySQLTarget struct {
	// contains filtered or unexported fields
}

MySQLTarget - MySQL target.

func NewMySQLTarget

func NewMySQLTarget(id string, args MySQLArgs, doneCh <-chan struct{}) (*MySQLTarget, error)

NewMySQLTarget - creates new MySQL target.

func (*MySQLTarget) Close

func (target *MySQLTarget) Close() error

Close - closes underneath connections to MySQL database.

func (*MySQLTarget) ID

func (target *MySQLTarget) ID() event.TargetID

ID - returns target ID.

func (*MySQLTarget) Save

func (target *MySQLTarget) Save(eventData event.Event) error

Save - saves the events to the store which will be replayed when the SQL connection is active.

func (*MySQLTarget) Send

func (target *MySQLTarget) Send(eventKey string) error

Send - reads an event from store and sends it to MySQL.

type NATSArgs

type NATSArgs struct {
	Enable       bool      `json:"enable"`
	Address      xnet.Host `json:"address"`
	Subject      string    `json:"subject"`
	Username     string    `json:"username"`
	Password     string    `json:"password"`
	Token        string    `json:"token"`
	Secure       bool      `json:"secure"`
	PingInterval int64     `json:"pingInterval"`
	QueueDir     string    `json:"queueDir"`
	QueueLimit   uint64    `json:"queueLimit"`
	Streaming    struct {
		Enable             bool   `json:"enable"`
		ClusterID          string `json:"clusterID"`
		Async              bool   `json:"async"`
		MaxPubAcksInflight int    `json:"maxPubAcksInflight"`
	} `json:"streaming"`
}

NATSArgs - NATS target arguments.

func (NATSArgs) Validate

func (n NATSArgs) Validate() error

Validate NATSArgs fields

type NATSTarget

type NATSTarget struct {
	// contains filtered or unexported fields
}

NATSTarget - NATS target.

func NewNATSTarget

func NewNATSTarget(id string, args NATSArgs, doneCh <-chan struct{}) (*NATSTarget, error)

NewNATSTarget - creates new NATS target.

func (*NATSTarget) Close

func (target *NATSTarget) Close() (err error)

Close - closes underneath connections to NATS server.

func (*NATSTarget) ID

func (target *NATSTarget) ID() event.TargetID

ID - returns target ID.

func (*NATSTarget) Save

func (target *NATSTarget) Save(eventData event.Event) error

Save - saves the events to the store which will be replayed when the Nats connection is active.

func (*NATSTarget) Send

func (target *NATSTarget) Send(eventKey string) error

Send - sends event to Nats.

type NSQArgs

type NSQArgs struct {
	Enable      bool      `json:"enable"`
	NSQDAddress xnet.Host `json:"nsqdAddress"`
	Topic       string    `json:"topic"`
	TLS         struct {
		Enable     bool `json:"enable"`
		SkipVerify bool `json:"skipVerify"`
	} `json:"tls"`
	QueueDir   string `json:"queueDir"`
	QueueLimit uint64 `json:"queueLimit"`
}

NSQArgs - NSQ target arguments.

func (NSQArgs) Validate

func (n NSQArgs) Validate() error

Validate NSQArgs fields

type NSQTarget

type NSQTarget struct {
	// contains filtered or unexported fields
}

NSQTarget - NSQ target.

func NewNSQTarget

func NewNSQTarget(id string, args NSQArgs, doneCh <-chan struct{}) (*NSQTarget, error)

NewNSQTarget - creates new NSQ target.

func (*NSQTarget) Close

func (target *NSQTarget) Close() (err error)

Close - closes underneath connections to NSQD server.

func (*NSQTarget) ID

func (target *NSQTarget) ID() event.TargetID

ID - returns target ID.

func (*NSQTarget) Save

func (target *NSQTarget) Save(eventData event.Event) error

Save - saves the events to the store which will be replayed when the nsq connection is active.

func (*NSQTarget) Send

func (target *NSQTarget) Send(eventKey string) error

Send - reads an event from store and sends it to NSQ.

type PostgreSQLArgs

type PostgreSQLArgs struct {
	Enable           bool      `json:"enable"`
	Format           string    `json:"format"`
	ConnectionString string    `json:"connectionString"`
	Table            string    `json:"table"`
	Host             xnet.Host `json:"host"`     // default: localhost
	Port             string    `json:"port"`     // default: 5432
	User             string    `json:"user"`     // default: user running minio
	Password         string    `json:"password"` // default: no password
	Database         string    `json:"database"` // default: same as user
	QueueDir         string    `json:"queueDir"`
	QueueLimit       uint64    `json:"queueLimit"`
}

PostgreSQLArgs - PostgreSQL target arguments.

func (PostgreSQLArgs) Validate

func (p PostgreSQLArgs) Validate() error

Validate PostgreSQLArgs fields

type PostgreSQLTarget

type PostgreSQLTarget struct {
	// contains filtered or unexported fields
}

PostgreSQLTarget - PostgreSQL target.

func NewPostgreSQLTarget

func NewPostgreSQLTarget(id string, args PostgreSQLArgs, doneCh <-chan struct{}) (*PostgreSQLTarget, error)

NewPostgreSQLTarget - creates new PostgreSQL target.

func (*PostgreSQLTarget) Close

func (target *PostgreSQLTarget) Close() error

Close - closes underneath connections to PostgreSQL database.

func (*PostgreSQLTarget) ID

func (target *PostgreSQLTarget) ID() event.TargetID

ID - returns target ID.

func (*PostgreSQLTarget) Save

func (target *PostgreSQLTarget) Save(eventData event.Event) error

Save - saves the events to the store if questore is configured, which will be replayed when the PostgreSQL connection is active.

func (*PostgreSQLTarget) Send

func (target *PostgreSQLTarget) Send(eventKey string) error

Send - reads an event from store and sends it to PostgreSQL.

type QueueStore

type QueueStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

QueueStore - Filestore for persisting events.

func NewQueueStore

func NewQueueStore(directory string, limit uint64) *QueueStore

NewQueueStore - Creates an instance for QueueStore.

func (*QueueStore) Del

func (store *QueueStore) Del(key string) error

Del - Deletes an entry from the store.

func (*QueueStore) Get

func (store *QueueStore) Get(key string) (event.Event, error)

Get - gets a event from the store.

func (*QueueStore) List

func (store *QueueStore) List() []string

List - lists all files from the directory.

func (*QueueStore) Open

func (store *QueueStore) Open() error

Open - Creates the directory if not present.

func (*QueueStore) Put

func (store *QueueStore) Put(e event.Event) error

Put - puts a event to the store.

type RedisArgs

type RedisArgs struct {
	Enable     bool      `json:"enable"`
	Format     string    `json:"format"`
	Addr       xnet.Host `json:"address"`
	Password   string    `json:"password"`
	Key        string    `json:"key"`
	QueueDir   string    `json:"queueDir"`
	QueueLimit uint64    `json:"queueLimit"`
}

RedisArgs - Redis target arguments.

func (RedisArgs) Validate

func (r RedisArgs) Validate() error

Validate RedisArgs fields

type RedisTarget

type RedisTarget struct {
	// contains filtered or unexported fields
}

RedisTarget - Redis target.

func NewRedisTarget

func NewRedisTarget(id string, args RedisArgs, doneCh <-chan struct{}) (*RedisTarget, error)

NewRedisTarget - creates new Redis target.

func (*RedisTarget) Close

func (target *RedisTarget) Close() error

Close - does nothing and available for interface compatibility.

func (*RedisTarget) ID

func (target *RedisTarget) ID() event.TargetID

ID - returns target ID.

func (*RedisTarget) Save

func (target *RedisTarget) Save(eventData event.Event) error

Save - saves the events to the store if questore is configured, which will be replayed when the redis connection is active.

func (*RedisTarget) Send

func (target *RedisTarget) Send(eventKey string) error

Send - reads an event from store and sends it to redis.

type Store

type Store interface {
	Put(event event.Event) error
	Get(key string) (event.Event, error)
	List() []string
	Del(key string) error
	Open() error
}

Store - To persist the events.

type WebhookArgs

type WebhookArgs struct {
	Enable     bool           `json:"enable"`
	Endpoint   xnet.URL       `json:"endpoint"`
	RootCAs    *x509.CertPool `json:"-"`
	QueueDir   string         `json:"queueDir"`
	QueueLimit uint64         `json:"queueLimit"`
}

WebhookArgs - Webhook target arguments.

func (WebhookArgs) Validate

func (w WebhookArgs) Validate() error

Validate WebhookArgs fields

type WebhookTarget

type WebhookTarget struct {
	// contains filtered or unexported fields
}

WebhookTarget - Webhook target.

func NewWebhookTarget

func NewWebhookTarget(id string, args WebhookArgs, doneCh <-chan struct{}) *WebhookTarget

NewWebhookTarget - creates new Webhook target.

func (*WebhookTarget) Close

func (target *WebhookTarget) Close() error

Close - does nothing and available for interface compatibility.

func (WebhookTarget) ID

func (target WebhookTarget) ID() event.TargetID

ID - returns target ID.

func (*WebhookTarget) Save

func (target *WebhookTarget) Save(eventData event.Event) error

Save - saves the events to the store if queuestore is configured, which will be replayed when the wenhook connection is active.

func (*WebhookTarget) Send

func (target *WebhookTarget) Send(eventKey string) error

Send - reads an event from store and sends it to webhook.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL