rpc

package
v1.77.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package rpc is the backup module as another module sees it (docs/decisions/0071): the status of the backups, the list of what the archive holds, and a backup now, as methods of the `backup` module over internal/modcall. The restore function's methods are its own (U26).

Index

Constants

View Source
const (
	RestoreModule        = "restore"
	MethodRestoreStatus  = "status"
	MethodRestorePreview = "preview"
)

The restore function's module and methods. It is the same zip as the backup module's, deployed a second time (docs/decisions/0072), and answers two reads: how the restore stands, and what restoring a backup would do. Nothing here starts or resumes a restore: that is an invocation of the function itself, which only an administrator or the break-glass role may make (internal/lambdaapp), with their own credentials and never through the issuer, so that it works when the issuer is broken.

View Source
const (
	Module       = "backup"
	MethodStatus = "status"
	MethodList   = "list"
	MethodRun    = "run"
)

Module is the name of the module and the methods it answers.

View Source
const (
	CallerConsole    = "console"
	CallerAdmin      = "admin"
	CallerBreakglass = "breakglass"
)

Caller classes (the alias a call arrives through, `live-<class>`): the console shows the status and the list, and starts a backup for a person its policy lets (`backup.runGroups`), naming that person in RunRequest.By; an administrator or the break-glass role start one with their own credentials. No caller class starts or resumes a restore through a module call.

View Source
const DefaultTokenFile = "/var/run/secrets/sluis/backup/token"

DefaultTokenFile is where the pod's projected token for the backup module is mounted when the document does not say.

View Source
const PreviewOutcome = "preview"

PreviewOutcome is the outcome of a preview that produced a report.

Variables

This section is empty.

Functions

func Register

func Register(s *modcall.Server, svc Service)

Register makes svc answer the module's methods on s.

func RegisterRestore

func RegisterRestore(s *modcall.Server, svc RestoreService)

RegisterRestore makes svc answer `restore.status` and `restore.preview` on s: the console, an administrator and the break-glass role may call them, and no caller may do more.

Types

type Client

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

Client is the backup and restore modules as the console calls them: through a modcall.Caller whose transport says the caller class is `console`. It reads, previews a restore and starts a backup for a named person; it has no method that starts or resumes a restore, because the modules do not let that class.

func Dial

func Dial(ctx context.Context, b *config.ConsoleBackup) (*Client, error)

Dial is the Client of the modules `console.backup` names, called as the caller class `console`: each module's Lambda function (its `live-console` alias) or Kubernetes Service. A restore target left out is a module the router cannot reach, which the page shows as a restore function it has none of.

func NewClient

func NewClient(c modcall.Caller) *Client

NewClient calls the modules through c.

func (*Client) List

func (c *Client) List(ctx context.Context, limit int) ([]job.Info, error)

List is `backup.list`: the newest limit backups, all when 0.

func (*Client) PreviewRestore added in v1.77.0

func (c *Client) PreviewRestore(ctx context.Context, backupID string) (PreviewResponse, error)

PreviewRestore is `restore.preview`: what restoring the backup would do, as counts.

func (*Client) RestoreStatus

func (c *Client) RestoreStatus(ctx context.Context) (restorejob.Status, error)

RestoreStatus is `restore.status`.

func (*Client) StartRun added in v1.77.0

func (c *Client) StartRun(ctx context.Context, by string) error

StartRun starts `backup.run` for the person by, whom the module records as the actor, and returns once the module has been handed the call: a backup runs for minutes, and its record is read back with Client.Status.

func (*Client) Status

func (c *Client) Status(ctx context.Context) (job.Status, error)

Status is `backup.status`.

type ListRequest

type ListRequest struct {
	Limit int `json:"limit,omitempty"`
}

ListRequest asks for the newest Limit backups; 0 is all.

type ListResponse

type ListResponse struct {
	Backups []job.Info `json:"backups"`
}

ListResponse is `backup.list`.

type PreviewRequest added in v1.77.0

type PreviewRequest struct {
	Backup string `json:"backup"`
}

PreviewRequest names the backup to preview.

type PreviewResponse added in v1.77.0

type PreviewResponse struct {
	Outcome string          `json:"outcome"`
	Backup  string          `json:"backup,omitempty"`
	Error   string          `json:"error,omitempty"`
	Report  *restore.Report `json:"report,omitempty"`
}

PreviewResponse is `restore.preview`: a report of counts, or a refusal. The report never carries the records that differ (their names or their values): a caller that wants them runs the preview directly.

type RestoreService

type RestoreService interface {
	RestoreStatus(ctx context.Context) (restorejob.Status, error)
	PreviewRestore(ctx context.Context, backupID string) (*restore.Report, error)
}

RestoreService is what the restore methods call. *App of internal/backup/app is one.

type RunRequest

type RunRequest struct {
	Resume bool `json:"resume,omitempty"`
	// By is the person the console started the run for, by the address its
	// policy knows them by. Only the console class is believed: it is the
	// issuer's own, authenticated the person and checked the group before it
	// called. From any other class the field is ignored, since an alias says
	// nothing about the human behind it.
	By string `json:"by,omitempty"`
}

RunRequest starts a backup. Resume, which continued a paused run of format 1, answers idle.

type Service

type Service interface {
	Status(ctx context.Context) (job.Status, error)
	List(ctx context.Context) ([]job.Info, error)
	Run(ctx context.Context, req job.Request) (job.Result, error)
}

Service is what the methods call. *App of internal/backup/app is one.

type StatusRequest

type StatusRequest struct{}

StatusRequest has nothing in it.

Jump to

Keyboard shortcuts

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