daemon

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithIdleTimeout added in v0.4.0

func WithIdleTimeout(timeout time.Duration) func(o *options) error

WithIdleTimeout changes server default idle timeout

func WithLibZFS added in v0.4.0

func WithLibZFS(libzfs libzfs.Interface) func(o *options) error

WithLibZFS allows overriding default libzfs implementations with a mock

Types

type Server

type Server struct {
	// Machines scanned
	Machines machines.Machines

	// Requests mutex
	RWRequest sync.RWMutex
	// contains filtered or unexported fields
}

Server is used to implement zsys.ZsysServer.

func New

func New(socket string, opts ...option) (*Server, error)

New returns an new, initialized daemon server, which handles systemd activation socket is ignored if we are using socket activation.

func (*Server) ChangeHomeOnUserData

func (s *Server) ChangeHomeOnUserData(req *zsys.ChangeHomeOnUserDataRequest, stream zsys.Zsys_ChangeHomeOnUserDataServer) (err error)

ChangeHomeOnUserData tries to find an existing dataset matching home as a valid mountpoint and rename it to newhome

func (*Server) CommitBoot

func (s *Server) CommitBoot(req *zsys.Empty, stream zsys.Zsys_CommitBootServer) (err error)

CommitBoot commits current state to be the active one by promoting its datasets if needed, set last used, associate user datasets to it and rebuilding grub menu. After this operation, every New() call will get the current and correct system state. Return if any dataset / machine changed has been done during boot commit and an error if any encountered.

func (*Server) CreateUserData

func (s *Server) CreateUserData(req *zsys.CreateUserDataRequest, stream zsys.Zsys_CreateUserDataServer) (err error)

CreateUserData creates a new userdata for user and set it to homepath on current zsys system. if the user already exists for a dataset attached to the current system, set its mountpoint to homepath. This is called by zsys grpc request, once the server is registered

func (*Server) DaemonStop added in v0.4.0

func (s *Server) DaemonStop(req *zsys.Empty, stream zsys.Zsys_DaemonStopServer) error

DaemonStop stops zsys daemon

func (*Server) DumpStates added in v0.4.0

func (s *Server) DumpStates(req *zsys.Empty, stream zsys.Zsys_DumpStatesServer) error

DumpStates dumps the entire internal state of zsys daemon

func (*Server) GC added in v0.4.0

func (s *Server) GC(req *zsys.GCRequest, stream zsys.Zsys_GCServer) error

GC call machine garbage collection stops zsys daemon

func (*Server) Listen

func (s *Server) Listen() error

Listen serves on its unix socket path. It handles systemd activation notification. When the server stop listening, the socket is removed automatically.

func (*Server) LoggingLevel added in v0.4.0

func (s *Server) LoggingLevel(req *zsys.LoggingLevelRequest, stream zsys.Zsys_LoggingLevelServer) error

LoggingLevel set the verbosity of the logger

func (*Server) MachineList added in v0.4.0

func (s *Server) MachineList(req *zsys.Empty, stream zsys.Zsys_MachineListServer) error

MachineList returns a list of machines and their summary

func (*Server) MachineShow added in v0.4.0

func (s *Server) MachineShow(req *zsys.MachineShowRequest, stream zsys.Zsys_MachineShowServer) error

MachineShow returns information about the machine id passed in argument

func (*Server) PrepareBoot

func (s *Server) PrepareBoot(req *zsys.Empty, stream zsys.Zsys_PrepareBootServer) (err error)

PrepareBoot consolidates canmount states for early boot. Return if any dataset / machine changed has been done during boot and an error if any encountered.

func (*Server) Refresh added in v0.4.0

func (s *Server) Refresh(req *zsys.Empty, stream zsys.Zsys_RefreshServer) error

Refresh reloads the state of zfs from the system

func (*Server) Reload added in v0.4.0

func (s *Server) Reload(req *zsys.Empty, stream zsys.Zsys_ReloadServer) error

Reload reloads daemon configuration

func (*Server) RemoveSystemState added in v0.4.0

func (s *Server) RemoveSystemState(req *zsys.RemoveSystemStateRequest, stream zsys.Zsys_RemoveSystemStateServer) (err error)

RemoveSystemState removes this and all depending states from system.

func (*Server) RemoveUserState added in v0.4.0

func (s *Server) RemoveUserState(req *zsys.RemoveUserStateRequest, stream zsys.Zsys_RemoveUserStateServer) error

RemoveUserState removes a user state

func (*Server) SaveSystemState added in v0.4.0

func (s *Server) SaveSystemState(req *zsys.SaveSystemStateRequest, stream zsys.Zsys_SaveSystemStateServer) (err error)

SaveSystemState creates a snapshot of a system and all users datasets. If stateName is not empty, it is used as the id of the snapshot otherwise an id is generated with a random string.

func (*Server) SaveUserState added in v0.4.0

func (s *Server) SaveUserState(req *zsys.SaveUserStateRequest, stream zsys.Zsys_SaveUserStateServer) (err error)

SaveUserState creates a snapshot for the provided user. If snapshotName is not empty, it is used as the id of the snapshot otherwise an id is generated with a random string. userName is the name of the user to snapshot the datasets from.

func (*Server) Status added in v0.4.0

func (s *Server) Status(req *zsys.Empty, stream zsys.Zsys_StatusServer) error

Status returns the status of the daemion

func (*Server) Stop

func (s *Server) Stop()

Stop gracefully stops the grpc server

func (*Server) Trace added in v0.4.0

func (s *Server) Trace(req *zsys.TraceRequest, stream zsys.Zsys_TraceServer) error

Trace performs CPU of MEM profiling and returns the trace to the client

func (*Server) TrackRequest

func (s *Server) TrackRequest() func()

TrackRequest prevents the idling timeout to fire up and return the function to reset it.

func (*Server) Version

func (s *Server) Version(req *zsys.Empty, stream zsys.Zsys_VersionServer) (err error)

Version returns the version of the daemon

Jump to

Keyboard shortcuts

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