datarecv

package
v3.0.0-rc49 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstalledDir

func InstalledDir(p naming.Path) string

InstalledDir returns the directory holding the install records of the resources of the instance of p, a file named after each resource.

func Keywords

func Keywords(prefix string) []*keywords.Keyword

func ModeHasSpecialBits

func ModeHasSpecialBits(s string) bool

ModeHasSpecialBits reports whether a perm or dirperm value asks for the setuid or the setgid bit.

A file installed in a volume with one of them, owned by an account of the node, runs as that account for whoever executes it: on the node, where the volume is mounted, or in a container mounting the volume.

func Pop

func Pop(words []string) (string, []string)

Pop returns "a", "b c d" from "a b c d". This function is used in a loop to iterate all words of a line until Pop returns "", "".

func Split

func Split(text []string) [][]string

func TextHasLocalSource

func TextHasLocalSource(s string) bool

TextHasLocalSource reports whether an install text names a source the server reads locally, as opposed to one it fetches over http.

It lives here, next to the grammar it parses, so the rbac policy that refuses a local source to a user holding no root grant does not have to reimplement that grammar and drift from it.

func TextHasSpecialMode

func TextHasSpecialMode(s string) bool

TextHasSpecialMode reports whether an install text asks for the setuid or the setgid bit on one of the files or directories it installs.

Such a mode is not applied today: the mode word is read as permission bits alone. It is refused anyway, so a mode that would be applied once the grammar honours the bits is not one a user holding no root grant has already written.

func ValidateInstall

func ValidateInstall(value string) error

ValidateInstall says whether the install lines of value are ones the install takes, as far as the lines naming datastores by a pattern go: their pattern, and the * of their destination, the files of the datastores having to be told apart.

Types

type DataRecv

type DataRecv struct {
	// Install is the list of files or directories to install in the data receiver.
	Install []string `json:"install"`

	// User is the default owner user of the installed items.
	User string `json:"user"`

	// Group is the default owner group of the installed items.
	Group string `json:"group"`

	// Perm is the default permission of the installed files.
	Perm *os.FileMode `json:"perm"`

	// DirPerm is the default permission of the installed directories.
	// If not set, DirPerm defaults to Perm with execution bit over read bits (e.g. 0640 => 0750).
	DirPerm *os.FileMode `json:"dirperm"`

	// Deprecated by Install
	Configs     []string `json:"configs"`
	Secrets     []string `json:"secrets"`
	Directories []string `json:"directories"`
	Signal      string   `json:"signal"`
	// contains filtered or unexported fields
}

func (*DataRecv) DatastoreList

func (t *DataRecv) DatastoreList(_ context.Context) naming.Paths

func (*DataRecv) Do

func (t *DataRecv) Do(ctx context.Context) error

func (*DataRecv) HasMetadata

func (t *DataRecv) HasMetadata(path naming.Path, k string) bool

HasMetadata returns true if the volume has a configs or secrets reference to <namespace>/<kind>/<name>[/<key>]

func (*DataRecv) InstallDataByKind

func (t *DataRecv) InstallDataByKind(kind naming.Kind) (bool, error)

func (*DataRecv) InstallFromDatastore

func (t *DataRecv) InstallFromDatastore(ctx context.Context, from object.DataStore) (bool, error)

func (*DataRecv) OldSendSignals

func (t *DataRecv) OldSendSignals(ctx context.Context) error

func (*DataRecv) RootDirPerm

func (t *DataRecv) RootDirPerm() *os.FileMode

func (*DataRecv) RunInstall

func (t *DataRecv) RunInstall(ctx context.Context) error

RunInstall installs what the data receiver declares, as a start does, and logs what it leaves as it is too, and why: a directory in place, a file up to date, a key the store does not hold, a store that does not exist.

func (*DataRecv) SendSignals

func (t *DataRecv) SendSignals(ctx context.Context, signals *volsignal.T) error

func (*DataRecv) SetReceiver

func (t *DataRecv) SetReceiver(to receiver)

func (*DataRecv) Status

func (t *DataRecv) Status()

type Installed

type Installed struct {
	At    time.Time `json:"at"`
	Files []string  `json:"files"`
}

Installed is the record of the last install of a resource that wrote files: the daemon watching it tells the tasks reading them.

func ReadInstalled

func ReadInstalled(filename string) (Installed, error)

ReadInstalled returns the install record of the file filename.

type KeyMeta

type KeyMeta struct {
	Key        string
	Path       naming.Path
	From       string
	Source     string
	IsTemplate bool
}

func ParseKeyMetaRel

func ParseKeyMetaRel(line, namespace string) (KeyMeta, error)

func ParseKeyMetaRelObj

func ParseKeyMetaRelObj(line string, i any) (KeyMeta, error)

func ParseKeyMetaRelWithFallback

func ParseKeyMetaRelWithFallback(line, namespace, defaultKey string) (KeyMeta, error)

ParseKeyMetaRelWithFallback parses a key reference in the format "from <path> key <key>" and falls back to the legacy format "<path>" with a default key name for backward compatibility.

func (*KeyMeta) CacheFile

func (t *KeyMeta) CacheFile() (string, error)

func (*KeyMeta) Decode

func (t *KeyMeta) Decode() ([]byte, error)

func (*KeyMeta) RootDecode

func (t *KeyMeta) RootDecode() ([]byte, error)

func (*KeyMeta) String

func (t *KeyMeta) String() string

type SigRoute

type SigRoute struct {
	Signum syscall.Signal
	RID    string
}

SigRoute is a relation between a signal number and the id of a resource supporting signaling

Jump to

Keyboard shortcuts

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