backend

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetList

func GetList() []string

GetList returns list of registered backends

func HaveBackend

func HaveBackend(name string) bool

HaveBackend checks if backend is registered

func Register

func Register(name string, b Backend)

Register registers backend

Types

type Backend

type Backend interface {
	Configure(*zap.Logger, policies.PolicyRepo, map[string]interface{}, config.BackendCommons) error
	Version() (string, error)
	Start(ctx context.Context, cancelFunc context.CancelFunc) error
	Stop(ctx context.Context) error
	FullReset(ctx context.Context) error

	GetStartTime() time.Time
	GetCapabilities() (map[string]interface{}, error)
	GetRunningStatus() (RunningStatus, string, error)
	GetInitialState() RunningStatus

	ApplyPolicy(data policies.PolicyData, updatePolicy bool) error
	RemovePolicy(data policies.PolicyData) error
}

Backend is the interface that all backends must implement

func GetBackend

func GetBackend(name string) Backend

GetBackend returns a registered backend

type RunningStatus

type RunningStatus int

RunningStatus is the status of the backend

const (
	Unknown RunningStatus = iota
	Running
	BackendError
	AgentError
	Offline
	Waiting
)

Running Status types

func (RunningStatus) String

func (s RunningStatus) String() string

type State

type State struct {
	Status            RunningStatus
	RestartCount      int64
	LastError         string
	LastRestartTS     time.Time
	LastRestartReason string
}

State represents the state of the backend

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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