1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
//go:build linux && cgo && !agent
package state
import (
"context"
"net/http"
"net/url"
"time"
"github.com/lxc/incus/v6/internal/server/auth"
"github.com/lxc/incus/v6/internal/server/bgp"
clusterConfig "github.com/lxc/incus/v6/internal/server/cluster/config"
"github.com/lxc/incus/v6/internal/server/db"
"github.com/lxc/incus/v6/internal/server/dns"
"github.com/lxc/incus/v6/internal/server/endpoints"
"github.com/lxc/incus/v6/internal/server/events"
"github.com/lxc/incus/v6/internal/server/firewall"
"github.com/lxc/incus/v6/internal/server/fsmonitor"
"github.com/lxc/incus/v6/internal/server/instance/instancetype"
"github.com/lxc/incus/v6/internal/server/network/ovn"
"github.com/lxc/incus/v6/internal/server/network/ovs"
"github.com/lxc/incus/v6/internal/server/node"
"github.com/lxc/incus/v6/internal/server/sys"
localtls "github.com/lxc/incus/v6/shared/tls"
)
type clusterGateway interface {
LeaderAddress() (string, error)
}
// State is a gateway to the two main stateful components, the database
// and the operating system. It's typically used by model entities such as
// containers, volumes, etc. in order to perform changes.
type State struct {
// Shutdown Context
ShutdownCtx context.Context
// Databases
DB *db.DB
// BGP server
BGP *bgp.Server
// Cluster
Cluster clusterGateway
// DNS server
DNS *dns.Server
// OS access
OS *sys.OS
Proxy func(req *http.Request) (*url.URL, error)
// REST endpoints
Endpoints *endpoints.Endpoints
// Event server
DevIncusEvents *events.DevIncusServer
Events *events.Server
// Firewall instance
Firewall firewall.Firewall
// Server certificate
ServerCert func() *localtls.CertInfo
UpdateCertificateCache func()
// Available instance types based on operational drivers.
InstanceTypes map[instancetype.Type]error
// Filesystem monitor
DevMonitor fsmonitor.FSMonitor
// Global configuration
GlobalConfig *clusterConfig.Config
// Local configuration
LocalConfig *node.Config
// Local server name.
ServerName string
// Whether the server is clustered.
ServerClustered bool
// Local server start time.
StartTime time.Time
// Authorizer.
Authorizer auth.Authorizer
// OVN.
OVN func() (*ovn.NB, *ovn.SB, error)
// OVS.
OVS func() (*ovs.VSwitch, error)
}
|