_id stringlengths 2 7 | title stringlengths 1 118 | partition stringclasses 3
values | text stringlengths 52 85.5k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q3400 | PlanInfo | train | func (v *volumeAttachmentPlan) PlanInfo() (VolumeAttachmentPlanInfo, error) {
if v.doc.PlanInfo == nil {
return VolumeAttachmentPlanInfo{}, errors.NotProvisionedf("volume attachment plan %q on %q", v.doc.Volume, v.doc.Machine)
}
return *v.doc.PlanInfo, nil
} | go | {
"resource": ""
} |
q3401 | Volume | train | func (v *volumeAttachment) Volume() names.VolumeTag {
return names.NewVolumeTag(v.doc.Volume)
} | go | {
"resource": ""
} |
q3402 | Info | train | func (v *volumeAttachment) Info() (VolumeAttachmentInfo, error) {
if v.doc.Info == nil {
host := storageAttachmentHost(v.doc.Host)
return VolumeAttachmentInfo{}, errors.NotProvisionedf("volume attachment %q on %q", v.doc.Volume, names.ReadableString(host))
}
return *v.doc.Info, nil
} | go | {
"resource": ""
} |
q3403 | Params | train | func (v *volumeAttachment) Params() (VolumeAttachmentParams, bool) {
if v.doc.Params == nil {
return VolumeAttachmentParams{}, false
}
return *v.doc.Params, true
} | go | {
"resource": ""
} |
q3404 | Volume | train | func (sb *storageBackend) Volume(tag names.VolumeTag) (Volume, error) {
v, err := getVolumeByTag(sb.mb, tag)
return v, err
} | go | {
"resource": ""
} |
q3405 | StorageInstanceVolume | train | func (sb *storageBackend) StorageInstanceVolume(tag names.StorageTag) (Volume, error) {
v, err := sb.storageInstanceVolume(tag)
return v, err
} | go | {
"resource": ""
} |
q3406 | VolumeAttachment | train | func (sb *storageBackend) VolumeAttachment(host names.Tag, volume names.VolumeTag) (VolumeAttachment, error) {
coll, cleanup := sb.mb.db().GetCollection(volumeAttachmentsC)
defer cleanup()
var att volumeAttachment
err := coll.FindId(volumeAttachmentId(host.Id(), volume.Id())).One(&att.doc)
if err == mgo.ErrNotFou... | go | {
"resource": ""
} |
q3407 | MachineVolumeAttachments | train | func (sb *storageBackend) MachineVolumeAttachments(machine names.MachineTag) ([]VolumeAttachment, error) {
attachments, err := sb.volumeAttachments(bson.D{{"hostid", machine.Id()}})
if err != nil {
return nil, errors.Annotatef(err, "getting volume attachments for machine %q", machine.Id())
}
return attachments, n... | go | {
"resource": ""
} |
q3408 | UnitVolumeAttachments | train | func (sb *storageBackend) UnitVolumeAttachments(unit names.UnitTag) ([]VolumeAttachment, error) {
attachments, err := sb.volumeAttachments(bson.D{{"hostid", unit.Id()}})
if err != nil {
return nil, errors.Annotatef(err, "getting volume attachments for unit %q", unit.Id())
}
return attachments, nil
} | go | {
"resource": ""
} |
q3409 | VolumeAttachments | train | func (sb *storageBackend) VolumeAttachments(volume names.VolumeTag) ([]VolumeAttachment, error) {
attachments, err := sb.volumeAttachments(bson.D{{"volumeid", volume.Id()}})
if err != nil {
return nil, errors.Annotatef(err, "getting volume attachments for volume %q", volume.Id())
}
return attachments, nil
} | go | {
"resource": ""
} |
q3410 | VolumeAttachmentPlans | train | func (sb *storageBackend) VolumeAttachmentPlans(volume names.VolumeTag) ([]VolumeAttachmentPlan, error) {
attachmentPlans, err := sb.volumeAttachmentPlans(bson.D{{"volumeid", volume.Id()}})
if err != nil {
return nil, errors.Annotatef(err, "getting volume attachment plans for volume %q", volume.Id())
}
return att... | go | {
"resource": ""
} |
q3411 | removeMachineVolumesOps | train | func (sb *storageBackend) removeMachineVolumesOps(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 volume is "non-detachable", there still exist volume
// attachments, and they may ... | go | {
"resource": ""
} |
q3412 | isDetachableVolumeTag | train | func isDetachableVolumeTag(db Database, tag names.VolumeTag) (bool, error) {
doc, err := getVolumeDocByTag(db, tag)
if err != nil {
return false, errors.Trace(err)
}
return detachableVolumeDoc(&doc), nil
} | go | {
"resource": ""
} |
q3413 | isDetachableVolumePool | train | func isDetachableVolumePool(im *storageBackend, pool string) (bool, error) {
_, provider, _, err := poolStorageProvider(im, pool)
if err != nil {
return false, errors.Trace(err)
}
if provider.Scope() == storage.ScopeMachine {
// Any storage created by a machine cannot be detached from
// the machine, and must... | go | {
"resource": ""
} |
q3414 | DetachVolume | train | func (sb *storageBackend) DetachVolume(host names.Tag, volume names.VolumeTag) (err error) {
defer errors.DeferredAnnotatef(&err, "detaching volume %s from %s", volume.Id(), names.ReadableString(host))
// If the volume is backing a filesystem, the volume cannot be detached
// until the filesystem has been detached.
... | go | {
"resource": ""
} |
q3415 | RemoveVolumeAttachment | train | func (sb *storageBackend) RemoveVolumeAttachment(host names.Tag, volume names.VolumeTag) (err error) {
defer errors.DeferredAnnotatef(&err, "removing attachment of volume %s from %s", volume.Id(), names.ReadableString(host))
buildTxn := func(attempt int) ([]txn.Op, error) {
attachment, err := sb.VolumeAttachment(ho... | go | {
"resource": ""
} |
q3416 | DestroyVolume | train | func (sb *storageBackend) DestroyVolume(tag names.VolumeTag) (err error) {
defer errors.DeferredAnnotatef(&err, "destroying volume %s", tag.Id())
if _, err := sb.VolumeFilesystem(tag); err == nil {
return &errContainsFilesystem{errors.New("volume contains filesystem")}
} else if !errors.IsNotFound(err) {
return ... | go | {
"resource": ""
} |
q3417 | RemoveVolume | train | func (sb *storageBackend) RemoveVolume(tag names.VolumeTag) (err error) {
defer errors.DeferredAnnotatef(&err, "removing volume %s", tag.Id())
buildTxn := func(attempt int) ([]txn.Op, error) {
volume, err := sb.Volume(tag)
if errors.IsNotFound(err) {
return nil, jujutxn.ErrNoOperations
} else if err != nil {... | go | {
"resource": ""
} |
q3418 | addVolumeOps | train | func (sb *storageBackend) addVolumeOps(params VolumeParams, hostId string) ([]txn.Op, names.VolumeTag, error) {
params, err := sb.volumeParamsWithDefaults(params)
if err != nil {
return nil, names.VolumeTag{}, errors.Trace(err)
}
detachable, err := isDetachableVolumePool(sb, params.Pool)
if err != nil {
return... | go | {
"resource": ""
} |
q3419 | validateVolumeParams | train | func (sb *storageBackend) validateVolumeParams(params VolumeParams, machineId string) (maybeMachineId string, _ error) {
if err := validateStoragePool(sb, params.Pool, storage.StorageKindBlock, &machineId); err != nil {
return "", err
}
if params.Size == 0 {
return "", errors.New("invalid size 0")
}
return mac... | go | {
"resource": ""
} |
q3420 | ParseVolumeAttachmentId | train | func ParseVolumeAttachmentId(id string) (names.Tag, names.VolumeTag, error) {
fields := strings.SplitN(id, ":", 2)
isValidHost := names.IsValidMachine(fields[0]) || names.IsValidUnit(fields[0])
if len(fields) != 2 || !isValidHost || !names.IsValidVolume(fields[1]) {
return names.MachineTag{}, names.VolumeTag{}, er... | go | {
"resource": ""
} |
q3421 | createMachineVolumeAttachmentsOps | train | func createMachineVolumeAttachmentsOps(hostId string, attachments []volumeAttachmentTemplate) []txn.Op {
ops := make([]txn.Op, len(attachments))
for i, attachment := range attachments {
paramsCopy := attachment.params
ops[i] = txn.Op{
C: volumeAttachmentsC,
Id: volumeAttachmentId(hostId, attachment... | go | {
"resource": ""
} |
q3422 | setMachineVolumeAttachmentInfo | train | func setMachineVolumeAttachmentInfo(sb *storageBackend, machineId string, attachments map[names.VolumeTag]VolumeAttachmentInfo) (err error) {
defer errors.DeferredAnnotatef(&err, "cannot set volume attachment info for machine %s", machineId)
machineTag := names.NewMachineTag(machineId)
for volumeTag, info := range a... | go | {
"resource": ""
} |
q3423 | SetVolumeAttachmentInfo | train | func (sb *storageBackend) SetVolumeAttachmentInfo(hostTag names.Tag, volumeTag names.VolumeTag, info VolumeAttachmentInfo) (err error) {
defer errors.DeferredAnnotatef(&err, "cannot set info for volume attachment %s:%s", volumeTag.Id(), hostTag.Id())
v, err := sb.Volume(volumeTag)
if err != nil {
return errors.Tra... | go | {
"resource": ""
} |
q3424 | RemoveVolumeAttachmentPlan | train | func (sb *storageBackend) RemoveVolumeAttachmentPlan(hostTag names.Tag, volume names.VolumeTag) (err error) {
defer errors.DeferredAnnotatef(&err, "removing attachment plan of volume %s from machine %s", volume.Id(), hostTag.Id())
buildTxn := func(attempt int) ([]txn.Op, error) {
plans, err := sb.machineVolumeAttac... | go | {
"resource": ""
} |
q3425 | removeVolumeAttachmentPlanOps | train | func removeVolumeAttachmentPlanOps(hostTag names.Tag, volume names.VolumeTag) []txn.Op {
detachOps := detachVolumeOps(hostTag, volume)
removeOps := []txn.Op{{
C: volumeAttachmentPlanC,
Id: volumeAttachmentId(hostTag.Id(), volume.Id()),
Assert: bson.D{{"life", Dying}},
Remove: true,
}}
removeOps = a... | go | {
"resource": ""
} |
q3426 | setProvisionedVolumeInfo | train | func setProvisionedVolumeInfo(sb *storageBackend, volumes map[names.VolumeTag]VolumeInfo) error {
for volumeTag, info := range volumes {
if err := sb.SetVolumeInfo(volumeTag, info); err != nil {
return errors.Trace(err)
}
}
return nil
} | go | {
"resource": ""
} |
q3427 | SetVolumeInfo | train | func (sb *storageBackend) SetVolumeInfo(tag names.VolumeTag, info VolumeInfo) (err error) {
defer errors.DeferredAnnotatef(&err, "cannot set info for volume %q", tag.Id())
if info.VolumeId == "" {
return errors.New("volume ID not set")
}
// TODO(axw) we should reject info without VolumeId set; can't do this
// u... | go | {
"resource": ""
} |
q3428 | AllVolumes | train | func (sb *storageBackend) AllVolumes() ([]Volume, error) {
volumes, err := sb.volumes(nil)
if err != nil {
return nil, errors.Annotate(err, "cannot get volumes")
}
return volumesToInterfaces(volumes), nil
} | go | {
"resource": ""
} |
q3429 | watchMachinesLoop | train | func watchMachinesLoop(context updaterContext, machinesWatcher watcher.StringsWatcher) (err error) {
p := &updater{
context: context,
machines: make(map[names.MachineTag]chan struct{}),
machineDead: make(chan machine),
}
defer func() {
// TODO(fwereade): is this a home-grown sync.WaitGroup or somethin... | go | {
"resource": ""
} |
q3430 | runMachine | train | func runMachine(context machineContext, m machine, changed <-chan struct{}, died chan<- machine, clock clock.Clock) {
defer func() {
// We can't just send on the died channel because the
// central loop might be trying to write to us on the
// changed channel.
for {
select {
case died <- m:
return
... | go | {
"resource": ""
} |
q3431 | pollInstanceInfo | train | func pollInstanceInfo(context machineContext, m machine) (instInfo instanceInfo, err error) {
instInfo = instanceInfo{}
instId, err := m.InstanceId()
// We can't ask the machine for its addresses if it isn't provisioned yet.
if params.IsCodeNotProvisioned(err) {
return instanceInfo{}, err
}
if err != nil {
re... | go | {
"resource": ""
} |
q3432 | addressesEqual | train | func addressesEqual(a0, a1 []network.Address) bool {
if len(a0) != len(a1) {
logger.Tracef("address lists have different lengths %d != %d for %v != %v",
len(a0), len(a1), a0, a1)
return false
}
ca0 := make([]network.Address, len(a0))
copy(ca0, a0)
network.SortAddresses(ca0)
ca1 := make([]network.Address, ... | go | {
"resource": ""
} |
q3433 | Count | train | func (c *modelStateCollection) Count() (int, error) {
return c.WriteCollection.Find(bson.D{{"model-uuid", c.modelUUID}}).Count()
} | go | {
"resource": ""
} |
q3434 | Insert | train | func (c *modelStateCollection) Insert(docs ...interface{}) error {
var mungedDocs []interface{}
for _, doc := range docs {
mungedDoc, err := mungeDocForMultiModel(doc, c.modelUUID, modelUUIDRequired)
if err != nil {
return errors.Trace(err)
}
mungedDocs = append(mungedDocs, mungedDoc)
}
return c.WriteCol... | go | {
"resource": ""
} |
q3435 | UpdateId | train | func (c *modelStateCollection) UpdateId(id interface{}, update interface{}) error {
if sid, ok := id.(string); ok {
return c.WriteCollection.UpdateId(ensureModelUUID(c.modelUUID, sid), update)
}
return c.WriteCollection.UpdateId(bson.D{{"_id", id}}, update)
} | go | {
"resource": ""
} |
q3436 | getAllUnitNames | train | func getAllUnitNames(st *state.State, units, services []string) (result []names.Tag, err error) {
var leaders map[string]string
getLeader := func(appName string) (string, error) {
if leaders == nil {
var err error
leaders, err = st.ApplicationLeaders()
if err != nil {
return "", err
}
}
if leade... | go | {
"resource": ""
} |
q3437 | Run | train | func (a *ActionAPI) Run(run params.RunParams) (results params.ActionResults, err error) {
if err := a.checkCanAdmin(); err != nil {
return results, err
}
if err := a.check.ChangeAllowed(); err != nil {
return results, errors.Trace(err)
}
units, err := getAllUnitNames(a.state, run.Units, run.Applications)
if... | go | {
"resource": ""
} |
q3438 | RunOnAllMachines | train | func (a *ActionAPI) RunOnAllMachines(run params.RunParams) (results params.ActionResults, err error) {
if err := a.checkCanAdmin(); err != nil {
return results, err
}
if err := a.check.ChangeAllowed(); err != nil {
return results, errors.Trace(err)
}
machines, err := a.state.AllMachines()
if err != nil {
... | go | {
"resource": ""
} |
q3439 | bounceErrChanged | train | func bounceErrChanged(err error) error {
if errors.Cause(err) == ErrChanged {
return dependency.ErrBounce
}
return err
} | go | {
"resource": ""
} |
q3440 | stateStepsFor237 | train | func stateStepsFor237() []Step {
return []Step{
&upgradeStep{
description: "ensure container-image-stream isn't set in applications",
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return context.State().RemoveContainerImageStreamFromNonModelSettings()
},
},
}
} | go | {
"resource": ""
} |
q3441 | hookToolMain | train | func hookToolMain(commandName string, ctx *cmd.Context, args []string) (code int, err error) {
code = 1
contextId, err := getenv("JUJU_CONTEXT_ID")
if err != nil {
return
}
dir, err := getwd()
if err != nil {
return
}
req := jujuc.Request{
ContextId: contextId,
Dir: dir,
CommandName: command... | go | {
"resource": ""
} |
q3442 | jujuDMain | train | func jujuDMain(args []string, ctx *cmd.Context) (code int, err error) {
// Assuming an average of 200 bytes per log message, use up to
// 200MB for the log buffer.
defer logger.Debugf("jujud complete, code %d, err %v", code, err)
bufferedLogger, err := logsender.InstallBufferedLogWriter(1048576)
if err != nil {
... | go | {
"resource": ""
} |
q3443 | saveApplicationWorker | train | func (p *provisioner) saveApplicationWorker(appName string, aw worker.Worker) {
p.mu.Lock()
defer p.mu.Unlock()
if p.provisioners == nil {
p.provisioners = make(map[string]worker.Worker)
}
p.provisioners[appName] = aw
} | go | {
"resource": ""
} |
q3444 | RunOnAllMachines | train | func (c *Client) RunOnAllMachines(commands string, timeout time.Duration) ([]params.ActionResult, error) {
var results params.ActionResults
args := params.RunParams{Commands: commands, Timeout: timeout}
err := c.facade.FacadeCall("RunOnAllMachines", args, &results)
return results.Results, err
} | go | {
"resource": ""
} |
q3445 | Run | train | func (c *Client) Run(run params.RunParams) ([]params.ActionResult, error) {
var results params.ActionResults
err := c.facade.FacadeCall("Run", run, &results)
return results.Results, err
} | go | {
"resource": ""
} |
q3446 | CloudAPIVersion | train | func (g EnvironConfigGetter) CloudAPIVersion(spec environs.CloudSpec) (string, error) {
// Only CAAS models have an API version we care about right now.
if g.Model.Type() == state.ModelTypeIAAS {
return "", nil
}
cfg, err := g.ModelConfig()
if err != nil {
return "", errors.Trace(err)
}
ctrlCfg, err := g.Con... | go | {
"resource": ""
} |
q3447 | GetNewEnvironFunc | train | func GetNewEnvironFunc(newEnviron environs.NewEnvironFunc) NewEnvironFunc {
return func(st *state.State) (environs.Environ, error) {
m, err := st.Model()
if err != nil {
return nil, errors.Trace(err)
}
g := EnvironConfigGetter{State: st, Model: m}
return environs.GetEnviron(g, newEnviron)
}
} | go | {
"resource": ""
} |
q3448 | GetNewCAASBrokerFunc | train | func GetNewCAASBrokerFunc(newBroker caas.NewContainerBrokerFunc) NewCAASBrokerFunc {
return func(st *state.State) (caas.Broker, error) {
m, err := st.Model()
if err != nil {
return nil, errors.Trace(err)
}
g := EnvironConfigGetter{State: st, Model: m}
cloudSpec, err := g.CloudSpec()
if err != nil {
r... | go | {
"resource": ""
} |
q3449 | setModelAccess | train | func (st *State) setModelAccess(access permission.Access, userGlobalKey, modelUUID string) error {
if err := permission.ValidateModelAccess(access); err != nil {
return errors.Trace(err)
}
op := updatePermissionOp(modelKey(modelUUID), userGlobalKey, access)
err := st.db().RunTransactionFor(modelUUID, []txn.Op{op}... | go | {
"resource": ""
} |
q3450 | LastModelConnection | train | func (m *Model) LastModelConnection(user names.UserTag) (time.Time, error) {
lastConnections, closer := m.st.db().GetRawCollection(modelUserLastConnectionC)
defer closer()
username := user.Id()
var lastConn modelUserLastConnectionDoc
err := lastConnections.FindId(m.st.docID(username)).Select(bson.D{{"last-connect... | go | {
"resource": ""
} |
q3451 | IsNeverConnectedError | train | func IsNeverConnectedError(err error) bool {
_, ok := errors.Cause(err).(NeverConnectedError)
return ok
} | go | {
"resource": ""
} |
q3452 | UpdateLastModelConnection | train | func (m *Model) UpdateLastModelConnection(user names.UserTag) error {
return m.updateLastModelConnection(user, m.st.nowToTheSecond())
} | go | {
"resource": ""
} |
q3453 | modelUser | train | func (st *State) modelUser(modelUUID string, user names.UserTag) (userAccessDoc, error) {
modelUser := userAccessDoc{}
modelUsers, closer := st.db().GetCollectionFor(modelUUID, modelUsersC)
defer closer()
username := strings.ToLower(user.Id())
err := modelUsers.FindId(username).One(&modelUser)
if err == mgo.ErrN... | go | {
"resource": ""
} |
q3454 | removeModelUser | train | func (st *State) removeModelUser(user names.UserTag) error {
ops := removeModelUserOps(st.ModelUUID(), user)
err := st.db().RunTransaction(ops)
if err == txn.ErrAborted {
err = errors.NewNotFound(nil, fmt.Sprintf("model user %q does not exist", user.Id()))
}
if err != nil {
return errors.Trace(err)
}
return ... | go | {
"resource": ""
} |
q3455 | isUserSuperuser | train | func (st *State) isUserSuperuser(user names.UserTag) (bool, error) {
access, err := st.UserAccess(user, st.controllerTag)
if err != nil {
// TODO(jam): 2017-11-27 We weren't suppressing NotFound here so that we would know when someone asked for
// the list of models of a user that doesn't exist.
// However, now... | go | {
"resource": ""
} |
q3456 | modelQueryForUser | train | func (st *State) modelQueryForUser(user names.UserTag, isSuperuser bool) (mongo.Query, SessionCloser, error) {
var modelQuery mongo.Query
models, closer := st.db().GetCollection(modelsC)
if isSuperuser {
// Fast path, we just return all the models that aren't Importing
modelQuery = models.Find(bson.M{"migration-... | go | {
"resource": ""
} |
q3457 | ModelBasicInfoForUser | train | func (st *State) ModelBasicInfoForUser(user names.UserTag) ([]ModelAccessInfo, error) {
isSuperuser, err := st.isUserSuperuser(user)
if err != nil {
return nil, errors.Trace(err)
}
modelQuery, closer1, err := st.modelQueryForUser(user, isSuperuser)
if err != nil {
return nil, errors.Trace(err)
}
defer closer... | go | {
"resource": ""
} |
q3458 | IsControllerAdmin | train | func (st *State) IsControllerAdmin(user names.UserTag) (bool, error) {
model, err := st.Model()
if err != nil {
return false, errors.Trace(err)
}
ua, err := st.UserAccess(user, model.ControllerTag())
if errors.IsNotFound(err) {
return false, nil
}
if err != nil {
return false, errors.Trace(err)
}
return ... | go | {
"resource": ""
} |
q3459 | SetAPIHostPorts | train | func (s APIHostPortsSetter) SetAPIHostPorts(servers [][]network.HostPort) error {
return s.ChangeConfig(func(c ConfigSetter) error {
c.SetAPIHostPorts(servers)
return nil
})
} | go | {
"resource": ""
} |
q3460 | Migrate | train | func (p *Paths) Migrate(newPaths Paths) {
if newPaths.DataDir != "" {
p.DataDir = newPaths.DataDir
}
if newPaths.LogDir != "" {
p.LogDir = newPaths.LogDir
}
if newPaths.MetricsSpoolDir != "" {
p.MetricsSpoolDir = newPaths.MetricsSpoolDir
}
if newPaths.ConfDir != "" {
p.ConfDir = newPaths.ConfDir
}
} | go | {
"resource": ""
} |
q3461 | NewPathsWithDefaults | train | func NewPathsWithDefaults(p Paths) Paths {
paths := DefaultPaths
if p.DataDir != "" {
paths.DataDir = p.DataDir
}
if p.LogDir != "" {
paths.LogDir = p.LogDir
}
if p.MetricsSpoolDir != "" {
paths.MetricsSpoolDir = p.MetricsSpoolDir
}
if p.ConfDir != "" {
paths.ConfDir = p.ConfDir
}
return paths
} | go | {
"resource": ""
} |
q3462 | LogFilename | train | func LogFilename(c Config) string {
return filepath.Join(c.LogDir(), c.Tag().String()+".log")
} | go | {
"resource": ""
} |
q3463 | MachineLockLogFilename | train | func MachineLockLogFilename(c Config) string {
return filepath.Join(c.LogDir(), machinelock.Filename)
} | go | {
"resource": ""
} |
q3464 | NewAgentConfig | train | func NewAgentConfig(configParams AgentConfigParams) (ConfigSetterWriter, error) {
if configParams.Paths.DataDir == "" {
return nil, errors.Trace(requiredError("data directory"))
}
if configParams.Tag == nil {
return nil, errors.Trace(requiredError("entity tag"))
}
switch configParams.Tag.(type) {
case names.M... | go | {
"resource": ""
} |
q3465 | NewStateMachineConfig | train | func NewStateMachineConfig(configParams AgentConfigParams, serverInfo params.StateServingInfo) (ConfigSetterWriter, error) {
if serverInfo.Cert == "" {
return nil, errors.Trace(requiredError("controller cert"))
}
if serverInfo.PrivateKey == "" {
return nil, errors.Trace(requiredError("controller key"))
}
if se... | go | {
"resource": ""
} |
q3466 | Dir | train | func Dir(dataDir string, tag names.Tag) string {
// Note: must use path, not filepath, as this
// function is used by the client on Windows.
return path.Join(BaseDir(dataDir), tag.String())
} | go | {
"resource": ""
} |
q3467 | ReadConfig | train | func ReadConfig(configFilePath string) (ConfigSetterWriter, error) {
var (
format formatter
config *configInternal
)
configData, err := ioutil.ReadFile(configFilePath)
if err != nil {
return nil, errors.Annotatef(err, "cannot read agent config %q", configFilePath)
}
format, config, err = parseConfigData(con... | go | {
"resource": ""
} |
q3468 | MongoVersion | train | func (c *configInternal) MongoVersion() mongo.Version {
v, err := mongo.NewVersion(c.mongoVersion)
if err != nil {
return mongo.Mongo24
}
return v
} | go | {
"resource": ""
} |
q3469 | MongoMemoryProfile | train | func (c *configInternal) MongoMemoryProfile() mongo.MemoryProfile {
mprof := mongo.MemoryProfile(c.mongoMemoryProfile)
if err := mprof.Validate(); err != nil {
return mongo.MemoryProfileLow
}
return mongo.MemoryProfile(c.mongoMemoryProfile)
} | go | {
"resource": ""
} |
q3470 | SetMongoVersion | train | func (c *configInternal) SetMongoVersion(v mongo.Version) {
c.mongoVersion = v.String()
} | go | {
"resource": ""
} |
q3471 | SetMongoMemoryProfile | train | func (c *configInternal) SetMongoMemoryProfile(v mongo.MemoryProfile) {
c.mongoMemoryProfile = v.String()
} | go | {
"resource": ""
} |
q3472 | WriteCommands | train | func (c *configInternal) WriteCommands(renderer shell.Renderer) ([]string, error) {
data, err := c.Render()
if err != nil {
return nil, errors.Trace(err)
}
commands := renderer.MkdirAll(c.Dir())
filename := c.File(AgentConfigFilename)
commands = append(commands, renderer.WriteFile(filename, data)...)
commands ... | go | {
"resource": ""
} |
q3473 | APIInfo | train | func (c *configInternal) APIInfo() (*api.Info, bool) {
if c.apiDetails == nil || c.apiDetails.addresses == nil {
return nil, false
}
servingInfo, isController := c.StateServingInfo()
addrs := c.apiDetails.addresses
// For controller we return only localhost - we should not connect
// to other controllers if we ... | go | {
"resource": ""
} |
q3474 | MongoInfo | train | func (c *configInternal) MongoInfo() (info *mongo.MongoInfo, ok bool) {
ssi, ok := c.StateServingInfo()
if !ok {
return nil, false
}
// We return localhost first and then all addresses of known API
// endpoints - this lets us connect to other Mongo instances and start
// state even if our own Mongo has not star... | go | {
"resource": ""
} |
q3475 | isCAASModelFacade | train | func isCAASModelFacade(facadeName string) bool {
return caasModelFacadeNames.Contains(facadeName) ||
commonModelFacadeNames.Contains(facadeName) ||
commonFacadeNames.Contains(facadeName)
} | go | {
"resource": ""
} |
q3476 | UserErr | train | func (e *TermsRequiredError) UserErr() error {
terms := strings.Join(e.Terms, " ")
return errors.Wrap(e,
errors.Errorf(`Declined: some terms require agreement. Try: "juju agree %s"`, terms))
} | go | {
"resource": ""
} |
q3477 | String | train | func (ic *InstanceConstraint) String() string {
return fmt.Sprintf(
"{region: %s, series: %s, arches: %s, constraints: %s, storage: %s}",
ic.Region,
ic.Series,
ic.Arches,
ic.Constraints,
ic.Storage,
)
} | go | {
"resource": ""
} |
q3478 | match | train | func (image Image) match(itype InstanceType) imageMatch {
if !image.matchArch(itype.Arches) {
return nonMatch
}
if itype.VirtType == nil || image.VirtType == *itype.VirtType {
return exactMatch
}
if image.VirtType == "" {
// Image doesn't specify virtualisation type. We allow it
// to match, but prefer exa... | go | {
"resource": ""
} |
q3479 | New | train | func New(
externalControllers ExternalControllerUpdaterClient,
newExternalControllerWatcherClient NewExternalControllerWatcherClientFunc,
clock clock.Clock,
) (worker.Worker, error) {
w := updaterWorker{
watchExternalControllers: externalControllers.WatchExternalControllers,
externalControllerInfo: ... | go | {
"resource": ""
} |
q3480 | NewMockAvailabilityZone | train | func NewMockAvailabilityZone(ctrl *gomock.Controller) *MockAvailabilityZone {
mock := &MockAvailabilityZone{ctrl: ctrl}
mock.recorder = &MockAvailabilityZoneMockRecorder{mock}
return mock
} | go | {
"resource": ""
} |
q3481 | Available | train | func (m *MockAvailabilityZone) Available() bool {
ret := m.ctrl.Call(m, "Available")
ret0, _ := ret[0].(bool)
return ret0
} | go | {
"resource": ""
} |
q3482 | Available | train | func (mr *MockAvailabilityZoneMockRecorder) Available() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Available", reflect.TypeOf((*MockAvailabilityZone)(nil).Available))
} | go | {
"resource": ""
} |
q3483 | NewMockMetricsCollector | train | func NewMockMetricsCollector(ctrl *gomock.Controller) *MockMetricsCollector {
mock := &MockMetricsCollector{ctrl: ctrl}
mock.recorder = &MockMetricsCollectorMockRecorder{mock}
return mock
} | go | {
"resource": ""
} |
q3484 | Connections | train | func (m *MockMetricsCollector) Connections() prometheus.Gauge {
ret := m.ctrl.Call(m, "Connections")
ret0, _ := ret[0].(prometheus.Gauge)
return ret0
} | go | {
"resource": ""
} |
q3485 | LogReadCount | train | func (m *MockMetricsCollector) LogReadCount(arg0, arg1 string) prometheus.Counter {
ret := m.ctrl.Call(m, "LogReadCount", arg0, arg1)
ret0, _ := ret[0].(prometheus.Counter)
return ret0
} | go | {
"resource": ""
} |
q3486 | LogReadCount | train | func (mr *MockMetricsCollectorMockRecorder) LogReadCount(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogReadCount", reflect.TypeOf((*MockMetricsCollector)(nil).LogReadCount), arg0, arg1)
} | go | {
"resource": ""
} |
q3487 | PingFailureCount | train | func (m *MockMetricsCollector) PingFailureCount(arg0 string) prometheus.Counter {
ret := m.ctrl.Call(m, "PingFailureCount", arg0)
ret0, _ := ret[0].(prometheus.Counter)
return ret0
} | go | {
"resource": ""
} |
q3488 | TotalConnections | train | func (m *MockMetricsCollector) TotalConnections() prometheus.Counter {
ret := m.ctrl.Call(m, "TotalConnections")
ret0, _ := ret[0].(prometheus.Counter)
return ret0
} | go | {
"resource": ""
} |
q3489 | NewFacade | train | func NewFacade(apiCaller base.APICaller) (Facade, error) {
return applicationscaler.NewAPI(
apiCaller,
watcher.NewStringsWatcher,
), nil
} | go | {
"resource": ""
} |
q3490 | Close | train | func (l *streamLayer) Close() error {
l.tomb.Kill(nil)
return l.tomb.Wait()
} | go | {
"resource": ""
} |
q3491 | Addr | train | func (l *streamLayer) Addr() net.Addr {
select {
case <-l.tomb.Dying():
return invalidAddr
case <-l.clock.After(AddrTimeout):
logger.Errorf("streamLayer.Addr timed out waiting for API address")
// Stop this (and parent) worker.
l.tomb.Kill(ErrAddressTimeout)
return invalidAddr
case addr := <-l.addr:
ret... | go | {
"resource": ""
} |
q3492 | registerForServer | train | func (r resources) registerForServer() error {
r.registerState()
r.registerAgentWorkers()
r.registerHookContext()
return nil
} | go | {
"resource": ""
} |
q3493 | registerAgentWorkers | train | func (r resources) registerAgentWorkers() {
if !markRegistered(resource.ComponentName, "agent-workers") {
return
}
charmrevisionupdater.RegisterLatestCharmHandler("resources", resourceadapters.NewLatestCharmHandler)
} | go | {
"resource": ""
} |
q3494 | NewMockZonedEnviron | train | func NewMockZonedEnviron(ctrl *gomock.Controller) *MockZonedEnviron {
mock := &MockZonedEnviron{ctrl: ctrl}
mock.recorder = &MockZonedEnvironMockRecorder{mock}
return mock
} | go | {
"resource": ""
} |
q3495 | AdoptResources | train | func (m *MockZonedEnviron) AdoptResources(arg0 context.ProviderCallContext, arg1 string, arg2 version.Number) error {
ret := m.ctrl.Call(m, "AdoptResources", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
} | go | {
"resource": ""
} |
q3496 | AvailabilityZones | train | func (m *MockZonedEnviron) AvailabilityZones(arg0 context.ProviderCallContext) ([]common.AvailabilityZone, error) {
ret := m.ctrl.Call(m, "AvailabilityZones", arg0)
ret0, _ := ret[0].([]common.AvailabilityZone)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | {
"resource": ""
} |
q3497 | ConstraintsValidator | train | func (m *MockZonedEnviron) ConstraintsValidator(arg0 context.ProviderCallContext) (constraints.Validator, error) {
ret := m.ctrl.Call(m, "ConstraintsValidator", arg0)
ret0, _ := ret[0].(constraints.Validator)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | {
"resource": ""
} |
q3498 | DeriveAvailabilityZones | train | func (m *MockZonedEnviron) DeriveAvailabilityZones(arg0 context.ProviderCallContext, arg1 environs.StartInstanceParams) ([]string, error) {
ret := m.ctrl.Call(m, "DeriveAvailabilityZones", arg0, arg1)
ret0, _ := ret[0].([]string)
ret1, _ := ret[1].(error)
return ret0, ret1
} | go | {
"resource": ""
} |
q3499 | Destroy | train | func (m *MockZonedEnviron) Destroy(arg0 context.ProviderCallContext) error {
ret := m.ctrl.Call(m, "Destroy", arg0)
ret0, _ := ret[0].(error)
return ret0
} | go | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.