rpc

package
v1.76.6 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 12 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"
)

The restore function's module and method. It is the same zip as the backup module's, deployed a second time (docs/decisions/0072), and answers one call: the console and the administrator's tools read how the restore stands. Nothing here starts, resumes or previews a restore: that is an invocation of the function itself, which only an administrator or the break-glass role may make (internal/lambdaapp).

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; an administrator or the break-glass role also starts a backup. The console has no button for a restore, and none to start a backup.

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.

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` on s: the console, an administrator and the break-glass role may read it, and no caller may do more.

Types

type Client

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

Client is the read side of the backup and restore modules, as the console calls them: through a modcall.Caller whose transport says the caller class is `console`. It has no method that starts a backup or touches a restore, because the modules do not let that class do either.

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) RestoreStatus

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

RestoreStatus is `restore.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 RestoreService

type RestoreService interface {
	RestoreStatus(ctx context.Context) (restorejob.Status, 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"`
}

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