prefetch

package
v3.0.0-rc75 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package prefetch pulls the images of the container resources of the node ahead of their start, so a failover to the node finds them in the store of the engine, and neither waits for the registry nor fails with it.

It is a cache, kept on a best effort: an image is pulled when the store does not hold it, and never pulled again once there. What to hold is read from the instance configs of the node, which say the image each container resource would run, with the engine and the store it runs from: a Pull. The resources saying the same Pull, whatever their objects, are one key, pulled once.

It works from events, and polls nothing:

  • a key new to the node is checked, a while after, at a time drawn at random so the nodes of a cluster receiving the same configuration do not pull together;
  • a failure is tried again later, less and less often, and at once when the configuration of an object of the key changes, which may be its fix, or when a container of such an object turns up on another node, which then holds an image to copy;
  • an image untagged or removed from the store of an engine, which the container monitor tells, has the keys of the engine checked again: the engines do not name the image removed in a way to rely on, docker telling its id alone, so all are checked, once for a burst of removals, as an image prune makes.

A key is checked by asking the store of its engine, which the daemon does itself: it reads no credentials and changes nothing. A missing image is fetched by the command of an object of the key, "om <path> instance prefetch", which copies it from a node of the object holding it, and pulls it from its registry when none does. The command is what knows the nodes and the registry credentials of the object, and the user of a rootless store: the daemon handles none of them. The store of such a user is not one the daemon reads, nor one the container monitor tells the removals of: its keys always go through the command, and are not pulled again after a prune.

The command records the outcome of the pull on the node, where the status of the resources reads it to warn of a missing image whose prefetch failed. The daemon tells the instances when an outcome changes to or from failed, for the warning to show and clear as it happens.

One check, copy or pull runs at a time. The delays are counted on the clock of the node, and compared to no time of another node: a container of another node is up from when this node is told so. A frozen node or instance is prefetched as another: nothing of the instance changes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CmdArgs

func CmdArgs(p naming.Path, rid string) []string

CmdArgs returns the om argv prefetching the image of a resource of an object.

These words are a contract with the om command tree: core/om's TestPrefetchCmdArgsResolve keeps this function and the tree in sync.

Types

type Manager

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

Manager is the daemon component prefetching the images.

func NewManager

func NewManager(subQS pubsub.QueueSizer) *Manager

NewManager returns the component, not started.

func (*Manager) Start

func (t *Manager) Start(parent context.Context) error

Start starts following what the objects of the node pull.

func (*Manager) Stop

func (t *Manager) Stop() error

Stop ends the component, and the command it runs: a pull cut short leaves the layers it got in the store, which the next pull does not fetch again.

Jump to

Keyboard shortcuts

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