server

package
v4.0.52 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

Action is the db change action type for the change set

const (
	// Create is the action when a new record is created
	Create Action = "create"
	// Update is the action when an existing record is updated
	Update Action = "update"
	// Delete is the action when an existing record is deleted
	Delete Action = "delete"
)

type Config

type Config struct {
	Ctx          context.Context
	Dir          string // temp dir for files
	Logger       log.Logger
	State        sdk.State     // can be nil
	RedisClient  *redis.Client // can be nil
	Integration  *IntegrationContext
	UUID         string
	Channel      string
	Secret       string
	GroupID      string
	SelfManaged  bool
	APIKey       string
	EnrollmentID string
	SlackToken   string
	SlackChannel string
}

Config is the configuration for the server

type DbChangeEvent

type DbChangeEvent struct {
	Action Action          `json:"action"`
	Data   string          `json:"data"`
	Model  string          `json:"model"`
	Object datamodel.Model `json:"-"`
}

DbChangeEvent is an event which encapsulates a db change

type IntegrationContext

type IntegrationContext struct {
	Integration sdk.Integration
	Descriptor  *sdk.Descriptor
}

IntegrationContext is the details for each integration

type Server

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

Server is the event loop server portion of the agent

func New

func New(config Config) (*Server, error)

New returns a new server instance

func (*Server) Close

func (s *Server) Close() error

Close the server

type Subscriber

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

Subscriber is a convenience wrapper around a subscription channel

func NewDBChangeSubscriber

func NewDBChangeSubscriber(config Config, location agent.ExportIntegrationLocation, refType string, callback SubscriberCallback, metricServiceName, metricOperationName string) (*Subscriber, error)

NewDBChangeSubscriber will return a db change subscriber

func NewEventSubscriber

func NewEventSubscriber(config Config, topics []string, filters *event.SubscriptionFilter, location agent.ExportIntegrationLocation, callback SubscriberCallback, metricServiceName, metricOperationName string) (*Subscriber, error)

NewEventSubscriber will return an event subscriber

func (*Subscriber) Close

func (s *Subscriber) Close() error

Close will close the subscriber

type SubscriberCallback

type SubscriberCallback func(logger sdk.Logger, event event.SubscriptionEvent, refType string, location string) error

SubscriberCallback is the callback for processing events

Jump to

Keyboard shortcuts

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