auditor

package
v0.0.0-...-5655933 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRegistryFilename = "registry.json"

DefaultRegistryFilename is the default registry filename

Variables

This section is empty.

Functions

This section is empty.

Types

type Auditor

type Auditor interface {
	Registry
	Start()
	Stop()
	Channel() chan *message.Message
}

An Auditor handles messages successfully submitted to the intake

type JSONRegistry

type JSONRegistry struct {
	Version  int
	Registry map[string]RegistryEntry
}

JSONRegistry represents the registry that will be written on disk

type NullAuditor

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

NullAuditor is an auditor not doing anything with the message it received. It has been introduced for the Serverless Agent which doesn't need to maintain a registry.

func NewNullAuditor

func NewNullAuditor() *NullAuditor

NewNullAuditor returns an instanciated NullAuditor. `Start()` is the next method that should be used on this NullAuditor.

func (*NullAuditor) Channel

func (a *NullAuditor) Channel() chan *message.Message

Channel returns the channel on which should be sent the messages.

func (*NullAuditor) GetOffset

func (a *NullAuditor) GetOffset(identifier string) string

GetOffset returns an empty string.

func (*NullAuditor) GetTailingMode

func (a *NullAuditor) GetTailingMode(identifier string) string

GetTailingMode returns an empty string.

func (*NullAuditor) Start

func (a *NullAuditor) Start()

Start starts the NullAuditor main loop.

func (*NullAuditor) Stop

func (a *NullAuditor) Stop()

Stop stops the NullAuditor main loop.

type Registry

type Registry interface {
	GetOffset(identifier string) string
	GetTailingMode(identifier string) string
}

Registry holds a list of offsets.

type RegistryAuditor

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

A RegistryAuditor is storing the Auditor information using a registry.

func New

func New(runPath string, filename string, ttl time.Duration) *RegistryAuditor

New returns an initialized Auditor

func (*RegistryAuditor) Channel

func (a *RegistryAuditor) Channel() chan *message.Message

Channel returns the channel to use to communicate with the auditor or nil if the auditor is currently stopped.

func (*RegistryAuditor) GetOffset

func (a *RegistryAuditor) GetOffset(identifier string) string

GetOffset returns the last committed offset for a given identifier, returns an empty string if it does not exist.

func (*RegistryAuditor) GetTailingMode

func (a *RegistryAuditor) GetTailingMode(identifier string) string

GetTailingMode returns the last committed offset for a given identifier, returns an empty string if it does not exist.

func (*RegistryAuditor) Start

func (a *RegistryAuditor) Start()

Start starts the Auditor

func (*RegistryAuditor) Stop

func (a *RegistryAuditor) Stop()

Stop stops the Auditor

type RegistryEntry

type RegistryEntry struct {
	LastUpdated time.Time
	Offset      string
	TailingMode string
}

A RegistryEntry represents an entry in the registry where we keep track of current offsets

Jump to

Keyboard shortcuts

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