etcd

package
v2.13.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package etcd implements sabakan model on etcd.

Index

Constants

View Source
const (
	KeyVersion          = "version"
	KeySchemaLockPrefix = "schema-lock/"
	KeyCrypts           = "crypts/"
	KeyDHCP             = "dhcp"
	KeyIPAM             = "ipam"
	KeyLeaseUsages      = "lease-usages/"
	KeyMachines         = "machines/"
	KeyNodeIndices      = "node-indices/"
	KeyImages           = "images/"
	KeyAssets           = "assets/"
	KeyAssetsID         = "assets"
	KeyIgnitions        = "ignitions/"
	KeyAudit            = "audit/"
	KeyAuditLastGC      = "audit"
	KeyKernelParams     = "kernel-params/"
)

Internal schema keys.

View Source
const LastRevFile = "lastrev"

LastRevFile is the filename that keeps the last revision that the stateful watcher processed successfully.

View Source
const MaxDeleted = 10

MaxDeleted is the maximum number of deleted image IDs stored in etcd.

View Source
const MaxIgnitions = 10

MaxIgnitions is a number of the ignition templates to keep on etcd

Variables

This section is empty.

Functions

func NewModel

func NewModel(client *clientv3.Client, dataDir string, advertiseURL *url.URL) sabakan.Model

NewModel returns sabakan.Model

Types

type AssetDir

type AssetDir struct {
	Dir string
}

AssetDir is a struct to manage the assets directory.

func (AssetDir) Exists

func (d AssetDir) Exists(id int) bool

Exists returns true if a local copy of an asset of id exists.

func (AssetDir) GC

func (d AssetDir) GC(ids map[int]bool) error

GC removes garbage, that is, files whose names are not in ids.

func (AssetDir) Path

func (d AssetDir) Path(id int) string

Path returns a path to an asset of id.

func (AssetDir) Remove

func (d AssetDir) Remove(id int) error

Remove removes an asset.

func (AssetDir) Save

func (d AssetDir) Save(id int, r io.Reader, csum []byte) ([]byte, error)

Save stores an asset. When successful, this returns SHA256 checksum of the contents.

func (AssetDir) Size added in v2.5.0

func (d AssetDir) Size(id int) (int64, error)

Size returns byte size of the asset

type EventPool

type EventPool struct {
	Rev    int64
	Events []*clientv3.Event
}

EventPool is a pool of events.

type ImageDir

type ImageDir struct {
	// Dir is an absolute path to point image directory of an OS.
	Dir string
}

ImageDir is a struct to manage an image directory.

func (ImageDir) Download

func (d ImageDir) Download(w io.Writer, id string) error

Download writes files in a directory specified by "id" as a tar archive.

func (ImageDir) Exists

func (d ImageDir) Exists(id string) bool

Exists returns true if image files referenced by "id" is stored in the directory.

func (ImageDir) Extract

func (d ImageDir) Extract(r io.Reader, id string, members []string) error

Extract reads tar archive from "r" to extract files shown in "members".

Extracted files are finally stored under "id" directory. If the tar archive contains a file not in "members", or if the tar archive lacks a file in "members", this function returns sabakan.ErrBadRequest.

func (ImageDir) GC

func (d ImageDir) GC(ids []string) error

GC removes images listed in "ids".

func (ImageDir) ServeFile

func (d ImageDir) ServeFile(id, filename string, f func(content io.ReadSeeker)) error

ServeFile opens filename in "id" directory then calls "f" with the opened file.

func (ImageDir) Size added in v2.5.0

func (d ImageDir) Size(id string) (int64, error)

Size returns byte size of the image

Jump to

Keyboard shortcuts

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