auditor

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Identity  string
	ContextID string
	Source    string
	EventType string
	RaftIndex uint64
	Message   string
}

Event provides a default impl of Event

type InMemory

type InMemory struct {
	sync.Mutex
	// contains filtered or unexported fields
}

InMemory is ahelper Auditor to keep events in memory

func NewInMemory

func NewInMemory() *InMemory

NewInMemory creates new Auditor that captures events in memory

func (*InMemory) Audit

func (a *InMemory) Audit(
	source string,
	eventType string,
	identity string,
	contextID string,
	raftIndex uint64,
	message string,
)

Audit interface impl

func (*InMemory) Close

func (a *InMemory) Close() error

Close closes the auditor After this, auditor cannot track new audit events However, the events audited before calling Close() can still be queried

func (*InMemory) Event

func (a *InMemory) Event(e *Event)

Event records a new audit event

func (*InMemory) Find

func (a *InMemory) Find(source, eventType string) *Event

Find returns first event satisfying the filter

func (*InMemory) Get

func (a *InMemory) Get(idx int) *Event

Get returns the item at specified idx in the slice Ordering in audit events may not work as expected when multiple go-routines are appending events Use this method with caution

func (*InMemory) GetAll

func (a *InMemory) GetAll() []*Event

GetAll returns a cloned copy of all the events Ordering in audit events may not work as expected when multiple go-routines are appending events Use this method with caution

func (*InMemory) Len

func (a *InMemory) Len() int

Len returns the number of captured audit events

func (*InMemory) Reset

func (a *InMemory) Reset()

Reset will remove any collected events from this collector.

Jump to

Keyboard shortcuts

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