id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
20,900
rkt/rkt
pkg/sys/capability.go
HasChrootCapability
func HasChrootCapability() bool { // Checking the capabilities should be enough, but in case there're // problem retrieving them, fallback checking for the effective uid // (hoping it hasn't dropped its CAP_SYS_CHROOT). caps, err := capability.NewPid(0) if err == nil { return caps.Get(capability.EFFECTIVE, capab...
go
func HasChrootCapability() bool { // Checking the capabilities should be enough, but in case there're // problem retrieving them, fallback checking for the effective uid // (hoping it hasn't dropped its CAP_SYS_CHROOT). caps, err := capability.NewPid(0) if err == nil { return caps.Get(capability.EFFECTIVE, capab...
[ "func", "HasChrootCapability", "(", ")", "bool", "{", "// Checking the capabilities should be enough, but in case there're", "// problem retrieving them, fallback checking for the effective uid", "// (hoping it hasn't dropped its CAP_SYS_CHROOT).", "caps", ",", "err", ":=", "capability", ...
// HasChrootCapability checks if the current process has the CAP_SYS_CHROOT // capability
[ "HasChrootCapability", "checks", "if", "the", "current", "process", "has", "the", "CAP_SYS_CHROOT", "capability" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/pkg/sys/capability.go#L25-L35
20,901
rkt/rkt
pkg/group/group.go
LookupGidFromFile
func LookupGidFromFile(groupName, groupFile string) (gid int, err error) { groups, err := parseGroupFile(groupFile) if err != nil { return -1, errwrap.Wrap(fmt.Errorf("error parsing %q file", groupFile), err) } group, ok := groups[groupName] if !ok { return -1, fmt.Errorf("%q group not found", groupName) } ...
go
func LookupGidFromFile(groupName, groupFile string) (gid int, err error) { groups, err := parseGroupFile(groupFile) if err != nil { return -1, errwrap.Wrap(fmt.Errorf("error parsing %q file", groupFile), err) } group, ok := groups[groupName] if !ok { return -1, fmt.Errorf("%q group not found", groupName) } ...
[ "func", "LookupGidFromFile", "(", "groupName", ",", "groupFile", "string", ")", "(", "gid", "int", ",", "err", "error", ")", "{", "groups", ",", "err", ":=", "parseGroupFile", "(", "groupFile", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "...
// LookupGid reads the group file specified by groupFile, and returns the gid of the group // specified by groupName.
[ "LookupGid", "reads", "the", "group", "file", "specified", "by", "groupFile", "and", "returns", "the", "gid", "of", "the", "group", "specified", "by", "groupName", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/pkg/group/group.go#L43-L55
20,902
rkt/rkt
pkg/lock/keylock.go
TryExclusiveKeyLock
func TryExclusiveKeyLock(lockDir string, key string) (*KeyLock, error) { return createAndLock(lockDir, key, keyLockExclusive|keyLockNonBlocking) }
go
func TryExclusiveKeyLock(lockDir string, key string) (*KeyLock, error) { return createAndLock(lockDir, key, keyLockExclusive|keyLockNonBlocking) }
[ "func", "TryExclusiveKeyLock", "(", "lockDir", "string", ",", "key", "string", ")", "(", "*", "KeyLock", ",", "error", ")", "{", "return", "createAndLock", "(", "lockDir", ",", "key", ",", "keyLockExclusive", "|", "keyLockNonBlocking", ")", "\n", "}" ]
// TryExclusiveLock takes an exclusive lock on the key without blocking. // lockDir is the directory where the lock file will be created. // It will return ErrLocked if any lock is already held.
[ "TryExclusiveLock", "takes", "an", "exclusive", "lock", "on", "the", "key", "without", "blocking", ".", "lockDir", "is", "the", "directory", "where", "the", "lock", "file", "will", "be", "created", ".", "It", "will", "return", "ErrLocked", "if", "any", "lock...
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/pkg/lock/keylock.go#L94-L96
20,903
rkt/rkt
pkg/lock/keylock.go
ExclusiveKeyLock
func ExclusiveKeyLock(lockDir string, key string) (*KeyLock, error) { return createAndLock(lockDir, key, keyLockExclusive) }
go
func ExclusiveKeyLock(lockDir string, key string) (*KeyLock, error) { return createAndLock(lockDir, key, keyLockExclusive) }
[ "func", "ExclusiveKeyLock", "(", "lockDir", "string", ",", "key", "string", ")", "(", "*", "KeyLock", ",", "error", ")", "{", "return", "createAndLock", "(", "lockDir", ",", "key", ",", "keyLockExclusive", ")", "\n", "}" ]
// ExclusiveLock takes an exclusive lock on a key. // lockDir is the directory where the lock file will be created. // It will block if an exclusive lock is already held on the key.
[ "ExclusiveLock", "takes", "an", "exclusive", "lock", "on", "a", "key", ".", "lockDir", "is", "the", "directory", "where", "the", "lock", "file", "will", "be", "created", ".", "It", "will", "block", "if", "an", "exclusive", "lock", "is", "already", "held", ...
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/pkg/lock/keylock.go#L109-L111
20,904
rkt/rkt
pkg/lock/keylock.go
Unlock
func (l *KeyLock) Unlock() error { err := l.keyLock.Unlock() if err != nil { return err } return nil }
go
func (l *KeyLock) Unlock() error { err := l.keyLock.Unlock() if err != nil { return err } return nil }
[ "func", "(", "l", "*", "KeyLock", ")", "Unlock", "(", ")", "error", "{", "err", ":=", "l", ".", "keyLock", ".", "Unlock", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Unlock unlocks the key lock.
[ "Unlock", "unlocks", "the", "key", "lock", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/pkg/lock/keylock.go#L238-L244
20,905
rkt/rkt
pkg/lock/keylock.go
CleanKeyLocks
func CleanKeyLocks(lockDir string) error { f, err := os.Open(lockDir) if err != nil { return errwrap.Wrap(errors.New("error opening lockDir"), err) } defer f.Close() files, err := f.Readdir(0) if err != nil { return errwrap.Wrap(errors.New("error getting lock files list"), err) } for _, f := range files { ...
go
func CleanKeyLocks(lockDir string) error { f, err := os.Open(lockDir) if err != nil { return errwrap.Wrap(errors.New("error opening lockDir"), err) } defer f.Close() files, err := f.Readdir(0) if err != nil { return errwrap.Wrap(errors.New("error getting lock files list"), err) } for _, f := range files { ...
[ "func", "CleanKeyLocks", "(", "lockDir", "string", ")", "error", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "lockDir", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errwrap", ".", "Wrap", "(", "errors", ".", "New", "(", "\"", "\"", ...
// CleanKeyLocks remove lock files from the lockDir. // For every key it tries to take an Exclusive lock on it and skip it if it // fails with ErrLocked
[ "CleanKeyLocks", "remove", "lock", "files", "from", "the", "lockDir", ".", "For", "every", "key", "it", "tries", "to", "take", "an", "Exclusive", "lock", "on", "it", "and", "skip", "it", "if", "it", "fails", "with", "ErrLocked" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/pkg/lock/keylock.go#L249-L277
20,906
rkt/rkt
rkt/pubkey/pubkey.go
GetPubKeyLocations
func (m *Manager) GetPubKeyLocations(prefix string) ([]string, error) { ensureLogger(m.Debug) if prefix == "" { return nil, fmt.Errorf("empty prefix") } kls, err := m.metaDiscoverPubKeyLocations(prefix) if err != nil { return nil, errwrap.Wrap(errors.New("prefix meta discovery error"), err) } if len(kls) =...
go
func (m *Manager) GetPubKeyLocations(prefix string) ([]string, error) { ensureLogger(m.Debug) if prefix == "" { return nil, fmt.Errorf("empty prefix") } kls, err := m.metaDiscoverPubKeyLocations(prefix) if err != nil { return nil, errwrap.Wrap(errors.New("prefix meta discovery error"), err) } if len(kls) =...
[ "func", "(", "m", "*", "Manager", ")", "GetPubKeyLocations", "(", "prefix", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "ensureLogger", "(", "m", ".", "Debug", ")", "\n", "if", "prefix", "==", "\"", "\"", "{", "return", "nil", "...
// GetPubKeyLocations discovers locations at prefix
[ "GetPubKeyLocations", "discovers", "locations", "at", "prefix" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/pubkey/pubkey.go#L72-L88
20,907
rkt/rkt
rkt/pubkey/pubkey.go
AddKeys
func (m *Manager) AddKeys(pkls []string, prefix string, accept AcceptOption) error { ensureLogger(m.Debug) if m.Ks == nil { return fmt.Errorf("no keystore available to add keys to") } for _, pkl := range pkls { u, err := url.Parse(pkl) if err != nil { return err } pk, err := m.getPubKey(u) if err !=...
go
func (m *Manager) AddKeys(pkls []string, prefix string, accept AcceptOption) error { ensureLogger(m.Debug) if m.Ks == nil { return fmt.Errorf("no keystore available to add keys to") } for _, pkl := range pkls { u, err := url.Parse(pkl) if err != nil { return err } pk, err := m.getPubKey(u) if err !=...
[ "func", "(", "m", "*", "Manager", ")", "AddKeys", "(", "pkls", "[", "]", "string", ",", "prefix", "string", ",", "accept", "AcceptOption", ")", "error", "{", "ensureLogger", "(", "m", ".", "Debug", ")", "\n", "if", "m", ".", "Ks", "==", "nil", "{",...
// AddKeys adds the keys listed in pkls at prefix
[ "AddKeys", "adds", "the", "keys", "listed", "in", "pkls", "at", "prefix" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/pubkey/pubkey.go#L91-L155
20,908
rkt/rkt
rkt/pubkey/pubkey.go
metaDiscoverPubKeyLocations
func (m *Manager) metaDiscoverPubKeyLocations(prefix string) ([]string, error) { app, err := discovery.NewAppFromString(prefix) if err != nil { return nil, err } hostHeaders := config.ResolveAuthPerHost(m.AuthPerHost) insecure := discovery.InsecureNone if m.InsecureAllowHTTP { insecure = insecure | discovery...
go
func (m *Manager) metaDiscoverPubKeyLocations(prefix string) ([]string, error) { app, err := discovery.NewAppFromString(prefix) if err != nil { return nil, err } hostHeaders := config.ResolveAuthPerHost(m.AuthPerHost) insecure := discovery.InsecureNone if m.InsecureAllowHTTP { insecure = insecure | discovery...
[ "func", "(", "m", "*", "Manager", ")", "metaDiscoverPubKeyLocations", "(", "prefix", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "app", ",", "err", ":=", "discovery", ".", "NewAppFromString", "(", "prefix", ")", "\n", "if", "err", "...
// metaDiscoverPubKeyLocations discovers the locations of public keys through ACDiscovery by applying prefix as an ACApp
[ "metaDiscoverPubKeyLocations", "discovers", "the", "locations", "of", "public", "keys", "through", "ACDiscovery", "by", "applying", "prefix", "as", "an", "ACApp" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/pubkey/pubkey.go#L158-L181
20,909
rkt/rkt
rkt/pubkey/pubkey.go
downloadKey
func downloadKey(u *url.URL, skipTLSCheck bool) (*os.File, error) { tf, err := ioutil.TempFile("", "") if err != nil { return nil, errwrap.Wrap(errors.New("error creating tempfile"), err) } os.Remove(tf.Name()) // no need to keep the tempfile around defer func() { if tf != nil { tf.Close() } }() // TO...
go
func downloadKey(u *url.URL, skipTLSCheck bool) (*os.File, error) { tf, err := ioutil.TempFile("", "") if err != nil { return nil, errwrap.Wrap(errors.New("error creating tempfile"), err) } os.Remove(tf.Name()) // no need to keep the tempfile around defer func() { if tf != nil { tf.Close() } }() // TO...
[ "func", "downloadKey", "(", "u", "*", "url", ".", "URL", ",", "skipTLSCheck", "bool", ")", "(", "*", "os", ".", "File", ",", "error", ")", "{", "tf", ",", "err", ":=", "ioutil", ".", "TempFile", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if"...
// downloadKey retrieves the file, storing it in a deleted tempfile
[ "downloadKey", "retrieves", "the", "file", "storing", "it", "in", "a", "deleted", "tempfile" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/pubkey/pubkey.go#L201-L244
20,910
rkt/rkt
rkt/pubkey/pubkey.go
displayKey
func displayKey(prefix, location string, key *os.File) error { defer key.Seek(0, os.SEEK_SET) kr, err := openpgp.ReadArmoredKeyRing(key) if err != nil { return errwrap.Wrap(errors.New("error reading key"), err) } log.Printf("prefix: %q\nkey: %q", prefix, location) for _, k := range kr { stdout.Printf("gpg k...
go
func displayKey(prefix, location string, key *os.File) error { defer key.Seek(0, os.SEEK_SET) kr, err := openpgp.ReadArmoredKeyRing(key) if err != nil { return errwrap.Wrap(errors.New("error reading key"), err) } log.Printf("prefix: %q\nkey: %q", prefix, location) for _, k := range kr { stdout.Printf("gpg k...
[ "func", "displayKey", "(", "prefix", ",", "location", "string", ",", "key", "*", "os", ".", "File", ")", "error", "{", "defer", "key", ".", "Seek", "(", "0", ",", "os", ".", "SEEK_SET", ")", "\n\n", "kr", ",", "err", ":=", "openpgp", ".", "ReadArmo...
// displayKey shows the key summary
[ "displayKey", "shows", "the", "key", "summary" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/pubkey/pubkey.go#L275-L296
20,911
rkt/rkt
rkt/pubkey/pubkey.go
reviewKey
func reviewKey() (bool, error) { in := bufio.NewReader(os.Stdin) for { stdout.Printf("Are you sure you want to trust this key (yes/no)?") input, err := in.ReadString('\n') if err != nil { return false, errwrap.Wrap(errors.New("error reading input"), err) } switch input { case "yes\n": return true, n...
go
func reviewKey() (bool, error) { in := bufio.NewReader(os.Stdin) for { stdout.Printf("Are you sure you want to trust this key (yes/no)?") input, err := in.ReadString('\n') if err != nil { return false, errwrap.Wrap(errors.New("error reading input"), err) } switch input { case "yes\n": return true, n...
[ "func", "reviewKey", "(", ")", "(", "bool", ",", "error", ")", "{", "in", ":=", "bufio", ".", "NewReader", "(", "os", ".", "Stdin", ")", "\n", "for", "{", "stdout", ".", "Printf", "(", "\"", "\"", ")", "\n", "input", ",", "err", ":=", "in", "."...
// reviewKey asks the user to accept the key
[ "reviewKey", "asks", "the", "user", "to", "accept", "the", "key" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/pubkey/pubkey.go#L299-L316
20,912
rkt/rkt
networking/kvm.go
setupTapDevice
func setupTapDevice(podID types.UUID) (netlink.Link, error) { // network device names are limited to 16 characters // the suffix %d will be replaced by the kernel with a suitable number nameTemplate := fmt.Sprintf("rkt-%s-tap%%d", podID.String()[0:4]) ifName, err := tuntap.CreatePersistentIface(nameTemplate, tuntap...
go
func setupTapDevice(podID types.UUID) (netlink.Link, error) { // network device names are limited to 16 characters // the suffix %d will be replaced by the kernel with a suitable number nameTemplate := fmt.Sprintf("rkt-%s-tap%%d", podID.String()[0:4]) ifName, err := tuntap.CreatePersistentIface(nameTemplate, tuntap...
[ "func", "setupTapDevice", "(", "podID", "types", ".", "UUID", ")", "(", "netlink", ".", "Link", ",", "error", ")", "{", "// network device names are limited to 16 characters", "// the suffix %d will be replaced by the kernel with a suitable number", "nameTemplate", ":=", "fmt...
// setupTapDevice creates persistent tap device // and returns a newly created netlink.Link structure
[ "setupTapDevice", "creates", "persistent", "tap", "device", "and", "returns", "a", "newly", "created", "netlink", ".", "Link", "structure" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/networking/kvm.go#L59-L77
20,913
rkt/rkt
networking/kvm.go
setupMacVTapDevice
func setupMacVTapDevice(podID types.UUID, config MacVTapNetConf, interfaceNumber int) (netlink.Link, error) { master, err := netlink.LinkByName(config.Master) if err != nil { return nil, errwrap.Wrap(fmt.Errorf("cannot find master device '%v'", config.Master), err) } var mode netlink.MacvlanMode switch config.Mo...
go
func setupMacVTapDevice(podID types.UUID, config MacVTapNetConf, interfaceNumber int) (netlink.Link, error) { master, err := netlink.LinkByName(config.Master) if err != nil { return nil, errwrap.Wrap(fmt.Errorf("cannot find master device '%v'", config.Master), err) } var mode netlink.MacvlanMode switch config.Mo...
[ "func", "setupMacVTapDevice", "(", "podID", "types", ".", "UUID", ",", "config", "MacVTapNetConf", ",", "interfaceNumber", "int", ")", "(", "netlink", ".", "Link", ",", "error", ")", "{", "master", ",", "err", ":=", "netlink", ".", "LinkByName", "(", "conf...
// setupTapDevice creates persistent macvtap device // and returns a newly created netlink.Link structure // using part of pod hash and interface number in interface name
[ "setupTapDevice", "creates", "persistent", "macvtap", "device", "and", "returns", "a", "newly", "created", "netlink", ".", "Link", "structure", "using", "part", "of", "pod", "hash", "and", "interface", "number", "in", "interface", "name" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/networking/kvm.go#L92-L146
20,914
rkt/rkt
networking/kvm.go
kvmTeardown
func (n *Networking) kvmTeardown() { if err := n.teardownForwarding(); err != nil { stderr.PrintE("error removing forwarded ports (kvm)", err) } n.teardownKvmNets() }
go
func (n *Networking) kvmTeardown() { if err := n.teardownForwarding(); err != nil { stderr.PrintE("error removing forwarded ports (kvm)", err) } n.teardownKvmNets() }
[ "func", "(", "n", "*", "Networking", ")", "kvmTeardown", "(", ")", "{", "if", "err", ":=", "n", ".", "teardownForwarding", "(", ")", ";", "err", "!=", "nil", "{", "stderr", ".", "PrintE", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "n", ...
// kvmTeardown network teardown for kvm flavor based pods // similar to Networking.Teardown but without host namespaces
[ "kvmTeardown", "network", "teardown", "for", "kvm", "flavor", "based", "pods", "similar", "to", "Networking", ".", "Teardown", "but", "without", "host", "namespaces" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/networking/kvm.go#L705-L711
20,915
rkt/rkt
rkt/image/filefetcher.go
Hash
func (f *fileFetcher) Hash(aciPath string, a *asc) (string, error) { ensureLogger(f.Debug) absPath, err := filepath.Abs(aciPath) if err != nil { return "", errwrap.Wrap(fmt.Errorf("failed to get an absolute path for %q", aciPath), err) } aciPath = absPath aciFile, err := f.getFile(aciPath, a) if err != nil { ...
go
func (f *fileFetcher) Hash(aciPath string, a *asc) (string, error) { ensureLogger(f.Debug) absPath, err := filepath.Abs(aciPath) if err != nil { return "", errwrap.Wrap(fmt.Errorf("failed to get an absolute path for %q", aciPath), err) } aciPath = absPath aciFile, err := f.getFile(aciPath, a) if err != nil { ...
[ "func", "(", "f", "*", "fileFetcher", ")", "Hash", "(", "aciPath", "string", ",", "a", "*", "asc", ")", "(", "string", ",", "error", ")", "{", "ensureLogger", "(", "f", ".", "Debug", ")", "\n", "absPath", ",", "err", ":=", "filepath", ".", "Abs", ...
// Hash opens a file, optionally verifies it against passed asc, // stores it in the store and returns the hash.
[ "Hash", "opens", "a", "file", "optionally", "verifies", "it", "against", "passed", "asc", "stores", "it", "in", "the", "store", "and", "returns", "the", "hash", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/image/filefetcher.go#L39-L61
20,916
rkt/rkt
rkt/image/filefetcher.go
getVerifiedFile
func (f *fileFetcher) getVerifiedFile(aciPath string, a *asc) (*os.File, error) { var aciFile *os.File // closed on error var errClose error // error signaling to close aciFile f.maybeOverrideAsc(aciPath, a) ascFile, err := a.Get() if err != nil { return nil, errwrap.Wrap(errors.New("error opening signature f...
go
func (f *fileFetcher) getVerifiedFile(aciPath string, a *asc) (*os.File, error) { var aciFile *os.File // closed on error var errClose error // error signaling to close aciFile f.maybeOverrideAsc(aciPath, a) ascFile, err := a.Get() if err != nil { return nil, errwrap.Wrap(errors.New("error opening signature f...
[ "func", "(", "f", "*", "fileFetcher", ")", "getVerifiedFile", "(", "aciPath", "string", ",", "a", "*", "asc", ")", "(", "*", "os", ".", "File", ",", "error", ")", "{", "var", "aciFile", "*", "os", ".", "File", "// closed on error", "\n", "var", "errC...
// fetch opens and verifies the ACI.
[ "fetch", "opens", "and", "verifies", "the", "ACI", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/image/filefetcher.go#L82-L116
20,917
rkt/rkt
pkg/fs/mount.go
NewLoggingMounter
func NewLoggingMounter(m Mounter, um Unmounter, logf func(string, ...interface{})) MountUnmounter { return &loggingMounter{m, um, logf} }
go
func NewLoggingMounter(m Mounter, um Unmounter, logf func(string, ...interface{})) MountUnmounter { return &loggingMounter{m, um, logf} }
[ "func", "NewLoggingMounter", "(", "m", "Mounter", ",", "um", "Unmounter", ",", "logf", "func", "(", "string", ",", "...", "interface", "{", "}", ")", ")", "MountUnmounter", "{", "return", "&", "loggingMounter", "{", "m", ",", "um", ",", "logf", "}", "\...
// NewLoggingMounter returns a MountUnmounter that logs mount events using the given logger func.
[ "NewLoggingMounter", "returns", "a", "MountUnmounter", "that", "logs", "mount", "events", "using", "the", "given", "logger", "func", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/pkg/fs/mount.go#L56-L58
20,918
rkt/rkt
pkg/tpm/tpm.go
Extend
func Extend(description string) error { connection := tpmclient.New("localhost:12041", timeout) err := connection.Extend(15, 0x1000, nil, description) return err }
go
func Extend(description string) error { connection := tpmclient.New("localhost:12041", timeout) err := connection.Extend(15, 0x1000, nil, description) return err }
[ "func", "Extend", "(", "description", "string", ")", "error", "{", "connection", ":=", "tpmclient", ".", "New", "(", "\"", "\"", ",", "timeout", ")", "\n", "err", ":=", "connection", ".", "Extend", "(", "15", ",", "0x1000", ",", "nil", ",", "descriptio...
// Extend extends the TPM log with the provided string. Returns any error.
[ "Extend", "extends", "the", "TPM", "log", "with", "the", "provided", "string", ".", "Returns", "any", "error", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/pkg/tpm/tpm.go#L29-L33
20,919
rkt/rkt
common/common.go
Stage1RootfsPath
func Stage1RootfsPath(root string) string { return filepath.Join(Stage1ImagePath(root), aci.RootfsDir) }
go
func Stage1RootfsPath(root string) string { return filepath.Join(Stage1ImagePath(root), aci.RootfsDir) }
[ "func", "Stage1RootfsPath", "(", "root", "string", ")", "string", "{", "return", "filepath", ".", "Join", "(", "Stage1ImagePath", "(", "root", ")", ",", "aci", ".", "RootfsDir", ")", "\n", "}" ]
// Stage1RootfsPath returns the path to the stage1 rootfs
[ "Stage1RootfsPath", "returns", "the", "path", "to", "the", "stage1", "rootfs" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L101-L103
20,920
rkt/rkt
common/common.go
Stage1ManifestPath
func Stage1ManifestPath(root string) string { return filepath.Join(Stage1ImagePath(root), aci.ManifestFile) }
go
func Stage1ManifestPath(root string) string { return filepath.Join(Stage1ImagePath(root), aci.ManifestFile) }
[ "func", "Stage1ManifestPath", "(", "root", "string", ")", "string", "{", "return", "filepath", ".", "Join", "(", "Stage1ImagePath", "(", "root", ")", ",", "aci", ".", "ManifestFile", ")", "\n", "}" ]
// Stage1ManifestPath returns the path to the stage1's manifest file inside the expanded ACI.
[ "Stage1ManifestPath", "returns", "the", "path", "to", "the", "stage1", "s", "manifest", "file", "inside", "the", "expanded", "ACI", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L106-L108
20,921
rkt/rkt
common/common.go
AppStatusPath
func AppStatusPath(root, appName string) string { return filepath.Join(AppsStatusesPath(root), appName) }
go
func AppStatusPath(root, appName string) string { return filepath.Join(AppsStatusesPath(root), appName) }
[ "func", "AppStatusPath", "(", "root", ",", "appName", "string", ")", "string", "{", "return", "filepath", ".", "Join", "(", "AppsStatusesPath", "(", "root", ")", ",", "appName", ")", "\n", "}" ]
// AppStatusPath returns the path of the status file of an app.
[ "AppStatusPath", "returns", "the", "path", "of", "the", "status", "file", "of", "an", "app", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L140-L142
20,922
rkt/rkt
common/common.go
AppStatusPathFromStage1Rootfs
func AppStatusPathFromStage1Rootfs(rootfs, appName string) string { return filepath.Join(AppsStatusesPathFromStage1Rootfs(rootfs), appName) }
go
func AppStatusPathFromStage1Rootfs(rootfs, appName string) string { return filepath.Join(AppsStatusesPathFromStage1Rootfs(rootfs), appName) }
[ "func", "AppStatusPathFromStage1Rootfs", "(", "rootfs", ",", "appName", "string", ")", "string", "{", "return", "filepath", ".", "Join", "(", "AppsStatusesPathFromStage1Rootfs", "(", "rootfs", ")", ",", "appName", ")", "\n", "}" ]
// AppStatusPathFromStage1Rootfs returns the path of the status file of an app. // It receives the stage1 rootfs as parameter instead of the pod root.
[ "AppStatusPathFromStage1Rootfs", "returns", "the", "path", "of", "the", "status", "file", "of", "an", "app", ".", "It", "receives", "the", "stage1", "rootfs", "as", "parameter", "instead", "of", "the", "pod", "root", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L146-L148
20,923
rkt/rkt
common/common.go
AppPath
func AppPath(root string, appName types.ACName) string { return filepath.Join(AppsPath(root), appName.String()) }
go
func AppPath(root string, appName types.ACName) string { return filepath.Join(AppsPath(root), appName.String()) }
[ "func", "AppPath", "(", "root", "string", ",", "appName", "types", ".", "ACName", ")", "string", "{", "return", "filepath", ".", "Join", "(", "AppsPath", "(", "root", ")", ",", "appName", ".", "String", "(", ")", ")", "\n", "}" ]
// AppPath returns the path to an app's rootfs.
[ "AppPath", "returns", "the", "path", "to", "an", "app", "s", "rootfs", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L182-L184
20,924
rkt/rkt
common/common.go
AppRootfsPath
func AppRootfsPath(root string, appName types.ACName) string { return filepath.Join(AppPath(root, appName), aci.RootfsDir) }
go
func AppRootfsPath(root string, appName types.ACName) string { return filepath.Join(AppPath(root, appName), aci.RootfsDir) }
[ "func", "AppRootfsPath", "(", "root", "string", ",", "appName", "types", ".", "ACName", ")", "string", "{", "return", "filepath", ".", "Join", "(", "AppPath", "(", "root", ",", "appName", ")", ",", "aci", ".", "RootfsDir", ")", "\n", "}" ]
// AppRootfsPath returns the path to an app's rootfs.
[ "AppRootfsPath", "returns", "the", "path", "to", "an", "app", "s", "rootfs", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L187-L189
20,925
rkt/rkt
common/common.go
RelAppPath
func RelAppPath(appName types.ACName) string { return filepath.Join(stage2Dir, appName.String()) }
go
func RelAppPath(appName types.ACName) string { return filepath.Join(stage2Dir, appName.String()) }
[ "func", "RelAppPath", "(", "appName", "types", ".", "ACName", ")", "string", "{", "return", "filepath", ".", "Join", "(", "stage2Dir", ",", "appName", ".", "String", "(", ")", ")", "\n", "}" ]
// RelAppPath returns the path of an app relative to the stage1 chroot.
[ "RelAppPath", "returns", "the", "path", "of", "an", "app", "relative", "to", "the", "stage1", "chroot", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L192-L194
20,926
rkt/rkt
common/common.go
RelAppRootfsPath
func RelAppRootfsPath(appName types.ACName) string { return filepath.Join(RelAppPath(appName), aci.RootfsDir) }
go
func RelAppRootfsPath(appName types.ACName) string { return filepath.Join(RelAppPath(appName), aci.RootfsDir) }
[ "func", "RelAppRootfsPath", "(", "appName", "types", ".", "ACName", ")", "string", "{", "return", "filepath", ".", "Join", "(", "RelAppPath", "(", "appName", ")", ",", "aci", ".", "RootfsDir", ")", "\n", "}" ]
// RelAppRootfsPath returns the path of an app's rootfs relative to the stage1 chroot.
[ "RelAppRootfsPath", "returns", "the", "path", "of", "an", "app", "s", "rootfs", "relative", "to", "the", "stage1", "chroot", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L197-L199
20,927
rkt/rkt
common/common.go
ImageManifestPath
func ImageManifestPath(root string, appName types.ACName) string { return filepath.Join(AppPath(root, appName), aci.ManifestFile) }
go
func ImageManifestPath(root string, appName types.ACName) string { return filepath.Join(AppPath(root, appName), aci.ManifestFile) }
[ "func", "ImageManifestPath", "(", "root", "string", ",", "appName", "types", ".", "ACName", ")", "string", "{", "return", "filepath", ".", "Join", "(", "AppPath", "(", "root", ",", "appName", ")", ",", "aci", ".", "ManifestFile", ")", "\n", "}" ]
// ImageManifestPath returns the path to the app's manifest file of a pod.
[ "ImageManifestPath", "returns", "the", "path", "to", "the", "app", "s", "manifest", "file", "of", "a", "pod", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L202-L204
20,928
rkt/rkt
common/common.go
AppInfoPath
func AppInfoPath(root string, appName types.ACName) string { return filepath.Join(AppsInfoPath(root), appName.String()) }
go
func AppInfoPath(root string, appName types.ACName) string { return filepath.Join(AppsInfoPath(root), appName.String()) }
[ "func", "AppInfoPath", "(", "root", "string", ",", "appName", "types", ".", "ACName", ")", "string", "{", "return", "filepath", ".", "Join", "(", "AppsInfoPath", "(", "root", ")", ",", "appName", ".", "String", "(", ")", ")", "\n", "}" ]
// AppInfoPath returns the path to the app's appsinfo directory of a pod.
[ "AppInfoPath", "returns", "the", "path", "to", "the", "app", "s", "appsinfo", "directory", "of", "a", "pod", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L212-L214
20,929
rkt/rkt
common/common.go
AppTreeStoreIDPath
func AppTreeStoreIDPath(root string, appName types.ACName) string { return filepath.Join(AppInfoPath(root, appName), AppTreeStoreIDFilename) }
go
func AppTreeStoreIDPath(root string, appName types.ACName) string { return filepath.Join(AppInfoPath(root, appName), AppTreeStoreIDFilename) }
[ "func", "AppTreeStoreIDPath", "(", "root", "string", ",", "appName", "types", ".", "ACName", ")", "string", "{", "return", "filepath", ".", "Join", "(", "AppInfoPath", "(", "root", ",", "appName", ")", ",", "AppTreeStoreIDFilename", ")", "\n", "}" ]
// AppTreeStoreIDPath returns the path to the app's treeStoreID file of a pod.
[ "AppTreeStoreIDPath", "returns", "the", "path", "to", "the", "app", "s", "treeStoreID", "file", "of", "a", "pod", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L217-L219
20,930
rkt/rkt
common/common.go
AppImageManifestPath
func AppImageManifestPath(root string, appName types.ACName) string { return filepath.Join(AppInfoPath(root, appName), aci.ManifestFile) }
go
func AppImageManifestPath(root string, appName types.ACName) string { return filepath.Join(AppInfoPath(root, appName), aci.ManifestFile) }
[ "func", "AppImageManifestPath", "(", "root", "string", ",", "appName", "types", ".", "ACName", ")", "string", "{", "return", "filepath", ".", "Join", "(", "AppInfoPath", "(", "root", ",", "appName", ")", ",", "aci", ".", "ManifestFile", ")", "\n", "}" ]
// AppImageManifestPath returns the path to the app's ImageManifest file
[ "AppImageManifestPath", "returns", "the", "path", "to", "the", "app", "s", "ImageManifest", "file" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L222-L224
20,931
rkt/rkt
common/common.go
CreateSharedVolumesPath
func CreateSharedVolumesPath(root string) (string, error) { sharedVolPath := SharedVolumesPath(root) if err := os.MkdirAll(sharedVolPath, SharedVolumePerm); err != nil { return "", errwrap.Wrap(errors.New("could not create shared volumes directory"), err) } // In case it already existed and we didn't make it, en...
go
func CreateSharedVolumesPath(root string) (string, error) { sharedVolPath := SharedVolumesPath(root) if err := os.MkdirAll(sharedVolPath, SharedVolumePerm); err != nil { return "", errwrap.Wrap(errors.New("could not create shared volumes directory"), err) } // In case it already existed and we didn't make it, en...
[ "func", "CreateSharedVolumesPath", "(", "root", "string", ")", "(", "string", ",", "error", ")", "{", "sharedVolPath", ":=", "SharedVolumesPath", "(", "root", ")", "\n\n", "if", "err", ":=", "os", ".", "MkdirAll", "(", "sharedVolPath", ",", "SharedVolumePerm",...
// CreateSharedVolumesPath ensures the sharedVolumePath for the pod root passed // in exists. It returns the shared volume path or an error.
[ "CreateSharedVolumesPath", "ensures", "the", "sharedVolumePath", "for", "the", "pod", "root", "passed", "in", "exists", ".", "It", "returns", "the", "shared", "volume", "path", "or", "an", "error", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L233-L246
20,932
rkt/rkt
common/common.go
MetadataServicePublicURL
func MetadataServicePublicURL(ip net.IP, token string) string { return fmt.Sprintf("http://%v:%v/%v", ip, MetadataServicePort, token) }
go
func MetadataServicePublicURL(ip net.IP, token string) string { return fmt.Sprintf("http://%v:%v/%v", ip, MetadataServicePort, token) }
[ "func", "MetadataServicePublicURL", "(", "ip", "net", ".", "IP", ",", "token", "string", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "ip", ",", "MetadataServicePort", ",", "token", ")", "\n", "}" ]
// MetadataServicePublicURL returns the public URL used to host the metadata service
[ "MetadataServicePublicURL", "returns", "the", "public", "URL", "used", "to", "host", "the", "metadata", "service" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L249-L251
20,933
rkt/rkt
common/common.go
LookupPath
func LookupPath(bin string, paths string) (string, error) { pathsArr := filepath.SplitList(paths) for _, path := range pathsArr { binPath := filepath.Join(path, bin) binAbsPath, err := filepath.Abs(binPath) if err != nil { return "", fmt.Errorf("unable to find absolute path for %s", binPath) } if fileuti...
go
func LookupPath(bin string, paths string) (string, error) { pathsArr := filepath.SplitList(paths) for _, path := range pathsArr { binPath := filepath.Join(path, bin) binAbsPath, err := filepath.Abs(binPath) if err != nil { return "", fmt.Errorf("unable to find absolute path for %s", binPath) } if fileuti...
[ "func", "LookupPath", "(", "bin", "string", ",", "paths", "string", ")", "(", "string", ",", "error", ")", "{", "pathsArr", ":=", "filepath", ".", "SplitList", "(", "paths", ")", "\n", "for", "_", ",", "path", ":=", "range", "pathsArr", "{", "binPath",...
// LookupPath search for bin in paths. If found, it returns its absolute path, // if not, an error
[ "LookupPath", "search", "for", "bin", "in", "paths", ".", "If", "found", "it", "returns", "its", "absolute", "path", "if", "not", "an", "error" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L375-L388
20,934
rkt/rkt
common/common.go
SystemdVersion
func SystemdVersion(systemdBinaryPath string) (int, error) { versionBytes, err := exec.Command(systemdBinaryPath, "--version").CombinedOutput() if err != nil { return -1, errwrap.Wrap(fmt.Errorf("unable to probe %s version", systemdBinaryPath), err) } versionStr := strings.SplitN(string(versionBytes), "\n", 2)[0]...
go
func SystemdVersion(systemdBinaryPath string) (int, error) { versionBytes, err := exec.Command(systemdBinaryPath, "--version").CombinedOutput() if err != nil { return -1, errwrap.Wrap(fmt.Errorf("unable to probe %s version", systemdBinaryPath), err) } versionStr := strings.SplitN(string(versionBytes), "\n", 2)[0]...
[ "func", "SystemdVersion", "(", "systemdBinaryPath", "string", ")", "(", "int", ",", "error", ")", "{", "versionBytes", ",", "err", ":=", "exec", ".", "Command", "(", "systemdBinaryPath", ",", "\"", "\"", ")", ".", "CombinedOutput", "(", ")", "\n", "if", ...
// SystemdVersion parses and returns the version of a given systemd binary
[ "SystemdVersion", "parses", "and", "returns", "the", "version", "of", "a", "given", "systemd", "binary" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L391-L404
20,935
rkt/rkt
common/common.go
SupportsOverlay
func SupportsOverlay() error { // ignore exec.Command error, modprobe may not be present on the system, // or the kernel module will fail to load. // we'll find out by reading the side effect in /proc/filesystems _ = exec.Command("modprobe", "overlay").Run() f, err := os.Open("/proc/filesystems") if err != nil {...
go
func SupportsOverlay() error { // ignore exec.Command error, modprobe may not be present on the system, // or the kernel module will fail to load. // we'll find out by reading the side effect in /proc/filesystems _ = exec.Command("modprobe", "overlay").Run() f, err := os.Open("/proc/filesystems") if err != nil {...
[ "func", "SupportsOverlay", "(", ")", "error", "{", "// ignore exec.Command error, modprobe may not be present on the system,", "// or the kernel module will fail to load.", "// we'll find out by reading the side effect in /proc/filesystems", "_", "=", "exec", ".", "Command", "(", "\"",...
// SupportsOverlay returns whether the operating system generally supports OverlayFS, // returning an instance of ErrOverlayUnsupported which encodes the reason. // It is sufficient to check for nil if the reason is not of interest.
[ "SupportsOverlay", "returns", "whether", "the", "operating", "system", "generally", "supports", "OverlayFS", "returning", "an", "instance", "of", "ErrOverlayUnsupported", "which", "encodes", "the", "reason", ".", "It", "is", "sufficient", "to", "check", "for", "nil"...
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L409-L430
20,936
rkt/rkt
common/common.go
RemoveEmptyLines
func RemoveEmptyLines(str string) []string { lines := make([]string, 0) for _, v := range strings.Split(str, "\n") { if len(v) > 0 { lines = append(lines, v) } } return lines }
go
func RemoveEmptyLines(str string) []string { lines := make([]string, 0) for _, v := range strings.Split(str, "\n") { if len(v) > 0 { lines = append(lines, v) } } return lines }
[ "func", "RemoveEmptyLines", "(", "str", "string", ")", "[", "]", "string", "{", "lines", ":=", "make", "(", "[", "]", "string", ",", "0", ")", "\n\n", "for", "_", ",", "v", ":=", "range", "strings", ".", "Split", "(", "str", ",", "\"", "\\n", "\"...
// RemoveEmptyLines removes empty lines from the given string // and breaks it up into a list of strings at newline characters
[ "RemoveEmptyLines", "removes", "empty", "lines", "from", "the", "given", "string", "and", "breaks", "it", "up", "into", "a", "list", "of", "strings", "at", "newline", "characters" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L490-L500
20,937
rkt/rkt
common/common.go
GetExitStatus
func GetExitStatus(err error) (int, error) { if err == nil { return 0, nil } if exiterr, ok := err.(*exec.ExitError); ok { // the program has exited with an exit code != 0 if status, ok := exiterr.Sys().(syscall.WaitStatus); ok { return status.ExitStatus(), nil } } return -1, err }
go
func GetExitStatus(err error) (int, error) { if err == nil { return 0, nil } if exiterr, ok := err.(*exec.ExitError); ok { // the program has exited with an exit code != 0 if status, ok := exiterr.Sys().(syscall.WaitStatus); ok { return status.ExitStatus(), nil } } return -1, err }
[ "func", "GetExitStatus", "(", "err", "error", ")", "(", "int", ",", "error", ")", "{", "if", "err", "==", "nil", "{", "return", "0", ",", "nil", "\n", "}", "\n", "if", "exiterr", ",", "ok", ":=", "err", ".", "(", "*", "exec", ".", "ExitError", ...
// GetExitStatus converts an error to an exit status. If it wasn't an exit // status != 0 it returns the same error that it was called with
[ "GetExitStatus", "converts", "an", "error", "to", "an", "exit", "status", ".", "If", "it", "wasn", "t", "an", "exit", "status", "!", "=", "0", "it", "returns", "the", "same", "error", "that", "it", "was", "called", "with" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L504-L515
20,938
rkt/rkt
common/common.go
ImageNameToAppName
func ImageNameToAppName(name types.ACIdentifier) (*types.ACName, error) { parts := strings.Split(name.String(), "/") last := parts[len(parts)-1] sn, err := types.SanitizeACName(last) if err != nil { return nil, err } return types.MustACName(sn), nil }
go
func ImageNameToAppName(name types.ACIdentifier) (*types.ACName, error) { parts := strings.Split(name.String(), "/") last := parts[len(parts)-1] sn, err := types.SanitizeACName(last) if err != nil { return nil, err } return types.MustACName(sn), nil }
[ "func", "ImageNameToAppName", "(", "name", "types", ".", "ACIdentifier", ")", "(", "*", "types", ".", "ACName", ",", "error", ")", "{", "parts", ":=", "strings", ".", "Split", "(", "name", ".", "String", "(", ")", ",", "\"", "\"", ")", "\n", "last", ...
// ImageNameToAppName converts the full name of image to an app name without special // characters - we use it as a default app name when specyfing it is optional
[ "ImageNameToAppName", "converts", "the", "full", "name", "of", "image", "to", "an", "app", "name", "without", "special", "characters", "-", "we", "use", "it", "as", "a", "default", "app", "name", "when", "specyfing", "it", "is", "optional" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/common/common.go#L545-L555
20,939
rkt/rkt
stage1/init/kvm/network.go
GetNetworkDescriptions
func GetNetworkDescriptions(n *networking.Networking) []NetDescriber { var nds []NetDescriber for _, an := range n.GetActiveNetworks() { nds = append(nds, an) } return nds }
go
func GetNetworkDescriptions(n *networking.Networking) []NetDescriber { var nds []NetDescriber for _, an := range n.GetActiveNetworks() { nds = append(nds, an) } return nds }
[ "func", "GetNetworkDescriptions", "(", "n", "*", "networking", ".", "Networking", ")", "[", "]", "NetDescriber", "{", "var", "nds", "[", "]", "NetDescriber", "\n", "for", "_", ",", "an", ":=", "range", "n", ".", "GetActiveNetworks", "(", ")", "{", "nds",...
// GetNetworkDescriptions converts activeNets to netDescribers
[ "GetNetworkDescriptions", "converts", "activeNets", "to", "netDescribers" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/kvm/network.go#L32-L38
20,940
rkt/rkt
stage1/init/kvm/network.go
GetKVMNetArgs
func GetKVMNetArgs(nds []NetDescriber) ([]string, error) { var lkvmArgs []string for _, nd := range nds { lkvmArgs = append(lkvmArgs, "--network") lkvmArg := fmt.Sprintf("mode=tap,tapif=%s,host_ip=%s,guest_ip=%s", nd.IfName(), nd.Gateway(), nd.GuestIP()) lkvmArgs = append(lkvmArgs, lkvmArg) } return lkvmAr...
go
func GetKVMNetArgs(nds []NetDescriber) ([]string, error) { var lkvmArgs []string for _, nd := range nds { lkvmArgs = append(lkvmArgs, "--network") lkvmArg := fmt.Sprintf("mode=tap,tapif=%s,host_ip=%s,guest_ip=%s", nd.IfName(), nd.Gateway(), nd.GuestIP()) lkvmArgs = append(lkvmArgs, lkvmArg) } return lkvmAr...
[ "func", "GetKVMNetArgs", "(", "nds", "[", "]", "NetDescriber", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "lkvmArgs", "[", "]", "string", "\n\n", "for", "_", ",", "nd", ":=", "range", "nds", "{", "lkvmArgs", "=", "append", "(", "l...
// GetKVMNetArgs returns additional arguments that need to be passed // to lkvm tool to configure networks properly. // Logic is based on Network configuration extracted from Networking struct // and essentially from activeNets that expose netDescriber behavior
[ "GetKVMNetArgs", "returns", "additional", "arguments", "that", "need", "to", "be", "passed", "to", "lkvm", "tool", "to", "configure", "networks", "properly", ".", "Logic", "is", "based", "on", "Network", "configuration", "extracted", "from", "Networking", "struct"...
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/kvm/network.go#L55-L66
20,941
rkt/rkt
stage1/init/kvm/network.go
generateMacAddress
func generateMacAddress() (net.HardwareAddr, error) { mac := []byte{ 2, // locally administered unicast 0x65, 0x02, // OUI (randomly chosen by jell) 0, 0, 0, // bytes to randomly overwrite } _, err := rand.Read(mac[3:6]) if err != nil { return nil, errwrap.Wrap(errors.New("cannot generate random m...
go
func generateMacAddress() (net.HardwareAddr, error) { mac := []byte{ 2, // locally administered unicast 0x65, 0x02, // OUI (randomly chosen by jell) 0, 0, 0, // bytes to randomly overwrite } _, err := rand.Read(mac[3:6]) if err != nil { return nil, errwrap.Wrap(errors.New("cannot generate random m...
[ "func", "generateMacAddress", "(", ")", "(", "net", ".", "HardwareAddr", ",", "error", ")", "{", "mac", ":=", "[", "]", "byte", "{", "2", ",", "// locally administered unicast", "0x65", ",", "0x02", ",", "// OUI (randomly chosen by jell)", "0", ",", "0", ","...
// generateMacAddress returns net.HardwareAddr filled with fixed 3 byte prefix // complemented by 3 random bytes.
[ "generateMacAddress", "returns", "net", ".", "HardwareAddr", "filled", "with", "fixed", "3", "byte", "prefix", "complemented", "by", "3", "random", "bytes", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/kvm/network.go#L70-L83
20,942
rkt/rkt
tools/depsgen/util.go
replacePlaceholders
func replacePlaceholders(str string, kv ...string) string { for ph, value := range toMap(kv...) { str = strings.Replace(str, "!!!"+ph+"!!!", value, -1) } return str }
go
func replacePlaceholders(str string, kv ...string) string { for ph, value := range toMap(kv...) { str = strings.Replace(str, "!!!"+ph+"!!!", value, -1) } return str }
[ "func", "replacePlaceholders", "(", "str", "string", ",", "kv", "...", "string", ")", "string", "{", "for", "ph", ",", "value", ":=", "range", "toMap", "(", "kv", "...", ")", "{", "str", "=", "strings", ".", "Replace", "(", "str", ",", "\"", "\"", ...
// replacePlaceholders replaces placeholders with values in kv in // initial str. Placeholders are in form of !!!FOO!!!, but those // passed here should be without exclamation marks.
[ "replacePlaceholders", "replaces", "placeholders", "with", "values", "in", "kv", "in", "initial", "str", ".", "Placeholders", "are", "in", "form", "of", "!!!FOO!!!", "but", "those", "passed", "here", "should", "be", "without", "exclamation", "marks", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/tools/depsgen/util.go#L54-L59
20,943
rkt/rkt
tools/depsgen/util.go
standardFlags
func standardFlags(cmd string) (*flag.FlagSet, *string) { f := flag.NewFlagSet(appName()+" "+cmd, flag.ExitOnError) target := f.String("target", "", "Make target (example: $(FOO_BINARY))") return f, target }
go
func standardFlags(cmd string) (*flag.FlagSet, *string) { f := flag.NewFlagSet(appName()+" "+cmd, flag.ExitOnError) target := f.String("target", "", "Make target (example: $(FOO_BINARY))") return f, target }
[ "func", "standardFlags", "(", "cmd", "string", ")", "(", "*", "flag", ".", "FlagSet", ",", "*", "string", ")", "{", "f", ":=", "flag", ".", "NewFlagSet", "(", "appName", "(", ")", "+", "\"", "\"", "+", "cmd", ",", "flag", ".", "ExitOnError", ")", ...
// standardFlags returns a new flag set with target flag already set up
[ "standardFlags", "returns", "a", "new", "flag", "set", "with", "target", "flag", "already", "set", "up" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/tools/depsgen/util.go#L62-L66
20,944
rkt/rkt
networking/net_plugin.go
netPluginAdd
func (e *podEnv) netPluginAdd(n *activeNet, netns string) error { output, err := e.execNetPlugin("ADD", n, netns) if err != nil { return pluginErr(err, output) } pr := cnitypes.Result{} if err = json.Unmarshal(output, &pr); err != nil { err = errwrap.Wrap(fmt.Errorf("parsing %q", string(output)), err) retur...
go
func (e *podEnv) netPluginAdd(n *activeNet, netns string) error { output, err := e.execNetPlugin("ADD", n, netns) if err != nil { return pluginErr(err, output) } pr := cnitypes.Result{} if err = json.Unmarshal(output, &pr); err != nil { err = errwrap.Wrap(fmt.Errorf("parsing %q", string(output)), err) retur...
[ "func", "(", "e", "*", "podEnv", ")", "netPluginAdd", "(", "n", "*", "activeNet", ",", "netns", "string", ")", "error", "{", "output", ",", "err", ":=", "e", ".", "execNetPlugin", "(", "\"", "\"", ",", "n", ",", "netns", ")", "\n", "if", "err", "...
// Executes a given network plugin. If successful, mutates n.runtime with // the runtime information
[ "Executes", "a", "given", "network", "plugin", ".", "If", "successful", "mutates", "n", ".", "runtime", "with", "the", "runtime", "information" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/networking/net_plugin.go#L54-L73
20,945
rkt/rkt
rkt/api_service.go
copyPod
func copyPod(pod *v1alpha.Pod) *v1alpha.Pod { p := &v1alpha.Pod{ Id: pod.Id, Manifest: pod.Manifest, Annotations: pod.Annotations, } for _, app := range pod.Apps { p.Apps = append(p.Apps, &v1alpha.App{ Name: app.Name, Image: app.Image, Annotations: app.Annotations, }) } ...
go
func copyPod(pod *v1alpha.Pod) *v1alpha.Pod { p := &v1alpha.Pod{ Id: pod.Id, Manifest: pod.Manifest, Annotations: pod.Annotations, } for _, app := range pod.Apps { p.Apps = append(p.Apps, &v1alpha.App{ Name: app.Name, Image: app.Image, Annotations: app.Annotations, }) } ...
[ "func", "copyPod", "(", "pod", "*", "v1alpha", ".", "Pod", ")", "*", "v1alpha", ".", "Pod", "{", "p", ":=", "&", "v1alpha", ".", "Pod", "{", "Id", ":", "pod", ".", "Id", ",", "Manifest", ":", "pod", ".", "Manifest", ",", "Annotations", ":", "pod"...
// copyPod copies the immutable information of the pod into the new pod.
[ "copyPod", "copies", "the", "immutable", "information", "of", "the", "pod", "into", "the", "new", "pod", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/api_service.go#L89-L104
20,946
rkt/rkt
rkt/api_service.go
copyImage
func copyImage(img *v1alpha.Image) *v1alpha.Image { return &v1alpha.Image{ BaseFormat: img.BaseFormat, Id: img.Id, Name: img.Name, Version: img.Version, ImportTimestamp: img.ImportTimestamp, Manifest: img.Manifest, Size: img.Size, Annotations: ...
go
func copyImage(img *v1alpha.Image) *v1alpha.Image { return &v1alpha.Image{ BaseFormat: img.BaseFormat, Id: img.Id, Name: img.Name, Version: img.Version, ImportTimestamp: img.ImportTimestamp, Manifest: img.Manifest, Size: img.Size, Annotations: ...
[ "func", "copyImage", "(", "img", "*", "v1alpha", ".", "Image", ")", "*", "v1alpha", ".", "Image", "{", "return", "&", "v1alpha", ".", "Image", "{", "BaseFormat", ":", "img", ".", "BaseFormat", ",", "Id", ":", "img", ".", "Id", ",", "Name", ":", "im...
// copyImage copies the image object to avoid modification on the original one.
[ "copyImage", "copies", "the", "image", "object", "to", "avoid", "modification", "on", "the", "original", "one", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/api_service.go#L107-L119
20,947
rkt/rkt
rkt/api_service.go
GetInfo
func (s *v1AlphaAPIServer) GetInfo(context.Context, *v1alpha.GetInfoRequest) (*v1alpha.GetInfoResponse, error) { return &v1alpha.GetInfoResponse{ Info: &v1alpha.Info{ RktVersion: version.Version, AppcVersion: schema.AppContainerVersion.String(), ApiVersion: supportedAPIVersion, GlobalFlags: &v1alpha.Gl...
go
func (s *v1AlphaAPIServer) GetInfo(context.Context, *v1alpha.GetInfoRequest) (*v1alpha.GetInfoResponse, error) { return &v1alpha.GetInfoResponse{ Info: &v1alpha.Info{ RktVersion: version.Version, AppcVersion: schema.AppContainerVersion.String(), ApiVersion: supportedAPIVersion, GlobalFlags: &v1alpha.Gl...
[ "func", "(", "s", "*", "v1AlphaAPIServer", ")", "GetInfo", "(", "context", ".", "Context", ",", "*", "v1alpha", ".", "GetInfoRequest", ")", "(", "*", "v1alpha", ".", "GetInfoResponse", ",", "error", ")", "{", "return", "&", "v1alpha", ".", "GetInfoResponse...
// GetInfo returns the information about the rkt, appc, api server version.
[ "GetInfo", "returns", "the", "information", "about", "the", "rkt", "appc", "api", "server", "version", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/api_service.go#L154-L170
20,948
rkt/rkt
rkt/api_service.go
containsAllKeyValues
func containsAllKeyValues(actualKVs []*v1alpha.KeyValue, requiredKVs []*v1alpha.KeyValue) bool { for _, requiredKV := range requiredKVs { actualValue, ok := findInKeyValues(actualKVs, requiredKV.Key) if !ok || actualValue != requiredKV.Value { return false } } return true }
go
func containsAllKeyValues(actualKVs []*v1alpha.KeyValue, requiredKVs []*v1alpha.KeyValue) bool { for _, requiredKV := range requiredKVs { actualValue, ok := findInKeyValues(actualKVs, requiredKV.Key) if !ok || actualValue != requiredKV.Value { return false } } return true }
[ "func", "containsAllKeyValues", "(", "actualKVs", "[", "]", "*", "v1alpha", ".", "KeyValue", ",", "requiredKVs", "[", "]", "*", "v1alpha", ".", "KeyValue", ")", "bool", "{", "for", "_", ",", "requiredKV", ":=", "range", "requiredKVs", "{", "actualValue", "...
// containsAllKeyValues returns true if the actualKVs contains all of the key-value // pairs listed in requiredKVs, otherwise it returns false.
[ "containsAllKeyValues", "returns", "true", "if", "the", "actualKVs", "contains", "all", "of", "the", "key", "-", "value", "pairs", "listed", "in", "requiredKVs", "otherwise", "it", "returns", "false", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/api_service.go#L183-L191
20,949
rkt/rkt
rkt/api_service.go
satisfiesPodFilter
func satisfiesPodFilter(pod v1alpha.Pod, filter v1alpha.PodFilter) bool { // Filter according to the ID. if len(filter.Ids) > 0 { s := set.NewString(filter.Ids...) if !s.Has(pod.Id) { return false } } // Filter according to the state. if len(filter.States) > 0 { foundState := false for _, state := ra...
go
func satisfiesPodFilter(pod v1alpha.Pod, filter v1alpha.PodFilter) bool { // Filter according to the ID. if len(filter.Ids) > 0 { s := set.NewString(filter.Ids...) if !s.Has(pod.Id) { return false } } // Filter according to the state. if len(filter.States) > 0 { foundState := false for _, state := ra...
[ "func", "satisfiesPodFilter", "(", "pod", "v1alpha", ".", "Pod", ",", "filter", "v1alpha", ".", "PodFilter", ")", "bool", "{", "// Filter according to the ID.", "if", "len", "(", "filter", ".", "Ids", ")", ">", "0", "{", "s", ":=", "set", ".", "NewString",...
// satisfiesPodFilter returns true if the pod satisfies the filter. // The pod, filter must not be nil.
[ "satisfiesPodFilter", "returns", "true", "if", "the", "pod", "satisfies", "the", "filter", ".", "The", "pod", "filter", "must", "not", "be", "nil", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/api_service.go#L210-L299
20,950
rkt/rkt
rkt/api_service.go
satisfiesAnyPodFilters
func satisfiesAnyPodFilters(pod *v1alpha.Pod, filters []*v1alpha.PodFilter) bool { // No filters, return true directly. if len(filters) == 0 { return true } for _, filter := range filters { if satisfiesPodFilter(*pod, *filter) { return true } } return false }
go
func satisfiesAnyPodFilters(pod *v1alpha.Pod, filters []*v1alpha.PodFilter) bool { // No filters, return true directly. if len(filters) == 0 { return true } for _, filter := range filters { if satisfiesPodFilter(*pod, *filter) { return true } } return false }
[ "func", "satisfiesAnyPodFilters", "(", "pod", "*", "v1alpha", ".", "Pod", ",", "filters", "[", "]", "*", "v1alpha", ".", "PodFilter", ")", "bool", "{", "// No filters, return true directly.", "if", "len", "(", "filters", ")", "==", "0", "{", "return", "true"...
// satisfiesAnyPodFilters returns true if any of the filter conditions is satisfied // by the pod, or there's no filters.
[ "satisfiesAnyPodFilters", "returns", "true", "if", "any", "of", "the", "filter", "conditions", "is", "satisfied", "by", "the", "pod", "or", "there", "s", "no", "filters", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/api_service.go#L303-L315
20,951
rkt/rkt
rkt/api_service.go
getApplist
func getApplist(manifest *schema.PodManifest) []*v1alpha.App { var apps []*v1alpha.App for _, app := range manifest.Apps { img := &v1alpha.Image{ BaseFormat: &v1alpha.ImageFormat{ // Only support appc image now. If it's a docker image, then it // will be transformed to appc before storing in the disk sto...
go
func getApplist(manifest *schema.PodManifest) []*v1alpha.App { var apps []*v1alpha.App for _, app := range manifest.Apps { img := &v1alpha.Image{ BaseFormat: &v1alpha.ImageFormat{ // Only support appc image now. If it's a docker image, then it // will be transformed to appc before storing in the disk sto...
[ "func", "getApplist", "(", "manifest", "*", "schema", ".", "PodManifest", ")", "[", "]", "*", "v1alpha", ".", "App", "{", "var", "apps", "[", "]", "*", "v1alpha", ".", "App", "\n", "for", "_", ",", "app", ":=", "range", "manifest", ".", "Apps", "{"...
// getApplist returns a list of apps in the pod.
[ "getApplist", "returns", "a", "list", "of", "apps", "in", "the", "pod", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/api_service.go#L370-L393
20,952
rkt/rkt
rkt/api_service.go
getNetworks
func getNetworks(p *pkgPod.Pod) []*v1alpha.Network { var networks []*v1alpha.Network for _, n := range p.Nets { networks = append(networks, &v1alpha.Network{ Name: n.NetName, // There will be IPv6 support soon so distinguish between v4 and v6 Ipv4: n.IP.String(), }) } return networks }
go
func getNetworks(p *pkgPod.Pod) []*v1alpha.Network { var networks []*v1alpha.Network for _, n := range p.Nets { networks = append(networks, &v1alpha.Network{ Name: n.NetName, // There will be IPv6 support soon so distinguish between v4 and v6 Ipv4: n.IP.String(), }) } return networks }
[ "func", "getNetworks", "(", "p", "*", "pkgPod", ".", "Pod", ")", "[", "]", "*", "v1alpha", ".", "Network", "{", "var", "networks", "[", "]", "*", "v1alpha", ".", "Network", "\n", "for", "_", ",", "n", ":=", "range", "p", ".", "Nets", "{", "networ...
// getNetworks returns the list of the info of the network that the pod belongs to.
[ "getNetworks", "returns", "the", "list", "of", "the", "info", "of", "the", "network", "that", "the", "pod", "belongs", "to", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/api_service.go#L396-L406
20,953
rkt/rkt
rkt/api_service.go
fillStaticAppInfo
func fillStaticAppInfo(store *imagestore.Store, pod *pkgPod.Pod, v1pod *v1alpha.Pod) error { var errlist []error // Fill static app image info. for _, app := range v1pod.Apps { // Fill app's image info. app.Image = &v1alpha.Image{ BaseFormat: &v1alpha.ImageFormat{ // Only support appc image now. If it's ...
go
func fillStaticAppInfo(store *imagestore.Store, pod *pkgPod.Pod, v1pod *v1alpha.Pod) error { var errlist []error // Fill static app image info. for _, app := range v1pod.Apps { // Fill app's image info. app.Image = &v1alpha.Image{ BaseFormat: &v1alpha.ImageFormat{ // Only support appc image now. If it's ...
[ "func", "fillStaticAppInfo", "(", "store", "*", "imagestore", ".", "Store", ",", "pod", "*", "pkgPod", ".", "Pod", ",", "v1pod", "*", "v1alpha", ".", "Pod", ")", "error", "{", "var", "errlist", "[", "]", "error", "\n\n", "// Fill static app image info.", "...
// fillStaticAppInfo will modify the 'v1pod' in place with the information retrieved with 'pod'. // Today, these information are static and will not change during the pod's lifecycle.
[ "fillStaticAppInfo", "will", "modify", "the", "v1pod", "in", "place", "with", "the", "information", "retrieved", "with", "pod", ".", "Today", "these", "information", "are", "static", "and", "will", "not", "change", "during", "the", "pod", "s", "lifecycle", "."...
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/api_service.go#L419-L456
20,954
rkt/rkt
rkt/api_service.go
getBasicPod
func (s *v1AlphaAPIServer) getBasicPod(p *pkgPod.Pod) *v1alpha.Pod { mtime, mtimeErr := getPodManifestModTime(p) if mtimeErr != nil { stderr.PrintE(fmt.Sprintf("failed to read the pod manifest's mtime for pod %q", p.UUID), mtimeErr) } // Couldn't use pod.uuid directly as it's a pointer. itemValue, found := s.po...
go
func (s *v1AlphaAPIServer) getBasicPod(p *pkgPod.Pod) *v1alpha.Pod { mtime, mtimeErr := getPodManifestModTime(p) if mtimeErr != nil { stderr.PrintE(fmt.Sprintf("failed to read the pod manifest's mtime for pod %q", p.UUID), mtimeErr) } // Couldn't use pod.uuid directly as it's a pointer. itemValue, found := s.po...
[ "func", "(", "s", "*", "v1AlphaAPIServer", ")", "getBasicPod", "(", "p", "*", "pkgPod", ".", "Pod", ")", "*", "v1alpha", ".", "Pod", "{", "mtime", ",", "mtimeErr", ":=", "getPodManifestModTime", "(", "p", ")", "\n", "if", "mtimeErr", "!=", "nil", "{", ...
// getBasicPod returns v1alpha.Pod with basic pod information.
[ "getBasicPod", "returns", "v1alpha", ".", "Pod", "with", "basic", "pod", "information", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/api_service.go#L484-L513
20,955
rkt/rkt
rkt/api_service.go
aciInfoToV1AlphaAPIImage
func aciInfoToV1AlphaAPIImage(store *imagestore.Store, aciInfo *imagestore.ACIInfo) (*v1alpha.Image, error) { manifest, err := store.GetImageManifestJSON(aciInfo.BlobKey) if err != nil { stderr.PrintE("failed to read the image manifest", err) return nil, err } var im schema.ImageManifest if err = json.Unmarsh...
go
func aciInfoToV1AlphaAPIImage(store *imagestore.Store, aciInfo *imagestore.ACIInfo) (*v1alpha.Image, error) { manifest, err := store.GetImageManifestJSON(aciInfo.BlobKey) if err != nil { stderr.PrintE("failed to read the image manifest", err) return nil, err } var im schema.ImageManifest if err = json.Unmarsh...
[ "func", "aciInfoToV1AlphaAPIImage", "(", "store", "*", "imagestore", ".", "Store", ",", "aciInfo", "*", "imagestore", ".", "ACIInfo", ")", "(", "*", "v1alpha", ".", "Image", ",", "error", ")", "{", "manifest", ",", "err", ":=", "store", ".", "GetImageManif...
// aciInfoToV1AlphaAPIImage takes an aciInfo object and construct the v1alpha.Image object.
[ "aciInfoToV1AlphaAPIImage", "takes", "an", "aciInfo", "object", "and", "construct", "the", "v1alpha", ".", "Image", "object", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/api_service.go#L654-L688
20,956
rkt/rkt
rkt/api_service.go
satisfiesImageFilter
func satisfiesImageFilter(image v1alpha.Image, filter v1alpha.ImageFilter) bool { // Filter according to the IDs. if len(filter.Ids) > 0 { s := set.NewString(filter.Ids...) if !s.Has(image.Id) { return false } } // Filter according to the image full names. if len(filter.FullNames) > 0 { s := set.NewStr...
go
func satisfiesImageFilter(image v1alpha.Image, filter v1alpha.ImageFilter) bool { // Filter according to the IDs. if len(filter.Ids) > 0 { s := set.NewString(filter.Ids...) if !s.Has(image.Id) { return false } } // Filter according to the image full names. if len(filter.FullNames) > 0 { s := set.NewStr...
[ "func", "satisfiesImageFilter", "(", "image", "v1alpha", ".", "Image", ",", "filter", "v1alpha", ".", "ImageFilter", ")", "bool", "{", "// Filter according to the IDs.", "if", "len", "(", "filter", ".", "Ids", ")", ">", "0", "{", "s", ":=", "set", ".", "Ne...
// satisfiesImageFilter returns true if the image satisfies the filter. // The image, filter must not be nil.
[ "satisfiesImageFilter", "returns", "true", "if", "the", "image", "satisfies", "the", "filter", ".", "The", "image", "filter", "must", "not", "be", "nil", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/api_service.go#L716-L784
20,957
rkt/rkt
rkt/api_service.go
satisfiesAnyImageFilters
func satisfiesAnyImageFilters(image *v1alpha.Image, filters []*v1alpha.ImageFilter) bool { // No filters, return true directly. if len(filters) == 0 { return true } for _, filter := range filters { if satisfiesImageFilter(*image, *filter) { return true } } return false }
go
func satisfiesAnyImageFilters(image *v1alpha.Image, filters []*v1alpha.ImageFilter) bool { // No filters, return true directly. if len(filters) == 0 { return true } for _, filter := range filters { if satisfiesImageFilter(*image, *filter) { return true } } return false }
[ "func", "satisfiesAnyImageFilters", "(", "image", "*", "v1alpha", ".", "Image", ",", "filters", "[", "]", "*", "v1alpha", ".", "ImageFilter", ")", "bool", "{", "// No filters, return true directly.", "if", "len", "(", "filters", ")", "==", "0", "{", "return", ...
// satisfiesAnyImageFilters returns true if any of the filter conditions is satisfied // by the image, or there's no filters.
[ "satisfiesAnyImageFilters", "returns", "true", "if", "any", "of", "the", "filter", "conditions", "is", "satisfied", "by", "the", "image", "or", "there", "s", "no", "filters", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/api_service.go#L788-L799
20,958
rkt/rkt
rkt/api_service.go
runAPIService
func runAPIService(cmd *cobra.Command, args []string) (exit int) { // Set up the signal handler here so we can make sure the // signals are caught after print the starting message. signal.Notify(exitCh, syscall.SIGINT, syscall.SIGTERM) stderr.Print("API service starting...") listeners, err := openAPISockets() i...
go
func runAPIService(cmd *cobra.Command, args []string) (exit int) { // Set up the signal handler here so we can make sure the // signals are caught after print the starting message. signal.Notify(exitCh, syscall.SIGINT, syscall.SIGTERM) stderr.Print("API service starting...") listeners, err := openAPISockets() i...
[ "func", "runAPIService", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "(", "exit", "int", ")", "{", "// Set up the signal handler here so we can make sure the", "// signals are caught after print the starting message.", "signal", ".", ...
// Open one or more listening sockets, then start the gRPC server
[ "Open", "one", "or", "more", "listening", "sockets", "then", "start", "the", "gRPC", "server" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/api_service.go#L902-L941
20,959
rkt/rkt
stage1/init/common/units.go
WriteUnit
func (uw *UnitWriter) WriteUnit(path string, errmsg string, opts ...*unit.UnitOption) { if uw.err != nil { return } file, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) if err != nil { uw.err = errwrap.Wrap(errors.New(errmsg), err) return } defer file.Close() if _, err = io.Copy(file,...
go
func (uw *UnitWriter) WriteUnit(path string, errmsg string, opts ...*unit.UnitOption) { if uw.err != nil { return } file, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) if err != nil { uw.err = errwrap.Wrap(errors.New(errmsg), err) return } defer file.Close() if _, err = io.Copy(file,...
[ "func", "(", "uw", "*", "UnitWriter", ")", "WriteUnit", "(", "path", "string", ",", "errmsg", "string", ",", "opts", "...", "*", "unit", ".", "UnitOption", ")", "{", "if", "uw", ".", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "file", ","...
// WriteUnit writes a systemd unit in the given path with the given unit options // if no previous error occurred.
[ "WriteUnit", "writes", "a", "systemd", "unit", "in", "the", "given", "path", "with", "the", "given", "unit", "options", "if", "no", "previous", "error", "occurred", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/common/units.go#L367-L387
20,960
rkt/rkt
stage1/init/common/units.go
writeShutdownService
func (uw *UnitWriter) writeShutdownService(exec string, opts ...*unit.UnitOption) { if uw.err != nil { return } flavor, systemdVersion, err := GetFlavor(uw.p) if err != nil { uw.err = errwrap.Wrap(errors.New("failed to create shutdown service"), err) return } opts = append(opts, []*unit.UnitOption{ // T...
go
func (uw *UnitWriter) writeShutdownService(exec string, opts ...*unit.UnitOption) { if uw.err != nil { return } flavor, systemdVersion, err := GetFlavor(uw.p) if err != nil { uw.err = errwrap.Wrap(errors.New("failed to create shutdown service"), err) return } opts = append(opts, []*unit.UnitOption{ // T...
[ "func", "(", "uw", "*", "UnitWriter", ")", "writeShutdownService", "(", "exec", "string", ",", "opts", "...", "*", "unit", ".", "UnitOption", ")", "{", "if", "uw", ".", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "flavor", ",", "systemdVersio...
// writeShutdownService writes a shutdown.service unit with the given unit options // if no previous error occurred. // exec specifies how systemctl should be invoked, i.e. ExecStart, or ExecStop.
[ "writeShutdownService", "writes", "a", "shutdown", ".", "service", "unit", "with", "the", "given", "unit", "options", "if", "no", "previous", "error", "occurred", ".", "exec", "specifies", "how", "systemctl", "should", "be", "invoked", "i", ".", "e", ".", "E...
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/common/units.go#L392-L439
20,961
rkt/rkt
stage1/init/common/units.go
Activate
func (uw *UnitWriter) Activate(unit, wantPath string) { if uw.err != nil { return } if err := os.Symlink(path.Join("..", unit), wantPath); err != nil && !os.IsExist(err) { uw.err = errwrap.Wrap(errors.New("failed to link service want"), err) } }
go
func (uw *UnitWriter) Activate(unit, wantPath string) { if uw.err != nil { return } if err := os.Symlink(path.Join("..", unit), wantPath); err != nil && !os.IsExist(err) { uw.err = errwrap.Wrap(errors.New("failed to link service want"), err) } }
[ "func", "(", "uw", "*", "UnitWriter", ")", "Activate", "(", "unit", ",", "wantPath", "string", ")", "{", "if", "uw", ".", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "if", "err", ":=", "os", ".", "Symlink", "(", "path", ".", "Join", "("...
// Activate actives the given unit in the given wantPath.
[ "Activate", "actives", "the", "given", "unit", "in", "the", "given", "wantPath", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/common/units.go#L442-L450
20,962
rkt/rkt
stage1/init/common/units.go
AppUnit
func (uw *UnitWriter) AppUnit(ra *schema.RuntimeApp, binPath string, opts ...*unit.UnitOption) { if uw.err != nil { return } if len(ra.App.Exec) == 0 { uw.err = fmt.Errorf(`image %q has an empty "exec" (try --exec=BINARY)`, uw.p.AppNameToImageName(ra.Name)) return } pa, err := prepareApp(uw.p, ra) if e...
go
func (uw *UnitWriter) AppUnit(ra *schema.RuntimeApp, binPath string, opts ...*unit.UnitOption) { if uw.err != nil { return } if len(ra.App.Exec) == 0 { uw.err = fmt.Errorf(`image %q has an empty "exec" (try --exec=BINARY)`, uw.p.AppNameToImageName(ra.Name)) return } pa, err := prepareApp(uw.p, ra) if e...
[ "func", "(", "uw", "*", "UnitWriter", ")", "AppUnit", "(", "ra", "*", "schema", ".", "RuntimeApp", ",", "binPath", "string", ",", "opts", "...", "*", "unit", ".", "UnitOption", ")", "{", "if", "uw", ".", "err", "!=", "nil", "{", "return", "\n", "}"...
// AppUnit sets up the main systemd service unit for the application.
[ "AppUnit", "sets", "up", "the", "main", "systemd", "service", "unit", "for", "the", "application", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/common/units.go#L458-L509
20,963
rkt/rkt
stage1/init/common/units.go
AppReaperUnit
func (uw *UnitWriter) AppReaperUnit(appName types.ACName, binPath string, opts ...*unit.UnitOption) { if uw.err != nil { return } opts = append(opts, []*unit.UnitOption{ unit.NewUnitOption("Unit", "Description", fmt.Sprintf("%s Reaper", appName)), unit.NewUnitOption("Unit", "DefaultDependencies", "false"), ...
go
func (uw *UnitWriter) AppReaperUnit(appName types.ACName, binPath string, opts ...*unit.UnitOption) { if uw.err != nil { return } opts = append(opts, []*unit.UnitOption{ unit.NewUnitOption("Unit", "Description", fmt.Sprintf("%s Reaper", appName)), unit.NewUnitOption("Unit", "DefaultDependencies", "false"), ...
[ "func", "(", "uw", "*", "UnitWriter", ")", "AppReaperUnit", "(", "appName", "types", ".", "ACName", ",", "binPath", "string", ",", "opts", "...", "*", "unit", ".", "UnitOption", ")", "{", "if", "uw", ".", "err", "!=", "nil", "{", "return", "\n", "}",...
// AppReaperUnit writes an app reaper service unit for the given app in the given path using the given unit options.
[ "AppReaperUnit", "writes", "an", "app", "reaper", "service", "unit", "for", "the", "given", "app", "in", "the", "given", "path", "using", "the", "given", "unit", "options", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/common/units.go#L737-L764
20,964
rkt/rkt
stage1/init/common/units.go
AppSocketUnit
func (uw *UnitWriter) AppSocketUnit(appName types.ACName, binPath string, streamName string, opts ...*unit.UnitOption) { opts = append(opts, []*unit.UnitOption{ unit.NewUnitOption("Unit", "Description", fmt.Sprintf("%s socket for %s", streamName, appName)), unit.NewUnitOption("Unit", "DefaultDependencies", "no"), ...
go
func (uw *UnitWriter) AppSocketUnit(appName types.ACName, binPath string, streamName string, opts ...*unit.UnitOption) { opts = append(opts, []*unit.UnitOption{ unit.NewUnitOption("Unit", "Description", fmt.Sprintf("%s socket for %s", streamName, appName)), unit.NewUnitOption("Unit", "DefaultDependencies", "no"), ...
[ "func", "(", "uw", "*", "UnitWriter", ")", "AppSocketUnit", "(", "appName", "types", ".", "ACName", ",", "binPath", "string", ",", "streamName", "string", ",", "opts", "...", "*", "unit", ".", "UnitOption", ")", "{", "opts", "=", "append", "(", "opts", ...
// AppSocketUnits writes a stream socket-unit for the given app in the given path.
[ "AppSocketUnits", "writes", "a", "stream", "socket", "-", "unit", "for", "the", "given", "app", "in", "the", "given", "path", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/common/units.go#L767-L786
20,965
rkt/rkt
stage1/init/common/units.go
appendOptionsList
func appendOptionsList(opts []*unit.UnitOption, section, property, prefix string, vals ...string) []*unit.UnitOption { for _, v := range vals { opts = append(opts, unit.NewUnitOption(section, property, fmt.Sprintf("%s%s", prefix, v))) } return opts }
go
func appendOptionsList(opts []*unit.UnitOption, section, property, prefix string, vals ...string) []*unit.UnitOption { for _, v := range vals { opts = append(opts, unit.NewUnitOption(section, property, fmt.Sprintf("%s%s", prefix, v))) } return opts }
[ "func", "appendOptionsList", "(", "opts", "[", "]", "*", "unit", ".", "UnitOption", ",", "section", ",", "property", ",", "prefix", "string", ",", "vals", "...", "string", ")", "[", "]", "*", "unit", ".", "UnitOption", "{", "for", "_", ",", "v", ":="...
// appendOptionsList updates an existing unit options list appending // an array of new properties, one entry at a time. // This is the preferred method to avoid hitting line length limits // in unit files. Target property must support multi-line entries.
[ "appendOptionsList", "updates", "an", "existing", "unit", "options", "list", "appending", "an", "array", "of", "new", "properties", "one", "entry", "at", "a", "time", ".", "This", "is", "the", "preferred", "method", "to", "avoid", "hitting", "line", "length", ...
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/common/units.go#L792-L797
20,966
rkt/rkt
lib/app.go
AppsForPod
func AppsForPod(uuid, dataDir string, appName string) ([]*v1.App, error) { p, err := pkgPod.PodFromUUIDString(dataDir, uuid) if err != nil { return nil, err } defer p.Close() return appsForPod(p, appName, appStateInMutablePod) }
go
func AppsForPod(uuid, dataDir string, appName string) ([]*v1.App, error) { p, err := pkgPod.PodFromUUIDString(dataDir, uuid) if err != nil { return nil, err } defer p.Close() return appsForPod(p, appName, appStateInMutablePod) }
[ "func", "AppsForPod", "(", "uuid", ",", "dataDir", "string", ",", "appName", "string", ")", "(", "[", "]", "*", "v1", ".", "App", ",", "error", ")", "{", "p", ",", "err", ":=", "pkgPod", ".", "PodFromUUIDString", "(", "dataDir", ",", "uuid", ")", "...
// AppsForPod returns the apps of the pod with the given uuid in the given data directory. // If appName is non-empty, then only the app with the given name will be returned.
[ "AppsForPod", "returns", "the", "apps", "of", "the", "pod", "with", "the", "given", "uuid", "in", "the", "given", "data", "directory", ".", "If", "appName", "is", "non", "-", "empty", "then", "only", "the", "app", "with", "the", "given", "name", "will", ...
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/lib/app.go#L38-L46
20,967
rkt/rkt
lib/app.go
newApp
func newApp(ra *schema.RuntimeApp, podManifest *schema.PodManifest, pod *pkgPod.Pod, appState appStateFunc) (*v1.App, error) { app := &v1.App{ Name: ra.Name.String(), ImageID: ra.Image.ID.String(), UserAnnotations: ra.App.UserAnnotations, UserLabels: ra.App.UserLabels, } podVols := p...
go
func newApp(ra *schema.RuntimeApp, podManifest *schema.PodManifest, pod *pkgPod.Pod, appState appStateFunc) (*v1.App, error) { app := &v1.App{ Name: ra.Name.String(), ImageID: ra.Image.ID.String(), UserAnnotations: ra.App.UserAnnotations, UserLabels: ra.App.UserLabels, } podVols := p...
[ "func", "newApp", "(", "ra", "*", "schema", ".", "RuntimeApp", ",", "podManifest", "*", "schema", ".", "PodManifest", ",", "pod", "*", "pkgPod", ".", "Pod", ",", "appState", "appStateFunc", ")", "(", "*", "v1", ".", "App", ",", "error", ")", "{", "ap...
// newApp constructs the App object with the runtime app and pod manifest.
[ "newApp", "constructs", "the", "App", "object", "with", "the", "runtime", "app", "and", "pod", "manifest", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/lib/app.go#L73-L116
20,968
rkt/rkt
lib/app.go
appStateInImmutablePod
func appStateInImmutablePod(app *v1.App, pod *pkgPod.Pod) error { app.State = appStateFromPod(pod) t, err := pod.CreationTime() if err != nil { return err } createdAt := t.UnixNano() app.CreatedAt = &createdAt code, err := pod.AppExitCode(app.Name) if err == nil { // there is an exit code, it is definitel...
go
func appStateInImmutablePod(app *v1.App, pod *pkgPod.Pod) error { app.State = appStateFromPod(pod) t, err := pod.CreationTime() if err != nil { return err } createdAt := t.UnixNano() app.CreatedAt = &createdAt code, err := pod.AppExitCode(app.Name) if err == nil { // there is an exit code, it is definitel...
[ "func", "appStateInImmutablePod", "(", "app", "*", "v1", ".", "App", ",", "pod", "*", "pkgPod", ".", "Pod", ")", "error", "{", "app", ".", "State", "=", "appStateFromPod", "(", "pod", ")", "\n\n", "t", ",", "err", ":=", "pod", ".", "CreationTime", "(...
// appStateInImmutablePod infers most App state from the Pod itself, since all apps are created and destroyed with the Pod
[ "appStateInImmutablePod", "infers", "most", "App", "state", "from", "the", "Pod", "itself", "since", "all", "apps", "are", "created", "and", "destroyed", "with", "the", "Pod" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/lib/app.go#L200-L237
20,969
rkt/rkt
stage1/common/types/pod.go
SaveRuntime
func (p *Pod) SaveRuntime() error { path := filepath.Join(p.Root, RuntimeConfigPath) buf, err := json.Marshal(p.RuntimePod) if err != nil { return err } return ioutil.WriteFile(path, buf, 0644) }
go
func (p *Pod) SaveRuntime() error { path := filepath.Join(p.Root, RuntimeConfigPath) buf, err := json.Marshal(p.RuntimePod) if err != nil { return err } return ioutil.WriteFile(path, buf, 0644) }
[ "func", "(", "p", "*", "Pod", ")", "SaveRuntime", "(", ")", "error", "{", "path", ":=", "filepath", ".", "Join", "(", "p", ".", "Root", ",", "RuntimeConfigPath", ")", "\n", "buf", ",", "err", ":=", "json", ".", "Marshal", "(", "p", ".", "RuntimePod...
// SaveRuntime persists just the runtime state. This should be called when the // pod is started.
[ "SaveRuntime", "persists", "just", "the", "runtime", "state", ".", "This", "should", "be", "called", "when", "the", "pod", "is", "started", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/common/types/pod.go#L91-L99
20,970
rkt/rkt
stage1/common/types/pod.go
LoadPodManifest
func LoadPodManifest(root string) (*schema.PodManifest, error) { buf, err := ioutil.ReadFile(common.PodManifestPath(root)) if err != nil { return nil, errwrap.Wrap(errors.New("failed reading pod manifest"), err) } pm := &schema.PodManifest{} if err := json.Unmarshal(buf, pm); err != nil { return nil, errwrap....
go
func LoadPodManifest(root string) (*schema.PodManifest, error) { buf, err := ioutil.ReadFile(common.PodManifestPath(root)) if err != nil { return nil, errwrap.Wrap(errors.New("failed reading pod manifest"), err) } pm := &schema.PodManifest{} if err := json.Unmarshal(buf, pm); err != nil { return nil, errwrap....
[ "func", "LoadPodManifest", "(", "root", "string", ")", "(", "*", "schema", ".", "PodManifest", ",", "error", ")", "{", "buf", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "common", ".", "PodManifestPath", "(", "root", ")", ")", "\n", "if", "err", ...
// LoadPodManifest loads a Pod Manifest.
[ "LoadPodManifest", "loads", "a", "Pod", "Manifest", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/common/types/pod.go#L102-L113
20,971
rkt/rkt
rkt/image/fetcher.go
FetchImages
func (f *Fetcher) FetchImages(al *apps.Apps) error { return al.Walk(func(app *apps.App) error { d, err := DistFromImageString(app.Image) if err != nil { return err } h, err := f.FetchImage(d, app.Image, app.Asc) if err != nil { return err } app.ImageID = *h return nil }) }
go
func (f *Fetcher) FetchImages(al *apps.Apps) error { return al.Walk(func(app *apps.App) error { d, err := DistFromImageString(app.Image) if err != nil { return err } h, err := f.FetchImage(d, app.Image, app.Asc) if err != nil { return err } app.ImageID = *h return nil }) }
[ "func", "(", "f", "*", "Fetcher", ")", "FetchImages", "(", "al", "*", "apps", ".", "Apps", ")", "error", "{", "return", "al", ".", "Walk", "(", "func", "(", "app", "*", "apps", ".", "App", ")", "error", "{", "d", ",", "err", ":=", "DistFromImageS...
// FetchImages uses FetchImage to attain a list of image hashes
[ "FetchImages", "uses", "FetchImage", "to", "attain", "a", "list", "of", "image", "hashes" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/image/fetcher.go#L46-L59
20,972
rkt/rkt
rkt/image/fetcher.go
FetchImage
func (f *Fetcher) FetchImage(d dist.Distribution, image, ascPath string) (*types.Hash, error) { ensureLogger(f.Debug) db := &distBundle{ dist: d, image: image, } a := f.getAsc(ascPath) hash, err := f.fetchSingleImage(db, a) if err != nil { return nil, err } if f.WithDeps { err = f.fetchImageDeps(hash) ...
go
func (f *Fetcher) FetchImage(d dist.Distribution, image, ascPath string) (*types.Hash, error) { ensureLogger(f.Debug) db := &distBundle{ dist: d, image: image, } a := f.getAsc(ascPath) hash, err := f.fetchSingleImage(db, a) if err != nil { return nil, err } if f.WithDeps { err = f.fetchImageDeps(hash) ...
[ "func", "(", "f", "*", "Fetcher", ")", "FetchImage", "(", "d", "dist", ".", "Distribution", ",", "image", ",", "ascPath", "string", ")", "(", "*", "types", ".", "Hash", ",", "error", ")", "{", "ensureLogger", "(", "f", ".", "Debug", ")", "\n", "db"...
// FetchImage will take an image as either a path, a URL or a name // string and import it into the store if found. If ascPath is not "", // it must exist as a local file and will be used as the signature // file for verification, unless verification is disabled. If // f.WithDeps is true also image dependencies are fet...
[ "FetchImage", "will", "take", "an", "image", "as", "either", "a", "path", "a", "URL", "or", "a", "name", "string", "and", "import", "it", "into", "the", "store", "if", "found", ".", "If", "ascPath", "is", "not", "it", "must", "exist", "as", "a", "loc...
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/image/fetcher.go#L66-L99
20,973
rkt/rkt
rkt/image/fetcher.go
fetchImageDeps
func (f *Fetcher) fetchImageDeps(hash string) error { imgsl := list.New() seen := map[string]dist.Distribution{} f.addImageDeps(hash, imgsl, seen) for el := imgsl.Front(); el != nil; el = el.Next() { a := &asc{} d := el.Value.(*dist.Appc) str := d.String() db := &distBundle{ dist: d, image: str, } ...
go
func (f *Fetcher) fetchImageDeps(hash string) error { imgsl := list.New() seen := map[string]dist.Distribution{} f.addImageDeps(hash, imgsl, seen) for el := imgsl.Front(); el != nil; el = el.Next() { a := &asc{} d := el.Value.(*dist.Appc) str := d.String() db := &distBundle{ dist: d, image: str, } ...
[ "func", "(", "f", "*", "Fetcher", ")", "fetchImageDeps", "(", "hash", "string", ")", "error", "{", "imgsl", ":=", "list", ".", "New", "(", ")", "\n", "seen", ":=", "map", "[", "string", "]", "dist", ".", "Distribution", "{", "}", "\n", "f", ".", ...
// fetchImageDeps will recursively fetch all the image dependencies
[ "fetchImageDeps", "will", "recursively", "fetch", "all", "the", "image", "dependencies" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/image/fetcher.go#L112-L131
20,974
rkt/rkt
pkg/log/log.go
New
func New(out io.Writer, prefix string, debug bool) *Logger { l := &Logger{ debug: debug, Logger: log.New(out, prefix, 0), } l.SetFlags(0) return l }
go
func New(out io.Writer, prefix string, debug bool) *Logger { l := &Logger{ debug: debug, Logger: log.New(out, prefix, 0), } l.SetFlags(0) return l }
[ "func", "New", "(", "out", "io", ".", "Writer", ",", "prefix", "string", ",", "debug", "bool", ")", "*", "Logger", "{", "l", ":=", "&", "Logger", "{", "debug", ":", "debug", ",", "Logger", ":", "log", ".", "New", "(", "out", ",", "prefix", ",", ...
// New creates a new Logger with no Log flags set.
[ "New", "creates", "a", "new", "Logger", "with", "no", "Log", "flags", "set", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/pkg/log/log.go#L35-L42
20,975
rkt/rkt
pkg/log/log.go
Error
func (l *Logger) Error(e error) { l.Print(l.formatErr(e, "")) }
go
func (l *Logger) Error(e error) { l.Print(l.formatErr(e, "")) }
[ "func", "(", "l", "*", "Logger", ")", "Error", "(", "e", "error", ")", "{", "l", ".", "Print", "(", "l", ".", "formatErr", "(", "e", ",", "\"", "\"", ")", ")", "\n", "}" ]
// Error is a convenience function for printing errors without a message.
[ "Error", "is", "a", "convenience", "function", "for", "printing", "errors", "without", "a", "message", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/pkg/log/log.go#L110-L112
20,976
rkt/rkt
pkg/log/log.go
Errorf
func (l *Logger) Errorf(format string, a ...interface{}) { l.Print(l.formatErr(fmt.Errorf(format, a...), "")) }
go
func (l *Logger) Errorf(format string, a ...interface{}) { l.Print(l.formatErr(fmt.Errorf(format, a...), "")) }
[ "func", "(", "l", "*", "Logger", ")", "Errorf", "(", "format", "string", ",", "a", "...", "interface", "{", "}", ")", "{", "l", ".", "Print", "(", "l", ".", "formatErr", "(", "fmt", ".", "Errorf", "(", "format", ",", "a", "...", ")", ",", "\"",...
// Errorf is a convenience function for formatting and printing errors.
[ "Errorf", "is", "a", "convenience", "function", "for", "formatting", "and", "printing", "errors", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/pkg/log/log.go#L115-L117
20,977
rkt/rkt
pkg/log/log.go
PanicE
func (l *Logger) PanicE(msg string, e error) { l.Panic(l.formatErr(e, msg)) }
go
func (l *Logger) PanicE(msg string, e error) { l.Panic(l.formatErr(e, msg)) }
[ "func", "(", "l", "*", "Logger", ")", "PanicE", "(", "msg", "string", ",", "e", "error", ")", "{", "l", ".", "Panic", "(", "l", ".", "formatErr", "(", "e", ",", "msg", ")", ")", "\n", "}" ]
// PanicE prints a string and error then calls panic.
[ "PanicE", "prints", "a", "string", "and", "error", "then", "calls", "panic", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/pkg/log/log.go#L132-L134
20,978
rkt/rkt
tools/common/util.go
Warn
func Warn(format string, values ...interface{}) { fmt.Fprintf(os.Stderr, fmt.Sprintf("%s%c", format, '\n'), values...) }
go
func Warn(format string, values ...interface{}) { fmt.Fprintf(os.Stderr, fmt.Sprintf("%s%c", format, '\n'), values...) }
[ "func", "Warn", "(", "format", "string", ",", "values", "...", "interface", "{", "}", ")", "{", "fmt", ".", "Fprintf", "(", "os", ".", "Stderr", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "format", ",", "'\\n'", ")", ",", "values", "...", ...
// Warn is just a shorter version of a formatted printing to // stderr. It appends a newline for you.
[ "Warn", "is", "just", "a", "shorter", "version", "of", "a", "formatted", "printing", "to", "stderr", ".", "It", "appends", "a", "newline", "for", "you", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/tools/common/util.go#L45-L47
20,979
rkt/rkt
tools/common/util.go
MustAbs
func MustAbs(dir string) string { absDir, err := filepath.Abs(dir) if err != nil { panic(fmt.Sprintf("Failed to get absolute path of a directory %q: %v\n", dir, err)) } return filepath.Clean(absDir) }
go
func MustAbs(dir string) string { absDir, err := filepath.Abs(dir) if err != nil { panic(fmt.Sprintf("Failed to get absolute path of a directory %q: %v\n", dir, err)) } return filepath.Clean(absDir) }
[ "func", "MustAbs", "(", "dir", "string", ")", "string", "{", "absDir", ",", "err", ":=", "filepath", ".", "Abs", "(", "dir", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\"", ",", "dir", ",", ...
// MustAbs returns an absolute path. It works like filepath.Abs, but // panics if it fails.
[ "MustAbs", "returns", "an", "absolute", "path", ".", "It", "works", "like", "filepath", ".", "Abs", "but", "panics", "if", "it", "fails", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/tools/common/util.go#L75-L81
20,980
rkt/rkt
rkt/status.go
parseDuration
func parseDuration(s string) (time.Duration, error) { if s == "" { return time.Duration(-1), nil } b, err := strconv.ParseBool(s) switch { case err != nil: return time.ParseDuration(s) case b: return time.Duration(-1), nil } return time.Duration(0), nil }
go
func parseDuration(s string) (time.Duration, error) { if s == "" { return time.Duration(-1), nil } b, err := strconv.ParseBool(s) switch { case err != nil: return time.ParseDuration(s) case b: return time.Duration(-1), nil } return time.Duration(0), nil }
[ "func", "parseDuration", "(", "s", "string", ")", "(", "time", ".", "Duration", ",", "error", ")", "{", "if", "s", "==", "\"", "\"", "{", "return", "time", ".", "Duration", "(", "-", "1", ")", ",", "nil", "\n", "}", "\n\n", "b", ",", "err", ":=...
// parseDuration converts the given string s to a duration value. // If it is empty string or a true boolean value according to strconv.ParseBool, a negative duration is returned. // If the boolean value is false, a 0 duration is returned. // If the string s is a duration value, then it is returned. // It returns an er...
[ "parseDuration", "converts", "the", "given", "string", "s", "to", "a", "duration", "value", ".", "If", "it", "is", "empty", "string", "or", "a", "true", "boolean", "value", "according", "to", "strconv", ".", "ParseBool", "a", "negative", "duration", "is", ...
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/status.go#L126-L141
20,981
rkt/rkt
rkt/status.go
newContext
func newContext(t time.Duration) context.Context { ctx := context.Background() if t > 0 { ctx, _ = context.WithTimeout(ctx, t) } return ctx }
go
func newContext(t time.Duration) context.Context { ctx := context.Background() if t > 0 { ctx, _ = context.WithTimeout(ctx, t) } return ctx }
[ "func", "newContext", "(", "t", "time", ".", "Duration", ")", "context", ".", "Context", "{", "ctx", ":=", "context", ".", "Background", "(", ")", "\n", "if", "t", ">", "0", "{", "ctx", ",", "_", "=", "context", ".", "WithTimeout", "(", "ctx", ",",...
// newContext returns a new context with timeout t if t > 0.
[ "newContext", "returns", "a", "new", "context", "with", "timeout", "t", "if", "t", ">", "0", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/status.go#L144-L150
20,982
rkt/rkt
rkt/status.go
getExitStatuses
func getExitStatuses(p *pkgPod.Pod) (map[string]int, error) { _, manifest, err := p.PodManifest() if err != nil { return nil, err } stats := make(map[string]int) for _, app := range manifest.Apps { exitCode, err := p.AppExitCode(app.Name.String()) if err != nil { continue } stats[app.Name.String()] =...
go
func getExitStatuses(p *pkgPod.Pod) (map[string]int, error) { _, manifest, err := p.PodManifest() if err != nil { return nil, err } stats := make(map[string]int) for _, app := range manifest.Apps { exitCode, err := p.AppExitCode(app.Name.String()) if err != nil { continue } stats[app.Name.String()] =...
[ "func", "getExitStatuses", "(", "p", "*", "pkgPod", ".", "Pod", ")", "(", "map", "[", "string", "]", "int", ",", "error", ")", "{", "_", ",", "manifest", ",", "err", ":=", "p", ".", "PodManifest", "(", ")", "\n", "if", "err", "!=", "nil", "{", ...
// getExitStatuses returns a map of the statuses of the pod.
[ "getExitStatuses", "returns", "a", "map", "of", "the", "statuses", "of", "the", "pod", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/status.go#L153-L168
20,983
rkt/rkt
rkt/status.go
printStatus
func printStatus(p *pkgPod.Pod) error { if flagFormat != outputFormatTabbed { pod, err := lib.NewPodFromInternalPod(p) if err != nil { return fmt.Errorf("error converting pod: %v", err) } switch flagFormat { case outputFormatJSON: result, err := json.Marshal(pod) if err != nil { return fmt.Error...
go
func printStatus(p *pkgPod.Pod) error { if flagFormat != outputFormatTabbed { pod, err := lib.NewPodFromInternalPod(p) if err != nil { return fmt.Errorf("error converting pod: %v", err) } switch flagFormat { case outputFormatJSON: result, err := json.Marshal(pod) if err != nil { return fmt.Error...
[ "func", "printStatus", "(", "p", "*", "pkgPod", ".", "Pod", ")", "error", "{", "if", "flagFormat", "!=", "outputFormatTabbed", "{", "pod", ",", "err", ":=", "lib", ".", "NewPodFromInternalPod", "(", "p", ")", "\n", "if", "err", "!=", "nil", "{", "retur...
// printStatus prints the pod's pid and per-app status codes
[ "printStatus", "prints", "the", "pod", "s", "pid", "and", "per", "-", "app", "status", "codes" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/status.go#L171-L240
20,984
rkt/rkt
rkt/image/common.go
ascURLFromImgURL
func ascURLFromImgURL(u *url.URL) *url.URL { copy := *u copy.Path = ascPathFromImgPath(copy.Path) return &copy }
go
func ascURLFromImgURL(u *url.URL) *url.URL { copy := *u copy.Path = ascPathFromImgPath(copy.Path) return &copy }
[ "func", "ascURLFromImgURL", "(", "u", "*", "url", ".", "URL", ")", "*", "url", ".", "URL", "{", "copy", ":=", "*", "u", "\n", "copy", ".", "Path", "=", "ascPathFromImgPath", "(", "copy", ".", "Path", ")", "\n", "return", "&", "copy", "\n", "}" ]
// ascURLFromImgURL creates a URL to a signature file from passed URL // to an image.
[ "ascURLFromImgURL", "creates", "a", "URL", "to", "a", "signature", "file", "from", "passed", "URL", "to", "an", "image", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/image/common.go#L113-L117
20,985
rkt/rkt
rkt/image/common.go
printIdentities
func printIdentities(entity *openpgp.Entity) { lines := []string{"signature verified:"} for _, v := range entity.Identities { lines = append(lines, fmt.Sprintf(" %s", v.Name)) } log.Print(strings.Join(lines, "\n")) }
go
func printIdentities(entity *openpgp.Entity) { lines := []string{"signature verified:"} for _, v := range entity.Identities { lines = append(lines, fmt.Sprintf(" %s", v.Name)) } log.Print(strings.Join(lines, "\n")) }
[ "func", "printIdentities", "(", "entity", "*", "openpgp", ".", "Entity", ")", "{", "lines", ":=", "[", "]", "string", "{", "\"", "\"", "}", "\n", "for", "_", ",", "v", ":=", "range", "entity", ".", "Identities", "{", "lines", "=", "append", "(", "l...
// printIdentities prints a message that signature was verified.
[ "printIdentities", "prints", "a", "message", "that", "signature", "was", "verified", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/image/common.go#L126-L132
20,986
rkt/rkt
rkt/image/common.go
DistFromImageString
func DistFromImageString(is string) (dist.Distribution, error) { u, err := url.Parse(is) if err != nil { return nil, errwrap.Wrap(fmt.Errorf("failed to parse image url %q", is), err) } // Convert user friendly image string names to internal distribution URIs // file:///full/path/to/aci/file.aci -> archive:aci:f...
go
func DistFromImageString(is string) (dist.Distribution, error) { u, err := url.Parse(is) if err != nil { return nil, errwrap.Wrap(fmt.Errorf("failed to parse image url %q", is), err) } // Convert user friendly image string names to internal distribution URIs // file:///full/path/to/aci/file.aci -> archive:aci:f...
[ "func", "DistFromImageString", "(", "is", "string", ")", "(", "dist", ".", "Distribution", ",", "error", ")", "{", "u", ",", "err", ":=", "url", ".", "Parse", "(", "is", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errwrap", "."...
// DistFromImageString return the distribution for the given input image string
[ "DistFromImageString", "return", "the", "distribution", "for", "the", "given", "input", "image", "string" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/image/common.go#L135-L203
20,987
rkt/rkt
pkg/distribution/cimd.go
parseCIMD
func parseCIMD(u *url.URL) (*cimd, error) { if u.Scheme != Scheme { return nil, fmt.Errorf("unsupported scheme: %q", u.Scheme) } parts := strings.SplitN(u.Opaque, ":", 3) if len(parts) < 3 { return nil, fmt.Errorf("malformed distribution uri: %q", u.String()) } version, err := strconv.ParseUint(strings.TrimPr...
go
func parseCIMD(u *url.URL) (*cimd, error) { if u.Scheme != Scheme { return nil, fmt.Errorf("unsupported scheme: %q", u.Scheme) } parts := strings.SplitN(u.Opaque, ":", 3) if len(parts) < 3 { return nil, fmt.Errorf("malformed distribution uri: %q", u.String()) } version, err := strconv.ParseUint(strings.TrimPr...
[ "func", "parseCIMD", "(", "u", "*", "url", ".", "URL", ")", "(", "*", "cimd", ",", "error", ")", "{", "if", "u", ".", "Scheme", "!=", "Scheme", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "u", ".", "Scheme", ")", "\...
// parseCIMD parses the given url and returns a cimd.
[ "parseCIMD", "parses", "the", "given", "url", "and", "returns", "a", "cimd", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/pkg/distribution/cimd.go#L34-L51
20,988
rkt/rkt
pkg/distribution/cimd.go
NewCIMDString
func NewCIMDString(typ Type, version uint32, data string) string { return fmt.Sprintf("%s:%s:v=%d:%s", Scheme, typ, version, data) }
go
func NewCIMDString(typ Type, version uint32, data string) string { return fmt.Sprintf("%s:%s:v=%d:%s", Scheme, typ, version, data) }
[ "func", "NewCIMDString", "(", "typ", "Type", ",", "version", "uint32", ",", "data", "string", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "Scheme", ",", "typ", ",", "version", ",", "data", ")", "\n", "}" ]
// NewCIMDString creates a new cimd URL string.
[ "NewCIMDString", "creates", "a", "new", "cimd", "URL", "string", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/pkg/distribution/cimd.go#L54-L56
20,989
rkt/rkt
rkt/export.go
getApp
func getApp(p *pkgPod.Pod) (*schema.RuntimeApp, error) { _, manifest, err := p.PodManifest() if err != nil { return nil, errwrap.Wrap(errors.New("problem getting the pod's manifest"), err) } apps := manifest.Apps if flagExportAppName != "" { exportAppName, err := types.NewACName(flagExportAppName) if err !...
go
func getApp(p *pkgPod.Pod) (*schema.RuntimeApp, error) { _, manifest, err := p.PodManifest() if err != nil { return nil, errwrap.Wrap(errors.New("problem getting the pod's manifest"), err) } apps := manifest.Apps if flagExportAppName != "" { exportAppName, err := types.NewACName(flagExportAppName) if err !...
[ "func", "getApp", "(", "p", "*", "pkgPod", ".", "Pod", ")", "(", "*", "schema", ".", "RuntimeApp", ",", "error", ")", "{", "_", ",", "manifest", ",", "err", ":=", "p", ".", "PodManifest", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// getApp returns the app to export // If one was supplied in the flags then it's returned if present // If the PM contains a single app, that app is returned // If the PM has multiple apps, the names are printed and an error is returned
[ "getApp", "returns", "the", "app", "to", "export", "If", "one", "was", "supplied", "in", "the", "flags", "then", "it", "s", "returned", "if", "present", "If", "the", "PM", "contains", "a", "single", "app", "that", "app", "is", "returned", "If", "the", ...
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/export.go#L164-L199
20,990
rkt/rkt
rkt/export.go
mountOverlay
func mountOverlay(pod *pkgPod.Pod, app *schema.RuntimeApp, dest string) error { if _, err := os.Stat(dest); err != nil { return err } s, err := imagestore.NewStore(getDataDir()) if err != nil { return errwrap.Wrap(errors.New("cannot open store"), err) } ts, err := treestore.NewStore(treeStoreDir(), s) if e...
go
func mountOverlay(pod *pkgPod.Pod, app *schema.RuntimeApp, dest string) error { if _, err := os.Stat(dest); err != nil { return err } s, err := imagestore.NewStore(getDataDir()) if err != nil { return errwrap.Wrap(errors.New("cannot open store"), err) } ts, err := treestore.NewStore(treeStoreDir(), s) if e...
[ "func", "mountOverlay", "(", "pod", "*", "pkgPod", ".", "Pod", ",", "app", "*", "schema", ".", "RuntimeApp", ",", "dest", "string", ")", "error", "{", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "dest", ")", ";", "err", "!=", "nil", "{",...
// mountOverlay mounts the app from the overlay-rendered pod to the destination directory.
[ "mountOverlay", "mounts", "the", "app", "from", "the", "overlay", "-", "rendered", "pod", "to", "the", "destination", "directory", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/export.go#L202-L240
20,991
rkt/rkt
rkt/export.go
buildAci
func buildAci(root, manifestPath, target string, uidRange *user.UidRange) (e error) { mode := os.O_CREATE | os.O_WRONLY if flagOverwriteACI { mode |= os.O_TRUNC } else { mode |= os.O_EXCL } aciFile, err := os.OpenFile(target, mode, 0644) if err != nil { if os.IsExist(err) { return errors.New("target file...
go
func buildAci(root, manifestPath, target string, uidRange *user.UidRange) (e error) { mode := os.O_CREATE | os.O_WRONLY if flagOverwriteACI { mode |= os.O_TRUNC } else { mode |= os.O_EXCL } aciFile, err := os.OpenFile(target, mode, 0644) if err != nil { if os.IsExist(err) { return errors.New("target file...
[ "func", "buildAci", "(", "root", ",", "manifestPath", ",", "target", "string", ",", "uidRange", "*", "user", ".", "UidRange", ")", "(", "e", "error", ")", "{", "mode", ":=", "os", ".", "O_CREATE", "|", "os", ".", "O_WRONLY", "\n", "if", "flagOverwriteA...
// buildAci builds a target aci from the root directory using any uid shift // information from uidRange.
[ "buildAci", "builds", "a", "target", "aci", "from", "the", "root", "directory", "using", "any", "uid", "shift", "information", "from", "uidRange", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/export.go#L244-L306
20,992
rkt/rkt
rkt/rkt.go
ensureSuperuser
func ensureSuperuser(cf func(cmd *cobra.Command, args []string)) func(cmd *cobra.Command, args []string) { return func(cmd *cobra.Command, args []string) { if os.Geteuid() != 0 { stderr.Print("cannot run as unprivileged user") cmdExitCode = 254 return } cf(cmd, args) } }
go
func ensureSuperuser(cf func(cmd *cobra.Command, args []string)) func(cmd *cobra.Command, args []string) { return func(cmd *cobra.Command, args []string) { if os.Geteuid() != 0 { stderr.Print("cannot run as unprivileged user") cmdExitCode = 254 return } cf(cmd, args) } }
[ "func", "ensureSuperuser", "(", "cf", "func", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", ")", "func", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "{", "return", "func", "(", ...
// ensureSuperuser will error out if the effective UID of the current process // is not zero. Otherwise, it will invoke the supplied cobra command.
[ "ensureSuperuser", "will", "error", "out", "if", "the", "effective", "UID", "of", "the", "current", "process", "is", "not", "zero", ".", "Otherwise", "it", "will", "invoke", "the", "supplied", "cobra", "command", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/rkt.go#L192-L202
20,993
rkt/rkt
stage1/init/common/seccomp.go
generateSeccompFilter
func generateSeccompFilter(p *stage1commontypes.Pod, pa *preparedApp) (*seccompFilter, error) { sf := seccompFilter{} seenIsolators := 0 for _, i := range pa.app.App.Isolators { var flag string var err error if seccomp, ok := i.Value().(types.LinuxSeccompSet); ok { seenIsolators++ // By appc spec, only o...
go
func generateSeccompFilter(p *stage1commontypes.Pod, pa *preparedApp) (*seccompFilter, error) { sf := seccompFilter{} seenIsolators := 0 for _, i := range pa.app.App.Isolators { var flag string var err error if seccomp, ok := i.Value().(types.LinuxSeccompSet); ok { seenIsolators++ // By appc spec, only o...
[ "func", "generateSeccompFilter", "(", "p", "*", "stage1commontypes", ".", "Pod", ",", "pa", "*", "preparedApp", ")", "(", "*", "seccompFilter", ",", "error", ")", "{", "sf", ":=", "seccompFilter", "{", "}", "\n", "seenIsolators", ":=", "0", "\n", "for", ...
// generateSeccompFilter computes the concrete seccomp filter from the isolators
[ "generateSeccompFilter", "computes", "the", "concrete", "seccomp", "filter", "from", "the", "isolators" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/common/seccomp.go#L58-L107
20,994
rkt/rkt
stage1/init/common/seccomp.go
seccompUnitOptions
func seccompUnitOptions(opts []*unit.UnitOption, sf *seccompFilter) ([]*unit.UnitOption, error) { if sf == nil { return opts, nil } if sf.errno != "" { opts = append(opts, unit.NewUnitOption("Service", "SystemCallErrorNumber", sf.errno)) } var filterPrefix string switch sf.mode { case ModeWhitelist: filte...
go
func seccompUnitOptions(opts []*unit.UnitOption, sf *seccompFilter) ([]*unit.UnitOption, error) { if sf == nil { return opts, nil } if sf.errno != "" { opts = append(opts, unit.NewUnitOption("Service", "SystemCallErrorNumber", sf.errno)) } var filterPrefix string switch sf.mode { case ModeWhitelist: filte...
[ "func", "seccompUnitOptions", "(", "opts", "[", "]", "*", "unit", ".", "UnitOption", ",", "sf", "*", "seccompFilter", ")", "(", "[", "]", "*", "unit", ".", "UnitOption", ",", "error", ")", "{", "if", "sf", "==", "nil", "{", "return", "opts", ",", "...
// seccompUnitOptions converts a concrete seccomp filter to systemd unit options
[ "seccompUnitOptions", "converts", "a", "concrete", "seccomp", "filter", "to", "systemd", "unit", "options" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/common/seccomp.go#L110-L132
20,995
rkt/rkt
stage1/init/common/seccomp.go
parseLinuxSeccompSet
func parseLinuxSeccompSet(p *stage1commontypes.Pod, s types.LinuxSeccompSet) (syscallFilter []string, flag string, err error) { for _, item := range s.Set() { if item[0] == '@' { // Wildcards wildcard := strings.SplitN(string(item), "/", 2) if len(wildcard) != 2 { continue } scope := wildcard[0] ...
go
func parseLinuxSeccompSet(p *stage1commontypes.Pod, s types.LinuxSeccompSet) (syscallFilter []string, flag string, err error) { for _, item := range s.Set() { if item[0] == '@' { // Wildcards wildcard := strings.SplitN(string(item), "/", 2) if len(wildcard) != 2 { continue } scope := wildcard[0] ...
[ "func", "parseLinuxSeccompSet", "(", "p", "*", "stage1commontypes", ".", "Pod", ",", "s", "types", ".", "LinuxSeccompSet", ")", "(", "syscallFilter", "[", "]", "string", ",", "flag", "string", ",", "err", "error", ")", "{", "for", "_", ",", "item", ":=",...
// parseLinuxSeccompSet gets an appc LinuxSeccompSet and returns an array // of values suitable for systemd SystemCallFilter.
[ "parseLinuxSeccompSet", "gets", "an", "appc", "LinuxSeccompSet", "and", "returns", "an", "array", "of", "values", "suitable", "for", "systemd", "SystemCallFilter", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/init/common/seccomp.go#L136-L202
20,996
rkt/rkt
stage1/app_rm/app_rm.go
main
func main() { flag.Parse() stage1initcommon.InitDebug(debug) log, diag, _ = rktlog.NewLogSet("app-rm", debug) if !debug { diag.SetOutput(ioutil.Discard) } appName, err := types.NewACName(flagApp) if err != nil { log.FatalE("invalid app name", err) } enterCmd := stage1common.PrepareEnterCmd(false) swit...
go
func main() { flag.Parse() stage1initcommon.InitDebug(debug) log, diag, _ = rktlog.NewLogSet("app-rm", debug) if !debug { diag.SetOutput(ioutil.Discard) } appName, err := types.NewACName(flagApp) if err != nil { log.FatalE("invalid app name", err) } enterCmd := stage1common.PrepareEnterCmd(false) swit...
[ "func", "main", "(", ")", "{", "flag", ".", "Parse", "(", ")", "\n\n", "stage1initcommon", ".", "InitDebug", "(", "debug", ")", "\n\n", "log", ",", "diag", ",", "_", "=", "rktlog", ".", "NewLogSet", "(", "\"", "\"", ",", "debug", ")", "\n", "if", ...
// This is a multi-step entrypoint. It starts in stage0 context then invokes // itself again in stage1 context to perform further cleanup at pod level.
[ "This", "is", "a", "multi", "-", "step", "entrypoint", ".", "It", "starts", "in", "stage0", "context", "then", "invokes", "itself", "again", "in", "stage1", "context", "to", "perform", "further", "cleanup", "at", "pod", "level", "." ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/app_rm/app_rm.go#L56-L88
20,997
rkt/rkt
stage1/app_rm/app_rm.go
cleanupStage1
func cleanupStage1(appName *types.ACName, enterCmd []string) error { // TODO(lucab): re-evaluate once/if we support systemd as non-pid1 (eg. host pid-ns inheriting) mnts, err := mountinfo.ParseMounts(1) if err != nil { return err } appRootFs := filepath.Join("/opt/stage2", appName.String(), "rootfs") mnts = mnt...
go
func cleanupStage1(appName *types.ACName, enterCmd []string) error { // TODO(lucab): re-evaluate once/if we support systemd as non-pid1 (eg. host pid-ns inheriting) mnts, err := mountinfo.ParseMounts(1) if err != nil { return err } appRootFs := filepath.Join("/opt/stage2", appName.String(), "rootfs") mnts = mnt...
[ "func", "cleanupStage1", "(", "appName", "*", "types", ".", "ACName", ",", "enterCmd", "[", "]", "string", ")", "error", "{", "// TODO(lucab): re-evaluate once/if we support systemd as non-pid1 (eg. host pid-ns inheriting)", "mnts", ",", "err", ":=", "mountinfo", ".", "...
// cleanupStage1 is meant to be executed in stage1 context. It inspects pod systemd-pid1 mountinfo to // find all remaining mountpoints for appName and proceed to clean them up.
[ "cleanupStage1", "is", "meant", "to", "be", "executed", "in", "stage1", "context", ".", "It", "inspects", "pod", "systemd", "-", "pid1", "mountinfo", "to", "find", "all", "remaining", "mountpoints", "for", "appName", "and", "proceed", "to", "clean", "them", ...
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/stage1/app_rm/app_rm.go#L155-L176
20,998
rkt/rkt
rkt/gc.go
renameExited
func renameExited() error { if err := pkgPod.WalkPods(getDataDir(), pkgPod.IncludeRunDir, func(p *pkgPod.Pod) { if p.State() == pkgPod.Exited { stderr.Printf("moving pod %q to garbage", p.UUID) if err := p.ToExitedGarbage(); err != nil && err != os.ErrNotExist { stderr.PrintE("rename error", err) } } ...
go
func renameExited() error { if err := pkgPod.WalkPods(getDataDir(), pkgPod.IncludeRunDir, func(p *pkgPod.Pod) { if p.State() == pkgPod.Exited { stderr.Printf("moving pod %q to garbage", p.UUID) if err := p.ToExitedGarbage(); err != nil && err != os.ErrNotExist { stderr.PrintE("rename error", err) } } ...
[ "func", "renameExited", "(", ")", "error", "{", "if", "err", ":=", "pkgPod", ".", "WalkPods", "(", "getDataDir", "(", ")", ",", "pkgPod", ".", "IncludeRunDir", ",", "func", "(", "p", "*", "pkgPod", ".", "Pod", ")", "{", "if", "p", ".", "State", "("...
// renameExited renames exited pods to the exitedGarbage directory
[ "renameExited", "renames", "exited", "pods", "to", "the", "exitedGarbage", "directory" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/gc.go#L102-L115
20,999
rkt/rkt
rkt/gc.go
renameAborted
func renameAborted() error { if err := pkgPod.WalkPods(getDataDir(), pkgPod.IncludePrepareDir, func(p *pkgPod.Pod) { if p.State() == pkgPod.AbortedPrepare { stderr.Printf("moving failed prepare %q to garbage", p.UUID) if err := p.ToGarbage(); err != nil && err != os.ErrNotExist { stderr.PrintE("rename erro...
go
func renameAborted() error { if err := pkgPod.WalkPods(getDataDir(), pkgPod.IncludePrepareDir, func(p *pkgPod.Pod) { if p.State() == pkgPod.AbortedPrepare { stderr.Printf("moving failed prepare %q to garbage", p.UUID) if err := p.ToGarbage(); err != nil && err != os.ErrNotExist { stderr.PrintE("rename erro...
[ "func", "renameAborted", "(", ")", "error", "{", "if", "err", ":=", "pkgPod", ".", "WalkPods", "(", "getDataDir", "(", ")", ",", "pkgPod", ".", "IncludePrepareDir", ",", "func", "(", "p", "*", "pkgPod", ".", "Pod", ")", "{", "if", "p", ".", "State", ...
// renameAborted renames failed prepares to the garbage directory
[ "renameAborted", "renames", "failed", "prepares", "to", "the", "garbage", "directory" ]
0c8765619cae3391a9ffa12c8dbd12ba7a475eb8
https://github.com/rkt/rkt/blob/0c8765619cae3391a9ffa12c8dbd12ba7a475eb8/rkt/gc.go#L147-L159