catpogs

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package catpogs provides Go struct equivalents of the Cap'n Proto catalog. These are primarily intended for constructing test inputs.

Index

Constants

FileMode.Bits constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

type Catalog struct {
	Resources []*Resource
}

func (*Catalog) ToCapnp

func (c *Catalog) ToCapnp() (catalog.Catalog, error)

type Command

type Command struct {
	Which catalog.Exec_Command_Which
	Argv  []string
	Bash  string

	Env []EnvVar `capnp:"environment"`
	Dir string   `capnp:"workingDirectory"`
}

type EnvVar

type EnvVar struct {
	Name, Value string
}

type Exec

type Exec struct {
	Command   *Command
	Condition ExecCondition
}

type ExecCondition

type ExecCondition struct {
	Which         catalog.Exec_condition_Which
	OnlyIf        *Command
	Unless        *Command
	FileAbsent    string
	IfDepsChanged []uint64
}

type File

type File struct {
	Path string

	Which catalog.File_Which
	Plain struct {
		Content []byte
		Mode    *FileMode
	}
	Directory struct {
		Mode *FileMode
	}
	Symlink struct {
		Target string
	}
}

func Directory added in v0.2.0

func Directory(path string, mode *FileMode) *File

func PlainFile

func PlainFile(path string, content []byte) *File

func SymlinkFile

func SymlinkFile(oldname, newname string) *File

type FileMode added in v0.2.0

type FileMode struct {
	Bits  uint16
	User  *UserRef
	Group *GroupRef
}

type GroupRef added in v0.2.0

type GroupRef struct {
	Which catalog.GroupRef_Which
	ID    int32 `capnp:"id"`
	Name  string
}

func GroupIDRef added in v0.2.0

func GroupIDRef(gid int) *GroupRef

func GroupNameRef added in v0.2.0

func GroupNameRef(name string) *GroupRef

type Resource

type Resource struct {
	ID      uint64 `capnp:"id"`
	Comment string
	Deps    []uint64 `capnp:"dependencies"`

	Which catalog.Resource_Which
	File  *File
	Exec  *Exec
}

type UserRef added in v0.2.0

type UserRef struct {
	Which catalog.UserRef_Which
	ID    int32 `capnp:"id"`
	Name  string
}

func UserIDRef added in v0.2.0

func UserIDRef(uid int) *UserRef

func UserNameRef added in v0.2.0

func UserNameRef(name string) *UserRef

Jump to

Keyboard shortcuts

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