storage

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	ScannedEntities map[string]map[string]string `json:"scanned_entities"`
	Allowlist       map[string][]string          `json:"allowlist"`
	Denylist        map[string][]string          `json:"denylist"`
	// TODO: add denylist functionality in cli
	HostUUID string `json:"host_uuid,omitempty" validate:"omitempty,uuid_rfc4122"`
	OrgUUID  string `json:"org_uuid,omitempty" validate:"omitempty,uuid_rfc4122"`
}

Data represents the structure of the storage file.

type Storage

type Storage struct {
	Path string `validate:"required,filepath"`
	Data Data
}

Storage handles the loading and saving of the storage file.

func NewOrExistingStorage

func NewOrExistingStorage(path string) (*Storage, error)

NewOrExistingStorage returns existing storage if the file exists, or creates a new one otherwise. When creating a new storage, it writes the initial structure to disk immediately. Additionally, this ensures a HostUUID is present; if missing, it is generated and saved.

func NewStorage

func NewStorage(path string) (*Storage, error)

NewStorage creates a new Storage instance.

func (*Storage) Load

func (s *Storage) Load() error

func (*Storage) Save

func (s *Storage) Save() error

Save writes the storage data to the file.

Jump to

Keyboard shortcuts

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