lxd: github.com/lxc/lxd/lxd/state Index | Files

package state

import "github.com/lxc/lxd/lxd/state"

Index

Package Files

state.go testing.go

type State Uses

type State struct {
    // Databases
    Node    *db.Node
    Cluster *db.Cluster

    // MAAS server
    MAAS *maas.Controller

    // OS access
    OS    *sys.OS
    Proxy func(req *http.Request) (*url.URL, error)

    // LXD server
    Endpoints *endpoints.Endpoints

    // Event server
    DevlxdEvents *events.Server
    Events       *events.Server

    // Firewall instance
    Firewall firewall.Firewall

    Context context.Context
}

State is a gateway to the two main stateful components of LXD, the database and the operating system. It's typically used by model entities such as containers, volumes, etc. in order to perform changes.

func NewState Uses

func NewState(ctx context.Context, node *db.Node, cluster *db.Cluster, maas *maas.Controller, os *sys.OS, endpoints *endpoints.Endpoints, events *events.Server, devlxdEvents *events.Server, firewall firewall.Firewall, proxy func(req *http.Request) (*url.URL, error)) *State

NewState returns a new State object with the given database and operating system components.

func NewTestState Uses

func NewTestState(t *testing.T) (*State, func())

NewTestState returns a State object initialized with testable instances of the node/cluster databases and of the OS facade.

Return the newly created State object, along with a function that can be used for cleaning it up.

Package state imports 10 packages (graph) and is imported by 47 packages. Updated 2020-08-05. Refresh now. Tools for package owners.