data

package
v1.0.46 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKey

func GetKey(entityType string, keyPart ...string) string

GetKey returns a key to be used in the storage system

Types

type ConfigItem

type ConfigItem struct {
	Name    string    `json:"name"`
	Value   string    `json:"value"`
	Created time.Time `json:"created"`
	Updated time.Time `json:"updated"`
}

ConfigItem represents a single configuration item

type Event added in v1.0.36

type Event struct {
	ID        string    `json:"id"`        // Unique Event ID
	Created   time.Time `json:"created"`   // Event creation time
	SourceIP  string    `json:"ip"`        // Source IP address of the event
	EventType string    `json:"eventtype"` // One of: System startup, Config update, System shutdown, etc
	Details   string    `json:"details"`   // Additional information (like the config information involved)
}

Event represents an event in the system. These events can be logged or passed (as meta information) to other systems

type Manager

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

Manager is the data manager

func NewManager

func NewManager(systemdbpath string) (*Manager, error)

NewManager creates a new instance of a Manager and returns it

func (Manager) AddEvent added in v1.0.36

func (store Manager) AddEvent(eventtype, details string, ip string, expiresafter time.Duration) (Event, error)

AddEvent adds an event to the system

func (Manager) Close

func (store Manager) Close() error

Close closes the data Manager

func (Manager) DeleteConfig

func (store Manager) DeleteConfig(name string) error

DeleteConfig removes a config item from the system

func (Manager) GetAllConfig

func (store Manager) GetAllConfig() ([]ConfigItem, error)

GetAllConfig gets all config items in the system

func (Manager) GetAllEvents added in v1.0.36

func (store Manager) GetAllEvents() ([]Event, error)

GetAllEvents gets all events in the system

func (Manager) GetConfig

func (store Manager) GetConfig(name string) (ConfigItem, error)

GetConfig gets a config item from the system

func (Manager) GetEvent added in v1.0.36

func (store Manager) GetEvent(id string) (Event, error)

GetEvent gets an event from the system

func (Manager) SetConfig

func (store Manager) SetConfig(name string, value string) (ConfigItem, error)

SetConfig sets a config item to the system

type WebSocketResponse

type WebSocketResponse struct {
	Type string     `json:"type"`
	Data ConfigItem `json:"data"`
}

WebSocketResponse represents a WebSocket event response

Jump to

Keyboard shortcuts

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