destinations

package
v0.0.0-...-8aeb8a1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StatusInstance = &Status{Reloading: false}

Functions

This section is empty.

Types

type LoggerUsage

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

LoggerUsage is used for counting when logger isn't used

type Payload

type Payload struct {
	Destinations map[string]config.DestinationConfig `json:"destinations,omitempty"`
}

type Service

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

Service is a reloadable service of events destinations per token

func NewService

func NewService(destinations *viper.Viper, destinationsSource string, storageFactory storages.Factory, loggerFactory *logevents.Factory, strictAuth bool) (*Service, error)

NewService returns loaded Service instance and call resources.Watcher() if destinations source is http url or file path

func NewTestService

func NewTestService(unitsByID map[string]*Unit, consumersByTokenID TokenizedConsumers, storagesByTokenID TokenizedStorages,
	destinationsIDByTokenID TokenizedIDs, queueConsumerByDestinationID map[string]events.Consumer) *Service

NewTestService returns test instance. It is used only for tests

func (*Service) Close

func (s *Service) Close() (multiErr error)

Close closes destination storages

func (*Service) GetBatchStorages

func (s *Service) GetBatchStorages(tokenID string) (storages []storages.StorageProxy)

func (*Service) GetConsumers

func (s *Service) GetConsumers(tokenID string) (consumers []events.Consumer)

func (*Service) GetDestinationByID

func (s *Service) GetDestinationByID(id string) (storages.StorageProxy, bool)

func (*Service) GetDestinationIDs

func (s *Service) GetDestinationIDs(tokenID string) map[string]bool

func (*Service) GetDestinations

func (s *Service) GetDestinations(tokenID string) (storages []storages.StorageProxy)

func (*Service) GetEventsConsumerByDestinationID

func (s *Service) GetEventsConsumerByDestinationID(destinationID string) (events.Consumer, bool)

func (*Service) GetFactory

func (s *Service) GetFactory() storages.Factory

func (*Service) GetSynchronousStorages

func (s *Service) GetSynchronousStorages(tokenID string) (storages []storages.StorageProxy)

func (*Service) PostHandle

func (s *Service) PostHandle(id string, event events.Event) error

type Status

type Status struct {
	Reloading bool
}

Status is a singleton struct for storing destinations reloading state. Uploader checks this flag and doesn't upload batch files if Reloading = true

type TokenizedConsumers

type TokenizedConsumers map[string]map[string]events.Consumer

map["tokenID"]map["tokenID | destination_name"]interface because 1 token id = 1logger but ∞ event.queue

func (TokenizedConsumers) Add

func (tc TokenizedConsumers) Add(tokenID, name string, proxy events.Consumer)

func (TokenizedConsumers) AddAll

func (tc TokenizedConsumers) AddAll(other TokenizedConsumers)

type TokenizedIDs

type TokenizedIDs map[string]map[string]bool

map["tokenID"]map["destination_name"]true

func (TokenizedIDs) Add

func (ti TokenizedIDs) Add(tokenID, name string)

func (TokenizedIDs) AddAll

func (ti TokenizedIDs) AddAll(other TokenizedIDs)

type TokenizedStorages

type TokenizedStorages map[string]map[string]storages.StorageProxy

map["tokenID"]map["destination_name"]interface because 1 token id = ∞ storages

func (TokenizedStorages) Add

func (ts TokenizedStorages) Add(tokenID, name string, proxy storages.StorageProxy)

func (TokenizedStorages) AddAll

func (ts TokenizedStorages) AddAll(other TokenizedStorages)

type Unit

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

Unit holds storage bundle for closing at once

func NewTestUnit

func NewTestUnit(storage storages.StorageProxy) *Unit

NewTestUnit returns test unit with test storage. Only for tests

func (*Unit) Close

func (u *Unit) Close() (multiErr error)

Close closes storage and eventsQueue if exists

func (*Unit) CloseStorage

func (u *Unit) CloseStorage() error

CloseStorage runs storages.StorageProxy Close() returns err if occurred

Jump to

Keyboard shortcuts

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