id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
153,600 | juju/juju | agent/tools/toolsdir.go | ReadTools | func ReadTools(dataDir string, vers version.Binary) (*coretools.Tools, error) {
dir := SharedToolsDir(dataDir, vers)
toolsData, err := ioutil.ReadFile(path.Join(dir, toolsFile))
if err != nil {
return nil, fmt.Errorf("cannot read agent metadata in directory %v: %v", dir, err)
}
var tools coretools.Tools
if err ... | go | func ReadTools(dataDir string, vers version.Binary) (*coretools.Tools, error) {
dir := SharedToolsDir(dataDir, vers)
toolsData, err := ioutil.ReadFile(path.Join(dir, toolsFile))
if err != nil {
return nil, fmt.Errorf("cannot read agent metadata in directory %v: %v", dir, err)
}
var tools coretools.Tools
if err ... | [
"func",
"ReadTools",
"(",
"dataDir",
"string",
",",
"vers",
"version",
".",
"Binary",
")",
"(",
"*",
"coretools",
".",
"Tools",
",",
"error",
")",
"{",
"dir",
":=",
"SharedToolsDir",
"(",
"dataDir",
",",
"vers",
")",
"\n",
"toolsData",
",",
"err",
":="... | // ReadTools checks that the tools information for the given version exists
// in the dataDir directory, and returns a Tools instance.
// The tools information is json encoded in a text file, "downloaded-tools.txt". | [
"ReadTools",
"checks",
"that",
"the",
"tools",
"information",
"for",
"the",
"given",
"version",
"exists",
"in",
"the",
"dataDir",
"directory",
"and",
"returns",
"a",
"Tools",
"instance",
".",
"The",
"tools",
"information",
"is",
"json",
"encoded",
"in",
"a",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/agent/tools/toolsdir.go#L164-L175 |
153,601 | juju/juju | agent/tools/toolsdir.go | ReadGUIArchive | func ReadGUIArchive(dataDir string) (*coretools.GUIArchive, error) {
dir := SharedGUIDir(dataDir)
toolsData, err := ioutil.ReadFile(path.Join(dir, guiArchiveFile))
if err != nil {
if os.IsNotExist(err) {
return nil, errors.NotFoundf("GUI metadata")
}
return nil, fmt.Errorf("cannot read GUI metadata in direc... | go | func ReadGUIArchive(dataDir string) (*coretools.GUIArchive, error) {
dir := SharedGUIDir(dataDir)
toolsData, err := ioutil.ReadFile(path.Join(dir, guiArchiveFile))
if err != nil {
if os.IsNotExist(err) {
return nil, errors.NotFoundf("GUI metadata")
}
return nil, fmt.Errorf("cannot read GUI metadata in direc... | [
"func",
"ReadGUIArchive",
"(",
"dataDir",
"string",
")",
"(",
"*",
"coretools",
".",
"GUIArchive",
",",
"error",
")",
"{",
"dir",
":=",
"SharedGUIDir",
"(",
"dataDir",
")",
"\n",
"toolsData",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
".",... | // ReadGUIArchive reads the GUI information from the dataDir directory.
// The GUI information is JSON encoded in a text file, "downloaded-gui.txt". | [
"ReadGUIArchive",
"reads",
"the",
"GUI",
"information",
"from",
"the",
"dataDir",
"directory",
".",
"The",
"GUI",
"information",
"is",
"JSON",
"encoded",
"in",
"a",
"text",
"file",
"downloaded",
"-",
"gui",
".",
"txt",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/agent/tools/toolsdir.go#L179-L193 |
153,602 | juju/juju | agent/tools/toolsdir.go | ChangeAgentTools | func ChangeAgentTools(dataDir string, agentName string, vers version.Binary) (*coretools.Tools, error) {
tools, err := ReadTools(dataDir, vers)
if err != nil {
return nil, err
}
// build absolute path to toolsDir. Windows implementation of symlink
// will check for the existence of the source file and error if i... | go | func ChangeAgentTools(dataDir string, agentName string, vers version.Binary) (*coretools.Tools, error) {
tools, err := ReadTools(dataDir, vers)
if err != nil {
return nil, err
}
// build absolute path to toolsDir. Windows implementation of symlink
// will check for the existence of the source file and error if i... | [
"func",
"ChangeAgentTools",
"(",
"dataDir",
"string",
",",
"agentName",
"string",
",",
"vers",
"version",
".",
"Binary",
")",
"(",
"*",
"coretools",
".",
"Tools",
",",
"error",
")",
"{",
"tools",
",",
"err",
":=",
"ReadTools",
"(",
"dataDir",
",",
"vers"... | // ChangeAgentTools atomically replaces the agent-specific symlink
// under dataDir so it points to the previously unpacked
// version vers. It returns the new tools read. | [
"ChangeAgentTools",
"atomically",
"replaces",
"the",
"agent",
"-",
"specific",
"symlink",
"under",
"dataDir",
"so",
"it",
"points",
"to",
"the",
"previously",
"unpacked",
"version",
"vers",
".",
"It",
"returns",
"the",
"new",
"tools",
"read",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/agent/tools/toolsdir.go#L198-L214 |
153,603 | juju/juju | agent/tools/toolsdir.go | WriteToolsMetadataData | func WriteToolsMetadataData(dir string, tools *coretools.Tools) error {
toolsMetadataData, err := json.Marshal(tools)
if err != nil {
return err
}
return ioutil.WriteFile(path.Join(dir, toolsFile), toolsMetadataData, filePerm)
} | go | func WriteToolsMetadataData(dir string, tools *coretools.Tools) error {
toolsMetadataData, err := json.Marshal(tools)
if err != nil {
return err
}
return ioutil.WriteFile(path.Join(dir, toolsFile), toolsMetadataData, filePerm)
} | [
"func",
"WriteToolsMetadataData",
"(",
"dir",
"string",
",",
"tools",
"*",
"coretools",
".",
"Tools",
")",
"error",
"{",
"toolsMetadataData",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"tools",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err... | // WriteToolsMetadataData writes the tools metadata file to the given directory. | [
"WriteToolsMetadataData",
"writes",
"the",
"tools",
"metadata",
"file",
"to",
"the",
"given",
"directory",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/agent/tools/toolsdir.go#L217-L223 |
153,604 | juju/juju | apiserver/facades/agent/resourceshookcontext/unitfacade.go | NewHookContextFacade | func NewHookContextFacade(st *state.State, unit *state.Unit) (interface{}, error) {
res, err := st.Resources()
if err != nil {
return nil, errors.Trace(err)
}
return NewUnitFacade(&resourcesUnitDataStore{res, unit}), nil
} | go | func NewHookContextFacade(st *state.State, unit *state.Unit) (interface{}, error) {
res, err := st.Resources()
if err != nil {
return nil, errors.Trace(err)
}
return NewUnitFacade(&resourcesUnitDataStore{res, unit}), nil
} | [
"func",
"NewHookContextFacade",
"(",
"st",
"*",
"state",
".",
"State",
",",
"unit",
"*",
"state",
".",
"Unit",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"st",
".",
"Resources",
"(",
")",
"\n",
"if",
"err",
... | // NewHookContextFacade adapts NewUnitFacade for facade registration. | [
"NewHookContextFacade",
"adapts",
"NewUnitFacade",
"for",
"facade",
"registration",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/resourceshookcontext/unitfacade.go#L19-L25 |
153,605 | juju/juju | apiserver/facades/agent/resourceshookcontext/unitfacade.go | NewStateFacade | func NewStateFacade(ctx facade.Context) (*UnitFacade, error) {
authorizer := ctx.Auth()
st := ctx.State()
if !authorizer.AuthUnitAgent() && !authorizer.AuthApplicationAgent() {
return nil, common.ErrPerm
}
var (
unit *state.Unit
err error
)
switch tag := authorizer.GetAuthTag().(type) {
case names.Unit... | go | func NewStateFacade(ctx facade.Context) (*UnitFacade, error) {
authorizer := ctx.Auth()
st := ctx.State()
if !authorizer.AuthUnitAgent() && !authorizer.AuthApplicationAgent() {
return nil, common.ErrPerm
}
var (
unit *state.Unit
err error
)
switch tag := authorizer.GetAuthTag().(type) {
case names.Unit... | [
"func",
"NewStateFacade",
"(",
"ctx",
"facade",
".",
"Context",
")",
"(",
"*",
"UnitFacade",
",",
"error",
")",
"{",
"authorizer",
":=",
"ctx",
".",
"Auth",
"(",
")",
"\n",
"st",
":=",
"ctx",
".",
"State",
"(",
")",
"\n\n",
"if",
"!",
"authorizer",
... | // NewStateFacade provides the signature to register this resource facade | [
"NewStateFacade",
"provides",
"the",
"signature",
"to",
"register",
"this",
"resource",
"facade"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/resourceshookcontext/unitfacade.go#L28-L69 |
153,606 | juju/juju | cmd/juju/commands/bootstrap.go | credentialsAndRegionName | func (c *bootstrapCommand) credentialsAndRegionName(
ctx *cmd.Context,
provider environs.EnvironProvider,
cloud jujucloud.Cloud,
) (
creds bootstrapCredentials,
regionName string,
err error,
) {
store := c.ClientStore()
// When looking for credentials, we should attempt to see if there are any
// credentials... | go | func (c *bootstrapCommand) credentialsAndRegionName(
ctx *cmd.Context,
provider environs.EnvironProvider,
cloud jujucloud.Cloud,
) (
creds bootstrapCredentials,
regionName string,
err error,
) {
store := c.ClientStore()
// When looking for credentials, we should attempt to see if there are any
// credentials... | [
"func",
"(",
"c",
"*",
"bootstrapCommand",
")",
"credentialsAndRegionName",
"(",
"ctx",
"*",
"cmd",
".",
"Context",
",",
"provider",
"environs",
".",
"EnvironProvider",
",",
"cloud",
"jujucloud",
".",
"Cloud",
",",
")",
"(",
"creds",
"bootstrapCredentials",
",... | // Get the credentials and region name. | [
"Get",
"the",
"credentials",
"and",
"region",
"name",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/bootstrap.go#L978-L1026 |
153,607 | juju/juju | cmd/juju/commands/bootstrap.go | runInteractive | func (c *bootstrapCommand) runInteractive(ctx *cmd.Context) error {
scanner := bufio.NewScanner(ctx.Stdin)
clouds, err := assembleClouds()
if err != nil {
return errors.Trace(err)
}
c.Cloud, err = queryCloud(clouds, lxdnames.DefaultCloud, scanner, ctx.Stdout)
if err != nil {
return errors.Trace(err)
}
cloud... | go | func (c *bootstrapCommand) runInteractive(ctx *cmd.Context) error {
scanner := bufio.NewScanner(ctx.Stdin)
clouds, err := assembleClouds()
if err != nil {
return errors.Trace(err)
}
c.Cloud, err = queryCloud(clouds, lxdnames.DefaultCloud, scanner, ctx.Stdout)
if err != nil {
return errors.Trace(err)
}
cloud... | [
"func",
"(",
"c",
"*",
"bootstrapCommand",
")",
"runInteractive",
"(",
"ctx",
"*",
"cmd",
".",
"Context",
")",
"error",
"{",
"scanner",
":=",
"bufio",
".",
"NewScanner",
"(",
"ctx",
".",
"Stdin",
")",
"\n",
"clouds",
",",
"err",
":=",
"assembleClouds",
... | // runInteractive queries the user about bootstrap config interactively at the
// command prompt. | [
"runInteractive",
"queries",
"the",
"user",
"about",
"bootstrap",
"config",
"interactively",
"at",
"the",
"command",
"prompt",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/bootstrap.go#L1251-L1286 |
153,608 | juju/juju | cmd/juju/commands/bootstrap.go | checkProviderType | func checkProviderType(envType string) error {
featureflag.SetFlagsFromEnvironment(osenv.JujuFeatureFlagEnvKey)
flag, ok := provisionalProviders[envType]
if ok && !featureflag.Enabled(flag) {
msg := `the %q provider is provisional in this version of Juju. To use it anyway, set JUJU_DEV_FEATURE_FLAGS="%s" in your s... | go | func checkProviderType(envType string) error {
featureflag.SetFlagsFromEnvironment(osenv.JujuFeatureFlagEnvKey)
flag, ok := provisionalProviders[envType]
if ok && !featureflag.Enabled(flag) {
msg := `the %q provider is provisional in this version of Juju. To use it anyway, set JUJU_DEV_FEATURE_FLAGS="%s" in your s... | [
"func",
"checkProviderType",
"(",
"envType",
"string",
")",
"error",
"{",
"featureflag",
".",
"SetFlagsFromEnvironment",
"(",
"osenv",
".",
"JujuFeatureFlagEnvKey",
")",
"\n",
"flag",
",",
"ok",
":=",
"provisionalProviders",
"[",
"envType",
"]",
"\n",
"if",
"ok"... | // checkProviderType ensures the provider type is okay. | [
"checkProviderType",
"ensures",
"the",
"provider",
"type",
"is",
"okay",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/bootstrap.go#L1289-L1297 |
153,609 | juju/juju | cmd/juju/commands/bootstrap.go | handleBootstrapError | func handleBootstrapError(ctx *cmd.Context, cleanup func() error) {
ch := make(chan os.Signal, 1)
ctx.InterruptNotify(ch)
defer ctx.StopInterruptNotify(ch)
defer close(ch)
go func() {
for range ch {
fmt.Fprintln(ctx.GetStderr(), "Cleaning up failed bootstrap")
}
}()
logger.Debugf("cleaning up after failed... | go | func handleBootstrapError(ctx *cmd.Context, cleanup func() error) {
ch := make(chan os.Signal, 1)
ctx.InterruptNotify(ch)
defer ctx.StopInterruptNotify(ch)
defer close(ch)
go func() {
for range ch {
fmt.Fprintln(ctx.GetStderr(), "Cleaning up failed bootstrap")
}
}()
logger.Debugf("cleaning up after failed... | [
"func",
"handleBootstrapError",
"(",
"ctx",
"*",
"cmd",
".",
"Context",
",",
"cleanup",
"func",
"(",
")",
"error",
")",
"{",
"ch",
":=",
"make",
"(",
"chan",
"os",
".",
"Signal",
",",
"1",
")",
"\n",
"ctx",
".",
"InterruptNotify",
"(",
"ch",
")",
"... | // handleBootstrapError is called to clean up if bootstrap fails. | [
"handleBootstrapError",
"is",
"called",
"to",
"clean",
"up",
"if",
"bootstrap",
"fails",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/bootstrap.go#L1300-L1314 |
153,610 | juju/juju | provider/gce/environ_firewall.go | OpenPorts | func (env *environ) OpenPorts(ctx context.ProviderCallContext, rules []network.IngressRule) error {
err := env.gce.OpenPorts(env.globalFirewallName(), rules...)
return google.HandleCredentialError(errors.Trace(err), ctx)
} | go | func (env *environ) OpenPorts(ctx context.ProviderCallContext, rules []network.IngressRule) error {
err := env.gce.OpenPorts(env.globalFirewallName(), rules...)
return google.HandleCredentialError(errors.Trace(err), ctx)
} | [
"func",
"(",
"env",
"*",
"environ",
")",
"OpenPorts",
"(",
"ctx",
"context",
".",
"ProviderCallContext",
",",
"rules",
"[",
"]",
"network",
".",
"IngressRule",
")",
"error",
"{",
"err",
":=",
"env",
".",
"gce",
".",
"OpenPorts",
"(",
"env",
".",
"globa... | // OpenPorts opens the given port ranges for the whole environment.
// Must only be used if the environment was setup with the
// FwGlobal firewall mode. | [
"OpenPorts",
"opens",
"the",
"given",
"port",
"ranges",
"for",
"the",
"whole",
"environment",
".",
"Must",
"only",
"be",
"used",
"if",
"the",
"environment",
"was",
"setup",
"with",
"the",
"FwGlobal",
"firewall",
"mode",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/gce/environ_firewall.go#L23-L26 |
153,611 | juju/juju | payload/status/output_tabular.go | FormatTabular | func FormatTabular(writer io.Writer, value interface{}) error {
payloads, valueConverted := value.([]FormattedPayload)
if !valueConverted {
return errors.Errorf("expected value of type %T, got %T", payloads, value)
}
// TODO(ericsnow) sort the rows first?
tw := output.TabWriter(writer)
// Write the header.
... | go | func FormatTabular(writer io.Writer, value interface{}) error {
payloads, valueConverted := value.([]FormattedPayload)
if !valueConverted {
return errors.Errorf("expected value of type %T, got %T", payloads, value)
}
// TODO(ericsnow) sort the rows first?
tw := output.TabWriter(writer)
// Write the header.
... | [
"func",
"FormatTabular",
"(",
"writer",
"io",
".",
"Writer",
",",
"value",
"interface",
"{",
"}",
")",
"error",
"{",
"payloads",
",",
"valueConverted",
":=",
"value",
".",
"(",
"[",
"]",
"FormattedPayload",
")",
"\n",
"if",
"!",
"valueConverted",
"{",
"r... | // FormatTabular writes a tabular summary of payloads. | [
"FormatTabular",
"writes",
"a",
"tabular",
"summary",
"of",
"payloads",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/payload/status/output_tabular.go#L34-L64 |
153,612 | juju/juju | storage/poolmanager/defaultpool.go | AddDefaultStoragePools | func AddDefaultStoragePools(p storage.Provider, pm PoolManager) error {
for _, pool := range p.DefaultPools() {
if err := addDefaultPool(pm, pool); err != nil {
return err
}
}
return nil
} | go | func AddDefaultStoragePools(p storage.Provider, pm PoolManager) error {
for _, pool := range p.DefaultPools() {
if err := addDefaultPool(pm, pool); err != nil {
return err
}
}
return nil
} | [
"func",
"AddDefaultStoragePools",
"(",
"p",
"storage",
".",
"Provider",
",",
"pm",
"PoolManager",
")",
"error",
"{",
"for",
"_",
",",
"pool",
":=",
"range",
"p",
".",
"DefaultPools",
"(",
")",
"{",
"if",
"err",
":=",
"addDefaultPool",
"(",
"pm",
",",
"... | // AddDefaultStoragePools adds the default storage pools for the given
// provider to the given pool manager. This is called whenever a new
// model is created. | [
"AddDefaultStoragePools",
"adds",
"the",
"default",
"storage",
"pools",
"for",
"the",
"given",
"provider",
"to",
"the",
"given",
"pool",
"manager",
".",
"This",
"is",
"called",
"whenever",
"a",
"new",
"model",
"is",
"created",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/storage/poolmanager/defaultpool.go#L15-L22 |
153,613 | juju/juju | provider/ec2/provider.go | Open | func (p environProvider) Open(args environs.OpenParams) (environs.Environ, error) {
logger.Infof("opening model %q", args.Config.Name())
e := new(environ)
e.cloud = args.Cloud
e.name = args.Config.Name()
// The endpoints in public-clouds.yaml from 2.0-rc2
// and before were wrong, so we use whatever is defined
... | go | func (p environProvider) Open(args environs.OpenParams) (environs.Environ, error) {
logger.Infof("opening model %q", args.Config.Name())
e := new(environ)
e.cloud = args.Cloud
e.name = args.Config.Name()
// The endpoints in public-clouds.yaml from 2.0-rc2
// and before were wrong, so we use whatever is defined
... | [
"func",
"(",
"p",
"environProvider",
")",
"Open",
"(",
"args",
"environs",
".",
"OpenParams",
")",
"(",
"environs",
".",
"Environ",
",",
"error",
")",
"{",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
",",
"args",
".",
"Config",
".",
"Name",
"(",
")",
... | // Open is specified in the EnvironProvider interface. | [
"Open",
"is",
"specified",
"in",
"the",
"EnvironProvider",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/ec2/provider.go#L38-L64 |
153,614 | juju/juju | provider/ec2/provider.go | isBrokenCloud | func isBrokenCloud(cloud environs.CloudSpec) bool {
// The public-clouds.yaml from 2.0-rc2 and before was
// complete nonsense for general regions and for
// govcloud. The cn-north-1 region has a trailing slash,
// which we don't want as it means we won't match the
// simplestreams data.
switch cloud.Region {
ca... | go | func isBrokenCloud(cloud environs.CloudSpec) bool {
// The public-clouds.yaml from 2.0-rc2 and before was
// complete nonsense for general regions and for
// govcloud. The cn-north-1 region has a trailing slash,
// which we don't want as it means we won't match the
// simplestreams data.
switch cloud.Region {
ca... | [
"func",
"isBrokenCloud",
"(",
"cloud",
"environs",
".",
"CloudSpec",
")",
"bool",
"{",
"// The public-clouds.yaml from 2.0-rc2 and before was",
"// complete nonsense for general regions and for",
"// govcloud. The cn-north-1 region has a trailing slash,",
"// which we don't want as it mean... | // isBrokenCloud reports whether the given CloudSpec is from an old,
// broken version of public-clouds.yaml. | [
"isBrokenCloud",
"reports",
"whether",
"the",
"given",
"CloudSpec",
"is",
"from",
"an",
"old",
"broken",
"version",
"of",
"public",
"-",
"clouds",
".",
"yaml",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/ec2/provider.go#L68-L85 |
153,615 | juju/juju | provider/ec2/provider.go | Validate | func (environProvider) Validate(cfg, old *config.Config) (valid *config.Config, err error) {
newEcfg, err := validateConfig(cfg, old)
if err != nil {
return nil, fmt.Errorf("invalid EC2 provider config: %v", err)
}
return newEcfg.Apply(newEcfg.attrs)
} | go | func (environProvider) Validate(cfg, old *config.Config) (valid *config.Config, err error) {
newEcfg, err := validateConfig(cfg, old)
if err != nil {
return nil, fmt.Errorf("invalid EC2 provider config: %v", err)
}
return newEcfg.Apply(newEcfg.attrs)
} | [
"func",
"(",
"environProvider",
")",
"Validate",
"(",
"cfg",
",",
"old",
"*",
"config",
".",
"Config",
")",
"(",
"valid",
"*",
"config",
".",
"Config",
",",
"err",
"error",
")",
"{",
"newEcfg",
",",
"err",
":=",
"validateConfig",
"(",
"cfg",
",",
"ol... | // Validate is specified in the EnvironProvider interface. | [
"Validate",
"is",
"specified",
"in",
"the",
"EnvironProvider",
"interface",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/ec2/provider.go#L149-L155 |
153,616 | juju/juju | state/logdb/buf.go | NewBufferedLogger | func NewBufferedLogger(
l Logger,
bufferSize int,
flushInterval time.Duration,
clock clock.Clock,
) *BufferedLogger {
return &BufferedLogger{
l: l,
buf: make([]state.LogRecord, 0, bufferSize),
clock: clock,
flushInterval: flushInterval,
}
} | go | func NewBufferedLogger(
l Logger,
bufferSize int,
flushInterval time.Duration,
clock clock.Clock,
) *BufferedLogger {
return &BufferedLogger{
l: l,
buf: make([]state.LogRecord, 0, bufferSize),
clock: clock,
flushInterval: flushInterval,
}
} | [
"func",
"NewBufferedLogger",
"(",
"l",
"Logger",
",",
"bufferSize",
"int",
",",
"flushInterval",
"time",
".",
"Duration",
",",
"clock",
"clock",
".",
"Clock",
",",
")",
"*",
"BufferedLogger",
"{",
"return",
"&",
"BufferedLogger",
"{",
"l",
":",
"l",
",",
... | // NewBufferedLogger returns a new BufferedLogger, wrapping the given
// Logger with a buffer of the specified size and flush interval. | [
"NewBufferedLogger",
"returns",
"a",
"new",
"BufferedLogger",
"wrapping",
"the",
"given",
"Logger",
"with",
"a",
"buffer",
"of",
"the",
"specified",
"size",
"and",
"flush",
"interval",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/logdb/buf.go#L37-L49 |
153,617 | juju/juju | state/logdb/buf.go | Log | func (b *BufferedLogger) Log(in []state.LogRecord) error {
b.mu.Lock()
defer b.mu.Unlock()
for len(in) > 0 {
r := cap(b.buf) - len(b.buf)
n := len(in)
if n > r {
n = r
}
b.buf = append(b.buf, in[:n]...)
in = in[n:]
if len(b.buf) >= cap(b.buf) {
if err := b.flush(); err != nil {
return errors.... | go | func (b *BufferedLogger) Log(in []state.LogRecord) error {
b.mu.Lock()
defer b.mu.Unlock()
for len(in) > 0 {
r := cap(b.buf) - len(b.buf)
n := len(in)
if n > r {
n = r
}
b.buf = append(b.buf, in[:n]...)
in = in[n:]
if len(b.buf) >= cap(b.buf) {
if err := b.flush(); err != nil {
return errors.... | [
"func",
"(",
"b",
"*",
"BufferedLogger",
")",
"Log",
"(",
"in",
"[",
"]",
"state",
".",
"LogRecord",
")",
"error",
"{",
"b",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"for",
"len",
"(",
"i... | // Log is part of the Logger interface.
//
// BufferedLogger's Log implementation will buffer log records up to
// the specified capacity and duration; after either of which is exceeded,
// the records will be flushed to the underlying logger. | [
"Log",
"is",
"part",
"of",
"the",
"Logger",
"interface",
".",
"BufferedLogger",
"s",
"Log",
"implementation",
"will",
"buffer",
"log",
"records",
"up",
"to",
"the",
"specified",
"capacity",
"and",
"duration",
";",
"after",
"either",
"of",
"which",
"is",
"exc... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/logdb/buf.go#L56-L77 |
153,618 | juju/juju | state/logdb/buf.go | Flush | func (b *BufferedLogger) Flush() error {
b.mu.Lock()
b.mu.Unlock()
return b.flush()
} | go | func (b *BufferedLogger) Flush() error {
b.mu.Lock()
b.mu.Unlock()
return b.flush()
} | [
"func",
"(",
"b",
"*",
"BufferedLogger",
")",
"Flush",
"(",
")",
"error",
"{",
"b",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"b",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"b",
".",
"flush",
"(",
")",
"\n",
"}"
] | // Flush flushes any buffered log records to the underlying Logger. | [
"Flush",
"flushes",
"any",
"buffered",
"log",
"records",
"to",
"the",
"underlying",
"Logger",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/logdb/buf.go#L80-L84 |
153,619 | juju/juju | state/logdb/buf.go | flush | func (b *BufferedLogger) flush() error {
if b.flushTimer != nil {
b.flushTimer.Stop()
b.flushTimer = nil
}
if len(b.buf) > 0 {
if err := b.l.Log(b.buf); err != nil {
return errors.Trace(err)
}
b.buf = b.buf[:0]
}
return nil
} | go | func (b *BufferedLogger) flush() error {
if b.flushTimer != nil {
b.flushTimer.Stop()
b.flushTimer = nil
}
if len(b.buf) > 0 {
if err := b.l.Log(b.buf); err != nil {
return errors.Trace(err)
}
b.buf = b.buf[:0]
}
return nil
} | [
"func",
"(",
"b",
"*",
"BufferedLogger",
")",
"flush",
"(",
")",
"error",
"{",
"if",
"b",
".",
"flushTimer",
"!=",
"nil",
"{",
"b",
".",
"flushTimer",
".",
"Stop",
"(",
")",
"\n",
"b",
".",
"flushTimer",
"=",
"nil",
"\n",
"}",
"\n",
"if",
"len",
... | // flush flushes any buffered log records to the underlying Logger, and stops
// the flush timer if there is one. The caller must be holding b.mu. | [
"flush",
"flushes",
"any",
"buffered",
"log",
"records",
"to",
"the",
"underlying",
"Logger",
"and",
"stops",
"the",
"flush",
"timer",
"if",
"there",
"is",
"one",
".",
"The",
"caller",
"must",
"be",
"holding",
"b",
".",
"mu",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/logdb/buf.go#L97-L109 |
153,620 | juju/juju | resource/api/upload.go | NewUploadRequest | func NewUploadRequest(application, name, filename string, r io.ReadSeeker) (UploadRequest, error) {
if !names.IsValidApplication(application) {
return UploadRequest{}, errors.Errorf("invalid application %q", application)
}
content, err := resource.GenerateContent(r)
if err != nil {
return UploadRequest{}, erro... | go | func NewUploadRequest(application, name, filename string, r io.ReadSeeker) (UploadRequest, error) {
if !names.IsValidApplication(application) {
return UploadRequest{}, errors.Errorf("invalid application %q", application)
}
content, err := resource.GenerateContent(r)
if err != nil {
return UploadRequest{}, erro... | [
"func",
"NewUploadRequest",
"(",
"application",
",",
"name",
",",
"filename",
"string",
",",
"r",
"io",
".",
"ReadSeeker",
")",
"(",
"UploadRequest",
",",
"error",
")",
"{",
"if",
"!",
"names",
".",
"IsValidApplication",
"(",
"application",
")",
"{",
"retu... | // NewUploadRequest generates a new upload request for the given resource. | [
"NewUploadRequest",
"generates",
"a",
"new",
"upload",
"request",
"for",
"the",
"given",
"resource",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/api/upload.go#L41-L59 |
153,621 | juju/juju | resource/api/upload.go | HTTPRequest | func (ur UploadRequest) HTTPRequest() (*http.Request, error) {
// TODO(ericsnow) What about the rest of the URL?
urlStr := NewEndpointPath(ur.Application, ur.Name)
req, err := http.NewRequest(http.MethodPut, urlStr, nil)
if err != nil {
return nil, errors.Trace(err)
}
req.Header.Set(HeaderContentType, Content... | go | func (ur UploadRequest) HTTPRequest() (*http.Request, error) {
// TODO(ericsnow) What about the rest of the URL?
urlStr := NewEndpointPath(ur.Application, ur.Name)
req, err := http.NewRequest(http.MethodPut, urlStr, nil)
if err != nil {
return nil, errors.Trace(err)
}
req.Header.Set(HeaderContentType, Content... | [
"func",
"(",
"ur",
"UploadRequest",
")",
"HTTPRequest",
"(",
")",
"(",
"*",
"http",
".",
"Request",
",",
"error",
")",
"{",
"// TODO(ericsnow) What about the rest of the URL?",
"urlStr",
":=",
"NewEndpointPath",
"(",
"ur",
".",
"Application",
",",
"ur",
".",
"... | // HTTPRequest generates a new HTTP request. | [
"HTTPRequest",
"generates",
"a",
"new",
"HTTP",
"request",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/resource/api/upload.go#L83-L106 |
153,622 | juju/juju | core/lease/store.go | LockedTrapdoor | func LockedTrapdoor(attempt int, key interface{}) error {
if key != nil {
return errors.New("lease substrate not accessible")
}
return nil
} | go | func LockedTrapdoor(attempt int, key interface{}) error {
if key != nil {
return errors.New("lease substrate not accessible")
}
return nil
} | [
"func",
"LockedTrapdoor",
"(",
"attempt",
"int",
",",
"key",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"key",
"!=",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // LockedTrapdoor is a Trapdoor suitable for use by substrates that don't want
// or need to expose their internals. | [
"LockedTrapdoor",
"is",
"a",
"Trapdoor",
"suitable",
"for",
"use",
"by",
"substrates",
"that",
"don",
"t",
"want",
"or",
"need",
"to",
"expose",
"their",
"internals",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/lease/store.go#L100-L105 |
153,623 | juju/juju | core/lease/store.go | Validate | func (request Request) Validate() error {
if err := ValidateString(request.Holder); err != nil {
return errors.Annotatef(err, "invalid holder")
}
if request.Duration <= 0 {
return errors.Errorf("invalid duration")
}
return nil
} | go | func (request Request) Validate() error {
if err := ValidateString(request.Holder); err != nil {
return errors.Annotatef(err, "invalid holder")
}
if request.Duration <= 0 {
return errors.Errorf("invalid duration")
}
return nil
} | [
"func",
"(",
"request",
"Request",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"ValidateString",
"(",
"request",
".",
"Holder",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Annotatef",
"(",
"err",
",",
"\"",
"\"",
")",... | // Validate returns an error if any fields are invalid or inconsistent. | [
"Validate",
"returns",
"an",
"error",
"if",
"any",
"fields",
"are",
"invalid",
"or",
"inconsistent",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/lease/store.go#L118-L126 |
153,624 | juju/juju | apiserver/facades/agent/metricsadder/metricsadder.go | NewMetricsAdderAPI | func NewMetricsAdderAPI(
st *state.State,
resources facade.Resources,
authorizer facade.Authorizer,
) (*MetricsAdderAPI, error) {
// TODO(cmars): remove unit agent auth, once worker/metrics/sender manifold
// can be righteously relocated to machine agent.
if !authorizer.AuthMachineAgent() && !authorizer.AuthUnitA... | go | func NewMetricsAdderAPI(
st *state.State,
resources facade.Resources,
authorizer facade.Authorizer,
) (*MetricsAdderAPI, error) {
// TODO(cmars): remove unit agent auth, once worker/metrics/sender manifold
// can be righteously relocated to machine agent.
if !authorizer.AuthMachineAgent() && !authorizer.AuthUnitA... | [
"func",
"NewMetricsAdderAPI",
"(",
"st",
"*",
"state",
".",
"State",
",",
"resources",
"facade",
".",
"Resources",
",",
"authorizer",
"facade",
".",
"Authorizer",
",",
")",
"(",
"*",
"MetricsAdderAPI",
",",
"error",
")",
"{",
"// TODO(cmars): remove unit agent a... | // NewMetricsAdderAPI creates a new API endpoint for adding metrics to state. | [
"NewMetricsAdderAPI",
"creates",
"a",
"new",
"API",
"endpoint",
"for",
"adding",
"metrics",
"to",
"state",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/metricsadder/metricsadder.go#L30-L43 |
153,625 | juju/juju | cmd/juju/application/addrelation.go | validateEndpoints | func (c *addRelationCommand) validateEndpoints(all []string) error {
for _, endpoint := range all {
// We can only determine if this is a remote endpoint with 100%.
// If we cannot parse it, it may still be a valid local endpoint...
// so ignoring parsing error,
if url, err := crossmodel.ParseOfferURL(endpoint... | go | func (c *addRelationCommand) validateEndpoints(all []string) error {
for _, endpoint := range all {
// We can only determine if this is a remote endpoint with 100%.
// If we cannot parse it, it may still be a valid local endpoint...
// so ignoring parsing error,
if url, err := crossmodel.ParseOfferURL(endpoint... | [
"func",
"(",
"c",
"*",
"addRelationCommand",
")",
"validateEndpoints",
"(",
"all",
"[",
"]",
"string",
")",
"error",
"{",
"for",
"_",
",",
"endpoint",
":=",
"range",
"all",
"{",
"// We can only determine if this is a remote endpoint with 100%.",
"// If we cannot parse... | // validateEndpoints determines if all endpoints are valid.
// Each endpoint is either from local application or remote.
// If more than one remote endpoint are supplied, the input argument are considered invalid. | [
"validateEndpoints",
"determines",
"if",
"all",
"endpoints",
"are",
"valid",
".",
"Each",
"endpoint",
"is",
"either",
"from",
"local",
"application",
"or",
"remote",
".",
"If",
"more",
"than",
"one",
"remote",
"endpoint",
"are",
"supplied",
"the",
"input",
"ar... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/addrelation.go#L224-L244 |
153,626 | juju/juju | cmd/juju/application/addrelation.go | validateLocalEndpoint | func validateLocalEndpoint(endpoint string, sep string) error {
i := strings.Index(endpoint, sep)
applicationName := endpoint
if i != -1 {
// not a valid endpoint as sep either at the start or the end of the name
if i == 0 || i == len(endpoint)-1 {
return errors.NotValidf("endpoint %q", endpoint)
}
parts... | go | func validateLocalEndpoint(endpoint string, sep string) error {
i := strings.Index(endpoint, sep)
applicationName := endpoint
if i != -1 {
// not a valid endpoint as sep either at the start or the end of the name
if i == 0 || i == len(endpoint)-1 {
return errors.NotValidf("endpoint %q", endpoint)
}
parts... | [
"func",
"validateLocalEndpoint",
"(",
"endpoint",
"string",
",",
"sep",
"string",
")",
"error",
"{",
"i",
":=",
"strings",
".",
"Index",
"(",
"endpoint",
",",
"sep",
")",
"\n",
"applicationName",
":=",
"endpoint",
"\n",
"if",
"i",
"!=",
"-",
"1",
"{",
... | // validateLocalEndpoint determines if given endpoint could be a valid | [
"validateLocalEndpoint",
"determines",
"if",
"given",
"endpoint",
"could",
"be",
"a",
"valid"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/application/addrelation.go#L247-L273 |
153,627 | juju/juju | state/filesystem.go | FilesystemTag | func (f *filesystem) FilesystemTag() names.FilesystemTag {
return names.NewFilesystemTag(f.doc.FilesystemId)
} | go | func (f *filesystem) FilesystemTag() names.FilesystemTag {
return names.NewFilesystemTag(f.doc.FilesystemId)
} | [
"func",
"(",
"f",
"*",
"filesystem",
")",
"FilesystemTag",
"(",
")",
"names",
".",
"FilesystemTag",
"{",
"return",
"names",
".",
"NewFilesystemTag",
"(",
"f",
".",
"doc",
".",
"FilesystemId",
")",
"\n",
"}"
] | // FilesystemTag is required to implement Filesystem. | [
"FilesystemTag",
"is",
"required",
"to",
"implement",
"Filesystem",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L208-L210 |
153,628 | juju/juju | state/filesystem.go | Storage | func (f *filesystem) Storage() (names.StorageTag, error) {
if f.doc.StorageId == "" {
msg := fmt.Sprintf("filesystem %q is not assigned to any storage instance", f.Tag().Id())
return names.StorageTag{}, errors.NewNotAssigned(nil, msg)
}
return names.NewStorageTag(f.doc.StorageId), nil
} | go | func (f *filesystem) Storage() (names.StorageTag, error) {
if f.doc.StorageId == "" {
msg := fmt.Sprintf("filesystem %q is not assigned to any storage instance", f.Tag().Id())
return names.StorageTag{}, errors.NewNotAssigned(nil, msg)
}
return names.NewStorageTag(f.doc.StorageId), nil
} | [
"func",
"(",
"f",
"*",
"filesystem",
")",
"Storage",
"(",
")",
"(",
"names",
".",
"StorageTag",
",",
"error",
")",
"{",
"if",
"f",
".",
"doc",
".",
"StorageId",
"==",
"\"",
"\"",
"{",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f... | // Storage is required to implement Filesystem. | [
"Storage",
"is",
"required",
"to",
"implement",
"Filesystem",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L218-L224 |
153,629 | juju/juju | state/filesystem.go | Volume | func (f *filesystem) Volume() (names.VolumeTag, error) {
if f.doc.VolumeId == "" {
return names.VolumeTag{}, ErrNoBackingVolume
}
return names.NewVolumeTag(f.doc.VolumeId), nil
} | go | func (f *filesystem) Volume() (names.VolumeTag, error) {
if f.doc.VolumeId == "" {
return names.VolumeTag{}, ErrNoBackingVolume
}
return names.NewVolumeTag(f.doc.VolumeId), nil
} | [
"func",
"(",
"f",
"*",
"filesystem",
")",
"Volume",
"(",
")",
"(",
"names",
".",
"VolumeTag",
",",
"error",
")",
"{",
"if",
"f",
".",
"doc",
".",
"VolumeId",
"==",
"\"",
"\"",
"{",
"return",
"names",
".",
"VolumeTag",
"{",
"}",
",",
"ErrNoBackingVo... | // Volume is required to implement Filesystem. | [
"Volume",
"is",
"required",
"to",
"implement",
"Filesystem",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L227-L232 |
153,630 | juju/juju | state/filesystem.go | Info | func (f *filesystem) Info() (FilesystemInfo, error) {
if f.doc.Info == nil {
return FilesystemInfo{}, errors.NotProvisionedf("filesystem %q", f.doc.FilesystemId)
}
return *f.doc.Info, nil
} | go | func (f *filesystem) Info() (FilesystemInfo, error) {
if f.doc.Info == nil {
return FilesystemInfo{}, errors.NotProvisionedf("filesystem %q", f.doc.FilesystemId)
}
return *f.doc.Info, nil
} | [
"func",
"(",
"f",
"*",
"filesystem",
")",
"Info",
"(",
")",
"(",
"FilesystemInfo",
",",
"error",
")",
"{",
"if",
"f",
".",
"doc",
".",
"Info",
"==",
"nil",
"{",
"return",
"FilesystemInfo",
"{",
"}",
",",
"errors",
".",
"NotProvisionedf",
"(",
"\"",
... | // Info is required to implement Filesystem. | [
"Info",
"is",
"required",
"to",
"implement",
"Filesystem",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L235-L240 |
153,631 | juju/juju | state/filesystem.go | Params | func (f *filesystem) Params() (FilesystemParams, bool) {
if f.doc.Params == nil {
return FilesystemParams{}, false
}
return *f.doc.Params, true
} | go | func (f *filesystem) Params() (FilesystemParams, bool) {
if f.doc.Params == nil {
return FilesystemParams{}, false
}
return *f.doc.Params, true
} | [
"func",
"(",
"f",
"*",
"filesystem",
")",
"Params",
"(",
")",
"(",
"FilesystemParams",
",",
"bool",
")",
"{",
"if",
"f",
".",
"doc",
".",
"Params",
"==",
"nil",
"{",
"return",
"FilesystemParams",
"{",
"}",
",",
"false",
"\n",
"}",
"\n",
"return",
"... | // Params is required to implement Filesystem. | [
"Params",
"is",
"required",
"to",
"implement",
"Filesystem",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L243-L248 |
153,632 | juju/juju | state/filesystem.go | Filesystem | func (f *filesystemAttachment) Filesystem() names.FilesystemTag {
return names.NewFilesystemTag(f.doc.Filesystem)
} | go | func (f *filesystemAttachment) Filesystem() names.FilesystemTag {
return names.NewFilesystemTag(f.doc.Filesystem)
} | [
"func",
"(",
"f",
"*",
"filesystemAttachment",
")",
"Filesystem",
"(",
")",
"names",
".",
"FilesystemTag",
"{",
"return",
"names",
".",
"NewFilesystemTag",
"(",
"f",
".",
"doc",
".",
"Filesystem",
")",
"\n",
"}"
] | // Filesystem is required to implement FilesystemAttachment. | [
"Filesystem",
"is",
"required",
"to",
"implement",
"FilesystemAttachment",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L295-L297 |
153,633 | juju/juju | state/filesystem.go | Info | func (f *filesystemAttachment) Info() (FilesystemAttachmentInfo, error) {
if f.doc.Info == nil {
hostTag := storageAttachmentHost(f.doc.Host)
return FilesystemAttachmentInfo{}, errors.NotProvisionedf(
"filesystem attachment %q on %q", f.doc.Filesystem, names.ReadableString(hostTag))
}
return *f.doc.Info, nil
... | go | func (f *filesystemAttachment) Info() (FilesystemAttachmentInfo, error) {
if f.doc.Info == nil {
hostTag := storageAttachmentHost(f.doc.Host)
return FilesystemAttachmentInfo{}, errors.NotProvisionedf(
"filesystem attachment %q on %q", f.doc.Filesystem, names.ReadableString(hostTag))
}
return *f.doc.Info, nil
... | [
"func",
"(",
"f",
"*",
"filesystemAttachment",
")",
"Info",
"(",
")",
"(",
"FilesystemAttachmentInfo",
",",
"error",
")",
"{",
"if",
"f",
".",
"doc",
".",
"Info",
"==",
"nil",
"{",
"hostTag",
":=",
"storageAttachmentHost",
"(",
"f",
".",
"doc",
".",
"H... | // Info is required to implement FilesystemAttachment. | [
"Info",
"is",
"required",
"to",
"implement",
"FilesystemAttachment",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L317-L324 |
153,634 | juju/juju | state/filesystem.go | Params | func (f *filesystemAttachment) Params() (FilesystemAttachmentParams, bool) {
if f.doc.Params == nil {
return FilesystemAttachmentParams{}, false
}
return *f.doc.Params, true
} | go | func (f *filesystemAttachment) Params() (FilesystemAttachmentParams, bool) {
if f.doc.Params == nil {
return FilesystemAttachmentParams{}, false
}
return *f.doc.Params, true
} | [
"func",
"(",
"f",
"*",
"filesystemAttachment",
")",
"Params",
"(",
")",
"(",
"FilesystemAttachmentParams",
",",
"bool",
")",
"{",
"if",
"f",
".",
"doc",
".",
"Params",
"==",
"nil",
"{",
"return",
"FilesystemAttachmentParams",
"{",
"}",
",",
"false",
"\n",
... | // Params is required to implement FilesystemAttachment. | [
"Params",
"is",
"required",
"to",
"implement",
"FilesystemAttachment",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L327-L332 |
153,635 | juju/juju | state/filesystem.go | Filesystem | func (sb *storageBackend) Filesystem(tag names.FilesystemTag) (Filesystem, error) {
f, err := getFilesystemByTag(sb.mb, tag)
return f, err
} | go | func (sb *storageBackend) Filesystem(tag names.FilesystemTag) (Filesystem, error) {
f, err := getFilesystemByTag(sb.mb, tag)
return f, err
} | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"Filesystem",
"(",
"tag",
"names",
".",
"FilesystemTag",
")",
"(",
"Filesystem",
",",
"error",
")",
"{",
"f",
",",
"err",
":=",
"getFilesystemByTag",
"(",
"sb",
".",
"mb",
",",
"tag",
")",
"\n",
"return",
... | // Filesystem returns the Filesystem with the specified name. | [
"Filesystem",
"returns",
"the",
"Filesystem",
"with",
"the",
"specified",
"name",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L335-L338 |
153,636 | juju/juju | state/filesystem.go | StorageInstanceFilesystem | func (sb *storageBackend) StorageInstanceFilesystem(tag names.StorageTag) (Filesystem, error) {
f, err := sb.storageInstanceFilesystem(tag)
return f, err
} | go | func (sb *storageBackend) StorageInstanceFilesystem(tag names.StorageTag) (Filesystem, error) {
f, err := sb.storageInstanceFilesystem(tag)
return f, err
} | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"StorageInstanceFilesystem",
"(",
"tag",
"names",
".",
"StorageTag",
")",
"(",
"Filesystem",
",",
"error",
")",
"{",
"f",
",",
"err",
":=",
"sb",
".",
"storageInstanceFilesystem",
"(",
"tag",
")",
"\n",
"retur... | // StorageInstanceFilesystem returns the Filesystem assigned to the specified
// storage instance. | [
"StorageInstanceFilesystem",
"returns",
"the",
"Filesystem",
"assigned",
"to",
"the",
"specified",
"storage",
"instance",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L356-L359 |
153,637 | juju/juju | state/filesystem.go | VolumeFilesystem | func (sb *storageBackend) VolumeFilesystem(tag names.VolumeTag) (Filesystem, error) {
f, err := sb.volumeFilesystem(tag)
return f, err
} | go | func (sb *storageBackend) VolumeFilesystem(tag names.VolumeTag) (Filesystem, error) {
f, err := sb.volumeFilesystem(tag)
return f, err
} | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"VolumeFilesystem",
"(",
"tag",
"names",
".",
"VolumeTag",
")",
"(",
"Filesystem",
",",
"error",
")",
"{",
"f",
",",
"err",
":=",
"sb",
".",
"volumeFilesystem",
"(",
"tag",
")",
"\n",
"return",
"f",
",",
... | // VolumeFilesystem returns the Filesystem backed by the specified volume. | [
"VolumeFilesystem",
"returns",
"the",
"Filesystem",
"backed",
"by",
"the",
"specified",
"volume",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L368-L371 |
153,638 | juju/juju | state/filesystem.go | FilesystemAttachment | func (sb *storageBackend) FilesystemAttachment(host names.Tag, filesystem names.FilesystemTag) (FilesystemAttachment, error) {
coll, cleanup := sb.mb.db().GetCollection(filesystemAttachmentsC)
defer cleanup()
var att filesystemAttachment
err := coll.FindId(filesystemAttachmentId(host.Id(), filesystem.Id())).One(&a... | go | func (sb *storageBackend) FilesystemAttachment(host names.Tag, filesystem names.FilesystemTag) (FilesystemAttachment, error) {
coll, cleanup := sb.mb.db().GetCollection(filesystemAttachmentsC)
defer cleanup()
var att filesystemAttachment
err := coll.FindId(filesystemAttachmentId(host.Id(), filesystem.Id())).One(&a... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"FilesystemAttachment",
"(",
"host",
"names",
".",
"Tag",
",",
"filesystem",
"names",
".",
"FilesystemTag",
")",
"(",
"FilesystemAttachment",
",",
"error",
")",
"{",
"coll",
",",
"cleanup",
":=",
"sb",
".",
"m... | // FilesystemAttachment returns the FilesystemAttachment corresponding to
// the specified filesystem and machine. | [
"FilesystemAttachment",
"returns",
"the",
"FilesystemAttachment",
"corresponding",
"to",
"the",
"specified",
"filesystem",
"and",
"machine",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L435-L447 |
153,639 | juju/juju | state/filesystem.go | FilesystemAttachments | func (sb *storageBackend) FilesystemAttachments(filesystem names.FilesystemTag) ([]FilesystemAttachment, error) {
attachments, err := sb.filesystemAttachments(bson.D{{"filesystemid", filesystem.Id()}})
if err != nil {
return nil, errors.Annotatef(err, "getting attachments for filesystem %q", filesystem.Id())
}
re... | go | func (sb *storageBackend) FilesystemAttachments(filesystem names.FilesystemTag) ([]FilesystemAttachment, error) {
attachments, err := sb.filesystemAttachments(bson.D{{"filesystemid", filesystem.Id()}})
if err != nil {
return nil, errors.Annotatef(err, "getting attachments for filesystem %q", filesystem.Id())
}
re... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"FilesystemAttachments",
"(",
"filesystem",
"names",
".",
"FilesystemTag",
")",
"(",
"[",
"]",
"FilesystemAttachment",
",",
"error",
")",
"{",
"attachments",
",",
"err",
":=",
"sb",
".",
"filesystemAttachments",
"... | // FilesystemAttachments returns all of the FilesystemAttachments for the
// specified filesystem. | [
"FilesystemAttachments",
"returns",
"all",
"of",
"the",
"FilesystemAttachments",
"for",
"the",
"specified",
"filesystem",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L451-L457 |
153,640 | juju/juju | state/filesystem.go | MachineFilesystemAttachments | func (sb *storageBackend) MachineFilesystemAttachments(machine names.MachineTag) ([]FilesystemAttachment, error) {
attachments, err := sb.filesystemAttachments(bson.D{{"hostid", machine.Id()}})
if err != nil {
return nil, errors.Annotatef(err, "getting filesystem attachments for %q", names.ReadableString(machine))
... | go | func (sb *storageBackend) MachineFilesystemAttachments(machine names.MachineTag) ([]FilesystemAttachment, error) {
attachments, err := sb.filesystemAttachments(bson.D{{"hostid", machine.Id()}})
if err != nil {
return nil, errors.Annotatef(err, "getting filesystem attachments for %q", names.ReadableString(machine))
... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"MachineFilesystemAttachments",
"(",
"machine",
"names",
".",
"MachineTag",
")",
"(",
"[",
"]",
"FilesystemAttachment",
",",
"error",
")",
"{",
"attachments",
",",
"err",
":=",
"sb",
".",
"filesystemAttachments",
... | // MachineFilesystemAttachments returns all of the FilesystemAttachments for the
// specified machine. | [
"MachineFilesystemAttachments",
"returns",
"all",
"of",
"the",
"FilesystemAttachments",
"for",
"the",
"specified",
"machine",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L461-L467 |
153,641 | juju/juju | state/filesystem.go | UnitFilesystemAttachments | func (sb *storageBackend) UnitFilesystemAttachments(unit names.UnitTag) ([]FilesystemAttachment, error) {
attachments, err := sb.filesystemAttachments(bson.D{{"hostid", unit.Id()}})
if err != nil {
return nil, errors.Annotatef(err, "getting filesystem attachments for %q", names.ReadableString(unit))
}
return atta... | go | func (sb *storageBackend) UnitFilesystemAttachments(unit names.UnitTag) ([]FilesystemAttachment, error) {
attachments, err := sb.filesystemAttachments(bson.D{{"hostid", unit.Id()}})
if err != nil {
return nil, errors.Annotatef(err, "getting filesystem attachments for %q", names.ReadableString(unit))
}
return atta... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"UnitFilesystemAttachments",
"(",
"unit",
"names",
".",
"UnitTag",
")",
"(",
"[",
"]",
"FilesystemAttachment",
",",
"error",
")",
"{",
"attachments",
",",
"err",
":=",
"sb",
".",
"filesystemAttachments",
"(",
"b... | // UnitFilesystemAttachments returns all of the FilesystemAttachments for the
// specified unit. | [
"UnitFilesystemAttachments",
"returns",
"all",
"of",
"the",
"FilesystemAttachments",
"for",
"the",
"specified",
"unit",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L471-L477 |
153,642 | juju/juju | state/filesystem.go | removeMachineFilesystemsOps | func (sb *storageBackend) removeMachineFilesystemsOps(m *Machine) ([]txn.Op, error) {
// A machine cannot transition to Dead if it has any detachable storage
// attached, so any attachments are for machine-bound storage.
//
// Even if a filesystem is "non-detachable", there still exist filesystem
// attachments, a... | go | func (sb *storageBackend) removeMachineFilesystemsOps(m *Machine) ([]txn.Op, error) {
// A machine cannot transition to Dead if it has any detachable storage
// attached, so any attachments are for machine-bound storage.
//
// Even if a filesystem is "non-detachable", there still exist filesystem
// attachments, a... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"removeMachineFilesystemsOps",
"(",
"m",
"*",
"Machine",
")",
"(",
"[",
"]",
"txn",
".",
"Op",
",",
"error",
")",
"{",
"// A machine cannot transition to Dead if it has any detachable storage",
"// attached, so any attachme... | // removeMachineFilesystemsOps returns txn.Ops to remove non-persistent filesystems
// attached to the specified machine. This is used when the given machine is
// being removed from state. | [
"removeMachineFilesystemsOps",
"returns",
"txn",
".",
"Ops",
"to",
"remove",
"non",
"-",
"persistent",
"filesystems",
"attached",
"to",
"the",
"specified",
"machine",
".",
"This",
"is",
"used",
"when",
"the",
"given",
"machine",
"is",
"being",
"removed",
"from",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L500-L549 |
153,643 | juju/juju | state/filesystem.go | isDetachableFilesystemTag | func isDetachableFilesystemTag(db Database, tag names.FilesystemTag) (bool, error) {
doc, err := getFilesystemDocByTag(db, tag)
if err != nil {
return false, errors.Trace(err)
}
return doc.HostId == "", nil
} | go | func isDetachableFilesystemTag(db Database, tag names.FilesystemTag) (bool, error) {
doc, err := getFilesystemDocByTag(db, tag)
if err != nil {
return false, errors.Trace(err)
}
return doc.HostId == "", nil
} | [
"func",
"isDetachableFilesystemTag",
"(",
"db",
"Database",
",",
"tag",
"names",
".",
"FilesystemTag",
")",
"(",
"bool",
",",
"error",
")",
"{",
"doc",
",",
"err",
":=",
"getFilesystemDocByTag",
"(",
"db",
",",
"tag",
")",
"\n",
"if",
"err",
"!=",
"nil",... | // isDetachableFilesystemTag reports whether or not the filesystem with the
// specified tag is detachable. | [
"isDetachableFilesystemTag",
"reports",
"whether",
"or",
"not",
"the",
"filesystem",
"with",
"the",
"specified",
"tag",
"is",
"detachable",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L553-L559 |
153,644 | juju/juju | state/filesystem.go | DetachFilesystem | func (sb *storageBackend) DetachFilesystem(host names.Tag, filesystem names.FilesystemTag) (err error) {
defer errors.DeferredAnnotatef(&err, "detaching filesystem %s from %s", filesystem.Id(), names.ReadableString(host))
buildTxn := func(attempt int) ([]txn.Op, error) {
fsa, err := sb.FilesystemAttachment(host, fi... | go | func (sb *storageBackend) DetachFilesystem(host names.Tag, filesystem names.FilesystemTag) (err error) {
defer errors.DeferredAnnotatef(&err, "detaching filesystem %s from %s", filesystem.Id(), names.ReadableString(host))
buildTxn := func(attempt int) ([]txn.Op, error) {
fsa, err := sb.FilesystemAttachment(host, fi... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"DetachFilesystem",
"(",
"host",
"names",
".",
"Tag",
",",
"filesystem",
"names",
".",
"FilesystemTag",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",
"(",
"&",
"err",
",",
... | // DetachFilesystem marks the filesystem attachment identified by the specified machine
// and filesystem tags as Dying, if it is Alive. DetachFilesystem will fail for
// inherently machine-bound filesystems. | [
"DetachFilesystem",
"marks",
"the",
"filesystem",
"attachment",
"identified",
"by",
"the",
"specified",
"machine",
"and",
"filesystem",
"tags",
"as",
"Dying",
"if",
"it",
"is",
"Alive",
".",
"DetachFilesystem",
"will",
"fail",
"for",
"inherently",
"machine",
"-",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L598-L619 |
153,645 | juju/juju | state/filesystem.go | RemoveFilesystemAttachment | func (sb *storageBackend) RemoveFilesystemAttachment(host names.Tag, filesystem names.FilesystemTag) (err error) {
defer errors.DeferredAnnotatef(&err, "removing attachment of filesystem %s from %s", filesystem.Id(), names.ReadableString(host))
buildTxn := func(attempt int) ([]txn.Op, error) {
attachment, err := sb... | go | func (sb *storageBackend) RemoveFilesystemAttachment(host names.Tag, filesystem names.FilesystemTag) (err error) {
defer errors.DeferredAnnotatef(&err, "removing attachment of filesystem %s from %s", filesystem.Id(), names.ReadableString(host))
buildTxn := func(attempt int) ([]txn.Op, error) {
attachment, err := sb... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"RemoveFilesystemAttachment",
"(",
"host",
"names",
".",
"Tag",
",",
"filesystem",
"names",
".",
"FilesystemTag",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",
"(",
"&",
"err",... | // RemoveFilesystemAttachment removes the filesystem attachment from state.
// Removing a volume-backed filesystem attachment will cause the volume to
// be detached. | [
"RemoveFilesystemAttachment",
"removes",
"the",
"filesystem",
"attachment",
"from",
"state",
".",
"Removing",
"a",
"volume",
"-",
"backed",
"filesystem",
"attachment",
"will",
"cause",
"the",
"volume",
"to",
"be",
"detached",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L645-L705 |
153,646 | juju/juju | state/filesystem.go | DestroyFilesystem | func (sb *storageBackend) DestroyFilesystem(tag names.FilesystemTag) (err error) {
defer errors.DeferredAnnotatef(&err, "destroying filesystem %s", tag.Id())
buildTxn := func(attempt int) ([]txn.Op, error) {
filesystem, err := getFilesystemByTag(sb.mb, tag)
if errors.IsNotFound(err) && attempt > 0 {
// On the ... | go | func (sb *storageBackend) DestroyFilesystem(tag names.FilesystemTag) (err error) {
defer errors.DeferredAnnotatef(&err, "destroying filesystem %s", tag.Id())
buildTxn := func(attempt int) ([]txn.Op, error) {
filesystem, err := getFilesystemByTag(sb.mb, tag)
if errors.IsNotFound(err) && attempt > 0 {
// On the ... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"DestroyFilesystem",
"(",
"tag",
"names",
".",
"FilesystemTag",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",
"(",
"&",
"err",
",",
"\"",
"\"",
",",
"tag",
".",
"Id",
"("... | // DestroyFilesystem ensures that the filesystem and any attachments to it will
// be destroyed and removed from state at some point in the future. | [
"DestroyFilesystem",
"ensures",
"that",
"the",
"filesystem",
"and",
"any",
"attachments",
"to",
"it",
"will",
"be",
"destroyed",
"and",
"removed",
"from",
"state",
"at",
"some",
"point",
"in",
"the",
"future",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L747-L773 |
153,647 | juju/juju | state/filesystem.go | RemoveFilesystem | func (sb *storageBackend) RemoveFilesystem(tag names.FilesystemTag) (err error) {
defer errors.DeferredAnnotatef(&err, "removing filesystem %s", tag.Id())
buildTxn := func(attempt int) ([]txn.Op, error) {
filesystem, err := getFilesystemByTag(sb.mb, tag)
if errors.IsNotFound(err) {
return nil, jujutxn.ErrNoOpe... | go | func (sb *storageBackend) RemoveFilesystem(tag names.FilesystemTag) (err error) {
defer errors.DeferredAnnotatef(&err, "removing filesystem %s", tag.Id())
buildTxn := func(attempt int) ([]txn.Op, error) {
filesystem, err := getFilesystemByTag(sb.mb, tag)
if errors.IsNotFound(err) {
return nil, jujutxn.ErrNoOpe... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"RemoveFilesystem",
"(",
"tag",
"names",
".",
"FilesystemTag",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",
"(",
"&",
"err",
",",
"\"",
"\"",
",",
"tag",
".",
"Id",
"(",... | // RemoveFilesystem removes the filesystem from state. RemoveFilesystem will
// fail if there are any attachments remaining, or if the filesystem is not
// Dying. Removing a volume-backed filesystem will cause the volume to be
// destroyed. | [
"RemoveFilesystem",
"removes",
"the",
"filesystem",
"from",
"state",
".",
"RemoveFilesystem",
"will",
"fail",
"if",
"there",
"are",
"any",
"attachments",
"remaining",
"or",
"if",
"the",
"filesystem",
"is",
"not",
"Dying",
".",
"Removing",
"a",
"volume",
"-",
"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L843-L858 |
153,648 | juju/juju | state/filesystem.go | ParseFilesystemAttachmentId | func ParseFilesystemAttachmentId(id string) (names.Tag, names.FilesystemTag, error) {
fields := strings.SplitN(id, ":", 2)
isValidHost := names.IsValidMachine(fields[0]) || names.IsValidUnit(fields[0])
if len(fields) != 2 || !isValidHost || !names.IsValidFilesystem(fields[1]) {
return names.MachineTag{}, names.Fil... | go | func ParseFilesystemAttachmentId(id string) (names.Tag, names.FilesystemTag, error) {
fields := strings.SplitN(id, ":", 2)
isValidHost := names.IsValidMachine(fields[0]) || names.IsValidUnit(fields[0])
if len(fields) != 2 || !isValidHost || !names.IsValidFilesystem(fields[1]) {
return names.MachineTag{}, names.Fil... | [
"func",
"ParseFilesystemAttachmentId",
"(",
"id",
"string",
")",
"(",
"names",
".",
"Tag",
",",
"names",
".",
"FilesystemTag",
",",
"error",
")",
"{",
"fields",
":=",
"strings",
".",
"SplitN",
"(",
"id",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"isValidHo... | // ParseFilesystemAttachmentId parses a string as a filesystem attachment ID,
// returning the host and filesystem components. | [
"ParseFilesystemAttachmentId",
"parses",
"a",
"string",
"as",
"a",
"filesystem",
"attachment",
"ID",
"returning",
"the",
"host",
"and",
"filesystem",
"components",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L1009-L1023 |
153,649 | juju/juju | state/filesystem.go | newFilesystemId | func newFilesystemId(mb modelBackend, hostId string) (string, error) {
seq, err := sequence(mb, "filesystem")
if err != nil {
return "", errors.Trace(err)
}
id := fmt.Sprint(seq)
if hostId != "" {
id = hostId + "/" + id
}
return id, nil
} | go | func newFilesystemId(mb modelBackend, hostId string) (string, error) {
seq, err := sequence(mb, "filesystem")
if err != nil {
return "", errors.Trace(err)
}
id := fmt.Sprint(seq)
if hostId != "" {
id = hostId + "/" + id
}
return id, nil
} | [
"func",
"newFilesystemId",
"(",
"mb",
"modelBackend",
",",
"hostId",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"seq",
",",
"err",
":=",
"sequence",
"(",
"mb",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\... | // newFilesystemId returns a unique filesystem ID.
// If the host ID supplied is non-empty, the
// filesystem ID will incorporate it as the
// filesystem's machine scope. | [
"newFilesystemId",
"returns",
"a",
"unique",
"filesystem",
"ID",
".",
"If",
"the",
"host",
"ID",
"supplied",
"is",
"non",
"-",
"empty",
"the",
"filesystem",
"ID",
"will",
"incorporate",
"it",
"as",
"the",
"filesystem",
"s",
"machine",
"scope",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L1029-L1039 |
153,650 | juju/juju | state/filesystem.go | validateFilesystemParams | func (sb *storageBackend) validateFilesystemParams(params FilesystemParams, machineId string) (maybeMachineId string, _ error) {
err := validateStoragePool(sb, params.Pool, storage.StorageKindFilesystem, &machineId)
if err != nil {
return "", errors.Trace(err)
}
if params.Size == 0 {
return "", errors.New("inva... | go | func (sb *storageBackend) validateFilesystemParams(params FilesystemParams, machineId string) (maybeMachineId string, _ error) {
err := validateStoragePool(sb, params.Pool, storage.StorageKindFilesystem, &machineId)
if err != nil {
return "", errors.Trace(err)
}
if params.Size == 0 {
return "", errors.New("inva... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"validateFilesystemParams",
"(",
"params",
"FilesystemParams",
",",
"machineId",
"string",
")",
"(",
"maybeMachineId",
"string",
",",
"_",
"error",
")",
"{",
"err",
":=",
"validateStoragePool",
"(",
"sb",
",",
"pa... | // validateFilesystemParams validates the filesystem parameters, and returns the
// machine ID to use as the scope in the filesystem tag. | [
"validateFilesystemParams",
"validates",
"the",
"filesystem",
"parameters",
"and",
"returns",
"the",
"machine",
"ID",
"to",
"use",
"as",
"the",
"scope",
"in",
"the",
"filesystem",
"tag",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L1162-L1171 |
153,651 | juju/juju | state/filesystem.go | createMachineFilesystemAttachmentsOps | func createMachineFilesystemAttachmentsOps(hostId string, attachments []filesystemAttachmentTemplate) []txn.Op {
ops := make([]txn.Op, len(attachments))
for i, attachment := range attachments {
paramsCopy := attachment.params
ops[i] = txn.Op{
C: filesystemAttachmentsC,
Id: filesystemAttachmentId(ho... | go | func createMachineFilesystemAttachmentsOps(hostId string, attachments []filesystemAttachmentTemplate) []txn.Op {
ops := make([]txn.Op, len(attachments))
for i, attachment := range attachments {
paramsCopy := attachment.params
ops[i] = txn.Op{
C: filesystemAttachmentsC,
Id: filesystemAttachmentId(ho... | [
"func",
"createMachineFilesystemAttachmentsOps",
"(",
"hostId",
"string",
",",
"attachments",
"[",
"]",
"filesystemAttachmentTemplate",
")",
"[",
"]",
"txn",
".",
"Op",
"{",
"ops",
":=",
"make",
"(",
"[",
"]",
"txn",
".",
"Op",
",",
"len",
"(",
"attachments"... | // createMachineFilesystemAttachmentInfo creates filesystem
// attachments for the specified host, and attachment
// parameters keyed by filesystem tags. | [
"createMachineFilesystemAttachmentInfo",
"creates",
"filesystem",
"attachments",
"for",
"the",
"specified",
"host",
"and",
"attachment",
"parameters",
"keyed",
"by",
"filesystem",
"tags",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L1183-L1207 |
153,652 | juju/juju | state/filesystem.go | SetFilesystemInfo | func (sb *storageBackend) SetFilesystemInfo(tag names.FilesystemTag, info FilesystemInfo) (err error) {
defer errors.DeferredAnnotatef(&err, "cannot set info for filesystem %q", tag.Id())
if info.FilesystemId == "" {
return errors.New("filesystem ID not set")
}
fs, err := sb.Filesystem(tag)
if err != nil {
re... | go | func (sb *storageBackend) SetFilesystemInfo(tag names.FilesystemTag, info FilesystemInfo) (err error) {
defer errors.DeferredAnnotatef(&err, "cannot set info for filesystem %q", tag.Id())
if info.FilesystemId == "" {
return errors.New("filesystem ID not set")
}
fs, err := sb.Filesystem(tag)
if err != nil {
re... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"SetFilesystemInfo",
"(",
"tag",
"names",
".",
"FilesystemTag",
",",
"info",
"FilesystemInfo",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"errors",
".",
"DeferredAnnotatef",
"(",
"&",
"err",
",",
"\"",
"\"",... | // SetFilesystemInfo sets the FilesystemInfo for the specified filesystem. | [
"SetFilesystemInfo",
"sets",
"the",
"FilesystemInfo",
"for",
"the",
"specified",
"filesystem",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L1210-L1272 |
153,653 | juju/juju | state/filesystem.go | SetFilesystemAttachmentInfo | func (sb *storageBackend) SetFilesystemAttachmentInfo(
hostTag names.Tag,
filesystemTag names.FilesystemTag,
info FilesystemAttachmentInfo,
) (err error) {
defer errors.DeferredAnnotatef(&err, "cannot set info for filesystem attachment %s:%s", filesystemTag.Id(), hostTag.Id())
f, err := sb.Filesystem(filesystemTag... | go | func (sb *storageBackend) SetFilesystemAttachmentInfo(
hostTag names.Tag,
filesystemTag names.FilesystemTag,
info FilesystemAttachmentInfo,
) (err error) {
defer errors.DeferredAnnotatef(&err, "cannot set info for filesystem attachment %s:%s", filesystemTag.Id(), hostTag.Id())
f, err := sb.Filesystem(filesystemTag... | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"SetFilesystemAttachmentInfo",
"(",
"hostTag",
"names",
".",
"Tag",
",",
"filesystemTag",
"names",
".",
"FilesystemTag",
",",
"info",
"FilesystemAttachmentInfo",
",",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"... | // SetFilesystemAttachmentInfo sets the FilesystemAttachmentInfo for the
// specified filesystem attachment. | [
"SetFilesystemAttachmentInfo",
"sets",
"the",
"FilesystemAttachmentInfo",
"for",
"the",
"specified",
"filesystem",
"attachment",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L1310-L1349 |
153,654 | juju/juju | state/filesystem.go | FilesystemMountPoint | func FilesystemMountPoint(
meta charm.Storage,
tag names.StorageTag,
series string,
) (string, error) {
storageDir, err := paths.StorageDir(series)
if err != nil {
return "", errors.Trace(err)
}
if strings.HasPrefix(meta.Location, storageDir) {
return "", errors.Errorf(
"invalid location %q: must not fall... | go | func FilesystemMountPoint(
meta charm.Storage,
tag names.StorageTag,
series string,
) (string, error) {
storageDir, err := paths.StorageDir(series)
if err != nil {
return "", errors.Trace(err)
}
if strings.HasPrefix(meta.Location, storageDir) {
return "", errors.Errorf(
"invalid location %q: must not fall... | [
"func",
"FilesystemMountPoint",
"(",
"meta",
"charm",
".",
"Storage",
",",
"tag",
"names",
".",
"StorageTag",
",",
"series",
"string",
",",
")",
"(",
"string",
",",
"error",
")",
"{",
"storageDir",
",",
"err",
":=",
"paths",
".",
"StorageDir",
"(",
"seri... | // FilesystemMountPoint returns a mount point to use for the given charm
// storage. For stores with potentially multiple instances, the instance
// name is appended to the location. | [
"FilesystemMountPoint",
"returns",
"a",
"mount",
"point",
"to",
"use",
"for",
"the",
"given",
"charm",
"storage",
".",
"For",
"stores",
"with",
"potentially",
"multiple",
"instances",
"the",
"instance",
"name",
"is",
"appended",
"to",
"the",
"location",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L1377-L1404 |
153,655 | juju/juju | state/filesystem.go | validateFilesystemMountPoints | func validateFilesystemMountPoints(m *Machine, newFilesystems []filesystemAttachmentTemplate) error {
sb, err := NewStorageBackend(m.st)
if err != nil {
return errors.Trace(err)
}
attachments, err := sb.MachineFilesystemAttachments(m.MachineTag())
if err != nil {
return errors.Trace(err)
}
existing := make(... | go | func validateFilesystemMountPoints(m *Machine, newFilesystems []filesystemAttachmentTemplate) error {
sb, err := NewStorageBackend(m.st)
if err != nil {
return errors.Trace(err)
}
attachments, err := sb.MachineFilesystemAttachments(m.MachineTag())
if err != nil {
return errors.Trace(err)
}
existing := make(... | [
"func",
"validateFilesystemMountPoints",
"(",
"m",
"*",
"Machine",
",",
"newFilesystems",
"[",
"]",
"filesystemAttachmentTemplate",
")",
"error",
"{",
"sb",
",",
"err",
":=",
"NewStorageBackend",
"(",
"m",
".",
"st",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",... | // validateFilesystemMountPoints validates the mount points of filesystems
// being attached to the specified machine. If there are any mount point
// path conflicts, an error will be returned. | [
"validateFilesystemMountPoints",
"validates",
"the",
"mount",
"points",
"of",
"filesystems",
"being",
"attached",
"to",
"the",
"specified",
"machine",
".",
"If",
"there",
"are",
"any",
"mount",
"point",
"path",
"conflicts",
"an",
"error",
"will",
"be",
"returned",... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L1409-L1496 |
153,656 | juju/juju | state/filesystem.go | AllFilesystems | func (sb *storageBackend) AllFilesystems() ([]Filesystem, error) {
filesystems, err := sb.filesystems(nil)
if err != nil {
return nil, errors.Annotate(err, "cannot get filesystems")
}
return filesystemsToInterfaces(filesystems), nil
} | go | func (sb *storageBackend) AllFilesystems() ([]Filesystem, error) {
filesystems, err := sb.filesystems(nil)
if err != nil {
return nil, errors.Annotate(err, "cannot get filesystems")
}
return filesystemsToInterfaces(filesystems), nil
} | [
"func",
"(",
"sb",
"*",
"storageBackend",
")",
"AllFilesystems",
"(",
")",
"(",
"[",
"]",
"Filesystem",
",",
"error",
")",
"{",
"filesystems",
",",
"err",
":=",
"sb",
".",
"filesystems",
"(",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",... | // AllFilesystems returns all Filesystems for this state. | [
"AllFilesystems",
"returns",
"all",
"Filesystems",
"for",
"this",
"state",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/filesystem.go#L1499-L1505 |
153,657 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | NewMockContext | func NewMockContext(ctrl *gomock.Controller) *MockContext {
mock := &MockContext{ctrl: ctrl}
mock.recorder = &MockContextMockRecorder{mock}
return mock
} | go | func NewMockContext(ctrl *gomock.Controller) *MockContext {
mock := &MockContext{ctrl: ctrl}
mock.recorder = &MockContextMockRecorder{mock}
return mock
} | [
"func",
"NewMockContext",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockContext",
"{",
"mock",
":=",
"&",
"MockContext",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockContextMockRecorder",
"{",
"mock",
"}",
... | // NewMockContext creates a new mock instance | [
"NewMockContext",
"creates",
"a",
"new",
"mock",
"instance"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L31-L35 |
153,658 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | Auth | func (m *MockContext) Auth() facade.Authorizer {
ret := m.ctrl.Call(m, "Auth")
ret0, _ := ret[0].(facade.Authorizer)
return ret0
} | go | func (m *MockContext) Auth() facade.Authorizer {
ret := m.ctrl.Call(m, "Auth")
ret0, _ := ret[0].(facade.Authorizer)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockContext",
")",
"Auth",
"(",
")",
"facade",
".",
"Authorizer",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"facade",... | // Auth mocks base method | [
"Auth",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L43-L47 |
153,659 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | Hub | func (m *MockContext) Hub() facade.Hub {
ret := m.ctrl.Call(m, "Hub")
ret0, _ := ret[0].(facade.Hub)
return ret0
} | go | func (m *MockContext) Hub() facade.Hub {
ret := m.ctrl.Call(m, "Hub")
ret0, _ := ret[0].(facade.Hub)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockContext",
")",
"Hub",
"(",
")",
"facade",
".",
"Hub",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"facade",
".",
... | // Hub mocks base method | [
"Hub",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L77-L81 |
153,660 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | LeadershipChecker | func (m *MockContext) LeadershipChecker() (leadership.Checker, error) {
ret := m.ctrl.Call(m, "LeadershipChecker")
ret0, _ := ret[0].(leadership.Checker)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockContext) LeadershipChecker() (leadership.Checker, error) {
ret := m.ctrl.Call(m, "LeadershipChecker")
ret0, _ := ret[0].(leadership.Checker)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockContext",
")",
"LeadershipChecker",
"(",
")",
"(",
"leadership",
".",
"Checker",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
... | // LeadershipChecker mocks base method | [
"LeadershipChecker",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L101-L106 |
153,661 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | LeadershipClaimer | func (m *MockContext) LeadershipClaimer(arg0 string) (leadership.Claimer, error) {
ret := m.ctrl.Call(m, "LeadershipClaimer", arg0)
ret0, _ := ret[0].(leadership.Claimer)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockContext) LeadershipClaimer(arg0 string) (leadership.Claimer, error) {
ret := m.ctrl.Call(m, "LeadershipClaimer", arg0)
ret0, _ := ret[0].(leadership.Claimer)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockContext",
")",
"LeadershipClaimer",
"(",
"arg0",
"string",
")",
"(",
"leadership",
".",
"Claimer",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
... | // LeadershipClaimer mocks base method | [
"LeadershipClaimer",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L114-L119 |
153,662 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | LeadershipPinner | func (m *MockContext) LeadershipPinner(arg0 string) (leadership.Pinner, error) {
ret := m.ctrl.Call(m, "LeadershipPinner", arg0)
ret0, _ := ret[0].(leadership.Pinner)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockContext) LeadershipPinner(arg0 string) (leadership.Pinner, error) {
ret := m.ctrl.Call(m, "LeadershipPinner", arg0)
ret0, _ := ret[0].(leadership.Pinner)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockContext",
")",
"LeadershipPinner",
"(",
"arg0",
"string",
")",
"(",
"leadership",
".",
"Pinner",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"r... | // LeadershipPinner mocks base method | [
"LeadershipPinner",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L127-L132 |
153,663 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | LeadershipReader | func (m *MockContext) LeadershipReader(arg0 string) (leadership.Reader, error) {
ret := m.ctrl.Call(m, "LeadershipReader", arg0)
ret0, _ := ret[0].(leadership.Reader)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockContext) LeadershipReader(arg0 string) (leadership.Reader, error) {
ret := m.ctrl.Call(m, "LeadershipReader", arg0)
ret0, _ := ret[0].(leadership.Reader)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockContext",
")",
"LeadershipReader",
"(",
"arg0",
"string",
")",
"(",
"leadership",
".",
"Reader",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"r... | // LeadershipReader mocks base method | [
"LeadershipReader",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L140-L145 |
153,664 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | Presence | func (m *MockContext) Presence() facade.Presence {
ret := m.ctrl.Call(m, "Presence")
ret0, _ := ret[0].(facade.Presence)
return ret0
} | go | func (m *MockContext) Presence() facade.Presence {
ret := m.ctrl.Call(m, "Presence")
ret0, _ := ret[0].(facade.Presence)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockContext",
")",
"Presence",
"(",
")",
"facade",
".",
"Presence",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"facade... | // Presence mocks base method | [
"Presence",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L153-L157 |
153,665 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | Resources | func (m *MockContext) Resources() facade.Resources {
ret := m.ctrl.Call(m, "Resources")
ret0, _ := ret[0].(facade.Resources)
return ret0
} | go | func (m *MockContext) Resources() facade.Resources {
ret := m.ctrl.Call(m, "Resources")
ret0, _ := ret[0].(facade.Resources)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockContext",
")",
"Resources",
"(",
")",
"facade",
".",
"Resources",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"faca... | // Resources mocks base method | [
"Resources",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L165-L169 |
153,666 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | SingularClaimer | func (m *MockContext) SingularClaimer() (lease.Claimer, error) {
ret := m.ctrl.Call(m, "SingularClaimer")
ret0, _ := ret[0].(lease.Claimer)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockContext) SingularClaimer() (lease.Claimer, error) {
ret := m.ctrl.Call(m, "SingularClaimer")
ret0, _ := ret[0].(lease.Claimer)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockContext",
")",
"SingularClaimer",
"(",
")",
"(",
"lease",
".",
"Claimer",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
... | // SingularClaimer mocks base method | [
"SingularClaimer",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L177-L182 |
153,667 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | State | func (m *MockContext) State() *state.State {
ret := m.ctrl.Call(m, "State")
ret0, _ := ret[0].(*state.State)
return ret0
} | go | func (m *MockContext) State() *state.State {
ret := m.ctrl.Call(m, "State")
ret0, _ := ret[0].(*state.State)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockContext",
")",
"State",
"(",
")",
"*",
"state",
".",
"State",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
... | // State mocks base method | [
"State",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L190-L194 |
153,668 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | StatePool | func (m *MockContext) StatePool() *state.StatePool {
ret := m.ctrl.Call(m, "StatePool")
ret0, _ := ret[0].(*state.StatePool)
return ret0
} | go | func (m *MockContext) StatePool() *state.StatePool {
ret := m.ctrl.Call(m, "StatePool")
ret0, _ := ret[0].(*state.StatePool)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockContext",
")",
"StatePool",
"(",
")",
"*",
"state",
".",
"StatePool",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
... | // StatePool mocks base method | [
"StatePool",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L202-L206 |
153,669 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | NewMockResources | func NewMockResources(ctrl *gomock.Controller) *MockResources {
mock := &MockResources{ctrl: ctrl}
mock.recorder = &MockResourcesMockRecorder{mock}
return mock
} | go | func NewMockResources(ctrl *gomock.Controller) *MockResources {
mock := &MockResources{ctrl: ctrl}
mock.recorder = &MockResourcesMockRecorder{mock}
return mock
} | [
"func",
"NewMockResources",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockResources",
"{",
"mock",
":=",
"&",
"MockResources",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockResourcesMockRecorder",
"{",
"mock",
... | // NewMockResources creates a new mock instance | [
"NewMockResources",
"creates",
"a",
"new",
"mock",
"instance"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L225-L229 |
153,670 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | NewMockAuthorizer | func NewMockAuthorizer(ctrl *gomock.Controller) *MockAuthorizer {
mock := &MockAuthorizer{ctrl: ctrl}
mock.recorder = &MockAuthorizerMockRecorder{mock}
return mock
} | go | func NewMockAuthorizer(ctrl *gomock.Controller) *MockAuthorizer {
mock := &MockAuthorizer{ctrl: ctrl}
mock.recorder = &MockAuthorizerMockRecorder{mock}
return mock
} | [
"func",
"NewMockAuthorizer",
"(",
"ctrl",
"*",
"gomock",
".",
"Controller",
")",
"*",
"MockAuthorizer",
"{",
"mock",
":=",
"&",
"MockAuthorizer",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockAuthorizerMockRecorder",
"{",
"mock... | // NewMockAuthorizer creates a new mock instance | [
"NewMockAuthorizer",
"creates",
"a",
"new",
"mock",
"instance"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L284-L288 |
153,671 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | AuthController | func (m *MockAuthorizer) AuthController() bool {
ret := m.ctrl.Call(m, "AuthController")
ret0, _ := ret[0].(bool)
return ret0
} | go | func (m *MockAuthorizer) AuthController() bool {
ret := m.ctrl.Call(m, "AuthController")
ret0, _ := ret[0].(bool)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockAuthorizer",
")",
"AuthController",
"(",
")",
"bool",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"bool",
")",
"\n"... | // AuthController mocks base method | [
"AuthController",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L320-L324 |
153,672 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | AuthController | func (mr *MockAuthorizerMockRecorder) AuthController() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AuthController", reflect.TypeOf((*MockAuthorizer)(nil).AuthController))
} | go | func (mr *MockAuthorizerMockRecorder) AuthController() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AuthController", reflect.TypeOf((*MockAuthorizer)(nil).AuthController))
} | [
"func",
"(",
"mr",
"*",
"MockAuthorizerMockRecorder",
")",
"AuthController",
"(",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".... | // AuthController indicates an expected call of AuthController | [
"AuthController",
"indicates",
"an",
"expected",
"call",
"of",
"AuthController"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L327-L329 |
153,673 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | AuthOwner | func (m *MockAuthorizer) AuthOwner(arg0 names_v2.Tag) bool {
ret := m.ctrl.Call(m, "AuthOwner", arg0)
ret0, _ := ret[0].(bool)
return ret0
} | go | func (m *MockAuthorizer) AuthOwner(arg0 names_v2.Tag) bool {
ret := m.ctrl.Call(m, "AuthOwner", arg0)
ret0, _ := ret[0].(bool)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockAuthorizer",
")",
"AuthOwner",
"(",
"arg0",
"names_v2",
".",
"Tag",
")",
"bool",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",... | // AuthOwner mocks base method | [
"AuthOwner",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L344-L348 |
153,674 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | ConnectedModel | func (m *MockAuthorizer) ConnectedModel() string {
ret := m.ctrl.Call(m, "ConnectedModel")
ret0, _ := ret[0].(string)
return ret0
} | go | func (m *MockAuthorizer) ConnectedModel() string {
ret := m.ctrl.Call(m, "ConnectedModel")
ret0, _ := ret[0].(string)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockAuthorizer",
")",
"ConnectedModel",
"(",
")",
"string",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"string",
")",
... | // ConnectedModel mocks base method | [
"ConnectedModel",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L368-L372 |
153,675 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | GetAuthTag | func (m *MockAuthorizer) GetAuthTag() names_v2.Tag {
ret := m.ctrl.Call(m, "GetAuthTag")
ret0, _ := ret[0].(names_v2.Tag)
return ret0
} | go | func (m *MockAuthorizer) GetAuthTag() names_v2.Tag {
ret := m.ctrl.Call(m, "GetAuthTag")
ret0, _ := ret[0].(names_v2.Tag)
return ret0
} | [
"func",
"(",
"m",
"*",
"MockAuthorizer",
")",
"GetAuthTag",
"(",
")",
"names_v2",
".",
"Tag",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"name... | // GetAuthTag mocks base method | [
"GetAuthTag",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L380-L384 |
153,676 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | HasPermission | func (m *MockAuthorizer) HasPermission(arg0 permission.Access, arg1 names_v2.Tag) (bool, error) {
ret := m.ctrl.Call(m, "HasPermission", arg0, arg1)
ret0, _ := ret[0].(bool)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | func (m *MockAuthorizer) HasPermission(arg0 permission.Access, arg1 names_v2.Tag) (bool, error) {
ret := m.ctrl.Call(m, "HasPermission", arg0, arg1)
ret0, _ := ret[0].(bool)
ret1, _ := ret[1].(error)
return ret0, ret1
} | [
"func",
"(",
"m",
"*",
"MockAuthorizer",
")",
"HasPermission",
"(",
"arg0",
"permission",
".",
"Access",
",",
"arg1",
"names_v2",
".",
"Tag",
")",
"(",
"bool",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",... | // HasPermission mocks base method | [
"HasPermission",
"mocks",
"base",
"method"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L392-L397 |
153,677 | juju/juju | apiserver/facades/agent/instancemutater/mocks/facade_mock.go | HasPermission | func (mr *MockAuthorizerMockRecorder) HasPermission(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasPermission", reflect.TypeOf((*MockAuthorizer)(nil).HasPermission), arg0, arg1)
} | go | func (mr *MockAuthorizerMockRecorder) HasPermission(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasPermission", reflect.TypeOf((*MockAuthorizer)(nil).HasPermission), arg0, arg1)
} | [
"func",
"(",
"mr",
"*",
"MockAuthorizerMockRecorder",
")",
"HasPermission",
"(",
"arg0",
",",
"arg1",
"interface",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
... | // HasPermission indicates an expected call of HasPermission | [
"HasPermission",
"indicates",
"an",
"expected",
"call",
"of",
"HasPermission"
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/instancemutater/mocks/facade_mock.go#L400-L402 |
153,678 | juju/juju | worker/uniter/runlistener.go | NewRunListener | func NewRunListener(cfg RunListenerConfig) (*RunListener, error) {
if err := cfg.Validate(); err != nil {
return nil, errors.Trace(err)
}
listener, err := sockets.Listen(cfg.SocketPath)
if err != nil {
return nil, errors.Trace(err)
}
runListener := &RunListener{
RunListenerConfig: cfg,
listener: ... | go | func NewRunListener(cfg RunListenerConfig) (*RunListener, error) {
if err := cfg.Validate(); err != nil {
return nil, errors.Trace(err)
}
listener, err := sockets.Listen(cfg.SocketPath)
if err != nil {
return nil, errors.Trace(err)
}
runListener := &RunListener{
RunListenerConfig: cfg,
listener: ... | [
"func",
"NewRunListener",
"(",
"cfg",
"RunListenerConfig",
")",
"(",
"*",
"RunListener",
",",
"error",
")",
"{",
"if",
"err",
":=",
"cfg",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Trace",
"(",
"er... | // NewRunListener returns a new RunListener that is listening on given
// socket or named pipe passed in. If a valid RunListener is returned, is
// has the go routine running, and should be closed by the creator
// when they are done with it. | [
"NewRunListener",
"returns",
"a",
"new",
"RunListener",
"that",
"is",
"listening",
"on",
"given",
"socket",
"or",
"named",
"pipe",
"passed",
"in",
".",
"If",
"a",
"valid",
"RunListener",
"is",
"returned",
"is",
"has",
"the",
"go",
"routine",
"running",
"and"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runlistener.go#L82-L102 |
153,679 | juju/juju | worker/uniter/runlistener.go | Run | func (s *RunListener) Run() (err error) {
logger.Debugf("juju-run listener running")
var conn net.Conn
for {
conn, err = s.listener.Accept()
if err != nil {
break
}
s.wg.Add(1)
go func(conn net.Conn) {
s.server.ServeConn(conn)
s.wg.Done()
}(conn)
}
logger.Debugf("juju-run listener stopping")
... | go | func (s *RunListener) Run() (err error) {
logger.Debugf("juju-run listener running")
var conn net.Conn
for {
conn, err = s.listener.Accept()
if err != nil {
break
}
s.wg.Add(1)
go func(conn net.Conn) {
s.server.ServeConn(conn)
s.wg.Done()
}(conn)
}
logger.Debugf("juju-run listener stopping")
... | [
"func",
"(",
"s",
"*",
"RunListener",
")",
"Run",
"(",
")",
"(",
"err",
"error",
")",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
")",
"\n",
"var",
"conn",
"net",
".",
"Conn",
"\n",
"for",
"{",
"conn",
",",
"err",
"=",
"s",
".",
"listener",
... | // Run accepts new connections until it encounters an error, or until Close is
// called, and then blocks until all existing connections have been closed. | [
"Run",
"accepts",
"new",
"connections",
"until",
"it",
"encounters",
"an",
"error",
"or",
"until",
"Close",
"is",
"called",
"and",
"then",
"blocks",
"until",
"all",
"existing",
"connections",
"have",
"been",
"closed",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runlistener.go#L106-L132 |
153,680 | juju/juju | worker/uniter/runlistener.go | RunCommands | func (r *JujuRunServer) RunCommands(args RunCommandsArgs, result *exec.ExecResponse) error {
logger.Debugf("RunCommands: %+v", args)
runResult, err := r.runner.RunCommands(args)
if err != nil {
return errors.Annotate(err, "r.runner.RunCommands")
}
*result = *runResult
return err
} | go | func (r *JujuRunServer) RunCommands(args RunCommandsArgs, result *exec.ExecResponse) error {
logger.Debugf("RunCommands: %+v", args)
runResult, err := r.runner.RunCommands(args)
if err != nil {
return errors.Annotate(err, "r.runner.RunCommands")
}
*result = *runResult
return err
} | [
"func",
"(",
"r",
"*",
"JujuRunServer",
")",
"RunCommands",
"(",
"args",
"RunCommandsArgs",
",",
"result",
"*",
"exec",
".",
"ExecResponse",
")",
"error",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"args",
")",
"\n",
"runResult",
",",
"err",
"... | // RunCommands delegates the actual running to the runner and populates the
// response structure. | [
"RunCommands",
"delegates",
"the",
"actual",
"running",
"to",
"the",
"runner",
"and",
"populates",
"the",
"response",
"structure",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runlistener.go#L194-L202 |
153,681 | juju/juju | worker/uniter/runlistener.go | NewChannelCommandRunner | func NewChannelCommandRunner(cfg ChannelCommandRunnerConfig) (*ChannelCommandRunner, error) {
if err := cfg.Validate(); err != nil {
return nil, errors.Trace(err)
}
return &ChannelCommandRunner{cfg}, nil
} | go | func NewChannelCommandRunner(cfg ChannelCommandRunnerConfig) (*ChannelCommandRunner, error) {
if err := cfg.Validate(); err != nil {
return nil, errors.Trace(err)
}
return &ChannelCommandRunner{cfg}, nil
} | [
"func",
"NewChannelCommandRunner",
"(",
"cfg",
"ChannelCommandRunnerConfig",
")",
"(",
"*",
"ChannelCommandRunner",
",",
"error",
")",
"{",
"if",
"err",
":=",
"cfg",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
"... | // NewChannelCommandRunner returns a new ChannelCommandRunner with the
// given configuration. | [
"NewChannelCommandRunner",
"returns",
"a",
"new",
"ChannelCommandRunner",
"with",
"the",
"given",
"configuration",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runlistener.go#L239-L244 |
153,682 | juju/juju | worker/uniter/runlistener.go | RunCommands | func (c *ChannelCommandRunner) RunCommands(args RunCommandsArgs) (results *exec.ExecResponse, err error) {
type responseInfo struct {
response *exec.ExecResponse
err error
}
// NOTE(axw) the response channel must be synchronous so that the
// response is received before the uniter resumes operation, and
... | go | func (c *ChannelCommandRunner) RunCommands(args RunCommandsArgs) (results *exec.ExecResponse, err error) {
type responseInfo struct {
response *exec.ExecResponse
err error
}
// NOTE(axw) the response channel must be synchronous so that the
// response is received before the uniter resumes operation, and
... | [
"func",
"(",
"c",
"*",
"ChannelCommandRunner",
")",
"RunCommands",
"(",
"args",
"RunCommandsArgs",
")",
"(",
"results",
"*",
"exec",
".",
"ExecResponse",
",",
"err",
"error",
")",
"{",
"type",
"responseInfo",
"struct",
"{",
"response",
"*",
"exec",
".",
"E... | // RunCommands executes the supplied run commands by registering the
// arguments in a runcommands.Commands, and then sending the returned
// ID to a channel and waiting for a response callback. | [
"RunCommands",
"executes",
"the",
"supplied",
"run",
"commands",
"by",
"registering",
"the",
"arguments",
"in",
"a",
"runcommands",
".",
"Commands",
"and",
"then",
"sending",
"the",
"returned",
"ID",
"to",
"a",
"channel",
"and",
"waiting",
"for",
"a",
"respons... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runlistener.go#L249-L287 |
153,683 | juju/juju | worker/uniter/runner/jujuc/leader-set.go | NewLeaderSetCommand | func NewLeaderSetCommand(ctx Context) (cmd.Command, error) {
return &leaderSetCommand{ctx: ctx}, nil
} | go | func NewLeaderSetCommand(ctx Context) (cmd.Command, error) {
return &leaderSetCommand{ctx: ctx}, nil
} | [
"func",
"NewLeaderSetCommand",
"(",
"ctx",
"Context",
")",
"(",
"cmd",
".",
"Command",
",",
"error",
")",
"{",
"return",
"&",
"leaderSetCommand",
"{",
"ctx",
":",
"ctx",
"}",
",",
"nil",
"\n",
"}"
] | // NewLeaderSetCommand returns a new leaderSetCommand with the given context. | [
"NewLeaderSetCommand",
"returns",
"a",
"new",
"leaderSetCommand",
"with",
"the",
"given",
"context",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runner/jujuc/leader-set.go#L22-L24 |
153,684 | juju/juju | apiserver/common/action.go | ParamsActionExecutionResultsToStateActionResults | func ParamsActionExecutionResultsToStateActionResults(arg params.ActionExecutionResult) (state.ActionResults, error) {
var status state.ActionStatus
switch arg.Status {
case params.ActionCancelled:
status = state.ActionCancelled
case params.ActionCompleted:
status = state.ActionCompleted
case params.ActionFail... | go | func ParamsActionExecutionResultsToStateActionResults(arg params.ActionExecutionResult) (state.ActionResults, error) {
var status state.ActionStatus
switch arg.Status {
case params.ActionCancelled:
status = state.ActionCancelled
case params.ActionCompleted:
status = state.ActionCompleted
case params.ActionFail... | [
"func",
"ParamsActionExecutionResultsToStateActionResults",
"(",
"arg",
"params",
".",
"ActionExecutionResult",
")",
"(",
"state",
".",
"ActionResults",
",",
"error",
")",
"{",
"var",
"status",
"state",
".",
"ActionStatus",
"\n",
"switch",
"arg",
".",
"Status",
"{... | // ParamsActionExecutionResultsToStateActionResults does exactly what
// the name implies. | [
"ParamsActionExecutionResultsToStateActionResults",
"does",
"exactly",
"what",
"the",
"name",
"implies",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/action.go#L19-L38 |
153,685 | juju/juju | apiserver/common/action.go | TagToActionReceiverFn | func TagToActionReceiverFn(findEntity func(names.Tag) (state.Entity, error)) func(tag string) (state.ActionReceiver, error) {
return func(tag string) (state.ActionReceiver, error) {
receiverTag, err := names.ParseTag(tag)
if err != nil {
return nil, errors.NotValidf("%s", tag)
}
entity, err := findEntity(re... | go | func TagToActionReceiverFn(findEntity func(names.Tag) (state.Entity, error)) func(tag string) (state.ActionReceiver, error) {
return func(tag string) (state.ActionReceiver, error) {
receiverTag, err := names.ParseTag(tag)
if err != nil {
return nil, errors.NotValidf("%s", tag)
}
entity, err := findEntity(re... | [
"func",
"TagToActionReceiverFn",
"(",
"findEntity",
"func",
"(",
"names",
".",
"Tag",
")",
"(",
"state",
".",
"Entity",
",",
"error",
")",
")",
"func",
"(",
"tag",
"string",
")",
"(",
"state",
".",
"ActionReceiver",
",",
"error",
")",
"{",
"return",
"f... | // TagToActionReceiver takes a tag string and tries to convert it to an
// ActionReceiver. It needs a findEntity function passed in that can search for the tags in state. | [
"TagToActionReceiver",
"takes",
"a",
"tag",
"string",
"and",
"tries",
"to",
"convert",
"it",
"to",
"an",
"ActionReceiver",
".",
"It",
"needs",
"a",
"findEntity",
"function",
"passed",
"in",
"that",
"can",
"search",
"for",
"the",
"tags",
"in",
"state",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/action.go#L42-L58 |
153,686 | juju/juju | apiserver/common/action.go | AuthAndActionFromTagFn | func AuthAndActionFromTagFn(canAccess AuthFunc, getActionByTag func(names.ActionTag) (state.Action, error)) func(string) (state.Action, error) {
return func(tag string) (state.Action, error) {
actionTag, err := names.ParseActionTag(tag)
if err != nil {
return nil, errors.Trace(err)
}
action, err := getActio... | go | func AuthAndActionFromTagFn(canAccess AuthFunc, getActionByTag func(names.ActionTag) (state.Action, error)) func(string) (state.Action, error) {
return func(tag string) (state.Action, error) {
actionTag, err := names.ParseActionTag(tag)
if err != nil {
return nil, errors.Trace(err)
}
action, err := getActio... | [
"func",
"AuthAndActionFromTagFn",
"(",
"canAccess",
"AuthFunc",
",",
"getActionByTag",
"func",
"(",
"names",
".",
"ActionTag",
")",
"(",
"state",
".",
"Action",
",",
"error",
")",
")",
"func",
"(",
"string",
")",
"(",
"state",
".",
"Action",
",",
"error",
... | // AuthAndActionFromTagFn takes in an authorizer function and a function that can fetch action by tags from state
// and returns a function that can fetch an action from state by id and check the authorization. | [
"AuthAndActionFromTagFn",
"takes",
"in",
"an",
"authorizer",
"function",
"and",
"a",
"function",
"that",
"can",
"fetch",
"action",
"by",
"tags",
"from",
"state",
"and",
"returns",
"a",
"function",
"that",
"can",
"fetch",
"an",
"action",
"from",
"state",
"by",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/action.go#L62-L81 |
153,687 | juju/juju | apiserver/common/action.go | BeginActions | func BeginActions(args params.Entities, actionFn func(string) (state.Action, error)) params.ErrorResults {
results := params.ErrorResults{Results: make([]params.ErrorResult, len(args.Entities))}
for i, arg := range args.Entities {
action, err := actionFn(arg.Tag)
if err != nil {
results.Results[i].Error = Ser... | go | func BeginActions(args params.Entities, actionFn func(string) (state.Action, error)) params.ErrorResults {
results := params.ErrorResults{Results: make([]params.ErrorResult, len(args.Entities))}
for i, arg := range args.Entities {
action, err := actionFn(arg.Tag)
if err != nil {
results.Results[i].Error = Ser... | [
"func",
"BeginActions",
"(",
"args",
"params",
".",
"Entities",
",",
"actionFn",
"func",
"(",
"string",
")",
"(",
"state",
".",
"Action",
",",
"error",
")",
")",
"params",
".",
"ErrorResults",
"{",
"results",
":=",
"params",
".",
"ErrorResults",
"{",
"Re... | // BeginActions calls begin on every action passed in through args.
// It's a helper function currently used by the uniter and by machineactions
// It needs an actionFn that can fetch an action from state using it's id, that's usually created by AuthAndActionFromTagFn | [
"BeginActions",
"calls",
"begin",
"on",
"every",
"action",
"passed",
"in",
"through",
"args",
".",
"It",
"s",
"a",
"helper",
"function",
"currently",
"used",
"by",
"the",
"uniter",
"and",
"by",
"machineactions",
"It",
"needs",
"an",
"actionFn",
"that",
"can"... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/action.go#L86-L104 |
153,688 | juju/juju | apiserver/common/action.go | FinishActions | func FinishActions(args params.ActionExecutionResults, actionFn func(string) (state.Action, error)) params.ErrorResults {
results := params.ErrorResults{Results: make([]params.ErrorResult, len(args.Results))}
for i, arg := range args.Results {
action, err := actionFn(arg.ActionTag)
if err != nil {
results.Res... | go | func FinishActions(args params.ActionExecutionResults, actionFn func(string) (state.Action, error)) params.ErrorResults {
results := params.ErrorResults{Results: make([]params.ErrorResult, len(args.Results))}
for i, arg := range args.Results {
action, err := actionFn(arg.ActionTag)
if err != nil {
results.Res... | [
"func",
"FinishActions",
"(",
"args",
"params",
".",
"ActionExecutionResults",
",",
"actionFn",
"func",
"(",
"string",
")",
"(",
"state",
".",
"Action",
",",
"error",
")",
")",
"params",
".",
"ErrorResults",
"{",
"results",
":=",
"params",
".",
"ErrorResults... | // FinishActions saves the result of a completed Action.
// It's a helper function currently used by the uniter and by machineactions
// It needs an actionFn that can fetch an action from state using it's id that's usually created by AuthAndActionFromTagFn | [
"FinishActions",
"saves",
"the",
"result",
"of",
"a",
"completed",
"Action",
".",
"It",
"s",
"a",
"helper",
"function",
"currently",
"used",
"by",
"the",
"uniter",
"and",
"by",
"machineactions",
"It",
"needs",
"an",
"actionFn",
"that",
"can",
"fetch",
"an",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/action.go#L109-L132 |
153,689 | juju/juju | apiserver/common/action.go | Actions | func Actions(args params.Entities, actionFn func(string) (state.Action, error)) params.ActionResults {
results := params.ActionResults{
Results: make([]params.ActionResult, len(args.Entities)),
}
for i, arg := range args.Entities {
action, err := actionFn(arg.Tag)
if err != nil {
results.Results[i].Error =... | go | func Actions(args params.Entities, actionFn func(string) (state.Action, error)) params.ActionResults {
results := params.ActionResults{
Results: make([]params.ActionResult, len(args.Entities)),
}
for i, arg := range args.Entities {
action, err := actionFn(arg.Tag)
if err != nil {
results.Results[i].Error =... | [
"func",
"Actions",
"(",
"args",
"params",
".",
"Entities",
",",
"actionFn",
"func",
"(",
"string",
")",
"(",
"state",
".",
"Action",
",",
"error",
")",
")",
"params",
".",
"ActionResults",
"{",
"results",
":=",
"params",
".",
"ActionResults",
"{",
"Resul... | // Actions returns the Actions by Tags passed in and ensures that the receiver asking for
// them is the same one that has the action.
// It's a helper function currently used by the uniter and by machineactions.
// It needs an actionFn that can fetch an action from state using it's id that's usually created by AuthAnd... | [
"Actions",
"returns",
"the",
"Actions",
"by",
"Tags",
"passed",
"in",
"and",
"ensures",
"that",
"the",
"receiver",
"asking",
"for",
"them",
"is",
"the",
"same",
"one",
"that",
"has",
"the",
"action",
".",
"It",
"s",
"a",
"helper",
"function",
"currently",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/action.go#L138-L160 |
153,690 | juju/juju | apiserver/common/action.go | WatchOneActionReceiverNotifications | func WatchOneActionReceiverNotifications(tagToActionReceiver func(tag string) (state.ActionReceiver, error), registerFunc func(r facade.Resource) string) func(names.Tag) (params.StringsWatchResult, error) {
return func(tag names.Tag) (params.StringsWatchResult, error) {
nothing := params.StringsWatchResult{}
recei... | go | func WatchOneActionReceiverNotifications(tagToActionReceiver func(tag string) (state.ActionReceiver, error), registerFunc func(r facade.Resource) string) func(names.Tag) (params.StringsWatchResult, error) {
return func(tag names.Tag) (params.StringsWatchResult, error) {
nothing := params.StringsWatchResult{}
recei... | [
"func",
"WatchOneActionReceiverNotifications",
"(",
"tagToActionReceiver",
"func",
"(",
"tag",
"string",
")",
"(",
"state",
".",
"ActionReceiver",
",",
"error",
")",
",",
"registerFunc",
"func",
"(",
"r",
"facade",
".",
"Resource",
")",
"string",
")",
"func",
... | // WatchOneActionReceiverNotifications to create a watcher for one receiver.
// It needs a tagToActionReceiver function and a registerFunc to register
// resources.
// It's a helper function currently used by the uniter and by machineactions | [
"WatchOneActionReceiverNotifications",
"to",
"create",
"a",
"watcher",
"for",
"one",
"receiver",
".",
"It",
"needs",
"a",
"tagToActionReceiver",
"function",
"and",
"a",
"registerFunc",
"to",
"register",
"resources",
".",
"It",
"s",
"a",
"helper",
"function",
"curr... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/action.go#L166-L183 |
153,691 | juju/juju | apiserver/common/action.go | WatchActionNotifications | func WatchActionNotifications(args params.Entities, canAccess AuthFunc, watchOne func(names.Tag) (params.StringsWatchResult, error)) params.StringsWatchResults {
result := params.StringsWatchResults{
Results: make([]params.StringsWatchResult, len(args.Entities)),
}
for i, entity := range args.Entities {
tag, er... | go | func WatchActionNotifications(args params.Entities, canAccess AuthFunc, watchOne func(names.Tag) (params.StringsWatchResult, error)) params.StringsWatchResults {
result := params.StringsWatchResults{
Results: make([]params.StringsWatchResult, len(args.Entities)),
}
for i, entity := range args.Entities {
tag, er... | [
"func",
"WatchActionNotifications",
"(",
"args",
"params",
".",
"Entities",
",",
"canAccess",
"AuthFunc",
",",
"watchOne",
"func",
"(",
"names",
".",
"Tag",
")",
"(",
"params",
".",
"StringsWatchResult",
",",
"error",
")",
")",
"params",
".",
"StringsWatchResu... | // WatchActionNotifications returns a StringsWatcher for observing incoming actions towards an actionreceiver.
// It's a helper function currently used by the uniter and by machineactions
// canAccess is passed in by the respective caller to provide authorization.
// watchOne is usually a function created by WatchOneAc... | [
"WatchActionNotifications",
"returns",
"a",
"StringsWatcher",
"for",
"observing",
"incoming",
"actions",
"towards",
"an",
"actionreceiver",
".",
"It",
"s",
"a",
"helper",
"function",
"currently",
"used",
"by",
"the",
"uniter",
"and",
"by",
"machineactions",
"canAcce... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/action.go#L189-L208 |
153,692 | juju/juju | apiserver/common/action.go | ConvertActions | func ConvertActions(ar state.ActionReceiver, fn GetActionsFn) ([]params.ActionResult, error) {
items := []params.ActionResult{}
actions, err := fn()
if err != nil {
return items, err
}
for _, action := range actions {
if action == nil {
continue
}
items = append(items, MakeActionResult(ar.Tag(), action)... | go | func ConvertActions(ar state.ActionReceiver, fn GetActionsFn) ([]params.ActionResult, error) {
items := []params.ActionResult{}
actions, err := fn()
if err != nil {
return items, err
}
for _, action := range actions {
if action == nil {
continue
}
items = append(items, MakeActionResult(ar.Tag(), action)... | [
"func",
"ConvertActions",
"(",
"ar",
"state",
".",
"ActionReceiver",
",",
"fn",
"GetActionsFn",
")",
"(",
"[",
"]",
"params",
".",
"ActionResult",
",",
"error",
")",
"{",
"items",
":=",
"[",
"]",
"params",
".",
"ActionResult",
"{",
"}",
"\n",
"actions",
... | // ConvertActions takes a generic getActionsFn to obtain a slice
// of state.Action and then converts them to the API slice of
// params.ActionResult. | [
"ConvertActions",
"takes",
"a",
"generic",
"getActionsFn",
"to",
"obtain",
"a",
"slice",
"of",
"state",
".",
"Action",
"and",
"then",
"converts",
"them",
"to",
"the",
"API",
"slice",
"of",
"params",
".",
"ActionResult",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/action.go#L217-L230 |
153,693 | juju/juju | apiserver/common/action.go | MakeActionResult | func MakeActionResult(actionReceiverTag names.Tag, action state.Action) params.ActionResult {
output, message := action.Results()
return params.ActionResult{
Action: ¶ms.Action{
Receiver: actionReceiverTag.String(),
Tag: action.ActionTag().String(),
Name: action.Name(),
Parameters: ac... | go | func MakeActionResult(actionReceiverTag names.Tag, action state.Action) params.ActionResult {
output, message := action.Results()
return params.ActionResult{
Action: ¶ms.Action{
Receiver: actionReceiverTag.String(),
Tag: action.ActionTag().String(),
Name: action.Name(),
Parameters: ac... | [
"func",
"MakeActionResult",
"(",
"actionReceiverTag",
"names",
".",
"Tag",
",",
"action",
"state",
".",
"Action",
")",
"params",
".",
"ActionResult",
"{",
"output",
",",
"message",
":=",
"action",
".",
"Results",
"(",
")",
"\n",
"return",
"params",
".",
"A... | // MakeActionResult does the actual type conversion from state.Action
// to params.ActionResult. | [
"MakeActionResult",
"does",
"the",
"actual",
"type",
"conversion",
"from",
"state",
".",
"Action",
"to",
"params",
".",
"ActionResult",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/common/action.go#L234-L250 |
153,694 | juju/juju | cmd/juju/firewall/listrules.go | NewListFirewallRulesCommand | func NewListFirewallRulesCommand() cmd.Command {
cmd := &listFirewallRulesCommand{}
cmd.newAPIFunc = func() (ListFirewallRulesAPI, error) {
root, err := cmd.NewAPIRoot()
if err != nil {
return nil, errors.Trace(err)
}
return firewallrules.NewClient(root), nil
}
return modelcmd.Wrap(cmd)
} | go | func NewListFirewallRulesCommand() cmd.Command {
cmd := &listFirewallRulesCommand{}
cmd.newAPIFunc = func() (ListFirewallRulesAPI, error) {
root, err := cmd.NewAPIRoot()
if err != nil {
return nil, errors.Trace(err)
}
return firewallrules.NewClient(root), nil
}
return modelcmd.Wrap(cmd)
} | [
"func",
"NewListFirewallRulesCommand",
"(",
")",
"cmd",
".",
"Command",
"{",
"cmd",
":=",
"&",
"listFirewallRulesCommand",
"{",
"}",
"\n",
"cmd",
".",
"newAPIFunc",
"=",
"func",
"(",
")",
"(",
"ListFirewallRulesAPI",
",",
"error",
")",
"{",
"root",
",",
"e... | // NewListFirewallRulesCommand returns a command to list firewall rules. | [
"NewListFirewallRulesCommand",
"returns",
"a",
"command",
"to",
"list",
"firewall",
"rules",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/firewall/listrules.go#L32-L43 |
153,695 | juju/juju | state/refcounts_ns.go | LazyCreateOp | func (ns nsRefcounts_) LazyCreateOp(coll mongo.Collection, key string) (txn.Op, bool, error) {
if exists, err := ns.exists(coll, key); err != nil {
return txn.Op{}, false, errors.Trace(err)
} else if exists {
return txn.Op{}, false, nil
}
return ns.JustCreateOp(coll.Name(), key, 0), true, nil
} | go | func (ns nsRefcounts_) LazyCreateOp(coll mongo.Collection, key string) (txn.Op, bool, error) {
if exists, err := ns.exists(coll, key); err != nil {
return txn.Op{}, false, errors.Trace(err)
} else if exists {
return txn.Op{}, false, nil
}
return ns.JustCreateOp(coll.Name(), key, 0), true, nil
} | [
"func",
"(",
"ns",
"nsRefcounts_",
")",
"LazyCreateOp",
"(",
"coll",
"mongo",
".",
"Collection",
",",
"key",
"string",
")",
"(",
"txn",
".",
"Op",
",",
"bool",
",",
"error",
")",
"{",
"if",
"exists",
",",
"err",
":=",
"ns",
".",
"exists",
"(",
"col... | // LazyCreateOp returns a txn.Op that creates a refcount document; or
// false if the document already exists. | [
"LazyCreateOp",
"returns",
"a",
"txn",
".",
"Op",
"that",
"creates",
"a",
"refcount",
"document",
";",
"or",
"false",
"if",
"the",
"document",
"already",
"exists",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/refcounts_ns.go#L52-L59 |
153,696 | juju/juju | state/refcounts_ns.go | StrictCreateOp | func (ns nsRefcounts_) StrictCreateOp(coll mongo.Collection, key string, value int) (txn.Op, error) {
if exists, err := ns.exists(coll, key); err != nil {
return txn.Op{}, errors.Trace(err)
} else if exists {
return txn.Op{}, errors.New("refcount already exists")
}
return ns.JustCreateOp(coll.Name(), key, value... | go | func (ns nsRefcounts_) StrictCreateOp(coll mongo.Collection, key string, value int) (txn.Op, error) {
if exists, err := ns.exists(coll, key); err != nil {
return txn.Op{}, errors.Trace(err)
} else if exists {
return txn.Op{}, errors.New("refcount already exists")
}
return ns.JustCreateOp(coll.Name(), key, value... | [
"func",
"(",
"ns",
"nsRefcounts_",
")",
"StrictCreateOp",
"(",
"coll",
"mongo",
".",
"Collection",
",",
"key",
"string",
",",
"value",
"int",
")",
"(",
"txn",
".",
"Op",
",",
"error",
")",
"{",
"if",
"exists",
",",
"err",
":=",
"ns",
".",
"exists",
... | // StrictCreateOp returns a txn.Op that creates a refcount document as
// configured, or an error if the document already exists. | [
"StrictCreateOp",
"returns",
"a",
"txn",
".",
"Op",
"that",
"creates",
"a",
"refcount",
"document",
"as",
"configured",
"or",
"an",
"error",
"if",
"the",
"document",
"already",
"exists",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/refcounts_ns.go#L63-L70 |
153,697 | juju/juju | state/refcounts_ns.go | CreateOrIncRefOp | func (ns nsRefcounts_) CreateOrIncRefOp(coll mongo.Collection, key string, n int) (txn.Op, error) {
if exists, err := ns.exists(coll, key); err != nil {
return txn.Op{}, errors.Trace(err)
} else if !exists {
return ns.JustCreateOp(coll.Name(), key, n), nil
}
return ns.JustIncRefOp(coll.Name(), key, n), nil
} | go | func (ns nsRefcounts_) CreateOrIncRefOp(coll mongo.Collection, key string, n int) (txn.Op, error) {
if exists, err := ns.exists(coll, key); err != nil {
return txn.Op{}, errors.Trace(err)
} else if !exists {
return ns.JustCreateOp(coll.Name(), key, n), nil
}
return ns.JustIncRefOp(coll.Name(), key, n), nil
} | [
"func",
"(",
"ns",
"nsRefcounts_",
")",
"CreateOrIncRefOp",
"(",
"coll",
"mongo",
".",
"Collection",
",",
"key",
"string",
",",
"n",
"int",
")",
"(",
"txn",
".",
"Op",
",",
"error",
")",
"{",
"if",
"exists",
",",
"err",
":=",
"ns",
".",
"exists",
"... | // CreateOrIncrefOp returns a txn.Op that creates a refcount document as
// configured with a specified value; or increments any such refcount doc
// that already exists. | [
"CreateOrIncrefOp",
"returns",
"a",
"txn",
".",
"Op",
"that",
"creates",
"a",
"refcount",
"document",
"as",
"configured",
"with",
"a",
"specified",
"value",
";",
"or",
"increments",
"any",
"such",
"refcount",
"doc",
"that",
"already",
"exists",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/refcounts_ns.go#L75-L82 |
153,698 | juju/juju | state/refcounts_ns.go | AliveDecRefOp | func (ns nsRefcounts_) AliveDecRefOp(coll mongo.Collection, key string) (txn.Op, error) {
if refcount, err := ns.read(coll, key); err != nil {
return txn.Op{}, errors.Trace(err)
} else if refcount < 1 {
return txn.Op{}, errors.Annotatef(errRefcountAlreadyZero, "%s(%s)", coll.Name(), key)
}
return ns.justDecRefO... | go | func (ns nsRefcounts_) AliveDecRefOp(coll mongo.Collection, key string) (txn.Op, error) {
if refcount, err := ns.read(coll, key); err != nil {
return txn.Op{}, errors.Trace(err)
} else if refcount < 1 {
return txn.Op{}, errors.Annotatef(errRefcountAlreadyZero, "%s(%s)", coll.Name(), key)
}
return ns.justDecRefO... | [
"func",
"(",
"ns",
"nsRefcounts_",
")",
"AliveDecRefOp",
"(",
"coll",
"mongo",
".",
"Collection",
",",
"key",
"string",
")",
"(",
"txn",
".",
"Op",
",",
"error",
")",
"{",
"if",
"refcount",
",",
"err",
":=",
"ns",
".",
"read",
"(",
"coll",
",",
"ke... | // AliveDecRefOp returns a txn.Op that decrements the value of a
// refcount doc, or an error if the doc does not exist or the count
// would go below 0. | [
"AliveDecRefOp",
"returns",
"a",
"txn",
".",
"Op",
"that",
"decrements",
"the",
"value",
"of",
"a",
"refcount",
"doc",
"or",
"an",
"error",
"if",
"the",
"doc",
"does",
"not",
"exist",
"or",
"the",
"count",
"would",
"go",
"below",
"0",
"."
] | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/refcounts_ns.go#L98-L105 |
153,699 | juju/juju | state/refcounts_ns.go | DyingDecRefOp | func (ns nsRefcounts_) DyingDecRefOp(coll mongo.Collection, key string) (txn.Op, bool, error) {
refcount, err := ns.read(coll, key)
if err != nil {
return txn.Op{}, false, errors.Trace(err)
}
if refcount < 1 {
return txn.Op{}, false, errors.Annotatef(errRefcountAlreadyZero, "%s(%s)", coll.Name(), key)
} else i... | go | func (ns nsRefcounts_) DyingDecRefOp(coll mongo.Collection, key string) (txn.Op, bool, error) {
refcount, err := ns.read(coll, key)
if err != nil {
return txn.Op{}, false, errors.Trace(err)
}
if refcount < 1 {
return txn.Op{}, false, errors.Annotatef(errRefcountAlreadyZero, "%s(%s)", coll.Name(), key)
} else i... | [
"func",
"(",
"ns",
"nsRefcounts_",
")",
"DyingDecRefOp",
"(",
"coll",
"mongo",
".",
"Collection",
",",
"key",
"string",
")",
"(",
"txn",
".",
"Op",
",",
"bool",
",",
"error",
")",
"{",
"refcount",
",",
"err",
":=",
"ns",
".",
"read",
"(",
"coll",
"... | // DyingDecRefOp returns a txn.Op that decrements the value of a
// refcount doc and deletes it if the count reaches 0; if the Op will
// cause a delete, the bool result will be true. It will return an error
// if the doc does not exist or the count would go below 0. | [
"DyingDecRefOp",
"returns",
"a",
"txn",
".",
"Op",
"that",
"decrements",
"the",
"value",
"of",
"a",
"refcount",
"doc",
"and",
"deletes",
"it",
"if",
"the",
"count",
"reaches",
"0",
";",
"if",
"the",
"Op",
"will",
"cause",
"a",
"delete",
"the",
"bool",
... | ba728eedb1e44937c7bdc59f374b06400d0c7133 | https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/refcounts_ns.go#L111-L122 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.