datastore

package
Version: v0.0.0-...-a748373 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDataStorePath string = "/var/run/selinuxd.db"

Variables

View Source
var (
	ErrPolicyNotFound          = errors.New("policy not found in datastore")
	ErrDataStoreNotInitialized = errors.New("datastore not initialized")
)

Functions

This section is empty.

Types

type DataStore

type DataStore interface {
	ReadOnlyDataStore
	Put(status PolicyStatus) error
	Remove(policy string) error
	GetReadOnly() ReadOnlyDataStore
}

func New

func New(path string) (DataStore, error)

type PolicyStatus

type PolicyStatus struct {
	Policy   string     `json:"-"`
	Status   StatusType `json:"status"`
	Message  string     `json:"msg"`
	Checksum []byte     `json:"-"`
}

PolicyStatus defines the status of a specific policy in the datastore.

type ReadOnlyDataStore

type ReadOnlyDataStore interface {
	Close() error
	Get(policy string) (PolicyStatus, error)
	List() ([]string, error)
}

type StatusType

type StatusType string
const (
	InstalledStatus StatusType = "Installed"
	FailedStatus    StatusType = "Failed"
)

type TestCountedDS

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

TestCountedDS a wrapper over the bbolt datastore that contains counters which are meant to aid in testing

func NewTestCountedDS

func NewTestCountedDS(path string) (*TestCountedDS, error)

func (*TestCountedDS) Close

func (tcds *TestCountedDS) Close() error

func (*TestCountedDS) Get

func (tcds *TestCountedDS) Get(policy string) (PolicyStatus, error)

func (*TestCountedDS) GetCalls

func (tcds *TestCountedDS) GetCalls() int32

func (*TestCountedDS) GetReadOnly

func (tcds *TestCountedDS) GetReadOnly() ReadOnlyDataStore

func (*TestCountedDS) List

func (tcds *TestCountedDS) List() ([]string, error)

func (*TestCountedDS) Put

func (tcds *TestCountedDS) Put(status PolicyStatus) error

func (*TestCountedDS) PutCalls

func (tcds *TestCountedDS) PutCalls() int32

func (*TestCountedDS) Remove

func (tcds *TestCountedDS) Remove(policy string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL