job

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EpListFilesystems = iota
	EpListFilesystemVersions
	EpDestroySnapshots
	EpWaitForConnectivity

	EpReceive

	EpSend
	EpSendDry
	EpSendCompleted
	EpReplicationCursor
)

Variables

This section is empty.

Functions

func EndpointNames added in v0.9.0

func EndpointNames(jobName string) []string

func GetLogger

func GetLogger(ctx context.Context) *logger.Logger

func JobsFromConfig

func JobsFromConfig(c *config.Config) ([]Job, *Connecter, error)

Types

type ActiveSide

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

func (*ActiveSide) Name

func (j *ActiveSide) Name() string

func (*ActiveSide) OwnedDatasetSubtreeRoot

func (j *ActiveSide) OwnedDatasetSubtreeRoot() (rfs *zfs.DatasetPath, ok bool)

func (*ActiveSide) RegisterMetrics

func (j *ActiveSide) RegisterMetrics(registerer prometheus.Registerer)

func (*ActiveSide) Run

func (j *ActiveSide) Run(ctx context.Context, cron *cron.Cron) error

func (*ActiveSide) Runnable added in v0.9.0

func (j *ActiveSide) Runnable() bool

func (*ActiveSide) Running

func (j *ActiveSide) Running() (d time.Duration, ok bool)

func (*ActiveSide) SenderConfig

func (j *ActiveSide) SenderConfig() *endpoint.SenderConfig

func (*ActiveSide) Shutdown

func (j *ActiveSide) Shutdown()

func (*ActiveSide) Status

func (j *ActiveSide) Status() *Status

type ActiveSideState

type ActiveSideState int
const (
	ActiveSideReplicating ActiveSideState = 1 << iota
	ActiveSidePruneSender
	ActiveSidePruneReceiver
	ActiveSideDone // also errors
)

func ActiveSideStateString

func ActiveSideStateString(s string) (ActiveSideState, error)

ActiveSideStateString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ActiveSideStateValues

func ActiveSideStateValues() []ActiveSideState

ActiveSideStateValues returns all values of the enum

func (ActiveSideState) IsAActiveSideState

func (i ActiveSideState) IsAActiveSideState() bool

IsAActiveSideState returns "true" if the value is listed in the enum definition. "false" otherwise

func (ActiveSideState) String

func (i ActiveSideState) String() string

type ActiveSideStatus

type ActiveSideStatus struct {
	CronSpec   string
	SleepUntil time.Time
	StartedAt  time.Time
	Err        string

	Replication                    *report.Report
	PruningSender, PruningReceiver *pruner.Report
	Snapshotting                   *snapper.Report
}

func (*ActiveSideStatus) Cron

func (self *ActiveSideStatus) Cron() string

func (*ActiveSideStatus) Error

func (self *ActiveSideStatus) Error() string

func (*ActiveSideStatus) Progress

func (self *ActiveSideStatus) Progress() (expected, completed uint64)

func (*ActiveSideStatus) Running

func (self *ActiveSideStatus) Running() (d time.Duration, ok bool)

func (*ActiveSideStatus) SleepingUntil

func (self *ActiveSideStatus) SleepingUntil() time.Time

func (*ActiveSideStatus) Steps

func (self *ActiveSideStatus) Steps() (expected, step int)

type Client added in v0.9.0

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

func NewClient added in v0.9.0

func NewClient(jobName string, client *jsonclient.Client) *Client

func (*Client) DestroySnapshots added in v0.9.0

func (self *Client) DestroySnapshots(ctx context.Context,
	req *pdu.DestroySnapshotsReq,
) (*pdu.DestroySnapshotsRes, error)

func (*Client) ListFilesystemVersions added in v0.9.0

func (self *Client) ListFilesystemVersions(ctx context.Context,
	req *pdu.ListFilesystemVersionsReq,
) (*pdu.ListFilesystemVersionsRes, error)

func (*Client) ListFilesystems added in v0.9.0

func (self *Client) ListFilesystems(ctx context.Context,
) (*pdu.ListFilesystemRes, error)

func (*Client) Receive added in v0.9.0

func (self *Client) Receive(ctx context.Context, req *pdu.ReceiveReq,
	receive io.ReadCloser,
) error

func (*Client) ReplicationCursor added in v0.9.0

func (self *Client) ReplicationCursor(ctx context.Context,
	req *pdu.ReplicationCursorReq,
) (*pdu.ReplicationCursorRes, error)

func (*Client) Send added in v0.9.0

func (self *Client) Send(ctx context.Context, req *pdu.SendReq,
) (*pdu.SendRes, io.ReadCloser, error)

func (*Client) SendCompleted added in v0.9.0

func (self *Client) SendCompleted(ctx context.Context,
	req *pdu.SendCompletedReq,
) error

func (*Client) SendDry added in v0.9.0

func (self *Client) SendDry(ctx context.Context, req *pdu.SendDryReq,
) (*pdu.SendDryRes, error)

func (*Client) WaitForConnectivity added in v0.9.0

func (self *Client) WaitForConnectivity(ctx context.Context) error

func (*Client) WithTimeout added in v0.9.0

func (self *Client) WithTimeout(d time.Duration) *Client

type Connected added in v0.9.0

type Connected interface {
	Name() string
	Endpoint() Endpoint
}

type Connecter added in v0.9.0

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

func NewConnecter added in v0.9.0

func NewConnecter(keys []config.AuthKey) *Connecter

func (*Connecter) AddJob added in v0.9.0

func (self *Connecter) AddJob(listnerName string, j *PassiveSide)

func (*Connecter) FromConfig added in v0.9.0

func (self *Connecter) FromConfig(in *config.Connect) (Connected, error)

func (*Connecter) Job added in v0.9.0

func (self *Connecter) Job(name string) *PassiveSide

func (*Connecter) Validate added in v0.9.0

func (self *Connecter) Validate() error

func (*Connecter) WithTimeout added in v0.9.0

func (self *Connecter) WithTimeout(d time.Duration) *Connecter

type Endpoint added in v0.9.0

type Endpoint interface {
	logic.Endpoint
	logic.Receiver
	logic.Sender
}

type Hook added in v0.8.10

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

func NewHookFromConfig added in v0.8.10

func NewHookFromConfig(in *config.HookCommand) *Hook

func (*Hook) ErrIsFatal added in v0.8.10

func (self *Hook) ErrIsFatal() bool

func (*Hook) Run added in v0.8.10

func (self *Hook) Run(ctx context.Context, j Job) error

func (*Hook) WithPostHook added in v0.8.10

func (self *Hook) WithPostHook(v bool) *Hook

type Internal

type Internal interface {
	Run(ctx context.Context, cron *cron.Cron) error
	RegisterMetrics(registerer prometheus.Registerer)
	Shutdown()
}

type Job

type Job interface {
	Internal

	Name() string
	Status() *Status
	// Jobs that return a subtree of the dataset hierarchy
	// must return the root of that subtree as rfs and ok = true
	OwnedDatasetSubtreeRoot() (rfs *zfs.DatasetPath, ok bool)
	SenderConfig() *endpoint.SenderConfig
	Runnable() bool
}

type JobStatus

type JobStatus interface {
	Error() string
	Running() (time.Duration, bool)
	Cron() string
	SleepingUntil() time.Time
	Steps() (expected, step int)
	Progress() (expected, completed uint64)
}

type LocalSender added in v0.9.2

type LocalSender struct {
	// the Target passed as Target to BuildLocalPruner
	pruner.Target
	// contains filtered or unexported fields
}

func NewLocalSender added in v0.9.2

func NewLocalSender(ctx context.Context, target pruner.Target) *LocalSender

Adaptor that implements pruner.History around a pruner.Target. The ReplicationCursor method is Get-op only and always returns the filesystem's most recent version's GUID.

TODO: This is a work-around for the current package daemon/pruner and package pruning.Snapshot limitation: they require the `Replicated` getter method be present, but obviously, a local job like SnapJob can't deliver on that. But the pruner.Pruner gives up on an FS if no replication cursor is present, which is why this pruner returns the most recent filesystem version.

func (*LocalSender) ListFilesystems added in v0.9.2

func (self *LocalSender) ListFilesystems(ctx context.Context,
) (*pdu.ListFilesystemRes, error)

func (*LocalSender) ReplicationCursor added in v0.9.2

func (self *LocalSender) ReplicationCursor(ctx context.Context,
	req *pdu.ReplicationCursorReq,
) (*pdu.ReplicationCursorRes, error)

type PassiveSide

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

func (*PassiveSide) Endpoint added in v0.9.0

func (j *PassiveSide) Endpoint(clientIdentity string) Endpoint

func (*PassiveSide) KnownClient added in v0.9.0

func (j *PassiveSide) KnownClient(clientIdentity string) bool

func (*PassiveSide) Name

func (j *PassiveSide) Name() string

func (*PassiveSide) OwnedDatasetSubtreeRoot

func (j *PassiveSide) OwnedDatasetSubtreeRoot() (rfs *zfs.DatasetPath, ok bool,
)

func (*PassiveSide) RegisterMetrics

func (*PassiveSide) RegisterMetrics(registerer prometheus.Registerer)

func (*PassiveSide) Run

func (j *PassiveSide) Run(ctx context.Context, cron *cron.Cron) error

func (*PassiveSide) Runnable added in v0.9.0

func (j *PassiveSide) Runnable() bool

func (*PassiveSide) SenderConfig

func (j *PassiveSide) SenderConfig() *endpoint.SenderConfig

func (*PassiveSide) Shutdown

func (j *PassiveSide) Shutdown()

func (*PassiveSide) Status

func (s *PassiveSide) Status() *Status

type PassiveStatus

type PassiveStatus struct {
	Snapper *snapper.Report
}

func (*PassiveStatus) Cron

func (self *PassiveStatus) Cron() string

func (*PassiveStatus) Error

func (self *PassiveStatus) Error() string

func (*PassiveStatus) Progress

func (self *PassiveStatus) Progress() (uint64, uint64)

func (*PassiveStatus) Running

func (self *PassiveStatus) Running() (time.Duration, bool)

func (*PassiveStatus) SleepingUntil

func (self *PassiveStatus) SleepingUntil() time.Time

func (*PassiveStatus) Steps

func (self *PassiveStatus) Steps() (expected, step int)

type ReceivingJobConfig

type ReceivingJobConfig interface {
	GetRootFS() string
	GetAppendClientIdentity() bool
	GetRecvOptions() *config.RecvOptions
}

type SendingJobConfig

type SendingJobConfig interface {
	GetFilesystems() (config.FilesystemsFilter, []config.DatasetFilter)
	GetSendOptions() *config.SendOptions // must not be nil
}

type SnapJob

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

func (*SnapJob) Name

func (j *SnapJob) Name() string

func (*SnapJob) OwnedDatasetSubtreeRoot

func (j *SnapJob) OwnedDatasetSubtreeRoot() (rfs *zfs.DatasetPath, ok bool)

func (*SnapJob) RegisterMetrics

func (j *SnapJob) RegisterMetrics(registerer prometheus.Registerer)

func (*SnapJob) Run

func (j *SnapJob) Run(ctx context.Context, cron *cron.Cron) error

func (*SnapJob) Runnable added in v0.9.0

func (j *SnapJob) Runnable() bool

func (*SnapJob) SenderConfig

func (j *SnapJob) SenderConfig() *endpoint.SenderConfig

func (*SnapJob) Shutdown

func (j *SnapJob) Shutdown()

func (*SnapJob) Status

func (j *SnapJob) Status() *Status

func (*SnapJob) Type

func (j *SnapJob) Type() Type

type SnapJobStatus

type SnapJobStatus struct {
	Pruning      *pruner.Report
	Snapshotting *snapper.Report // may be nil
}

func (*SnapJobStatus) Cron

func (self *SnapJobStatus) Cron() string

func (*SnapJobStatus) Error

func (self *SnapJobStatus) Error() string

func (*SnapJobStatus) Progress

func (self *SnapJobStatus) Progress() (uint64, uint64)

func (*SnapJobStatus) Running

func (self *SnapJobStatus) Running() (d time.Duration, ok bool)

func (*SnapJobStatus) SleepingUntil

func (self *SnapJobStatus) SleepingUntil() time.Time

func (*SnapJobStatus) Steps

func (self *SnapJobStatus) Steps() (expected, step int)

type Status

type Status struct {
	Type        Type
	JobSpecific JobStatus
}

func (*Status) CanSignal

func (s *Status) CanSignal() string

func (*Status) Cron

func (s *Status) Cron() string

func (*Status) Error

func (s *Status) Error() string

func (*Status) Internal

func (s *Status) Internal() bool

func (*Status) MarshalJSON

func (s *Status) MarshalJSON() ([]byte, error)

func (*Status) Progress

func (s *Status) Progress() (uint64, uint64)

func (*Status) Running

func (s *Status) Running() (time.Duration, bool)

func (*Status) SleepingUntil

func (s *Status) SleepingUntil() time.Time

func (*Status) Steps

func (s *Status) Steps() (expected, step int)

func (*Status) UnmarshalJSON

func (s *Status) UnmarshalJSON(in []byte) (err error)

type Type

type Type string
const (
	TypeInternal Type = "internal"
	TypeSnap     Type = "snap"
	TypePush     Type = "push"
	TypeSink     Type = "sink"
	TypePull     Type = "pull"
	TypeSource   Type = "source"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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