repo stringlengths 5 67 | path stringlengths 4 218 | func_name stringlengths 0 151 | original_string stringlengths 52 373k | language stringclasses 6
values | code stringlengths 52 373k | code_tokens listlengths 10 512 | docstring stringlengths 3 47.2k | docstring_tokens listlengths 3 234 | sha stringlengths 40 40 | url stringlengths 85 339 | partition stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
kubernetes/test-infra | prow/cmd/deck/pr_history.go | getPullCommitHash | func getPullCommitHash(pull string) (string, error) {
match := pullCommitRe.FindStringSubmatch(pull)
if len(match) != 2 {
expected := "branch:hash,pullNumber:hash"
return "", fmt.Errorf("unable to parse pull %q (expected %q)", pull, expected)
}
return match[1], nil
} | go | func getPullCommitHash(pull string) (string, error) {
match := pullCommitRe.FindStringSubmatch(pull)
if len(match) != 2 {
expected := "branch:hash,pullNumber:hash"
return "", fmt.Errorf("unable to parse pull %q (expected %q)", pull, expected)
}
return match[1], nil
} | [
"func",
"getPullCommitHash",
"(",
"pull",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"match",
":=",
"pullCommitRe",
".",
"FindStringSubmatch",
"(",
"pull",
")",
"\n",
"if",
"len",
"(",
"match",
")",
"!=",
"2",
"{",
"expected",
":=",
"\"branch:... | // gets the pull commit hash from metadata | [
"gets",
"the",
"pull",
"commit",
"hash",
"from",
"metadata"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/deck/pr_history.go#L99-L106 | test |
kubernetes/test-infra | prow/cmd/deck/pr_history.go | listJobBuilds | func listJobBuilds(bucket storageBucket, jobPrefixes []string) []jobBuilds {
jobch := make(chan jobBuilds)
defer close(jobch)
for i, jobPrefix := range jobPrefixes {
go func(i int, jobPrefix string) {
buildPrefixes, err := bucket.listSubDirs(jobPrefix)
if err != nil {
logrus.WithError(err).Warningf("Erro... | go | func listJobBuilds(bucket storageBucket, jobPrefixes []string) []jobBuilds {
jobch := make(chan jobBuilds)
defer close(jobch)
for i, jobPrefix := range jobPrefixes {
go func(i int, jobPrefix string) {
buildPrefixes, err := bucket.listSubDirs(jobPrefix)
if err != nil {
logrus.WithError(err).Warningf("Erro... | [
"func",
"listJobBuilds",
"(",
"bucket",
"storageBucket",
",",
"jobPrefixes",
"[",
"]",
"string",
")",
"[",
"]",
"jobBuilds",
"{",
"jobch",
":=",
"make",
"(",
"chan",
"jobBuilds",
")",
"\n",
"defer",
"close",
"(",
"jobch",
")",
"\n",
"for",
"i",
",",
"j... | // listJobBuilds concurrently lists builds for the given job prefixes that have been run on a PR | [
"listJobBuilds",
"concurrently",
"lists",
"builds",
"for",
"the",
"given",
"job",
"prefixes",
"that",
"have",
"been",
"run",
"on",
"a",
"PR"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/deck/pr_history.go#L109-L130 | test |
kubernetes/test-infra | prow/cmd/deck/pr_history.go | getPRBuildData | func getPRBuildData(bucket storageBucket, jobs []jobBuilds) []buildData {
buildch := make(chan buildData)
defer close(buildch)
expected := 0
for _, job := range jobs {
for j, buildPrefix := range job.buildPrefixes {
go func(j int, jobName, buildPrefix string) {
build, err := getBuildData(bucket, buildPrefi... | go | func getPRBuildData(bucket storageBucket, jobs []jobBuilds) []buildData {
buildch := make(chan buildData)
defer close(buildch)
expected := 0
for _, job := range jobs {
for j, buildPrefix := range job.buildPrefixes {
go func(j int, jobName, buildPrefix string) {
build, err := getBuildData(bucket, buildPrefi... | [
"func",
"getPRBuildData",
"(",
"bucket",
"storageBucket",
",",
"jobs",
"[",
"]",
"jobBuilds",
")",
"[",
"]",
"buildData",
"{",
"buildch",
":=",
"make",
"(",
"chan",
"buildData",
")",
"\n",
"defer",
"close",
"(",
"buildch",
")",
"\n",
"expected",
":=",
"0... | // getPRBuildData concurrently fetches metadata on each build of each job run on a PR | [
"getPRBuildData",
"concurrently",
"fetches",
"metadata",
"on",
"each",
"build",
"of",
"each",
"job",
"run",
"on",
"a",
"PR"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/deck/pr_history.go#L133-L161 | test |
kubernetes/test-infra | prow/cmd/deck/pr_history.go | getGCSDirsForPR | func getGCSDirsForPR(config *config.Config, org, repo string, pr int) (map[string]sets.String, error) {
toSearch := make(map[string]sets.String)
fullRepo := org + "/" + repo
presubmits, ok := config.Presubmits[fullRepo]
if !ok {
return toSearch, fmt.Errorf("couldn't find presubmits for %q in config", fullRepo)
}... | go | func getGCSDirsForPR(config *config.Config, org, repo string, pr int) (map[string]sets.String, error) {
toSearch := make(map[string]sets.String)
fullRepo := org + "/" + repo
presubmits, ok := config.Presubmits[fullRepo]
if !ok {
return toSearch, fmt.Errorf("couldn't find presubmits for %q in config", fullRepo)
}... | [
"func",
"getGCSDirsForPR",
"(",
"config",
"*",
"config",
".",
"Config",
",",
"org",
",",
"repo",
"string",
",",
"pr",
"int",
")",
"(",
"map",
"[",
"string",
"]",
"sets",
".",
"String",
",",
"error",
")",
"{",
"toSearch",
":=",
"make",
"(",
"map",
"... | // getGCSDirsForPR returns a map from bucket names -> set of "directories" containing presubmit data | [
"getGCSDirsForPR",
"returns",
"a",
"map",
"from",
"bucket",
"names",
"-",
">",
"set",
"of",
"directories",
"containing",
"presubmit",
"data"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/deck/pr_history.go#L204-L239 | test |
lxc/lxd | lxd/images.go | imageDeleteFromDisk | func imageDeleteFromDisk(fingerprint string) {
// Remove main image file.
fname := shared.VarPath("images", fingerprint)
if shared.PathExists(fname) {
err := os.Remove(fname)
if err != nil && !os.IsNotExist(err) {
logger.Errorf("Error deleting image file %s: %s", fname, err)
}
}
// Remove the rootfs file... | go | func imageDeleteFromDisk(fingerprint string) {
// Remove main image file.
fname := shared.VarPath("images", fingerprint)
if shared.PathExists(fname) {
err := os.Remove(fname)
if err != nil && !os.IsNotExist(err) {
logger.Errorf("Error deleting image file %s: %s", fname, err)
}
}
// Remove the rootfs file... | [
"func",
"imageDeleteFromDisk",
"(",
"fingerprint",
"string",
")",
"{",
"fname",
":=",
"shared",
".",
"VarPath",
"(",
"\"images\"",
",",
"fingerprint",
")",
"\n",
"if",
"shared",
".",
"PathExists",
"(",
"fname",
")",
"{",
"err",
":=",
"os",
".",
"Remove",
... | // Helper to delete an image file from the local images directory. | [
"Helper",
"to",
"delete",
"an",
"image",
"file",
"from",
"the",
"local",
"images",
"directory",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/images.go#L1428-L1446 | test |
lxc/lxd | lxd/networks.go | doNetworksCreate | func doNetworksCreate(d *Daemon, req api.NetworksPost, withDatabase bool) error {
// Start the network
n, err := networkLoadByName(d.State(), req.Name)
if err != nil {
return err
}
err = n.Start()
if err != nil {
n.Delete(withDatabase)
return err
}
return nil
} | go | func doNetworksCreate(d *Daemon, req api.NetworksPost, withDatabase bool) error {
// Start the network
n, err := networkLoadByName(d.State(), req.Name)
if err != nil {
return err
}
err = n.Start()
if err != nil {
n.Delete(withDatabase)
return err
}
return nil
} | [
"func",
"doNetworksCreate",
"(",
"d",
"*",
"Daemon",
",",
"req",
"api",
".",
"NetworksPost",
",",
"withDatabase",
"bool",
")",
"error",
"{",
"n",
",",
"err",
":=",
"networkLoadByName",
"(",
"d",
".",
"State",
"(",
")",
",",
"req",
".",
"Name",
")",
"... | // Create the network on the system. The withDatabase flag is used to decide
// whether to cleanup the database if an error occurs. | [
"Create",
"the",
"network",
"on",
"the",
"system",
".",
"The",
"withDatabase",
"flag",
"is",
"used",
"to",
"decide",
"whether",
"to",
"cleanup",
"the",
"database",
"if",
"an",
"error",
"occurs",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/networks.go#L333-L347 | test |
lxc/lxd | lxd/networks.go | networkLoadByName | func networkLoadByName(s *state.State, name string) (*network, error) {
id, dbInfo, err := s.Cluster.NetworkGet(name)
if err != nil {
return nil, err
}
n := network{state: s, id: id, name: name, description: dbInfo.Description, config: dbInfo.Config}
return &n, nil
} | go | func networkLoadByName(s *state.State, name string) (*network, error) {
id, dbInfo, err := s.Cluster.NetworkGet(name)
if err != nil {
return nil, err
}
n := network{state: s, id: id, name: name, description: dbInfo.Description, config: dbInfo.Config}
return &n, nil
} | [
"func",
"networkLoadByName",
"(",
"s",
"*",
"state",
".",
"State",
",",
"name",
"string",
")",
"(",
"*",
"network",
",",
"error",
")",
"{",
"id",
",",
"dbInfo",
",",
"err",
":=",
"s",
".",
"Cluster",
".",
"NetworkGet",
"(",
"name",
")",
"\n",
"if",... | // The network structs and functions | [
"The",
"network",
"structs",
"and",
"functions"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/networks.go#L828-L837 | test |
lxc/lxd | lxd/db/db.go | Transaction | func (n *Node) Transaction(f func(*NodeTx) error) error {
nodeTx := &NodeTx{}
return query.Transaction(n.db, func(tx *sql.Tx) error {
nodeTx.tx = tx
return f(nodeTx)
})
} | go | func (n *Node) Transaction(f func(*NodeTx) error) error {
nodeTx := &NodeTx{}
return query.Transaction(n.db, func(tx *sql.Tx) error {
nodeTx.tx = tx
return f(nodeTx)
})
} | [
"func",
"(",
"n",
"*",
"Node",
")",
"Transaction",
"(",
"f",
"func",
"(",
"*",
"NodeTx",
")",
"error",
")",
"error",
"{",
"nodeTx",
":=",
"&",
"NodeTx",
"{",
"}",
"\n",
"return",
"query",
".",
"Transaction",
"(",
"n",
".",
"db",
",",
"func",
"(",... | // Transaction creates a new NodeTx object and transactionally executes the
// node-level database interactions invoked by the given function. If the
// function returns no error, all database changes are committed to the
// node-level database, otherwise they are rolled back. | [
"Transaction",
"creates",
"a",
"new",
"NodeTx",
"object",
"and",
"transactionally",
"executes",
"the",
"node",
"-",
"level",
"database",
"interactions",
"invoked",
"by",
"the",
"given",
"function",
".",
"If",
"the",
"function",
"returns",
"no",
"error",
"all",
... | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/db.go#L123-L129 | test |
lxc/lxd | lxd/db/db.go | ForLocalInspectionWithPreparedStmts | func ForLocalInspectionWithPreparedStmts(db *sql.DB) (*Cluster, error) {
c := ForLocalInspection(db)
stmts, err := cluster.PrepareStmts(c.db)
if err != nil {
return nil, errors.Wrap(err, "Prepare database statements")
}
c.stmts = stmts
return c, nil
} | go | func ForLocalInspectionWithPreparedStmts(db *sql.DB) (*Cluster, error) {
c := ForLocalInspection(db)
stmts, err := cluster.PrepareStmts(c.db)
if err != nil {
return nil, errors.Wrap(err, "Prepare database statements")
}
c.stmts = stmts
return c, nil
} | [
"func",
"ForLocalInspectionWithPreparedStmts",
"(",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"*",
"Cluster",
",",
"error",
")",
"{",
"c",
":=",
"ForLocalInspection",
"(",
"db",
")",
"\n",
"stmts",
",",
"err",
":=",
"cluster",
".",
"PrepareStmts",
"(",
"c",... | // ForLocalInspectionWithPreparedStmts is the same as ForLocalInspection but it
// also prepares the statements used in auto-generated database code. | [
"ForLocalInspectionWithPreparedStmts",
"is",
"the",
"same",
"as",
"ForLocalInspection",
"but",
"it",
"also",
"prepares",
"the",
"statements",
"used",
"in",
"auto",
"-",
"generated",
"database",
"code",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/db.go#L274-L285 | test |
lxc/lxd | lxd/db/db.go | SetDefaultTimeout | func (c *Cluster) SetDefaultTimeout(timeout time.Duration) {
driver := c.db.Driver().(*dqlite.Driver)
driver.SetContextTimeout(timeout)
} | go | func (c *Cluster) SetDefaultTimeout(timeout time.Duration) {
driver := c.db.Driver().(*dqlite.Driver)
driver.SetContextTimeout(timeout)
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"SetDefaultTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"{",
"driver",
":=",
"c",
".",
"db",
".",
"Driver",
"(",
")",
".",
"(",
"*",
"dqlite",
".",
"Driver",
")",
"\n",
"driver",
".",
"SetContextTimeo... | // SetDefaultTimeout sets the default go-dqlite driver timeout. | [
"SetDefaultTimeout",
"sets",
"the",
"default",
"go",
"-",
"dqlite",
"driver",
"timeout",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/db.go#L288-L291 | test |
lxc/lxd | lxd/db/db.go | Transaction | func (c *Cluster) Transaction(f func(*ClusterTx) error) error {
c.mu.RLock()
defer c.mu.RUnlock()
return c.transaction(f)
} | go | func (c *Cluster) Transaction(f func(*ClusterTx) error) error {
c.mu.RLock()
defer c.mu.RUnlock()
return c.transaction(f)
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"Transaction",
"(",
"f",
"func",
"(",
"*",
"ClusterTx",
")",
"error",
")",
"error",
"{",
"c",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"c"... | // Transaction creates a new ClusterTx object and transactionally executes the
// cluster database interactions invoked by the given function. If the function
// returns no error, all database changes are committed to the cluster database
// database, otherwise they are rolled back.
//
// If EnterExclusive has been cal... | [
"Transaction",
"creates",
"a",
"new",
"ClusterTx",
"object",
"and",
"transactionally",
"executes",
"the",
"cluster",
"database",
"interactions",
"invoked",
"by",
"the",
"given",
"function",
".",
"If",
"the",
"function",
"returns",
"no",
"error",
"all",
"database",... | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/db.go#L300-L304 | test |
lxc/lxd | lxd/db/db.go | EnterExclusive | func (c *Cluster) EnterExclusive() error {
logger.Debug("Acquiring exclusive lock on cluster db")
ch := make(chan struct{})
go func() {
c.mu.Lock()
ch <- struct{}{}
}()
timeout := 20 * time.Second
select {
case <-ch:
return nil
case <-time.After(timeout):
return fmt.Errorf("timeout (%s)", timeout)
}
... | go | func (c *Cluster) EnterExclusive() error {
logger.Debug("Acquiring exclusive lock on cluster db")
ch := make(chan struct{})
go func() {
c.mu.Lock()
ch <- struct{}{}
}()
timeout := 20 * time.Second
select {
case <-ch:
return nil
case <-time.After(timeout):
return fmt.Errorf("timeout (%s)", timeout)
}
... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"EnterExclusive",
"(",
")",
"error",
"{",
"logger",
".",
"Debug",
"(",
"\"Acquiring exclusive lock on cluster db\"",
")",
"\n",
"ch",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"go",
"func",
"(",
")",... | // EnterExclusive acquires a lock on the cluster db, so any successive call to
// Transaction will block until ExitExclusive has been called. | [
"EnterExclusive",
"acquires",
"a",
"lock",
"on",
"the",
"cluster",
"db",
"so",
"any",
"successive",
"call",
"to",
"Transaction",
"will",
"block",
"until",
"ExitExclusive",
"has",
"been",
"called",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/db.go#L308-L324 | test |
lxc/lxd | lxd/db/db.go | ExitExclusive | func (c *Cluster) ExitExclusive(f func(*ClusterTx) error) error {
logger.Debug("Releasing exclusive lock on cluster db")
defer c.mu.Unlock()
return c.transaction(f)
} | go | func (c *Cluster) ExitExclusive(f func(*ClusterTx) error) error {
logger.Debug("Releasing exclusive lock on cluster db")
defer c.mu.Unlock()
return c.transaction(f)
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ExitExclusive",
"(",
"f",
"func",
"(",
"*",
"ClusterTx",
")",
"error",
")",
"error",
"{",
"logger",
".",
"Debug",
"(",
"\"Releasing exclusive lock on cluster db\"",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
... | // ExitExclusive runs the given transaction and then releases the lock acquired
// with EnterExclusive. | [
"ExitExclusive",
"runs",
"the",
"given",
"transaction",
"and",
"then",
"releases",
"the",
"lock",
"acquired",
"with",
"EnterExclusive",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/db.go#L328-L332 | test |
lxc/lxd | lxd/db/db.go | Close | func (c *Cluster) Close() error {
for _, stmt := range c.stmts {
stmt.Close()
}
return c.db.Close()
} | go | func (c *Cluster) Close() error {
for _, stmt := range c.stmts {
stmt.Close()
}
return c.db.Close()
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"Close",
"(",
")",
"error",
"{",
"for",
"_",
",",
"stmt",
":=",
"range",
"c",
".",
"stmts",
"{",
"stmt",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"return",
"c",
".",
"db",
".",
"Close",
"(",
")",
"\n",
... | // Close the database facade. | [
"Close",
"the",
"database",
"facade",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/db.go#L357-L362 | test |
lxc/lxd | lxd/db/db.go | TxCommit | func TxCommit(tx *sql.Tx) error {
err := tx.Commit()
if err == nil || err == sql.ErrTxDone { // Ignore duplicate commits/rollbacks
return nil
}
return err
} | go | func TxCommit(tx *sql.Tx) error {
err := tx.Commit()
if err == nil || err == sql.ErrTxDone { // Ignore duplicate commits/rollbacks
return nil
}
return err
} | [
"func",
"TxCommit",
"(",
"tx",
"*",
"sql",
".",
"Tx",
")",
"error",
"{",
"err",
":=",
"tx",
".",
"Commit",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"||",
"err",
"==",
"sql",
".",
"ErrTxDone",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"e... | // TxCommit commits the given transaction. | [
"TxCommit",
"commits",
"the",
"given",
"transaction",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/db.go#L408-L414 | test |
lxc/lxd | lxc/config/remote.go | ParseRemote | func (c *Config) ParseRemote(raw string) (string, string, error) {
result := strings.SplitN(raw, ":", 2)
if len(result) == 1 {
return c.DefaultRemote, raw, nil
}
_, ok := c.Remotes[result[0]]
if !ok {
// Attempt to play nice with snapshots containing ":"
if shared.IsSnapshot(raw) && shared.IsSnapshot(result... | go | func (c *Config) ParseRemote(raw string) (string, string, error) {
result := strings.SplitN(raw, ":", 2)
if len(result) == 1 {
return c.DefaultRemote, raw, nil
}
_, ok := c.Remotes[result[0]]
if !ok {
// Attempt to play nice with snapshots containing ":"
if shared.IsSnapshot(raw) && shared.IsSnapshot(result... | [
"func",
"(",
"c",
"*",
"Config",
")",
"ParseRemote",
"(",
"raw",
"string",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"result",
":=",
"strings",
".",
"SplitN",
"(",
"raw",
",",
"\":\"",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"resu... | // ParseRemote splits remote and object | [
"ParseRemote",
"splits",
"remote",
"and",
"object"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxc/config/remote.go#L33-L50 | test |
lxc/lxd | lxc/config/remote.go | GetContainerServer | func (c *Config) GetContainerServer(name string) (lxd.ContainerServer, error) {
// Get the remote
remote, ok := c.Remotes[name]
if !ok {
return nil, fmt.Errorf("The remote \"%s\" doesn't exist", name)
}
// Sanity checks
if remote.Public || remote.Protocol == "simplestreams" {
return nil, fmt.Errorf("The remo... | go | func (c *Config) GetContainerServer(name string) (lxd.ContainerServer, error) {
// Get the remote
remote, ok := c.Remotes[name]
if !ok {
return nil, fmt.Errorf("The remote \"%s\" doesn't exist", name)
}
// Sanity checks
if remote.Public || remote.Protocol == "simplestreams" {
return nil, fmt.Errorf("The remo... | [
"func",
"(",
"c",
"*",
"Config",
")",
"GetContainerServer",
"(",
"name",
"string",
")",
"(",
"lxd",
".",
"ContainerServer",
",",
"error",
")",
"{",
"remote",
",",
"ok",
":=",
"c",
".",
"Remotes",
"[",
"name",
"]",
"\n",
"if",
"!",
"ok",
"{",
"retur... | // GetContainerServer returns a ContainerServer struct for the remote | [
"GetContainerServer",
"returns",
"a",
"ContainerServer",
"struct",
"for",
"the",
"remote"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxc/config/remote.go#L53-L108 | test |
lxc/lxd | lxc/config/remote.go | GetImageServer | func (c *Config) GetImageServer(name string) (lxd.ImageServer, error) {
// Get the remote
remote, ok := c.Remotes[name]
if !ok {
return nil, fmt.Errorf("The remote \"%s\" doesn't exist", name)
}
// Get connection arguments
args, err := c.getConnectionArgs(name)
if err != nil {
return nil, err
}
// Unix s... | go | func (c *Config) GetImageServer(name string) (lxd.ImageServer, error) {
// Get the remote
remote, ok := c.Remotes[name]
if !ok {
return nil, fmt.Errorf("The remote \"%s\" doesn't exist", name)
}
// Get connection arguments
args, err := c.getConnectionArgs(name)
if err != nil {
return nil, err
}
// Unix s... | [
"func",
"(",
"c",
"*",
"Config",
")",
"GetImageServer",
"(",
"name",
"string",
")",
"(",
"lxd",
".",
"ImageServer",
",",
"error",
")",
"{",
"remote",
",",
"ok",
":=",
"c",
".",
"Remotes",
"[",
"name",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"n... | // GetImageServer returns a ImageServer struct for the remote | [
"GetImageServer",
"returns",
"a",
"ImageServer",
"struct",
"for",
"the",
"remote"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxc/config/remote.go#L111-L177 | test |
lxc/lxd | lxd/sys/apparmor.go | initAppArmor | func (s *OS) initAppArmor() {
/* Detect AppArmor availability */
_, err := exec.LookPath("apparmor_parser")
if os.Getenv("LXD_SECURITY_APPARMOR") == "false" {
logger.Warnf("AppArmor support has been manually disabled")
} else if !shared.IsDir("/sys/kernel/security/apparmor") {
logger.Warnf("AppArmor support has... | go | func (s *OS) initAppArmor() {
/* Detect AppArmor availability */
_, err := exec.LookPath("apparmor_parser")
if os.Getenv("LXD_SECURITY_APPARMOR") == "false" {
logger.Warnf("AppArmor support has been manually disabled")
} else if !shared.IsDir("/sys/kernel/security/apparmor") {
logger.Warnf("AppArmor support has... | [
"func",
"(",
"s",
"*",
"OS",
")",
"initAppArmor",
"(",
")",
"{",
"_",
",",
"err",
":=",
"exec",
".",
"LookPath",
"(",
"\"apparmor_parser\"",
")",
"\n",
"if",
"os",
".",
"Getenv",
"(",
"\"LXD_SECURITY_APPARMOR\"",
")",
"==",
"\"false\"",
"{",
"logger",
... | // Initialize AppArmor-specific attributes. | [
"Initialize",
"AppArmor",
"-",
"specific",
"attributes",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/sys/apparmor.go#L19-L64 | test |
lxc/lxd | lxd/sys/apparmor.go | appArmorCanStack | func appArmorCanStack() bool {
contentBytes, err := ioutil.ReadFile("/sys/kernel/security/apparmor/features/domain/stack")
if err != nil {
return false
}
if string(contentBytes) != "yes\n" {
return false
}
contentBytes, err = ioutil.ReadFile("/sys/kernel/security/apparmor/features/domain/version")
if err !... | go | func appArmorCanStack() bool {
contentBytes, err := ioutil.ReadFile("/sys/kernel/security/apparmor/features/domain/stack")
if err != nil {
return false
}
if string(contentBytes) != "yes\n" {
return false
}
contentBytes, err = ioutil.ReadFile("/sys/kernel/security/apparmor/features/domain/version")
if err !... | [
"func",
"appArmorCanStack",
"(",
")",
"bool",
"{",
"contentBytes",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"\"/sys/kernel/security/apparmor/features/domain/stack\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
... | // Returns true if AppArmor stacking support is available. | [
"Returns",
"true",
"if",
"AppArmor",
"stacking",
"support",
"is",
"available",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/sys/apparmor.go#L78-L118 | test |
lxc/lxd | lxc/utils.go | containerDeviceAdd | func containerDeviceAdd(client lxd.ContainerServer, name string, devName string, dev map[string]string) error {
// Get the container entry
container, etag, err := client.GetContainer(name)
if err != nil {
return err
}
// Check if the device already exists
_, ok := container.Devices[devName]
if ok {
return f... | go | func containerDeviceAdd(client lxd.ContainerServer, name string, devName string, dev map[string]string) error {
// Get the container entry
container, etag, err := client.GetContainer(name)
if err != nil {
return err
}
// Check if the device already exists
_, ok := container.Devices[devName]
if ok {
return f... | [
"func",
"containerDeviceAdd",
"(",
"client",
"lxd",
".",
"ContainerServer",
",",
"name",
"string",
",",
"devName",
"string",
",",
"dev",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"container",
",",
"etag",
",",
"err",
":=",
"client",
".",
"G... | // Add a device to a container | [
"Add",
"a",
"device",
"to",
"a",
"container"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxc/utils.go#L123-L144 | test |
lxc/lxd | lxc/utils.go | profileDeviceAdd | func profileDeviceAdd(client lxd.ContainerServer, name string, devName string, dev map[string]string) error {
// Get the profile entry
profile, profileEtag, err := client.GetProfile(name)
if err != nil {
return err
}
// Check if the device already exists
_, ok := profile.Devices[devName]
if ok {
return fmt.... | go | func profileDeviceAdd(client lxd.ContainerServer, name string, devName string, dev map[string]string) error {
// Get the profile entry
profile, profileEtag, err := client.GetProfile(name)
if err != nil {
return err
}
// Check if the device already exists
_, ok := profile.Devices[devName]
if ok {
return fmt.... | [
"func",
"profileDeviceAdd",
"(",
"client",
"lxd",
".",
"ContainerServer",
",",
"name",
"string",
",",
"devName",
"string",
",",
"dev",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"profile",
",",
"profileEtag",
",",
"err",
":=",
"client",
".",
... | // Add a device to a profile | [
"Add",
"a",
"device",
"to",
"a",
"profile"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxc/utils.go#L147-L169 | test |
lxc/lxd | lxc/utils.go | ensureImageAliases | func ensureImageAliases(client lxd.ContainerServer, aliases []api.ImageAlias, fingerprint string) error {
if len(aliases) == 0 {
return nil
}
names := make([]string, len(aliases))
for i, alias := range aliases {
names[i] = alias.Name
}
sort.Strings(names)
resp, err := client.GetImageAliases()
if err != ni... | go | func ensureImageAliases(client lxd.ContainerServer, aliases []api.ImageAlias, fingerprint string) error {
if len(aliases) == 0 {
return nil
}
names := make([]string, len(aliases))
for i, alias := range aliases {
names[i] = alias.Name
}
sort.Strings(names)
resp, err := client.GetImageAliases()
if err != ni... | [
"func",
"ensureImageAliases",
"(",
"client",
"lxd",
".",
"ContainerServer",
",",
"aliases",
"[",
"]",
"api",
".",
"ImageAlias",
",",
"fingerprint",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"aliases",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",... | // Create the specified image alises, updating those that already exist | [
"Create",
"the",
"specified",
"image",
"alises",
"updating",
"those",
"that",
"already",
"exist"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxc/utils.go#L172-L206 | test |
lxc/lxd | lxc/utils.go | GetExistingAliases | func GetExistingAliases(aliases []string, allAliases []api.ImageAliasesEntry) []api.ImageAliasesEntry {
existing := []api.ImageAliasesEntry{}
for _, alias := range allAliases {
name := alias.Name
pos := sort.SearchStrings(aliases, name)
if pos < len(aliases) && aliases[pos] == name {
existing = append(existi... | go | func GetExistingAliases(aliases []string, allAliases []api.ImageAliasesEntry) []api.ImageAliasesEntry {
existing := []api.ImageAliasesEntry{}
for _, alias := range allAliases {
name := alias.Name
pos := sort.SearchStrings(aliases, name)
if pos < len(aliases) && aliases[pos] == name {
existing = append(existi... | [
"func",
"GetExistingAliases",
"(",
"aliases",
"[",
"]",
"string",
",",
"allAliases",
"[",
"]",
"api",
".",
"ImageAliasesEntry",
")",
"[",
"]",
"api",
".",
"ImageAliasesEntry",
"{",
"existing",
":=",
"[",
"]",
"api",
".",
"ImageAliasesEntry",
"{",
"}",
"\n"... | // GetExistingAliases returns the intersection between a list of aliases and all the existing ones. | [
"GetExistingAliases",
"returns",
"the",
"intersection",
"between",
"a",
"list",
"of",
"aliases",
"and",
"all",
"the",
"existing",
"ones",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxc/utils.go#L209-L219 | test |
lxc/lxd | shared/api/status_code.go | String | func (o StatusCode) String() string {
return map[StatusCode]string{
OperationCreated: "Operation created",
Started: "Started",
Stopped: "Stopped",
Running: "Running",
Cancelling: "Cancelling",
Pending: "Pending",
Success: "Success",
Failure: "... | go | func (o StatusCode) String() string {
return map[StatusCode]string{
OperationCreated: "Operation created",
Started: "Started",
Stopped: "Stopped",
Running: "Running",
Cancelling: "Cancelling",
Pending: "Pending",
Success: "Success",
Failure: "... | [
"func",
"(",
"o",
"StatusCode",
")",
"String",
"(",
")",
"string",
"{",
"return",
"map",
"[",
"StatusCode",
"]",
"string",
"{",
"OperationCreated",
":",
"\"Operation created\"",
",",
"Started",
":",
"\"Started\"",
",",
"Stopped",
":",
"\"Stopped\"",
",",
"Ru... | // String returns a suitable string representation for the status code | [
"String",
"returns",
"a",
"suitable",
"string",
"representation",
"for",
"the",
"status",
"code"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/shared/api/status_code.go#L29-L48 | test |
lxc/lxd | lxd/db/images.go | ImagesGetExpired | func (c *Cluster) ImagesGetExpired(expiry int64) ([]string, error) {
q := `SELECT fingerprint, last_use_date, upload_date FROM images WHERE cached=1`
var fpStr string
var useStr string
var uploadStr string
inargs := []interface{}{}
outfmt := []interface{}{fpStr, useStr, uploadStr}
dbResults, err := queryScan(c... | go | func (c *Cluster) ImagesGetExpired(expiry int64) ([]string, error) {
q := `SELECT fingerprint, last_use_date, upload_date FROM images WHERE cached=1`
var fpStr string
var useStr string
var uploadStr string
inargs := []interface{}{}
outfmt := []interface{}{fpStr, useStr, uploadStr}
dbResults, err := queryScan(c... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImagesGetExpired",
"(",
"expiry",
"int64",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"q",
":=",
"`SELECT fingerprint, last_use_date, upload_date FROM images WHERE cached=1`",
"\n",
"var",
"fpStr",
"string",
"\n",... | // ImagesGetExpired returns the names of all images that have expired since the
// given time. | [
"ImagesGetExpired",
"returns",
"the",
"names",
"of",
"all",
"images",
"that",
"have",
"expired",
"since",
"the",
"given",
"time",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L66-L104 | test |
lxc/lxd | lxd/db/images.go | ImageSourceInsert | func (c *Cluster) ImageSourceInsert(id int, server string, protocol string, certificate string, alias string) error {
stmt := `INSERT INTO images_source (image_id, server, protocol, certificate, alias) values (?, ?, ?, ?, ?)`
protocolInt := -1
for protoInt, protoString := range ImageSourceProtocol {
if protoStrin... | go | func (c *Cluster) ImageSourceInsert(id int, server string, protocol string, certificate string, alias string) error {
stmt := `INSERT INTO images_source (image_id, server, protocol, certificate, alias) values (?, ?, ?, ?, ?)`
protocolInt := -1
for protoInt, protoString := range ImageSourceProtocol {
if protoStrin... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageSourceInsert",
"(",
"id",
"int",
",",
"server",
"string",
",",
"protocol",
"string",
",",
"certificate",
"string",
",",
"alias",
"string",
")",
"error",
"{",
"stmt",
":=",
"`INSERT INTO images_source (image_id, server... | // ImageSourceInsert inserts a new image source. | [
"ImageSourceInsert",
"inserts",
"a",
"new",
"image",
"source",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L107-L123 | test |
lxc/lxd | lxd/db/images.go | ImageSourceGet | func (c *Cluster) ImageSourceGet(imageID int) (int, api.ImageSource, error) {
q := `SELECT id, server, protocol, certificate, alias FROM images_source WHERE image_id=?`
id := 0
protocolInt := -1
result := api.ImageSource{}
arg1 := []interface{}{imageID}
arg2 := []interface{}{&id, &result.Server, &protocolInt, &... | go | func (c *Cluster) ImageSourceGet(imageID int) (int, api.ImageSource, error) {
q := `SELECT id, server, protocol, certificate, alias FROM images_source WHERE image_id=?`
id := 0
protocolInt := -1
result := api.ImageSource{}
arg1 := []interface{}{imageID}
arg2 := []interface{}{&id, &result.Server, &protocolInt, &... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageSourceGet",
"(",
"imageID",
"int",
")",
"(",
"int",
",",
"api",
".",
"ImageSource",
",",
"error",
")",
"{",
"q",
":=",
"`SELECT id, server, protocol, certificate, alias FROM images_source WHERE image_id=?`",
"\n",
"id",
... | // ImageSourceGet returns the image source with the given ID. | [
"ImageSourceGet",
"returns",
"the",
"image",
"source",
"with",
"the",
"given",
"ID",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L126-L153 | test |
lxc/lxd | lxd/db/images.go | ImageExists | func (c *Cluster) ImageExists(project string, fingerprint string) (bool, error) {
err := c.Transaction(func(tx *ClusterTx) error {
enabled, err := tx.ProjectHasImages(project)
if err != nil {
return errors.Wrap(err, "Check if project has images")
}
if !enabled {
project = "default"
}
return nil
})
... | go | func (c *Cluster) ImageExists(project string, fingerprint string) (bool, error) {
err := c.Transaction(func(tx *ClusterTx) error {
enabled, err := tx.ProjectHasImages(project)
if err != nil {
return errors.Wrap(err, "Check if project has images")
}
if !enabled {
project = "default"
}
return nil
})
... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageExists",
"(",
"project",
"string",
",",
"fingerprint",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"err",
":=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",... | // ImageExists returns whether an image with the given fingerprint exists. | [
"ImageExists",
"returns",
"whether",
"an",
"image",
"with",
"the",
"given",
"fingerprint",
"exists",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L194-L224 | test |
lxc/lxd | lxd/db/images.go | ImageGet | func (c *Cluster) ImageGet(project, fingerprint string, public bool, strictMatching bool) (int, *api.Image, error) {
err := c.Transaction(func(tx *ClusterTx) error {
enabled, err := tx.ProjectHasImages(project)
if err != nil {
return errors.Wrap(err, "Check if project has images")
}
if !enabled {
project... | go | func (c *Cluster) ImageGet(project, fingerprint string, public bool, strictMatching bool) (int, *api.Image, error) {
err := c.Transaction(func(tx *ClusterTx) error {
enabled, err := tx.ProjectHasImages(project)
if err != nil {
return errors.Wrap(err, "Check if project has images")
}
if !enabled {
project... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageGet",
"(",
"project",
",",
"fingerprint",
"string",
",",
"public",
"bool",
",",
"strictMatching",
"bool",
")",
"(",
"int",
",",
"*",
"api",
".",
"Image",
",",
"error",
")",
"{",
"err",
":=",
"c",
".",
"T... | // ImageGet gets an Image object from the database.
// If strictMatching is false, The fingerprint argument will be queried with a LIKE query, means you can
// pass a shortform and will get the full fingerprint.
// There can never be more than one image with a given fingerprint, as it is
// enforced by a UNIQUE constra... | [
"ImageGet",
"gets",
"an",
"Image",
"object",
"from",
"the",
"database",
".",
"If",
"strictMatching",
"is",
"false",
"The",
"fingerprint",
"argument",
"will",
"be",
"queried",
"with",
"a",
"LIKE",
"query",
"means",
"you",
"can",
"pass",
"a",
"shortform",
"and... | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L265-L349 | test |
lxc/lxd | lxd/db/images.go | ImageGetFromAnyProject | func (c *Cluster) ImageGetFromAnyProject(fingerprint string) (int, *api.Image, error) {
var create, expire, used, upload *time.Time // These hold the db-returned times
// The object we'll actually return
image := api.Image{}
id := -1
arch := -1
// These two humongous things will be filled by the call to DbQuery... | go | func (c *Cluster) ImageGetFromAnyProject(fingerprint string) (int, *api.Image, error) {
var create, expire, used, upload *time.Time // These hold the db-returned times
// The object we'll actually return
image := api.Image{}
id := -1
arch := -1
// These two humongous things will be filled by the call to DbQuery... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageGetFromAnyProject",
"(",
"fingerprint",
"string",
")",
"(",
"int",
",",
"*",
"api",
".",
"Image",
",",
"error",
")",
"{",
"var",
"create",
",",
"expire",
",",
"used",
",",
"upload",
"*",
"time",
".",
"Time... | // ImageGetFromAnyProject returns an image matching the given fingerprint, if
// it exists in any project. | [
"ImageGetFromAnyProject",
"returns",
"an",
"image",
"matching",
"the",
"given",
"fingerprint",
"if",
"it",
"exists",
"in",
"any",
"project",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L353-L390 | test |
lxc/lxd | lxd/db/images.go | imageFill | func (c *Cluster) imageFill(id int, image *api.Image, create, expire, used, upload *time.Time, arch int) error {
// Some of the dates can be nil in the DB, let's process them.
if create != nil {
image.CreatedAt = *create
} else {
image.CreatedAt = time.Time{}
}
if expire != nil {
image.ExpiresAt = *expire
... | go | func (c *Cluster) imageFill(id int, image *api.Image, create, expire, used, upload *time.Time, arch int) error {
// Some of the dates can be nil in the DB, let's process them.
if create != nil {
image.CreatedAt = *create
} else {
image.CreatedAt = time.Time{}
}
if expire != nil {
image.ExpiresAt = *expire
... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"imageFill",
"(",
"id",
"int",
",",
"image",
"*",
"api",
".",
"Image",
",",
"create",
",",
"expire",
",",
"used",
",",
"upload",
"*",
"time",
".",
"Time",
",",
"arch",
"int",
")",
"error",
"{",
"if",
"create... | // Fill extra image fields such as properties and alias. This is called after
// fetching a single row from the images table. | [
"Fill",
"extra",
"image",
"fields",
"such",
"as",
"properties",
"and",
"alias",
".",
"This",
"is",
"called",
"after",
"fetching",
"a",
"single",
"row",
"from",
"the",
"images",
"table",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L394-L463 | test |
lxc/lxd | lxd/db/images.go | ImageLocate | func (c *Cluster) ImageLocate(fingerprint string) (string, error) {
stmt := `
SELECT nodes.address FROM nodes
LEFT JOIN images_nodes ON images_nodes.node_id = nodes.id
LEFT JOIN images ON images_nodes.image_id = images.id
WHERE images.fingerprint = ?
`
var localAddress string // Address of this node
var addresse... | go | func (c *Cluster) ImageLocate(fingerprint string) (string, error) {
stmt := `
SELECT nodes.address FROM nodes
LEFT JOIN images_nodes ON images_nodes.node_id = nodes.id
LEFT JOIN images ON images_nodes.image_id = images.id
WHERE images.fingerprint = ?
`
var localAddress string // Address of this node
var addresse... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageLocate",
"(",
"fingerprint",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"stmt",
":=",
"`SELECT nodes.address FROM nodes LEFT JOIN images_nodes ON images_nodes.node_id = nodes.id LEFT JOIN images ON images_nodes.image_id ... | // ImageLocate returns the address of an online node that has a local copy of
// the given image, or an empty string if the image is already available on this
// node.
//
// If the image is not available on any online node, an error is returned. | [
"ImageLocate",
"returns",
"the",
"address",
"of",
"an",
"online",
"node",
"that",
"has",
"a",
"local",
"copy",
"of",
"the",
"given",
"image",
"or",
"an",
"empty",
"string",
"if",
"the",
"image",
"is",
"already",
"available",
"on",
"this",
"node",
".",
"I... | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L470-L520 | test |
lxc/lxd | lxd/db/images.go | ImageAssociateNode | func (c *Cluster) ImageAssociateNode(project, fingerprint string) error {
imageID, _, err := c.ImageGet(project, fingerprint, false, true)
if err != nil {
return err
}
err = c.Transaction(func(tx *ClusterTx) error {
_, err := tx.tx.Exec("INSERT INTO images_nodes(image_id, node_id) VALUES(?, ?)", imageID, c.nod... | go | func (c *Cluster) ImageAssociateNode(project, fingerprint string) error {
imageID, _, err := c.ImageGet(project, fingerprint, false, true)
if err != nil {
return err
}
err = c.Transaction(func(tx *ClusterTx) error {
_, err := tx.tx.Exec("INSERT INTO images_nodes(image_id, node_id) VALUES(?, ?)", imageID, c.nod... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageAssociateNode",
"(",
"project",
",",
"fingerprint",
"string",
")",
"error",
"{",
"imageID",
",",
"_",
",",
"err",
":=",
"c",
".",
"ImageGet",
"(",
"project",
",",
"fingerprint",
",",
"false",
",",
"true",
")... | // ImageAssociateNode creates a new entry in the images_nodes table for
// tracking that the current node has the given image. | [
"ImageAssociateNode",
"creates",
"a",
"new",
"entry",
"in",
"the",
"images_nodes",
"table",
"for",
"tracking",
"that",
"the",
"current",
"node",
"has",
"the",
"given",
"image",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L524-L535 | test |
lxc/lxd | lxd/db/images.go | ImageDelete | func (c *Cluster) ImageDelete(id int) error {
err := exec(c.db, "DELETE FROM images WHERE id=?", id)
if err != nil {
return err
}
return nil
} | go | func (c *Cluster) ImageDelete(id int) error {
err := exec(c.db, "DELETE FROM images WHERE id=?", id)
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageDelete",
"(",
"id",
"int",
")",
"error",
"{",
"err",
":=",
"exec",
"(",
"c",
".",
"db",
",",
"\"DELETE FROM images WHERE id=?\"",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",... | // ImageDelete deletes the image with the given ID. | [
"ImageDelete",
"deletes",
"the",
"image",
"with",
"the",
"given",
"ID",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L538-L545 | test |
lxc/lxd | lxd/db/images.go | ImageAliasesGet | func (c *Cluster) ImageAliasesGet(project string) ([]string, error) {
err := c.Transaction(func(tx *ClusterTx) error {
enabled, err := tx.ProjectHasImages(project)
if err != nil {
return errors.Wrap(err, "Check if project has images")
}
if !enabled {
project = "default"
}
return nil
})
if err != ni... | go | func (c *Cluster) ImageAliasesGet(project string) ([]string, error) {
err := c.Transaction(func(tx *ClusterTx) error {
enabled, err := tx.ProjectHasImages(project)
if err != nil {
return errors.Wrap(err, "Check if project has images")
}
if !enabled {
project = "default"
}
return nil
})
if err != ni... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageAliasesGet",
"(",
"project",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"err",
":=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"enabled",
... | // ImageAliasesGet returns the names of the aliases of all images. | [
"ImageAliasesGet",
"returns",
"the",
"names",
"of",
"the",
"aliases",
"of",
"all",
"images",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L548-L581 | test |
lxc/lxd | lxd/db/images.go | ImageAliasGet | func (c *Cluster) ImageAliasGet(project, name string, isTrustedClient bool) (int, api.ImageAliasesEntry, error) {
id := -1
entry := api.ImageAliasesEntry{}
err := c.Transaction(func(tx *ClusterTx) error {
enabled, err := tx.ProjectHasImages(project)
if err != nil {
return errors.Wrap(err, "Check if project h... | go | func (c *Cluster) ImageAliasGet(project, name string, isTrustedClient bool) (int, api.ImageAliasesEntry, error) {
id := -1
entry := api.ImageAliasesEntry{}
err := c.Transaction(func(tx *ClusterTx) error {
enabled, err := tx.ProjectHasImages(project)
if err != nil {
return errors.Wrap(err, "Check if project h... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageAliasGet",
"(",
"project",
",",
"name",
"string",
",",
"isTrustedClient",
"bool",
")",
"(",
"int",
",",
"api",
".",
"ImageAliasesEntry",
",",
"error",
")",
"{",
"id",
":=",
"-",
"1",
"\n",
"entry",
":=",
"... | // ImageAliasGet returns the alias with the given name in the given project. | [
"ImageAliasGet",
"returns",
"the",
"alias",
"with",
"the",
"given",
"name",
"in",
"the",
"given",
"project",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L584-L631 | test |
lxc/lxd | lxd/db/images.go | ImageAliasRename | func (c *Cluster) ImageAliasRename(id int, name string) error {
err := exec(c.db, "UPDATE images_aliases SET name=? WHERE id=?", name, id)
return err
} | go | func (c *Cluster) ImageAliasRename(id int, name string) error {
err := exec(c.db, "UPDATE images_aliases SET name=? WHERE id=?", name, id)
return err
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageAliasRename",
"(",
"id",
"int",
",",
"name",
"string",
")",
"error",
"{",
"err",
":=",
"exec",
"(",
"c",
".",
"db",
",",
"\"UPDATE images_aliases SET name=? WHERE id=?\"",
",",
"name",
",",
"id",
")",
"\n",
"r... | // ImageAliasRename renames the alias with the given ID. | [
"ImageAliasRename",
"renames",
"the",
"alias",
"with",
"the",
"given",
"ID",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L634-L637 | test |
lxc/lxd | lxd/db/images.go | ImageAliasDelete | func (c *Cluster) ImageAliasDelete(project, name string) error {
err := c.Transaction(func(tx *ClusterTx) error {
enabled, err := tx.ProjectHasImages(project)
if err != nil {
return errors.Wrap(err, "Check if project has images")
}
if !enabled {
project = "default"
}
return nil
})
if err != nil {
... | go | func (c *Cluster) ImageAliasDelete(project, name string) error {
err := c.Transaction(func(tx *ClusterTx) error {
enabled, err := tx.ProjectHasImages(project)
if err != nil {
return errors.Wrap(err, "Check if project has images")
}
if !enabled {
project = "default"
}
return nil
})
if err != nil {
... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageAliasDelete",
"(",
"project",
",",
"name",
"string",
")",
"error",
"{",
"err",
":=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"enabled",
",",
"err",
":=",
"tx",... | // ImageAliasDelete deletes the alias with the given name. | [
"ImageAliasDelete",
"deletes",
"the",
"alias",
"with",
"the",
"given",
"name",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L640-L661 | test |
lxc/lxd | lxd/db/images.go | ImageAliasesMove | func (c *Cluster) ImageAliasesMove(source int, destination int) error {
err := exec(c.db, "UPDATE images_aliases SET image_id=? WHERE image_id=?", destination, source)
return err
} | go | func (c *Cluster) ImageAliasesMove(source int, destination int) error {
err := exec(c.db, "UPDATE images_aliases SET image_id=? WHERE image_id=?", destination, source)
return err
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageAliasesMove",
"(",
"source",
"int",
",",
"destination",
"int",
")",
"error",
"{",
"err",
":=",
"exec",
"(",
"c",
".",
"db",
",",
"\"UPDATE images_aliases SET image_id=? WHERE image_id=?\"",
",",
"destination",
",",
... | // ImageAliasesMove changes the image ID associated with an alias. | [
"ImageAliasesMove",
"changes",
"the",
"image",
"ID",
"associated",
"with",
"an",
"alias",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L664-L667 | test |
lxc/lxd | lxd/db/images.go | ImageAliasAdd | func (c *Cluster) ImageAliasAdd(project, name string, imageID int, desc string) error {
err := c.Transaction(func(tx *ClusterTx) error {
enabled, err := tx.ProjectHasImages(project)
if err != nil {
return errors.Wrap(err, "Check if project has images")
}
if !enabled {
project = "default"
}
return nil... | go | func (c *Cluster) ImageAliasAdd(project, name string, imageID int, desc string) error {
err := c.Transaction(func(tx *ClusterTx) error {
enabled, err := tx.ProjectHasImages(project)
if err != nil {
return errors.Wrap(err, "Check if project has images")
}
if !enabled {
project = "default"
}
return nil... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageAliasAdd",
"(",
"project",
",",
"name",
"string",
",",
"imageID",
"int",
",",
"desc",
"string",
")",
"error",
"{",
"err",
":=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"erro... | // ImageAliasAdd inserts an alias ento the database. | [
"ImageAliasAdd",
"inserts",
"an",
"alias",
"ento",
"the",
"database",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L670-L691 | test |
lxc/lxd | lxd/db/images.go | ImageAliasUpdate | func (c *Cluster) ImageAliasUpdate(id int, imageID int, desc string) error {
stmt := `UPDATE images_aliases SET image_id=?, description=? WHERE id=?`
err := exec(c.db, stmt, imageID, desc, id)
return err
} | go | func (c *Cluster) ImageAliasUpdate(id int, imageID int, desc string) error {
stmt := `UPDATE images_aliases SET image_id=?, description=? WHERE id=?`
err := exec(c.db, stmt, imageID, desc, id)
return err
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageAliasUpdate",
"(",
"id",
"int",
",",
"imageID",
"int",
",",
"desc",
"string",
")",
"error",
"{",
"stmt",
":=",
"`UPDATE images_aliases SET image_id=?, description=? WHERE id=?`",
"\n",
"err",
":=",
"exec",
"(",
"c",
... | // ImageAliasUpdate updates the alias with the given ID. | [
"ImageAliasUpdate",
"updates",
"the",
"alias",
"with",
"the",
"given",
"ID",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L694-L698 | test |
lxc/lxd | lxd/db/images.go | ImageLastAccessUpdate | func (c *Cluster) ImageLastAccessUpdate(fingerprint string, date time.Time) error {
stmt := `UPDATE images SET last_use_date=? WHERE fingerprint=?`
err := exec(c.db, stmt, date, fingerprint)
return err
} | go | func (c *Cluster) ImageLastAccessUpdate(fingerprint string, date time.Time) error {
stmt := `UPDATE images SET last_use_date=? WHERE fingerprint=?`
err := exec(c.db, stmt, date, fingerprint)
return err
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageLastAccessUpdate",
"(",
"fingerprint",
"string",
",",
"date",
"time",
".",
"Time",
")",
"error",
"{",
"stmt",
":=",
"`UPDATE images SET last_use_date=? WHERE fingerprint=?`",
"\n",
"err",
":=",
"exec",
"(",
"c",
".",
... | // ImageLastAccessUpdate updates the last_use_date field of the image with the
// given fingerprint. | [
"ImageLastAccessUpdate",
"updates",
"the",
"last_use_date",
"field",
"of",
"the",
"image",
"with",
"the",
"given",
"fingerprint",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L702-L706 | test |
lxc/lxd | lxd/db/images.go | ImageLastAccessInit | func (c *Cluster) ImageLastAccessInit(fingerprint string) error {
stmt := `UPDATE images SET cached=1, last_use_date=strftime("%s") WHERE fingerprint=?`
err := exec(c.db, stmt, fingerprint)
return err
} | go | func (c *Cluster) ImageLastAccessInit(fingerprint string) error {
stmt := `UPDATE images SET cached=1, last_use_date=strftime("%s") WHERE fingerprint=?`
err := exec(c.db, stmt, fingerprint)
return err
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageLastAccessInit",
"(",
"fingerprint",
"string",
")",
"error",
"{",
"stmt",
":=",
"`UPDATE images SET cached=1, last_use_date=strftime(\"%s\") WHERE fingerprint=?`",
"\n",
"err",
":=",
"exec",
"(",
"c",
".",
"db",
",",
"stm... | //ImageLastAccessInit inits the last_use_date field of the image with the given fingerprint. | [
"ImageLastAccessInit",
"inits",
"the",
"last_use_date",
"field",
"of",
"the",
"image",
"with",
"the",
"given",
"fingerprint",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L709-L713 | test |
lxc/lxd | lxd/db/images.go | ImageUpdate | func (c *Cluster) ImageUpdate(id int, fname string, sz int64, public bool, autoUpdate bool, architecture string, createdAt time.Time, expiresAt time.Time, properties map[string]string) error {
arch, err := osarch.ArchitectureId(architecture)
if err != nil {
arch = 0
}
err = c.Transaction(func(tx *ClusterTx) erro... | go | func (c *Cluster) ImageUpdate(id int, fname string, sz int64, public bool, autoUpdate bool, architecture string, createdAt time.Time, expiresAt time.Time, properties map[string]string) error {
arch, err := osarch.ArchitectureId(architecture)
if err != nil {
arch = 0
}
err = c.Transaction(func(tx *ClusterTx) erro... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageUpdate",
"(",
"id",
"int",
",",
"fname",
"string",
",",
"sz",
"int64",
",",
"public",
"bool",
",",
"autoUpdate",
"bool",
",",
"architecture",
"string",
",",
"createdAt",
"time",
".",
"Time",
",",
"expiresAt",
... | // ImageUpdate updates the image with the given ID. | [
"ImageUpdate",
"updates",
"the",
"image",
"with",
"the",
"given",
"ID",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L716-L765 | test |
lxc/lxd | lxd/db/images.go | ImageInsert | func (c *Cluster) ImageInsert(project, fp string, fname string, sz int64, public bool, autoUpdate bool, architecture string, createdAt time.Time, expiresAt time.Time, properties map[string]string) error {
err := c.Transaction(func(tx *ClusterTx) error {
enabled, err := tx.ProjectHasImages(project)
if err != nil {
... | go | func (c *Cluster) ImageInsert(project, fp string, fname string, sz int64, public bool, autoUpdate bool, architecture string, createdAt time.Time, expiresAt time.Time, properties map[string]string) error {
err := c.Transaction(func(tx *ClusterTx) error {
enabled, err := tx.ProjectHasImages(project)
if err != nil {
... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageInsert",
"(",
"project",
",",
"fp",
"string",
",",
"fname",
"string",
",",
"sz",
"int64",
",",
"public",
"bool",
",",
"autoUpdate",
"bool",
",",
"architecture",
"string",
",",
"createdAt",
"time",
".",
"Time",... | // ImageInsert inserts a new image. | [
"ImageInsert",
"inserts",
"a",
"new",
"image",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L768-L842 | test |
lxc/lxd | lxd/db/images.go | ImageGetPools | func (c *Cluster) ImageGetPools(imageFingerprint string) ([]int64, error) {
poolID := int64(-1)
query := "SELECT storage_pool_id FROM storage_volumes WHERE node_id=? AND name=? AND type=?"
inargs := []interface{}{c.nodeID, imageFingerprint, StoragePoolVolumeTypeImage}
outargs := []interface{}{poolID}
result, err ... | go | func (c *Cluster) ImageGetPools(imageFingerprint string) ([]int64, error) {
poolID := int64(-1)
query := "SELECT storage_pool_id FROM storage_volumes WHERE node_id=? AND name=? AND type=?"
inargs := []interface{}{c.nodeID, imageFingerprint, StoragePoolVolumeTypeImage}
outargs := []interface{}{poolID}
result, err ... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageGetPools",
"(",
"imageFingerprint",
"string",
")",
"(",
"[",
"]",
"int64",
",",
"error",
")",
"{",
"poolID",
":=",
"int64",
"(",
"-",
"1",
")",
"\n",
"query",
":=",
"\"SELECT storage_pool_id FROM storage_volumes W... | // ImageGetPools get the names of all storage pools on which a given image exists. | [
"ImageGetPools",
"get",
"the",
"names",
"of",
"all",
"storage",
"pools",
"on",
"which",
"a",
"given",
"image",
"exists",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L845-L862 | test |
lxc/lxd | lxd/db/images.go | ImageGetPoolNamesFromIDs | func (c *Cluster) ImageGetPoolNamesFromIDs(poolIDs []int64) ([]string, error) {
var poolName string
query := "SELECT name FROM storage_pools WHERE id=?"
poolNames := []string{}
for _, poolID := range poolIDs {
inargs := []interface{}{poolID}
outargs := []interface{}{poolName}
result, err := queryScan(c.db, ... | go | func (c *Cluster) ImageGetPoolNamesFromIDs(poolIDs []int64) ([]string, error) {
var poolName string
query := "SELECT name FROM storage_pools WHERE id=?"
poolNames := []string{}
for _, poolID := range poolIDs {
inargs := []interface{}{poolID}
outargs := []interface{}{poolName}
result, err := queryScan(c.db, ... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageGetPoolNamesFromIDs",
"(",
"poolIDs",
"[",
"]",
"int64",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"poolName",
"string",
"\n",
"query",
":=",
"\"SELECT name FROM storage_pools WHERE id=?\"",
"\n",... | // ImageGetPoolNamesFromIDs get the names of all storage pools on which a given image exists. | [
"ImageGetPoolNamesFromIDs",
"get",
"the",
"names",
"of",
"all",
"storage",
"pools",
"on",
"which",
"a",
"given",
"image",
"exists",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L865-L885 | test |
lxc/lxd | lxd/db/images.go | ImageUploadedAt | func (c *Cluster) ImageUploadedAt(id int, uploadedAt time.Time) error {
err := exec(c.db, "UPDATE images SET upload_date=? WHERE id=?", uploadedAt, id)
return err
} | go | func (c *Cluster) ImageUploadedAt(id int, uploadedAt time.Time) error {
err := exec(c.db, "UPDATE images SET upload_date=? WHERE id=?", uploadedAt, id)
return err
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageUploadedAt",
"(",
"id",
"int",
",",
"uploadedAt",
"time",
".",
"Time",
")",
"error",
"{",
"err",
":=",
"exec",
"(",
"c",
".",
"db",
",",
"\"UPDATE images SET upload_date=? WHERE id=?\"",
",",
"uploadedAt",
",",
... | // ImageUploadedAt updates the upload_date column and an image row. | [
"ImageUploadedAt",
"updates",
"the",
"upload_date",
"column",
"and",
"an",
"image",
"row",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L888-L891 | test |
lxc/lxd | lxd/db/images.go | ImagesGetOnCurrentNode | func (c *Cluster) ImagesGetOnCurrentNode() (map[string][]string, error) {
return c.ImagesGetByNodeID(c.nodeID)
} | go | func (c *Cluster) ImagesGetOnCurrentNode() (map[string][]string, error) {
return c.ImagesGetByNodeID(c.nodeID)
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImagesGetOnCurrentNode",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
",",
"error",
")",
"{",
"return",
"c",
".",
"ImagesGetByNodeID",
"(",
"c",
".",
"nodeID",
")",
"\n",
"}"
] | // ImagesGetOnCurrentNode returns all images that the current LXD node instance has. | [
"ImagesGetOnCurrentNode",
"returns",
"all",
"images",
"that",
"the",
"current",
"LXD",
"node",
"instance",
"has",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L894-L896 | test |
lxc/lxd | lxd/db/images.go | ImagesGetByNodeID | func (c *Cluster) ImagesGetByNodeID(id int64) (map[string][]string, error) {
images := make(map[string][]string) // key is fingerprint, value is list of projects
err := c.Transaction(func(tx *ClusterTx) error {
stmt := `
SELECT images.fingerprint, projects.name FROM images
LEFT JOIN images_nodes ON images... | go | func (c *Cluster) ImagesGetByNodeID(id int64) (map[string][]string, error) {
images := make(map[string][]string) // key is fingerprint, value is list of projects
err := c.Transaction(func(tx *ClusterTx) error {
stmt := `
SELECT images.fingerprint, projects.name FROM images
LEFT JOIN images_nodes ON images... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImagesGetByNodeID",
"(",
"id",
"int64",
")",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
",",
"error",
")",
"{",
"images",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
"\n"... | // ImagesGetByNodeID returns all images that the LXD node instance has with the given node id. | [
"ImagesGetByNodeID",
"returns",
"all",
"images",
"that",
"the",
"LXD",
"node",
"instance",
"has",
"with",
"the",
"given",
"node",
"id",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L899-L928 | test |
lxc/lxd | lxd/db/images.go | ImageGetNodesWithImage | func (c *Cluster) ImageGetNodesWithImage(fingerprint string) ([]string, error) {
q := `
SELECT DISTINCT nodes.address FROM nodes
LEFT JOIN images_nodes ON images_nodes.node_id = nodes.id
LEFT JOIN images ON images_nodes.image_id = images.id
WHERE images.fingerprint = ?
`
return c.getNodesByImageFingerprint(q, fi... | go | func (c *Cluster) ImageGetNodesWithImage(fingerprint string) ([]string, error) {
q := `
SELECT DISTINCT nodes.address FROM nodes
LEFT JOIN images_nodes ON images_nodes.node_id = nodes.id
LEFT JOIN images ON images_nodes.image_id = images.id
WHERE images.fingerprint = ?
`
return c.getNodesByImageFingerprint(q, fi... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageGetNodesWithImage",
"(",
"fingerprint",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"q",
":=",
"`SELECT DISTINCT nodes.address FROM nodes LEFT JOIN images_nodes ON images_nodes.node_id = nodes.id LEFT JOIN i... | // ImageGetNodesWithImage returns the addresses of online nodes which already have the image. | [
"ImageGetNodesWithImage",
"returns",
"the",
"addresses",
"of",
"online",
"nodes",
"which",
"already",
"have",
"the",
"image",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L931-L939 | test |
lxc/lxd | lxd/db/images.go | ImageGetNodesWithoutImage | func (c *Cluster) ImageGetNodesWithoutImage(fingerprint string) ([]string, error) {
q := `
SELECT DISTINCT nodes.address FROM nodes WHERE nodes.address NOT IN (
SELECT DISTINCT nodes.address FROM nodes
LEFT JOIN images_nodes ON images_nodes.node_id = nodes.id
LEFT JOIN images ON images_nodes.image_id = image... | go | func (c *Cluster) ImageGetNodesWithoutImage(fingerprint string) ([]string, error) {
q := `
SELECT DISTINCT nodes.address FROM nodes WHERE nodes.address NOT IN (
SELECT DISTINCT nodes.address FROM nodes
LEFT JOIN images_nodes ON images_nodes.node_id = nodes.id
LEFT JOIN images ON images_nodes.image_id = image... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageGetNodesWithoutImage",
"(",
"fingerprint",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"q",
":=",
"`SELECT DISTINCT nodes.address FROM nodes WHERE nodes.address NOT IN ( SELECT DISTINCT nodes.address FROM nod... | // ImageGetNodesWithoutImage returns the addresses of online nodes which don't have the image. | [
"ImageGetNodesWithoutImage",
"returns",
"the",
"addresses",
"of",
"online",
"nodes",
"which",
"don",
"t",
"have",
"the",
"image",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/images.go#L942-L951 | test |
lxc/lxd | lxd/task/group.go | Add | func (g *Group) Add(f Func, schedule Schedule) *Task {
i := len(g.tasks)
g.tasks = append(g.tasks, Task{
f: f,
schedule: schedule,
reset: make(chan struct{}, 16), // Buffered to not block senders
})
return &g.tasks[i]
} | go | func (g *Group) Add(f Func, schedule Schedule) *Task {
i := len(g.tasks)
g.tasks = append(g.tasks, Task{
f: f,
schedule: schedule,
reset: make(chan struct{}, 16), // Buffered to not block senders
})
return &g.tasks[i]
} | [
"func",
"(",
"g",
"*",
"Group",
")",
"Add",
"(",
"f",
"Func",
",",
"schedule",
"Schedule",
")",
"*",
"Task",
"{",
"i",
":=",
"len",
"(",
"g",
".",
"tasks",
")",
"\n",
"g",
".",
"tasks",
"=",
"append",
"(",
"g",
".",
"tasks",
",",
"Task",
"{",... | // Add a new task to the group, returning its index. | [
"Add",
"a",
"new",
"task",
"to",
"the",
"group",
"returning",
"its",
"index",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/task/group.go#L25-L33 | test |
lxc/lxd | lxd/task/group.go | Start | func (g *Group) Start() {
ctx := context.Background()
ctx, g.cancel = context.WithCancel(ctx)
g.wg.Add(len(g.tasks))
g.mu.Lock()
if g.running == nil {
g.running = make(map[int]bool)
}
g.mu.Unlock()
for i := range g.tasks {
g.mu.Lock()
if g.running[i] {
g.mu.Unlock()
continue
}
g.running[i] = ... | go | func (g *Group) Start() {
ctx := context.Background()
ctx, g.cancel = context.WithCancel(ctx)
g.wg.Add(len(g.tasks))
g.mu.Lock()
if g.running == nil {
g.running = make(map[int]bool)
}
g.mu.Unlock()
for i := range g.tasks {
g.mu.Lock()
if g.running[i] {
g.mu.Unlock()
continue
}
g.running[i] = ... | [
"func",
"(",
"g",
"*",
"Group",
")",
"Start",
"(",
")",
"{",
"ctx",
":=",
"context",
".",
"Background",
"(",
")",
"\n",
"ctx",
",",
"g",
".",
"cancel",
"=",
"context",
".",
"WithCancel",
"(",
"ctx",
")",
"\n",
"g",
".",
"wg",
".",
"Add",
"(",
... | // Start all the tasks in the group. | [
"Start",
"all",
"the",
"tasks",
"in",
"the",
"group",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/task/group.go#L36-L67 | test |
lxc/lxd | lxd/storage_zfs_utils.go | zfsIsEnabled | func zfsIsEnabled() bool {
out, err := exec.LookPath("zfs")
if err != nil || len(out) == 0 {
return false
}
return true
} | go | func zfsIsEnabled() bool {
out, err := exec.LookPath("zfs")
if err != nil || len(out) == 0 {
return false
}
return true
} | [
"func",
"zfsIsEnabled",
"(",
")",
"bool",
"{",
"out",
",",
"err",
":=",
"exec",
".",
"LookPath",
"(",
"\"zfs\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"len",
"(",
"out",
")",
"==",
"0",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"tru... | // zfsIsEnabled returns whether zfs backend is supported. | [
"zfsIsEnabled",
"returns",
"whether",
"zfs",
"backend",
"is",
"supported",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/storage_zfs_utils.go#L20-L27 | test |
lxc/lxd | lxd/storage_zfs_utils.go | zfsToolVersionGet | func zfsToolVersionGet() (string, error) {
// This function is only really ever relevant on Ubuntu as the only
// distro that ships out of sync tools and kernel modules
out, err := shared.RunCommand("dpkg-query", "--showformat=${Version}", "--show", "zfsutils-linux")
if err != nil {
return "", err
}
return str... | go | func zfsToolVersionGet() (string, error) {
// This function is only really ever relevant on Ubuntu as the only
// distro that ships out of sync tools and kernel modules
out, err := shared.RunCommand("dpkg-query", "--showformat=${Version}", "--show", "zfsutils-linux")
if err != nil {
return "", err
}
return str... | [
"func",
"zfsToolVersionGet",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"shared",
".",
"RunCommand",
"(",
"\"dpkg-query\"",
",",
"\"--showformat=${Version}\"",
",",
"\"--show\"",
",",
"\"zfsutils-linux\"",
")",
"\n",
"if",
"err",... | // zfsToolVersionGet returns the ZFS tools version | [
"zfsToolVersionGet",
"returns",
"the",
"ZFS",
"tools",
"version"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/storage_zfs_utils.go#L30-L39 | test |
lxc/lxd | lxd/storage_zfs_utils.go | zfsModuleVersionGet | func zfsModuleVersionGet() (string, error) {
var zfsVersion string
if shared.PathExists("/sys/module/zfs/version") {
out, err := ioutil.ReadFile("/sys/module/zfs/version")
if err != nil {
return "", fmt.Errorf("Could not determine ZFS module version")
}
zfsVersion = string(out)
} else {
out, err := sh... | go | func zfsModuleVersionGet() (string, error) {
var zfsVersion string
if shared.PathExists("/sys/module/zfs/version") {
out, err := ioutil.ReadFile("/sys/module/zfs/version")
if err != nil {
return "", fmt.Errorf("Could not determine ZFS module version")
}
zfsVersion = string(out)
} else {
out, err := sh... | [
"func",
"zfsModuleVersionGet",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"zfsVersion",
"string",
"\n",
"if",
"shared",
".",
"PathExists",
"(",
"\"/sys/module/zfs/version\"",
")",
"{",
"out",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"... | // zfsModuleVersionGet returns the ZFS module version | [
"zfsModuleVersionGet",
"returns",
"the",
"ZFS",
"module",
"version"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/storage_zfs_utils.go#L42-L62 | test |
lxc/lxd | lxd/storage_zfs_utils.go | zfsPoolVolumeCreate | func zfsPoolVolumeCreate(dataset string, properties ...string) (string, error) {
cmd := []string{"zfs", "create"}
for _, prop := range properties {
cmd = append(cmd, []string{"-o", prop}...)
}
cmd = append(cmd, []string{"-p", dataset}...)
return shared.RunCommand(cmd[0], cmd[1:]...)
} | go | func zfsPoolVolumeCreate(dataset string, properties ...string) (string, error) {
cmd := []string{"zfs", "create"}
for _, prop := range properties {
cmd = append(cmd, []string{"-o", prop}...)
}
cmd = append(cmd, []string{"-p", dataset}...)
return shared.RunCommand(cmd[0], cmd[1:]...)
} | [
"func",
"zfsPoolVolumeCreate",
"(",
"dataset",
"string",
",",
"properties",
"...",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"cmd",
":=",
"[",
"]",
"string",
"{",
"\"zfs\"",
",",
"\"create\"",
"}",
"\n",
"for",
"_",
",",
"prop",
":=",
"rang... | // zfsPoolVolumeCreate creates a ZFS dataset with a set of given properties. | [
"zfsPoolVolumeCreate",
"creates",
"a",
"ZFS",
"dataset",
"with",
"a",
"set",
"of",
"given",
"properties",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/storage_zfs_utils.go#L65-L75 | test |
lxc/lxd | lxd/storage_zfs_utils.go | zfsPoolVolumeExists | func zfsPoolVolumeExists(dataset string) (bool, error) {
output, err := shared.RunCommand(
"zfs", "list", "-Ho", "name")
if err != nil {
return false, err
}
for _, name := range strings.Split(output, "\n") {
if name == dataset {
return true, nil
}
}
return false, nil
} | go | func zfsPoolVolumeExists(dataset string) (bool, error) {
output, err := shared.RunCommand(
"zfs", "list", "-Ho", "name")
if err != nil {
return false, err
}
for _, name := range strings.Split(output, "\n") {
if name == dataset {
return true, nil
}
}
return false, nil
} | [
"func",
"zfsPoolVolumeExists",
"(",
"dataset",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"output",
",",
"err",
":=",
"shared",
".",
"RunCommand",
"(",
"\"zfs\"",
",",
"\"list\"",
",",
"\"-Ho\"",
",",
"\"name\"",
")",
"\n",
"if",
"err",
"!=",
... | // zfsPoolVolumeExists verifies if a specific ZFS pool or volume exists. | [
"zfsPoolVolumeExists",
"verifies",
"if",
"a",
"specific",
"ZFS",
"pool",
"or",
"volume",
"exists",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/storage_zfs_utils.go#L93-L107 | test |
lxc/lxd | lxd/db/networks.go | NetworkIDsNotPending | func (c *ClusterTx) NetworkIDsNotPending() (map[string]int64, error) {
networks := []struct {
id int64
name string
}{}
dest := func(i int) []interface{} {
networks = append(networks, struct {
id int64
name string
}{})
return []interface{}{&networks[i].id, &networks[i].name}
}
stmt, err := c.tx... | go | func (c *ClusterTx) NetworkIDsNotPending() (map[string]int64, error) {
networks := []struct {
id int64
name string
}{}
dest := func(i int) []interface{} {
networks = append(networks, struct {
id int64
name string
}{})
return []interface{}{&networks[i].id, &networks[i].name}
}
stmt, err := c.tx... | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"NetworkIDsNotPending",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"int64",
",",
"error",
")",
"{",
"networks",
":=",
"[",
"]",
"struct",
"{",
"id",
"int64",
"\n",
"name",
"string",
"\n",
"}",
"{",
"}",
"\n",... | // NetworkIDsNotPending returns a map associating each network name to its ID.
//
// Pending networks are skipped. | [
"NetworkIDsNotPending",
"returns",
"a",
"map",
"associating",
"each",
"network",
"name",
"to",
"its",
"ID",
".",
"Pending",
"networks",
"are",
"skipped",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/networks.go#L37-L64 | test |
lxc/lxd | lxd/db/networks.go | NetworkConfigAdd | func (c *ClusterTx) NetworkConfigAdd(networkID, nodeID int64, config map[string]string) error {
return networkConfigAdd(c.tx, networkID, nodeID, config)
} | go | func (c *ClusterTx) NetworkConfigAdd(networkID, nodeID int64, config map[string]string) error {
return networkConfigAdd(c.tx, networkID, nodeID, config)
} | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"NetworkConfigAdd",
"(",
"networkID",
",",
"nodeID",
"int64",
",",
"config",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"return",
"networkConfigAdd",
"(",
"c",
".",
"tx",
",",
"networkID",
",",
"nodeI... | // NetworkConfigAdd adds a new entry in the networks_config table | [
"NetworkConfigAdd",
"adds",
"a",
"new",
"entry",
"in",
"the",
"networks_config",
"table"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/networks.go#L84-L86 | test |
lxc/lxd | lxd/db/networks.go | NetworkNodeJoin | func (c *ClusterTx) NetworkNodeJoin(networkID, nodeID int64) error {
columns := []string{"network_id", "node_id"}
values := []interface{}{networkID, nodeID}
_, err := query.UpsertObject(c.tx, "networks_nodes", columns, values)
return err
} | go | func (c *ClusterTx) NetworkNodeJoin(networkID, nodeID int64) error {
columns := []string{"network_id", "node_id"}
values := []interface{}{networkID, nodeID}
_, err := query.UpsertObject(c.tx, "networks_nodes", columns, values)
return err
} | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"NetworkNodeJoin",
"(",
"networkID",
",",
"nodeID",
"int64",
")",
"error",
"{",
"columns",
":=",
"[",
"]",
"string",
"{",
"\"network_id\"",
",",
"\"node_id\"",
"}",
"\n",
"values",
":=",
"[",
"]",
"interface",
"{"... | // NetworkNodeJoin adds a new entry in the networks_nodes table.
//
// It should only be used when a new node joins the cluster, when it's safe to
// assume that the relevant network has already been created on the joining node,
// and we just need to track it. | [
"NetworkNodeJoin",
"adds",
"a",
"new",
"entry",
"in",
"the",
"networks_nodes",
"table",
".",
"It",
"should",
"only",
"be",
"used",
"when",
"a",
"new",
"node",
"joins",
"the",
"cluster",
"when",
"it",
"s",
"safe",
"to",
"assume",
"that",
"the",
"relevant",
... | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/networks.go#L93-L98 | test |
lxc/lxd | lxd/db/networks.go | NetworkCreatePending | func (c *ClusterTx) NetworkCreatePending(node, name string, conf map[string]string) error {
// First check if a network with the given name exists, and, if
// so, that it's in the pending state.
network := struct {
id int64
state int
}{}
var errConsistency error
dest := func(i int) []interface{} {
// Sa... | go | func (c *ClusterTx) NetworkCreatePending(node, name string, conf map[string]string) error {
// First check if a network with the given name exists, and, if
// so, that it's in the pending state.
network := struct {
id int64
state int
}{}
var errConsistency error
dest := func(i int) []interface{} {
// Sa... | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"NetworkCreatePending",
"(",
"node",
",",
"name",
"string",
",",
"conf",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"network",
":=",
"struct",
"{",
"id",
"int64",
"\n",
"state",
"int",
"\n",
"}",
... | // NetworkCreatePending creates a new pending network on the node with
// the given name. | [
"NetworkCreatePending",
"creates",
"a",
"new",
"pending",
"network",
"on",
"the",
"node",
"with",
"the",
"given",
"name",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/networks.go#L149-L224 | test |
lxc/lxd | lxd/db/networks.go | NetworkCreated | func (c *ClusterTx) NetworkCreated(name string) error {
return c.networkState(name, networkCreated)
} | go | func (c *ClusterTx) NetworkCreated(name string) error {
return c.networkState(name, networkCreated)
} | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"NetworkCreated",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"c",
".",
"networkState",
"(",
"name",
",",
"networkCreated",
")",
"\n",
"}"
] | // NetworkCreated sets the state of the given network to "Created". | [
"NetworkCreated",
"sets",
"the",
"state",
"of",
"the",
"given",
"network",
"to",
"Created",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/networks.go#L227-L229 | test |
lxc/lxd | lxd/db/networks.go | NetworkErrored | func (c *ClusterTx) NetworkErrored(name string) error {
return c.networkState(name, networkErrored)
} | go | func (c *ClusterTx) NetworkErrored(name string) error {
return c.networkState(name, networkErrored)
} | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"NetworkErrored",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"c",
".",
"networkState",
"(",
"name",
",",
"networkErrored",
")",
"\n",
"}"
] | // NetworkErrored sets the state of the given network to "Errored". | [
"NetworkErrored",
"sets",
"the",
"state",
"of",
"the",
"given",
"network",
"to",
"Errored",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/networks.go#L232-L234 | test |
lxc/lxd | lxd/db/networks.go | NetworkGet | func (c *Cluster) NetworkGet(name string) (int64, *api.Network, error) {
description := sql.NullString{}
id := int64(-1)
state := 0
q := "SELECT id, description, state FROM networks WHERE name=?"
arg1 := []interface{}{name}
arg2 := []interface{}{&id, &description, &state}
err := dbQueryRowScan(c.db, q, arg1, ar... | go | func (c *Cluster) NetworkGet(name string) (int64, *api.Network, error) {
description := sql.NullString{}
id := int64(-1)
state := 0
q := "SELECT id, description, state FROM networks WHERE name=?"
arg1 := []interface{}{name}
arg2 := []interface{}{&id, &description, &state}
err := dbQueryRowScan(c.db, q, arg1, ar... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"NetworkGet",
"(",
"name",
"string",
")",
"(",
"int64",
",",
"*",
"api",
".",
"Network",
",",
"error",
")",
"{",
"description",
":=",
"sql",
".",
"NullString",
"{",
"}",
"\n",
"id",
":=",
"int64",
"(",
"-",
... | // NetworkGet returns the network with the given name. | [
"NetworkGet",
"returns",
"the",
"network",
"with",
"the",
"given",
"name",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/networks.go#L298-L344 | test |
lxc/lxd | lxd/db/networks.go | networkNodes | func (c *Cluster) networkNodes(networkID int64) ([]string, error) {
stmt := `
SELECT nodes.name FROM nodes
JOIN networks_nodes ON networks_nodes.node_id = nodes.id
WHERE networks_nodes.network_id = ?
`
var nodes []string
err := c.Transaction(func(tx *ClusterTx) error {
var err error
nodes, err = query.Select... | go | func (c *Cluster) networkNodes(networkID int64) ([]string, error) {
stmt := `
SELECT nodes.name FROM nodes
JOIN networks_nodes ON networks_nodes.node_id = nodes.id
WHERE networks_nodes.network_id = ?
`
var nodes []string
err := c.Transaction(func(tx *ClusterTx) error {
var err error
nodes, err = query.Select... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"networkNodes",
"(",
"networkID",
"int64",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"stmt",
":=",
"`SELECT nodes.name FROM nodes JOIN networks_nodes ON networks_nodes.node_id = nodes.id WHERE networks_nodes.network_id = ... | // Return the names of the nodes the given network is defined on. | [
"Return",
"the",
"names",
"of",
"the",
"nodes",
"the",
"given",
"network",
"is",
"defined",
"on",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/networks.go#L347-L363 | test |
lxc/lxd | lxd/db/networks.go | NetworkGetInterface | func (c *Cluster) NetworkGetInterface(devName string) (int64, *api.Network, error) {
id := int64(-1)
name := ""
value := ""
q := "SELECT networks.id, networks.name, networks_config.value FROM networks LEFT JOIN networks_config ON networks.id=networks_config.network_id WHERE networks_config.key=\"bridge.external_in... | go | func (c *Cluster) NetworkGetInterface(devName string) (int64, *api.Network, error) {
id := int64(-1)
name := ""
value := ""
q := "SELECT networks.id, networks.name, networks_config.value FROM networks LEFT JOIN networks_config ON networks.id=networks_config.network_id WHERE networks_config.key=\"bridge.external_in... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"NetworkGetInterface",
"(",
"devName",
"string",
")",
"(",
"int64",
",",
"*",
"api",
".",
"Network",
",",
"error",
")",
"{",
"id",
":=",
"int64",
"(",
"-",
"1",
")",
"\n",
"name",
":=",
"\"\"",
"\n",
"value",
... | // NetworkGetInterface returns the network associated with the interface with
// the given name. | [
"NetworkGetInterface",
"returns",
"the",
"network",
"associated",
"with",
"the",
"interface",
"with",
"the",
"given",
"name",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/networks.go#L367-L408 | test |
lxc/lxd | lxd/db/networks.go | NetworkConfigGet | func (c *Cluster) NetworkConfigGet(id int64) (map[string]string, error) {
var key, value string
query := `
SELECT
key, value
FROM networks_config
WHERE network_id=?
AND (node_id=? OR node_id IS NULL)`
inargs := []interface{}{id, c.nodeID}
outfmt := []interface{}{key, va... | go | func (c *Cluster) NetworkConfigGet(id int64) (map[string]string, error) {
var key, value string
query := `
SELECT
key, value
FROM networks_config
WHERE network_id=?
AND (node_id=? OR node_id IS NULL)`
inargs := []interface{}{id, c.nodeID}
outfmt := []interface{}{key, va... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"NetworkConfigGet",
"(",
"id",
"int64",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"var",
"key",
",",
"value",
"string",
"\n",
"query",
":=",
"` SELECT key, value FRO... | // NetworkConfigGet returns the config map of the network with the given ID. | [
"NetworkConfigGet",
"returns",
"the",
"config",
"map",
"of",
"the",
"network",
"with",
"the",
"given",
"ID",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/networks.go#L411-L453 | test |
lxc/lxd | lxd/db/networks.go | NetworkCreate | func (c *Cluster) NetworkCreate(name, description string, config map[string]string) (int64, error) {
var id int64
err := c.Transaction(func(tx *ClusterTx) error {
result, err := tx.tx.Exec("INSERT INTO networks (name, description, state) VALUES (?, ?, ?)", name, description, networkCreated)
if err != nil {
ret... | go | func (c *Cluster) NetworkCreate(name, description string, config map[string]string) (int64, error) {
var id int64
err := c.Transaction(func(tx *ClusterTx) error {
result, err := tx.tx.Exec("INSERT INTO networks (name, description, state) VALUES (?, ?, ?)", name, description, networkCreated)
if err != nil {
ret... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"NetworkCreate",
"(",
"name",
",",
"description",
"string",
",",
"config",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"var",
"id",
"int64",
"\n",
"err",
":=",
"c",
".",
"Tr... | // NetworkCreate creates a new network. | [
"NetworkCreate",
"creates",
"a",
"new",
"network",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/networks.go#L456-L488 | test |
lxc/lxd | lxd/db/networks.go | NetworkUpdate | func (c *Cluster) NetworkUpdate(name, description string, config map[string]string) error {
id, _, err := c.NetworkGet(name)
if err != nil {
return err
}
err = c.Transaction(func(tx *ClusterTx) error {
err = NetworkUpdateDescription(tx.tx, id, description)
if err != nil {
return err
}
err = NetworkCo... | go | func (c *Cluster) NetworkUpdate(name, description string, config map[string]string) error {
id, _, err := c.NetworkGet(name)
if err != nil {
return err
}
err = c.Transaction(func(tx *ClusterTx) error {
err = NetworkUpdateDescription(tx.tx, id, description)
if err != nil {
return err
}
err = NetworkCo... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"NetworkUpdate",
"(",
"name",
",",
"description",
"string",
",",
"config",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"id",
",",
"_",
",",
"err",
":=",
"c",
".",
"NetworkGet",
"(",
"name",
")",
"\... | // NetworkUpdate updates the network with the given name. | [
"NetworkUpdate",
"updates",
"the",
"network",
"with",
"the",
"given",
"name",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/networks.go#L491-L516 | test |
lxc/lxd | lxd/db/networks.go | NetworkUpdateDescription | func NetworkUpdateDescription(tx *sql.Tx, id int64, description string) error {
_, err := tx.Exec("UPDATE networks SET description=? WHERE id=?", description, id)
return err
} | go | func NetworkUpdateDescription(tx *sql.Tx, id int64, description string) error {
_, err := tx.Exec("UPDATE networks SET description=? WHERE id=?", description, id)
return err
} | [
"func",
"NetworkUpdateDescription",
"(",
"tx",
"*",
"sql",
".",
"Tx",
",",
"id",
"int64",
",",
"description",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"tx",
".",
"Exec",
"(",
"\"UPDATE networks SET description=? WHERE id=?\"",
",",
"description",
",... | // NetworkUpdateDescription updates the description of the network with the
// given ID. | [
"NetworkUpdateDescription",
"updates",
"the",
"description",
"of",
"the",
"network",
"with",
"the",
"given",
"ID",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/networks.go#L520-L523 | test |
lxc/lxd | lxd/db/networks.go | NetworkConfigClear | func NetworkConfigClear(tx *sql.Tx, networkID, nodeID int64) error {
_, err := tx.Exec(
"DELETE FROM networks_config WHERE network_id=? AND (node_id=? OR node_id IS NULL)",
networkID, nodeID)
if err != nil {
return err
}
return nil
} | go | func NetworkConfigClear(tx *sql.Tx, networkID, nodeID int64) error {
_, err := tx.Exec(
"DELETE FROM networks_config WHERE network_id=? AND (node_id=? OR node_id IS NULL)",
networkID, nodeID)
if err != nil {
return err
}
return nil
} | [
"func",
"NetworkConfigClear",
"(",
"tx",
"*",
"sql",
".",
"Tx",
",",
"networkID",
",",
"nodeID",
"int64",
")",
"error",
"{",
"_",
",",
"err",
":=",
"tx",
".",
"Exec",
"(",
"\"DELETE FROM networks_config WHERE network_id=? AND (node_id=? OR node_id IS NULL)\"",
",",
... | // NetworkConfigClear resets the config of the network with the given ID
// associated with the node with the given ID. | [
"NetworkConfigClear",
"resets",
"the",
"config",
"of",
"the",
"network",
"with",
"the",
"given",
"ID",
"associated",
"with",
"the",
"node",
"with",
"the",
"given",
"ID",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/networks.go#L555-L564 | test |
lxc/lxd | lxd/db/networks.go | NetworkDelete | func (c *Cluster) NetworkDelete(name string) error {
id, _, err := c.NetworkGet(name)
if err != nil {
return err
}
err = exec(c.db, "DELETE FROM networks WHERE id=?", id)
if err != nil {
return err
}
return nil
} | go | func (c *Cluster) NetworkDelete(name string) error {
id, _, err := c.NetworkGet(name)
if err != nil {
return err
}
err = exec(c.db, "DELETE FROM networks WHERE id=?", id)
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"NetworkDelete",
"(",
"name",
"string",
")",
"error",
"{",
"id",
",",
"_",
",",
"err",
":=",
"c",
".",
"NetworkGet",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
... | // NetworkDelete deletes the network with the given name. | [
"NetworkDelete",
"deletes",
"the",
"network",
"with",
"the",
"given",
"name",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/networks.go#L567-L579 | test |
lxc/lxd | lxd/db/networks.go | NetworkRename | func (c *Cluster) NetworkRename(oldName string, newName string) error {
id, _, err := c.NetworkGet(oldName)
if err != nil {
return err
}
err = c.Transaction(func(tx *ClusterTx) error {
_, err = tx.tx.Exec("UPDATE networks SET name=? WHERE id=?", newName, id)
return err
})
return err
} | go | func (c *Cluster) NetworkRename(oldName string, newName string) error {
id, _, err := c.NetworkGet(oldName)
if err != nil {
return err
}
err = c.Transaction(func(tx *ClusterTx) error {
_, err = tx.tx.Exec("UPDATE networks SET name=? WHERE id=?", newName, id)
return err
})
return err
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"NetworkRename",
"(",
"oldName",
"string",
",",
"newName",
"string",
")",
"error",
"{",
"id",
",",
"_",
",",
"err",
":=",
"c",
".",
"NetworkGet",
"(",
"oldName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"retu... | // NetworkRename renames a network. | [
"NetworkRename",
"renames",
"a",
"network",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/networks.go#L582-L594 | test |
lxc/lxd | client/lxd_containers.go | GetContainers | func (r *ProtocolLXD) GetContainers() ([]api.Container, error) {
containers := []api.Container{}
// Fetch the raw value
_, err := r.queryStruct("GET", "/containers?recursion=1", nil, "", &containers)
if err != nil {
return nil, err
}
return containers, nil
} | go | func (r *ProtocolLXD) GetContainers() ([]api.Container, error) {
containers := []api.Container{}
// Fetch the raw value
_, err := r.queryStruct("GET", "/containers?recursion=1", nil, "", &containers)
if err != nil {
return nil, err
}
return containers, nil
} | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainers",
"(",
")",
"(",
"[",
"]",
"api",
".",
"Container",
",",
"error",
")",
"{",
"containers",
":=",
"[",
"]",
"api",
".",
"Container",
"{",
"}",
"\n",
"_",
",",
"err",
":=",
"r",
".",
"querySt... | // GetContainers returns a list of containers | [
"GetContainers",
"returns",
"a",
"list",
"of",
"containers"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L42-L52 | test |
lxc/lxd | client/lxd_containers.go | GetContainersFull | func (r *ProtocolLXD) GetContainersFull() ([]api.ContainerFull, error) {
containers := []api.ContainerFull{}
if !r.HasExtension("container_full") {
return nil, fmt.Errorf("The server is missing the required \"container_full\" API extension")
}
// Fetch the raw value
_, err := r.queryStruct("GET", "/containers?... | go | func (r *ProtocolLXD) GetContainersFull() ([]api.ContainerFull, error) {
containers := []api.ContainerFull{}
if !r.HasExtension("container_full") {
return nil, fmt.Errorf("The server is missing the required \"container_full\" API extension")
}
// Fetch the raw value
_, err := r.queryStruct("GET", "/containers?... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainersFull",
"(",
")",
"(",
"[",
"]",
"api",
".",
"ContainerFull",
",",
"error",
")",
"{",
"containers",
":=",
"[",
"]",
"api",
".",
"ContainerFull",
"{",
"}",
"\n",
"if",
"!",
"r",
".",
"HasExtensio... | // GetContainersFull returns a list of containers including snapshots, backups and state | [
"GetContainersFull",
"returns",
"a",
"list",
"of",
"containers",
"including",
"snapshots",
"backups",
"and",
"state"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L55-L69 | test |
lxc/lxd | client/lxd_containers.go | GetContainer | func (r *ProtocolLXD) GetContainer(name string) (*api.Container, string, error) {
container := api.Container{}
// Fetch the raw value
etag, err := r.queryStruct("GET", fmt.Sprintf("/containers/%s", url.QueryEscape(name)), nil, "", &container)
if err != nil {
return nil, "", err
}
return &container, etag, nil
... | go | func (r *ProtocolLXD) GetContainer(name string) (*api.Container, string, error) {
container := api.Container{}
// Fetch the raw value
etag, err := r.queryStruct("GET", fmt.Sprintf("/containers/%s", url.QueryEscape(name)), nil, "", &container)
if err != nil {
return nil, "", err
}
return &container, etag, nil
... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainer",
"(",
"name",
"string",
")",
"(",
"*",
"api",
".",
"Container",
",",
"string",
",",
"error",
")",
"{",
"container",
":=",
"api",
".",
"Container",
"{",
"}",
"\n",
"etag",
",",
"err",
":=",
"... | // GetContainer returns the container entry for the provided name | [
"GetContainer",
"returns",
"the",
"container",
"entry",
"for",
"the",
"provided",
"name"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L72-L82 | test |
lxc/lxd | client/lxd_containers.go | CreateContainerFromBackup | func (r *ProtocolLXD) CreateContainerFromBackup(args ContainerBackupArgs) (Operation, error) {
if !r.HasExtension("container_backup") {
return nil, fmt.Errorf("The server is missing the required \"container_backup\" API extension")
}
if args.PoolName == "" {
// Send the request
op, _, err := r.queryOperation(... | go | func (r *ProtocolLXD) CreateContainerFromBackup(args ContainerBackupArgs) (Operation, error) {
if !r.HasExtension("container_backup") {
return nil, fmt.Errorf("The server is missing the required \"container_backup\" API extension")
}
if args.PoolName == "" {
// Send the request
op, _, err := r.queryOperation(... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"CreateContainerFromBackup",
"(",
"args",
"ContainerBackupArgs",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"container_backup\"",
")",
"{",
"return",
"nil",
",",
"fmt"... | // CreateContainerFromBackup is a convenience function to make it easier to
// create a container from a backup | [
"CreateContainerFromBackup",
"is",
"a",
"convenience",
"function",
"to",
"make",
"it",
"easier",
"to",
"create",
"a",
"container",
"from",
"a",
"backup"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L86-L151 | test |
lxc/lxd | client/lxd_containers.go | CreateContainer | func (r *ProtocolLXD) CreateContainer(container api.ContainersPost) (Operation, error) {
if container.Source.ContainerOnly {
if !r.HasExtension("container_only_migration") {
return nil, fmt.Errorf("The server is missing the required \"container_only_migration\" API extension")
}
}
// Send the request
op, _,... | go | func (r *ProtocolLXD) CreateContainer(container api.ContainersPost) (Operation, error) {
if container.Source.ContainerOnly {
if !r.HasExtension("container_only_migration") {
return nil, fmt.Errorf("The server is missing the required \"container_only_migration\" API extension")
}
}
// Send the request
op, _,... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"CreateContainer",
"(",
"container",
"api",
".",
"ContainersPost",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"if",
"container",
".",
"Source",
".",
"ContainerOnly",
"{",
"if",
"!",
"r",
".",
"HasExtension",
... | // CreateContainer requests that LXD creates a new container | [
"CreateContainer",
"requests",
"that",
"LXD",
"creates",
"a",
"new",
"container"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L154-L168 | test |
lxc/lxd | client/lxd_containers.go | CreateContainerFromImage | func (r *ProtocolLXD) CreateContainerFromImage(source ImageServer, image api.Image, req api.ContainersPost) (RemoteOperation, error) {
// Set the minimal source fields
req.Source.Type = "image"
// Optimization for the local image case
if r == source {
// Always use fingerprints for local case
req.Source.Finger... | go | func (r *ProtocolLXD) CreateContainerFromImage(source ImageServer, image api.Image, req api.ContainersPost) (RemoteOperation, error) {
// Set the minimal source fields
req.Source.Type = "image"
// Optimization for the local image case
if r == source {
// Always use fingerprints for local case
req.Source.Finger... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"CreateContainerFromImage",
"(",
"source",
"ImageServer",
",",
"image",
"api",
".",
"Image",
",",
"req",
"api",
".",
"ContainersPost",
")",
"(",
"RemoteOperation",
",",
"error",
")",
"{",
"req",
".",
"Source",
"."... | // CreateContainerFromImage is a convenience function to make it easier to create a container from an existing image | [
"CreateContainerFromImage",
"is",
"a",
"convenience",
"function",
"to",
"make",
"it",
"easier",
"to",
"create",
"a",
"container",
"from",
"an",
"existing",
"image"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L225-L285 | test |
lxc/lxd | client/lxd_containers.go | UpdateContainer | func (r *ProtocolLXD) UpdateContainer(name string, container api.ContainerPut, ETag string) (Operation, error) {
// Send the request
op, _, err := r.queryOperation("PUT", fmt.Sprintf("/containers/%s", url.QueryEscape(name)), container, ETag)
if err != nil {
return nil, err
}
return op, nil
} | go | func (r *ProtocolLXD) UpdateContainer(name string, container api.ContainerPut, ETag string) (Operation, error) {
// Send the request
op, _, err := r.queryOperation("PUT", fmt.Sprintf("/containers/%s", url.QueryEscape(name)), container, ETag)
if err != nil {
return nil, err
}
return op, nil
} | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"UpdateContainer",
"(",
"name",
"string",
",",
"container",
"api",
".",
"ContainerPut",
",",
"ETag",
"string",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"op",
",",
"_",
",",
"err",
":=",
"r",
".",
"quer... | // UpdateContainer updates the container definition | [
"UpdateContainer",
"updates",
"the",
"container",
"definition"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L587-L595 | test |
lxc/lxd | client/lxd_containers.go | RenameContainer | func (r *ProtocolLXD) RenameContainer(name string, container api.ContainerPost) (Operation, error) {
// Sanity check
if container.Migration {
return nil, fmt.Errorf("Can't ask for a migration through RenameContainer")
}
// Send the request
op, _, err := r.queryOperation("POST", fmt.Sprintf("/containers/%s", url... | go | func (r *ProtocolLXD) RenameContainer(name string, container api.ContainerPost) (Operation, error) {
// Sanity check
if container.Migration {
return nil, fmt.Errorf("Can't ask for a migration through RenameContainer")
}
// Send the request
op, _, err := r.queryOperation("POST", fmt.Sprintf("/containers/%s", url... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"RenameContainer",
"(",
"name",
"string",
",",
"container",
"api",
".",
"ContainerPost",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"if",
"container",
".",
"Migration",
"{",
"return",
"nil",
",",
"fmt",
".",... | // RenameContainer requests that LXD renames the container | [
"RenameContainer",
"requests",
"that",
"LXD",
"renames",
"the",
"container"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L598-L611 | test |
lxc/lxd | client/lxd_containers.go | ExecContainer | func (r *ProtocolLXD) ExecContainer(containerName string, exec api.ContainerExecPost, args *ContainerExecArgs) (Operation, error) {
if exec.RecordOutput {
if !r.HasExtension("container_exec_recording") {
return nil, fmt.Errorf("The server is missing the required \"container_exec_recording\" API extension")
}
}... | go | func (r *ProtocolLXD) ExecContainer(containerName string, exec api.ContainerExecPost, args *ContainerExecArgs) (Operation, error) {
if exec.RecordOutput {
if !r.HasExtension("container_exec_recording") {
return nil, fmt.Errorf("The server is missing the required \"container_exec_recording\" API extension")
}
}... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"ExecContainer",
"(",
"containerName",
"string",
",",
"exec",
"api",
".",
"ContainerExecPost",
",",
"args",
"*",
"ContainerExecArgs",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"if",
"exec",
".",
"RecordOutput",... | // ExecContainer requests that LXD spawns a command inside the container | [
"ExecContainer",
"requests",
"that",
"LXD",
"spawns",
"a",
"command",
"inside",
"the",
"container"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L697-L831 | test |
lxc/lxd | client/lxd_containers.go | GetContainerFile | func (r *ProtocolLXD) GetContainerFile(containerName string, path string) (io.ReadCloser, *ContainerFileResponse, error) {
// Prepare the HTTP request
requestURL, err := shared.URLEncode(
fmt.Sprintf("%s/1.0/containers/%s/files", r.httpHost, url.QueryEscape(containerName)),
map[string]string{"path": path})
if er... | go | func (r *ProtocolLXD) GetContainerFile(containerName string, path string) (io.ReadCloser, *ContainerFileResponse, error) {
// Prepare the HTTP request
requestURL, err := shared.URLEncode(
fmt.Sprintf("%s/1.0/containers/%s/files", r.httpHost, url.QueryEscape(containerName)),
map[string]string{"path": path})
if er... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainerFile",
"(",
"containerName",
"string",
",",
"path",
"string",
")",
"(",
"io",
".",
"ReadCloser",
",",
"*",
"ContainerFileResponse",
",",
"error",
")",
"{",
"requestURL",
",",
"err",
":=",
"shared",
".... | // GetContainerFile retrieves the provided path from the container | [
"GetContainerFile",
"retrieves",
"the",
"provided",
"path",
"from",
"the",
"container"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L834-L904 | test |
lxc/lxd | client/lxd_containers.go | CreateContainerFile | func (r *ProtocolLXD) CreateContainerFile(containerName string, path string, args ContainerFileArgs) error {
if args.Type == "directory" {
if !r.HasExtension("directory_manipulation") {
return fmt.Errorf("The server is missing the required \"directory_manipulation\" API extension")
}
}
if args.Type == "symli... | go | func (r *ProtocolLXD) CreateContainerFile(containerName string, path string, args ContainerFileArgs) error {
if args.Type == "directory" {
if !r.HasExtension("directory_manipulation") {
return fmt.Errorf("The server is missing the required \"directory_manipulation\" API extension")
}
}
if args.Type == "symli... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"CreateContainerFile",
"(",
"containerName",
"string",
",",
"path",
"string",
",",
"args",
"ContainerFileArgs",
")",
"error",
"{",
"if",
"args",
".",
"Type",
"==",
"\"directory\"",
"{",
"if",
"!",
"r",
".",
"HasEx... | // CreateContainerFile tells LXD to create a file in the container | [
"CreateContainerFile",
"tells",
"LXD",
"to",
"create",
"a",
"file",
"in",
"the",
"container"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L907-L978 | test |
lxc/lxd | client/lxd_containers.go | DeleteContainerFile | func (r *ProtocolLXD) DeleteContainerFile(containerName string, path string) error {
if !r.HasExtension("file_delete") {
return fmt.Errorf("The server is missing the required \"file_delete\" API extension")
}
// Send the request
_, _, err := r.query("DELETE", fmt.Sprintf("/containers/%s/files?path=%s", url.Query... | go | func (r *ProtocolLXD) DeleteContainerFile(containerName string, path string) error {
if !r.HasExtension("file_delete") {
return fmt.Errorf("The server is missing the required \"file_delete\" API extension")
}
// Send the request
_, _, err := r.query("DELETE", fmt.Sprintf("/containers/%s/files?path=%s", url.Query... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"DeleteContainerFile",
"(",
"containerName",
"string",
",",
"path",
"string",
")",
"error",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"file_delete\"",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"The s... | // DeleteContainerFile deletes a file in the container | [
"DeleteContainerFile",
"deletes",
"a",
"file",
"in",
"the",
"container"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L981-L993 | test |
lxc/lxd | client/lxd_containers.go | GetContainerSnapshotNames | func (r *ProtocolLXD) GetContainerSnapshotNames(containerName string) ([]string, error) {
urls := []string{}
// Fetch the raw value
_, err := r.queryStruct("GET", fmt.Sprintf("/containers/%s/snapshots", url.QueryEscape(containerName)), nil, "", &urls)
if err != nil {
return nil, err
}
// Parse it
names := []... | go | func (r *ProtocolLXD) GetContainerSnapshotNames(containerName string) ([]string, error) {
urls := []string{}
// Fetch the raw value
_, err := r.queryStruct("GET", fmt.Sprintf("/containers/%s/snapshots", url.QueryEscape(containerName)), nil, "", &urls)
if err != nil {
return nil, err
}
// Parse it
names := []... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainerSnapshotNames",
"(",
"containerName",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"urls",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"_",
",",
"err",
":=",
"r",
".",
"queryStr... | // GetContainerSnapshotNames returns a list of snapshot names for the container | [
"GetContainerSnapshotNames",
"returns",
"a",
"list",
"of",
"snapshot",
"names",
"for",
"the",
"container"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L996-L1013 | test |
lxc/lxd | client/lxd_containers.go | GetContainerSnapshots | func (r *ProtocolLXD) GetContainerSnapshots(containerName string) ([]api.ContainerSnapshot, error) {
snapshots := []api.ContainerSnapshot{}
// Fetch the raw value
_, err := r.queryStruct("GET", fmt.Sprintf("/containers/%s/snapshots?recursion=1", url.QueryEscape(containerName)), nil, "", &snapshots)
if err != nil {... | go | func (r *ProtocolLXD) GetContainerSnapshots(containerName string) ([]api.ContainerSnapshot, error) {
snapshots := []api.ContainerSnapshot{}
// Fetch the raw value
_, err := r.queryStruct("GET", fmt.Sprintf("/containers/%s/snapshots?recursion=1", url.QueryEscape(containerName)), nil, "", &snapshots)
if err != nil {... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainerSnapshots",
"(",
"containerName",
"string",
")",
"(",
"[",
"]",
"api",
".",
"ContainerSnapshot",
",",
"error",
")",
"{",
"snapshots",
":=",
"[",
"]",
"api",
".",
"ContainerSnapshot",
"{",
"}",
"\n",
... | // GetContainerSnapshots returns a list of snapshots for the container | [
"GetContainerSnapshots",
"returns",
"a",
"list",
"of",
"snapshots",
"for",
"the",
"container"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L1016-L1026 | test |
lxc/lxd | client/lxd_containers.go | GetContainerSnapshot | func (r *ProtocolLXD) GetContainerSnapshot(containerName string, name string) (*api.ContainerSnapshot, string, error) {
snapshot := api.ContainerSnapshot{}
// Fetch the raw value
etag, err := r.queryStruct("GET", fmt.Sprintf("/containers/%s/snapshots/%s", url.QueryEscape(containerName), url.QueryEscape(name)), nil,... | go | func (r *ProtocolLXD) GetContainerSnapshot(containerName string, name string) (*api.ContainerSnapshot, string, error) {
snapshot := api.ContainerSnapshot{}
// Fetch the raw value
etag, err := r.queryStruct("GET", fmt.Sprintf("/containers/%s/snapshots/%s", url.QueryEscape(containerName), url.QueryEscape(name)), nil,... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainerSnapshot",
"(",
"containerName",
"string",
",",
"name",
"string",
")",
"(",
"*",
"api",
".",
"ContainerSnapshot",
",",
"string",
",",
"error",
")",
"{",
"snapshot",
":=",
"api",
".",
"ContainerSnapshot"... | // GetContainerSnapshot returns a Snapshot struct for the provided container and snapshot names | [
"GetContainerSnapshot",
"returns",
"a",
"Snapshot",
"struct",
"for",
"the",
"provided",
"container",
"and",
"snapshot",
"names"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L1029-L1039 | test |
lxc/lxd | client/lxd_containers.go | CreateContainerSnapshot | func (r *ProtocolLXD) CreateContainerSnapshot(containerName string, snapshot api.ContainerSnapshotsPost) (Operation, error) {
// Validate the request
if snapshot.ExpiresAt != nil && !r.HasExtension("snapshot_expiry_creation") {
return nil, fmt.Errorf("The server is missing the required \"snapshot_expiry_creation\" ... | go | func (r *ProtocolLXD) CreateContainerSnapshot(containerName string, snapshot api.ContainerSnapshotsPost) (Operation, error) {
// Validate the request
if snapshot.ExpiresAt != nil && !r.HasExtension("snapshot_expiry_creation") {
return nil, fmt.Errorf("The server is missing the required \"snapshot_expiry_creation\" ... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"CreateContainerSnapshot",
"(",
"containerName",
"string",
",",
"snapshot",
"api",
".",
"ContainerSnapshotsPost",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"if",
"snapshot",
".",
"ExpiresAt",
"!=",
"nil",
"&&",
... | // CreateContainerSnapshot requests that LXD creates a new snapshot for the container | [
"CreateContainerSnapshot",
"requests",
"that",
"LXD",
"creates",
"a",
"new",
"snapshot",
"for",
"the",
"container"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L1042-L1055 | test |
lxc/lxd | client/lxd_containers.go | MigrateContainerSnapshot | func (r *ProtocolLXD) MigrateContainerSnapshot(containerName string, name string, container api.ContainerSnapshotPost) (Operation, error) {
// Sanity check
if !container.Migration {
return nil, fmt.Errorf("Can't ask for a rename through MigrateContainerSnapshot")
}
// Send the request
op, _, err := r.queryOpera... | go | func (r *ProtocolLXD) MigrateContainerSnapshot(containerName string, name string, container api.ContainerSnapshotPost) (Operation, error) {
// Sanity check
if !container.Migration {
return nil, fmt.Errorf("Can't ask for a rename through MigrateContainerSnapshot")
}
// Send the request
op, _, err := r.queryOpera... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"MigrateContainerSnapshot",
"(",
"containerName",
"string",
",",
"name",
"string",
",",
"container",
"api",
".",
"ContainerSnapshotPost",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"if",
"!",
"container",
".",
"... | // MigrateContainerSnapshot requests that LXD prepares for a snapshot migration | [
"MigrateContainerSnapshot",
"requests",
"that",
"LXD",
"prepares",
"for",
"a",
"snapshot",
"migration"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L1334-L1347 | test |
lxc/lxd | client/lxd_containers.go | UpdateContainerSnapshot | func (r *ProtocolLXD) UpdateContainerSnapshot(containerName string, name string, container api.ContainerSnapshotPut, ETag string) (Operation, error) {
if !r.HasExtension("snapshot_expiry") {
return nil, fmt.Errorf("The server is missing the required \"snapshot_expiry\" API extension")
}
// Send the request
op, _... | go | func (r *ProtocolLXD) UpdateContainerSnapshot(containerName string, name string, container api.ContainerSnapshotPut, ETag string) (Operation, error) {
if !r.HasExtension("snapshot_expiry") {
return nil, fmt.Errorf("The server is missing the required \"snapshot_expiry\" API extension")
}
// Send the request
op, _... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"UpdateContainerSnapshot",
"(",
"containerName",
"string",
",",
"name",
"string",
",",
"container",
"api",
".",
"ContainerSnapshotPut",
",",
"ETag",
"string",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"if",
"!"... | // UpdateContainerSnapshot requests that LXD updates the container snapshot | [
"UpdateContainerSnapshot",
"requests",
"that",
"LXD",
"updates",
"the",
"container",
"snapshot"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L1361-L1374 | test |
lxc/lxd | client/lxd_containers.go | GetContainerState | func (r *ProtocolLXD) GetContainerState(name string) (*api.ContainerState, string, error) {
state := api.ContainerState{}
// Fetch the raw value
etag, err := r.queryStruct("GET", fmt.Sprintf("/containers/%s/state", url.QueryEscape(name)), nil, "", &state)
if err != nil {
return nil, "", err
}
return &state, e... | go | func (r *ProtocolLXD) GetContainerState(name string) (*api.ContainerState, string, error) {
state := api.ContainerState{}
// Fetch the raw value
etag, err := r.queryStruct("GET", fmt.Sprintf("/containers/%s/state", url.QueryEscape(name)), nil, "", &state)
if err != nil {
return nil, "", err
}
return &state, e... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainerState",
"(",
"name",
"string",
")",
"(",
"*",
"api",
".",
"ContainerState",
",",
"string",
",",
"error",
")",
"{",
"state",
":=",
"api",
".",
"ContainerState",
"{",
"}",
"\n",
"etag",
",",
"err",
... | // GetContainerState returns a ContainerState entry for the provided container name | [
"GetContainerState",
"returns",
"a",
"ContainerState",
"entry",
"for",
"the",
"provided",
"container",
"name"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L1377-L1387 | test |
lxc/lxd | client/lxd_containers.go | UpdateContainerState | func (r *ProtocolLXD) UpdateContainerState(name string, state api.ContainerStatePut, ETag string) (Operation, error) {
// Send the request
op, _, err := r.queryOperation("PUT", fmt.Sprintf("/containers/%s/state", url.QueryEscape(name)), state, ETag)
if err != nil {
return nil, err
}
return op, nil
} | go | func (r *ProtocolLXD) UpdateContainerState(name string, state api.ContainerStatePut, ETag string) (Operation, error) {
// Send the request
op, _, err := r.queryOperation("PUT", fmt.Sprintf("/containers/%s/state", url.QueryEscape(name)), state, ETag)
if err != nil {
return nil, err
}
return op, nil
} | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"UpdateContainerState",
"(",
"name",
"string",
",",
"state",
"api",
".",
"ContainerStatePut",
",",
"ETag",
"string",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"op",
",",
"_",
",",
"err",
":=",
"r",
".",
... | // UpdateContainerState updates the container to match the requested state | [
"UpdateContainerState",
"updates",
"the",
"container",
"to",
"match",
"the",
"requested",
"state"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L1390-L1398 | test |
lxc/lxd | client/lxd_containers.go | GetContainerLogfiles | func (r *ProtocolLXD) GetContainerLogfiles(name string) ([]string, error) {
urls := []string{}
// Fetch the raw value
_, err := r.queryStruct("GET", fmt.Sprintf("/containers/%s/logs", url.QueryEscape(name)), nil, "", &urls)
if err != nil {
return nil, err
}
// Parse it
logfiles := []string{}
for _, uri := r... | go | func (r *ProtocolLXD) GetContainerLogfiles(name string) ([]string, error) {
urls := []string{}
// Fetch the raw value
_, err := r.queryStruct("GET", fmt.Sprintf("/containers/%s/logs", url.QueryEscape(name)), nil, "", &urls)
if err != nil {
return nil, err
}
// Parse it
logfiles := []string{}
for _, uri := r... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainerLogfiles",
"(",
"name",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"urls",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"_",
",",
"err",
":=",
"r",
".",
"queryStruct",
"(",
... | // GetContainerLogfiles returns a list of logfiles for the container | [
"GetContainerLogfiles",
"returns",
"a",
"list",
"of",
"logfiles",
"for",
"the",
"container"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L1401-L1418 | test |
lxc/lxd | client/lxd_containers.go | GetContainerLogfile | func (r *ProtocolLXD) GetContainerLogfile(name string, filename string) (io.ReadCloser, error) {
// Prepare the HTTP request
url := fmt.Sprintf("%s/1.0/containers/%s/logs/%s", r.httpHost, url.QueryEscape(name), url.QueryEscape(filename))
url, err := r.setQueryAttributes(url)
if err != nil {
return nil, err
}
... | go | func (r *ProtocolLXD) GetContainerLogfile(name string, filename string) (io.ReadCloser, error) {
// Prepare the HTTP request
url := fmt.Sprintf("%s/1.0/containers/%s/logs/%s", r.httpHost, url.QueryEscape(name), url.QueryEscape(filename))
url, err := r.setQueryAttributes(url)
if err != nil {
return nil, err
}
... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainerLogfile",
"(",
"name",
"string",
",",
"filename",
"string",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"url",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"%s/1.0/containers/%s/logs/%s\"",
",",
... | // GetContainerLogfile returns the content of the requested logfile
//
// Note that it's the caller's responsibility to close the returned ReadCloser | [
"GetContainerLogfile",
"returns",
"the",
"content",
"of",
"the",
"requested",
"logfile",
"Note",
"that",
"it",
"s",
"the",
"caller",
"s",
"responsibility",
"to",
"close",
"the",
"returned",
"ReadCloser"
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L1423-L1457 | test |
lxc/lxd | client/lxd_containers.go | GetContainerMetadata | func (r *ProtocolLXD) GetContainerMetadata(name string) (*api.ImageMetadata, string, error) {
if !r.HasExtension("container_edit_metadata") {
return nil, "", fmt.Errorf("The server is missing the required \"container_edit_metadata\" API extension")
}
metadata := api.ImageMetadata{}
url := fmt.Sprintf("/containe... | go | func (r *ProtocolLXD) GetContainerMetadata(name string) (*api.ImageMetadata, string, error) {
if !r.HasExtension("container_edit_metadata") {
return nil, "", fmt.Errorf("The server is missing the required \"container_edit_metadata\" API extension")
}
metadata := api.ImageMetadata{}
url := fmt.Sprintf("/containe... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainerMetadata",
"(",
"name",
"string",
")",
"(",
"*",
"api",
".",
"ImageMetadata",
",",
"string",
",",
"error",
")",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"container_edit_metadata\"",
")",
"{",
... | // GetContainerMetadata returns container metadata. | [
"GetContainerMetadata",
"returns",
"container",
"metadata",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L1471-L1485 | test |
lxc/lxd | client/lxd_containers.go | SetContainerMetadata | func (r *ProtocolLXD) SetContainerMetadata(name string, metadata api.ImageMetadata, ETag string) error {
if !r.HasExtension("container_edit_metadata") {
return fmt.Errorf("The server is missing the required \"container_edit_metadata\" API extension")
}
url := fmt.Sprintf("/containers/%s/metadata", url.QueryEscape... | go | func (r *ProtocolLXD) SetContainerMetadata(name string, metadata api.ImageMetadata, ETag string) error {
if !r.HasExtension("container_edit_metadata") {
return fmt.Errorf("The server is missing the required \"container_edit_metadata\" API extension")
}
url := fmt.Sprintf("/containers/%s/metadata", url.QueryEscape... | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"SetContainerMetadata",
"(",
"name",
"string",
",",
"metadata",
"api",
".",
"ImageMetadata",
",",
"ETag",
"string",
")",
"error",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"container_edit_metadata\"",
")",
"{... | // SetContainerMetadata sets the content of the container metadata file. | [
"SetContainerMetadata",
"sets",
"the",
"content",
"of",
"the",
"container",
"metadata",
"file",
"."
] | 7a41d14e4c1a6bc25918aca91004d594774dcdd3 | https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_containers.go#L1488-L1500 | test |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.