hostsstore

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package hostsstore provides the interface for /var/lib/nerdctl/<ADDRHASH>/etchosts Prioritizes simplicity over scalability. All methods perform atomic writes and are safe to use concurrently. Note that locking is done per namespace. hostsstore is currently by container rename, remove, network managers, and ocihooks Finally, NOTE: Since we will write to the hosts file after it is mounted in the container, we cannot use our atomic write method as the inode would change on rename. Henceforth, hosts file mutation uses filesystem methods instead, making it the one exception that has to bypass the Store implementation.

Index

Constants

View Source
const (
	MarkerBegin = "<nerdctl>"
	MarkerEnd   = "</nerdctl>"
)

Variables

View Source
var ErrHostsStore = errors.New("hosts-store error")

ErrHostsStore will wrap all errors here

Functions

This section is empty.

Types

type Meta

type Meta struct {
	ID         string
	Networks   map[string]*types100.Result
	Hostname   string
	ExtraHosts map[string]string // host:ip
	Name       string
	Domainname string
}

type Store

type Store interface {
	Acquire(Meta) error
	Release(id string) error
	Update(id, newName string) error
	HostsPath(id string) (location string, err error)
	Delete(id string) (err error)
	AllocHostsFile(id string, content []byte) (location string, err error)
}

func New

func New(dataStore string, namespace string) (retStore Store, err error)

Jump to

Keyboard shortcuts

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