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
3,700
juju/juju
apiserver/facades/controller/caasunitprovisioner/provisioner.go
ApplicationsScale
func (f *Facade) ApplicationsScale(args params.Entities) (params.IntResults, error) { results := params.IntResults{ Results: make([]params.IntResult, len(args.Entities)), } for i, arg := range args.Entities { scale, err := f.applicationScale(arg.Tag) if err != nil { results.Results[i].Error = common.ServerE...
go
func (f *Facade) ApplicationsScale(args params.Entities) (params.IntResults, error) { results := params.IntResults{ Results: make([]params.IntResult, len(args.Entities)), } for i, arg := range args.Entities { scale, err := f.applicationScale(arg.Tag) if err != nil { results.Results[i].Error = common.ServerE...
[ "func", "(", "f", "*", "Facade", ")", "ApplicationsScale", "(", "args", "params", ".", "Entities", ")", "(", "params", ".", "IntResults", ",", "error", ")", "{", "results", ":=", "params", ".", "IntResults", "{", "Results", ":", "make", "(", "[", "]", ...
// ApplicationsScale returns the scaling info for specified applications in this model.
[ "ApplicationsScale", "returns", "the", "scaling", "info", "for", "specified", "applications", "in", "this", "model", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/caasunitprovisioner/provisioner.go#L194-L208
3,701
juju/juju
apiserver/facades/controller/caasunitprovisioner/provisioner.go
ProvisioningInfo
func (f *Facade) ProvisioningInfo(args params.Entities) (params.KubernetesProvisioningInfoResults, error) { model, err := f.state.Model() if err != nil { return params.KubernetesProvisioningInfoResults{}, errors.Trace(err) } results := params.KubernetesProvisioningInfoResults{ Results: make([]params.KubernetesP...
go
func (f *Facade) ProvisioningInfo(args params.Entities) (params.KubernetesProvisioningInfoResults, error) { model, err := f.state.Model() if err != nil { return params.KubernetesProvisioningInfoResults{}, errors.Trace(err) } results := params.KubernetesProvisioningInfoResults{ Results: make([]params.KubernetesP...
[ "func", "(", "f", "*", "Facade", ")", "ProvisioningInfo", "(", "args", "params", ".", "Entities", ")", "(", "params", ".", "KubernetesProvisioningInfoResults", ",", "error", ")", "{", "model", ",", "err", ":=", "f", ".", "state", ".", "Model", "(", ")", ...
// ProvisioningInfo returns the provisioning info for specified applications in this model.
[ "ProvisioningInfo", "returns", "the", "provisioning", "info", "for", "specified", "applications", "in", "this", "model", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/caasunitprovisioner/provisioner.go#L223-L240
3,702
juju/juju
apiserver/facades/controller/caasunitprovisioner/provisioner.go
applicationFilesystemParams
func (f *Facade) applicationFilesystemParams( app Application, controllerConfig controller.Config, modelConfig *config.Config, ) ([]params.KubernetesFilesystemParams, error) { storage, err := app.StorageConstraints() if err != nil { return nil, errors.Trace(err) } ch, _, err := app.Charm() if err != nil { ...
go
func (f *Facade) applicationFilesystemParams( app Application, controllerConfig controller.Config, modelConfig *config.Config, ) ([]params.KubernetesFilesystemParams, error) { storage, err := app.StorageConstraints() if err != nil { return nil, errors.Trace(err) } ch, _, err := app.Charm() if err != nil { ...
[ "func", "(", "f", "*", "Facade", ")", "applicationFilesystemParams", "(", "app", "Application", ",", "controllerConfig", "controller", ".", "Config", ",", "modelConfig", "*", "config", ".", "Config", ",", ")", "(", "[", "]", "params", ".", "KubernetesFilesyste...
// applicationFilesystemParams retrieves FilesystemParams for the filesystems // that should be provisioned with, and attached to, pods of the application.
[ "applicationFilesystemParams", "retrieves", "FilesystemParams", "for", "the", "filesystems", "that", "should", "be", "provisioned", "with", "and", "attached", "to", "pods", "of", "the", "application", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/caasunitprovisioner/provisioner.go#L350-L394
3,703
juju/juju
apiserver/facades/controller/caasunitprovisioner/provisioner.go
ApplicationsConfig
func (f *Facade) ApplicationsConfig(args params.Entities) (params.ApplicationGetConfigResults, error) { results := params.ApplicationGetConfigResults{ Results: make([]params.ConfigResult, len(args.Entities)), } for i, arg := range args.Entities { result, err := f.getApplicationConfig(arg.Tag) results.Results[i...
go
func (f *Facade) ApplicationsConfig(args params.Entities) (params.ApplicationGetConfigResults, error) { results := params.ApplicationGetConfigResults{ Results: make([]params.ConfigResult, len(args.Entities)), } for i, arg := range args.Entities { result, err := f.getApplicationConfig(arg.Tag) results.Results[i...
[ "func", "(", "f", "*", "Facade", ")", "ApplicationsConfig", "(", "args", "params", ".", "Entities", ")", "(", "params", ".", "ApplicationGetConfigResults", ",", "error", ")", "{", "results", ":=", "params", ".", "ApplicationGetConfigResults", "{", "Results", "...
// ApplicationsConfig returns the config for the specified applications.
[ "ApplicationsConfig", "returns", "the", "config", "for", "the", "specified", "applications", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/caasunitprovisioner/provisioner.go#L414-L424
3,704
juju/juju
apiserver/facades/controller/caasunitprovisioner/provisioner.go
UpdateApplicationsUnits
func (a *Facade) UpdateApplicationsUnits(args params.UpdateApplicationUnitArgs) (params.ErrorResults, error) { result := params.ErrorResults{ Results: make([]params.ErrorResult, len(args.Args)), } if len(args.Args) == 0 { return result, nil } for i, appUpdate := range args.Args { appTag, err := names.ParseAp...
go
func (a *Facade) UpdateApplicationsUnits(args params.UpdateApplicationUnitArgs) (params.ErrorResults, error) { result := params.ErrorResults{ Results: make([]params.ErrorResult, len(args.Args)), } if len(args.Args) == 0 { return result, nil } for i, appUpdate := range args.Args { appTag, err := names.ParseAp...
[ "func", "(", "a", "*", "Facade", ")", "UpdateApplicationsUnits", "(", "args", "params", ".", "UpdateApplicationUnitArgs", ")", "(", "params", ".", "ErrorResults", ",", "error", ")", "{", "result", ":=", "params", ".", "ErrorResults", "{", "Results", ":", "ma...
// UpdateApplicationsUnits updates the Juju data model to reflect the given // units of the specified application.
[ "UpdateApplicationsUnits", "updates", "the", "Juju", "data", "model", "to", "reflect", "the", "given", "units", "of", "the", "specified", "application", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/caasunitprovisioner/provisioner.go#L440-L480
3,705
juju/juju
apiserver/facades/controller/caasunitprovisioner/provisioner.go
updateStatus
func (a *Facade) updateStatus(params params.ApplicationUnitParams) ( agentStatus *status.StatusInfo, cloudContainerStatus *status.StatusInfo, ) { var containerStatus status.Status switch status.Status(params.Status) { case status.Unknown: // The container runtime can spam us with unimportant // status updates,...
go
func (a *Facade) updateStatus(params params.ApplicationUnitParams) ( agentStatus *status.StatusInfo, cloudContainerStatus *status.StatusInfo, ) { var containerStatus status.Status switch status.Status(params.Status) { case status.Unknown: // The container runtime can spam us with unimportant // status updates,...
[ "func", "(", "a", "*", "Facade", ")", "updateStatus", "(", "params", "params", ".", "ApplicationUnitParams", ")", "(", "agentStatus", "*", "status", ".", "StatusInfo", ",", "cloudContainerStatus", "*", "status", ".", "StatusInfo", ",", ")", "{", "var", "cont...
// updateStatus constructs the agent and cloud container status values.
[ "updateStatus", "constructs", "the", "agent", "and", "cloud", "container", "status", "values", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/caasunitprovisioner/provisioner.go#L483-L525
3,706
juju/juju
apiserver/facades/controller/caasunitprovisioner/provisioner.go
UpdateApplicationsService
func (a *Facade) UpdateApplicationsService(args params.UpdateApplicationServiceArgs) (params.ErrorResults, error) { result := params.ErrorResults{ Results: make([]params.ErrorResult, len(args.Args)), } if len(args.Args) == 0 { return result, nil } for i, appUpdate := range args.Args { appTag, err := names.Pa...
go
func (a *Facade) UpdateApplicationsService(args params.UpdateApplicationServiceArgs) (params.ErrorResults, error) { result := params.ErrorResults{ Results: make([]params.ErrorResult, len(args.Args)), } if len(args.Args) == 0 { return result, nil } for i, appUpdate := range args.Args { appTag, err := names.Pa...
[ "func", "(", "a", "*", "Facade", ")", "UpdateApplicationsService", "(", "args", "params", ".", "UpdateApplicationServiceArgs", ")", "(", "params", ".", "ErrorResults", ",", "error", ")", "{", "result", ":=", "params", ".", "ErrorResults", "{", "Results", ":", ...
// UpdateApplicationsService updates the Juju data model to reflect the given // service details of the specified application.
[ "UpdateApplicationsService", "updates", "the", "Juju", "data", "model", "to", "reflect", "the", "given", "service", "details", "of", "the", "specified", "application", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/caasunitprovisioner/provisioner.go#L1186-L1209
3,707
juju/juju
apiserver/facades/controller/caasunitprovisioner/provisioner.go
SetOperatorStatus
func (a *Facade) SetOperatorStatus(args params.SetStatus) (params.ErrorResults, error) { result := params.ErrorResults{ Results: make([]params.ErrorResult, len(args.Entities)), } for i, arg := range args.Entities { appTag, err := names.ParseApplicationTag(arg.Tag) if err != nil { result.Results[i].Error = c...
go
func (a *Facade) SetOperatorStatus(args params.SetStatus) (params.ErrorResults, error) { result := params.ErrorResults{ Results: make([]params.ErrorResult, len(args.Entities)), } for i, arg := range args.Entities { appTag, err := names.ParseApplicationTag(arg.Tag) if err != nil { result.Results[i].Error = c...
[ "func", "(", "a", "*", "Facade", ")", "SetOperatorStatus", "(", "args", "params", ".", "SetStatus", ")", "(", "params", ".", "ErrorResults", ",", "error", ")", "{", "result", ":=", "params", ".", "ErrorResults", "{", "Results", ":", "make", "(", "[", "...
// SetOperatorStatus updates the operator status for each given application.
[ "SetOperatorStatus", "updates", "the", "operator", "status", "for", "each", "given", "application", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/caasunitprovisioner/provisioner.go#L1212-L1239
3,708
juju/juju
component/all/payload.go
Component
func (c payloadsHookContext) Component(name string) (context.Component, error) { found, err := c.Context.Component(name) if err != nil { return nil, errors.Trace(err) } compCtx, ok := found.(context.Component) if !ok && found != nil { return nil, errors.Errorf("wrong component context type registered: %T", fou...
go
func (c payloadsHookContext) Component(name string) (context.Component, error) { found, err := c.Context.Component(name) if err != nil { return nil, errors.Trace(err) } compCtx, ok := found.(context.Component) if !ok && found != nil { return nil, errors.Errorf("wrong component context type registered: %T", fou...
[ "func", "(", "c", "payloadsHookContext", ")", "Component", "(", "name", "string", ")", "(", "context", ".", "Component", ",", "error", ")", "{", "found", ",", "err", ":=", "c", ".", "Context", ".", "Component", "(", "name", ")", "\n", "if", "err", "!...
// Component implements context.HookContext.
[ "Component", "implements", "context", ".", "HookContext", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/component/all/payload.go#L94-L104
3,709
juju/juju
core/migration/targetinfo.go
Validate
func (info *TargetInfo) Validate() error { if !names.IsValidModel(info.ControllerTag.Id()) { return errors.NotValidf("ControllerTag") } if len(info.Addrs) < 1 { return errors.NotValidf("empty Addrs") } for _, addr := range info.Addrs { _, err := network.ParseHostPort(addr) if err != nil { return errors...
go
func (info *TargetInfo) Validate() error { if !names.IsValidModel(info.ControllerTag.Id()) { return errors.NotValidf("ControllerTag") } if len(info.Addrs) < 1 { return errors.NotValidf("empty Addrs") } for _, addr := range info.Addrs { _, err := network.ParseHostPort(addr) if err != nil { return errors...
[ "func", "(", "info", "*", "TargetInfo", ")", "Validate", "(", ")", "error", "{", "if", "!", "names", ".", "IsValidModel", "(", "info", ".", "ControllerTag", ".", "Id", "(", ")", ")", "{", "return", "errors", ".", "NotValidf", "(", "\"", "\"", ")", ...
// Validate returns an error if the TargetInfo contains bad data. Nil // is returned otherwise.
[ "Validate", "returns", "an", "error", "if", "the", "TargetInfo", "contains", "bad", "data", ".", "Nil", "is", "returned", "otherwise", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/migration/targetinfo.go#L50-L74
3,710
juju/juju
environs/imagemetadata/generate.go
IndexStoragePath
func IndexStoragePath() string { return path.Join(storage.BaseImagesPath, simplestreams.UnsignedIndex(currentStreamsVersion, IndexFileVersion)) }
go
func IndexStoragePath() string { return path.Join(storage.BaseImagesPath, simplestreams.UnsignedIndex(currentStreamsVersion, IndexFileVersion)) }
[ "func", "IndexStoragePath", "(", ")", "string", "{", "return", "path", ".", "Join", "(", "storage", ".", "BaseImagesPath", ",", "simplestreams", ".", "UnsignedIndex", "(", "currentStreamsVersion", ",", "IndexFileVersion", ")", ")", "\n", "}" ]
// IndexStoragePath returns the storage path for the image metadata index file.
[ "IndexStoragePath", "returns", "the", "storage", "path", "for", "the", "image", "metadata", "index", "file", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/imagemetadata/generate.go#L20-L22
3,711
juju/juju
environs/imagemetadata/generate.go
readMetadata
func readMetadata(metadataStore storage.Storage) ([]*ImageMetadata, error) { // Read any existing metadata so we can merge the new tools metadata with what's there. dataSource := storage.NewStorageSimpleStreamsDataSource("existing metadata", metadataStore, storage.BaseImagesPath, simplestreams.EXISTING_CLOUD_DATA, fa...
go
func readMetadata(metadataStore storage.Storage) ([]*ImageMetadata, error) { // Read any existing metadata so we can merge the new tools metadata with what's there. dataSource := storage.NewStorageSimpleStreamsDataSource("existing metadata", metadataStore, storage.BaseImagesPath, simplestreams.EXISTING_CLOUD_DATA, fa...
[ "func", "readMetadata", "(", "metadataStore", "storage", ".", "Storage", ")", "(", "[", "]", "*", "ImageMetadata", ",", "error", ")", "{", "// Read any existing metadata so we can merge the new tools metadata with what's there.", "dataSource", ":=", "storage", ".", "NewSt...
// readMetadata reads the image metadata from metadataStore.
[ "readMetadata", "reads", "the", "image", "metadata", "from", "metadataStore", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/imagemetadata/generate.go#L47-L56
3,712
juju/juju
environs/imagemetadata/generate.go
mapKey
func mapKey(im *ImageMetadata) string { return fmt.Sprintf("%s-%s-%s-%s", im.productId(), im.RegionName, im.VirtType, im.Storage) }
go
func mapKey(im *ImageMetadata) string { return fmt.Sprintf("%s-%s-%s-%s", im.productId(), im.RegionName, im.VirtType, im.Storage) }
[ "func", "mapKey", "(", "im", "*", "ImageMetadata", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "im", ".", "productId", "(", ")", ",", "im", ".", "RegionName", ",", "im", ".", "VirtType", ",", "im", ".", "Storage", ")"...
// mapKey returns a key that uniquely identifies image metadata. // The metadata for different images may have similar values // for some parameters. This key ensures that truly distinct // metadata is not overwritten by closely related ones. // This key is similar to image metadata key built in state which combines //...
[ "mapKey", "returns", "a", "key", "that", "uniquely", "identifies", "image", "metadata", ".", "The", "metadata", "for", "different", "images", "may", "have", "similar", "values", "for", "some", "parameters", ".", "This", "key", "ensures", "that", "truly", "dist...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/imagemetadata/generate.go#L64-L66
3,713
juju/juju
environs/imagemetadata/generate.go
mergeMetadata
func mergeMetadata(seriesVersion string, cloudSpec *simplestreams.CloudSpec, newMetadata, existingMetadata []*ImageMetadata) ([]*ImageMetadata, []simplestreams.CloudSpec) { regions := make(map[string]bool) var allCloudSpecs = []simplestreams.CloudSpec{} // Each metadata item defines its own cloud specification. /...
go
func mergeMetadata(seriesVersion string, cloudSpec *simplestreams.CloudSpec, newMetadata, existingMetadata []*ImageMetadata) ([]*ImageMetadata, []simplestreams.CloudSpec) { regions := make(map[string]bool) var allCloudSpecs = []simplestreams.CloudSpec{} // Each metadata item defines its own cloud specification. /...
[ "func", "mergeMetadata", "(", "seriesVersion", "string", ",", "cloudSpec", "*", "simplestreams", ".", "CloudSpec", ",", "newMetadata", ",", "existingMetadata", "[", "]", "*", "ImageMetadata", ")", "(", "[", "]", "*", "ImageMetadata", ",", "[", "]", "simplestre...
// mergeMetadata merges the newMetadata into existingMetadata, overwriting existing matching image records.
[ "mergeMetadata", "merges", "the", "newMetadata", "into", "existingMetadata", "overwriting", "existing", "matching", "image", "records", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/imagemetadata/generate.go#L69-L109
3,714
juju/juju
environs/imagemetadata/generate.go
writeMetadata
func writeMetadata(metadata []*ImageMetadata, cloudSpec []simplestreams.CloudSpec, metadataStore storage.Storage) error { // TODO(perrito666) 2016-05-02 lp:1558657 index, products, err := MarshalImageMetadataJSON(metadata, cloudSpec, time.Now()) if err != nil { return err } metadataInfo := []MetadataFile{ {I...
go
func writeMetadata(metadata []*ImageMetadata, cloudSpec []simplestreams.CloudSpec, metadataStore storage.Storage) error { // TODO(perrito666) 2016-05-02 lp:1558657 index, products, err := MarshalImageMetadataJSON(metadata, cloudSpec, time.Now()) if err != nil { return err } metadataInfo := []MetadataFile{ {I...
[ "func", "writeMetadata", "(", "metadata", "[", "]", "*", "ImageMetadata", ",", "cloudSpec", "[", "]", "simplestreams", ".", "CloudSpec", ",", "metadataStore", "storage", ".", "Storage", ")", "error", "{", "// TODO(perrito666) 2016-05-02 lp:1558657", "index", ",", ...
// writeMetadata generates some basic simplestreams metadata using the specified cloud and image details and writes // it to the supplied store.
[ "writeMetadata", "generates", "some", "basic", "simplestreams", "metadata", "using", "the", "specified", "cloud", "and", "image", "details", "and", "writes", "it", "to", "the", "supplied", "store", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/environs/imagemetadata/generate.go#L118-L137
3,715
juju/juju
state/presence/pruner.go
queueRemoval
func (p *Pruner) queueRemoval(seq int64) { p.toRemove = append(p.toRemove, docIDInt64(p.modelUUID, seq)) }
go
func (p *Pruner) queueRemoval(seq int64) { p.toRemove = append(p.toRemove, docIDInt64(p.modelUUID, seq)) }
[ "func", "(", "p", "*", "Pruner", ")", "queueRemoval", "(", "seq", "int64", ")", "{", "p", ".", "toRemove", "=", "append", "(", "p", ".", "toRemove", ",", "docIDInt64", "(", "p", ".", "modelUUID", ",", "seq", ")", ")", "\n", "}" ]
// queueRemoval includes this sequence as one that has been superseded
[ "queueRemoval", "includes", "this", "sequence", "as", "one", "that", "has", "been", "superseded" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/presence/pruner.go#L63-L65
3,716
juju/juju
state/presence/pruner.go
flushRemovals
func (p *Pruner) flushRemovals() error { if len(p.toRemove) == 0 { return nil } matched, err := p.beingsC.RemoveAll(bson.M{"_id": bson.M{"$in": p.toRemove}}) if err != nil { return err } p.toRemove = p.toRemove[:0] if matched.Removed > 0 { p.removedCount += uint64(matched.Removed) } return err }
go
func (p *Pruner) flushRemovals() error { if len(p.toRemove) == 0 { return nil } matched, err := p.beingsC.RemoveAll(bson.M{"_id": bson.M{"$in": p.toRemove}}) if err != nil { return err } p.toRemove = p.toRemove[:0] if matched.Removed > 0 { p.removedCount += uint64(matched.Removed) } return err }
[ "func", "(", "p", "*", "Pruner", ")", "flushRemovals", "(", ")", "error", "{", "if", "len", "(", "p", ".", "toRemove", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "matched", ",", "err", ":=", "p", ".", "beingsC", ".", "RemoveAll", "(",...
// flushRemovals makes sure that we've applied all desired removals
[ "flushRemovals", "makes", "sure", "that", "we", "ve", "applied", "all", "desired", "removals" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/presence/pruner.go#L68-L81
3,717
juju/juju
state/presence/pruner.go
NewPruner
func NewPruner(modelUUID string, beings *mgo.Collection, pings *mgo.Collection, delta time.Duration) *Pruner { return &Pruner{ modelUUID: modelUUID, beingsC: beings, maxQueue: 1000, pingsC: pings, delta: delta, } }
go
func NewPruner(modelUUID string, beings *mgo.Collection, pings *mgo.Collection, delta time.Duration) *Pruner { return &Pruner{ modelUUID: modelUUID, beingsC: beings, maxQueue: 1000, pingsC: pings, delta: delta, } }
[ "func", "NewPruner", "(", "modelUUID", "string", ",", "beings", "*", "mgo", ".", "Collection", ",", "pings", "*", "mgo", ".", "Collection", ",", "delta", "time", ".", "Duration", ")", "*", "Pruner", "{", "return", "&", "Pruner", "{", "modelUUID", ":", ...
// NewPruner returns an object that is ready to prune the Beings collection // of old beings sequence entries that we no longer need.
[ "NewPruner", "returns", "an", "object", "that", "is", "ready", "to", "prune", "the", "Beings", "collection", "of", "old", "beings", "sequence", "entries", "that", "we", "no", "longer", "need", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/presence/pruner.go#L196-L204
3,718
juju/juju
apiserver/facades/controller/agenttools/agenttools.go
NewFacade
func NewFacade(st *state.State, resources facade.Resources, authorizer facade.Authorizer) (*AgentToolsAPI, error) { newEnviron := func() (environs.Environ, error) { newEnviron := stateenvirons.GetNewEnvironFunc(environs.New) return newEnviron(st) } return NewAgentToolsAPI(st, newEnviron, findTools, envVersionUpd...
go
func NewFacade(st *state.State, resources facade.Resources, authorizer facade.Authorizer) (*AgentToolsAPI, error) { newEnviron := func() (environs.Environ, error) { newEnviron := stateenvirons.GetNewEnvironFunc(environs.New) return newEnviron(st) } return NewAgentToolsAPI(st, newEnviron, findTools, envVersionUpd...
[ "func", "NewFacade", "(", "st", "*", "state", ".", "State", ",", "resources", "facade", ".", "Resources", ",", "authorizer", "facade", ".", "Authorizer", ")", "(", "*", "AgentToolsAPI", ",", "error", ")", "{", "newEnviron", ":=", "func", "(", ")", "(", ...
// NewFacade is used to register the facade.
[ "NewFacade", "is", "used", "to", "register", "the", "facade", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/agenttools/agenttools.go#L38-L44
3,719
juju/juju
apiserver/facades/controller/agenttools/agenttools.go
NewAgentToolsAPI
func NewAgentToolsAPI( modelGetter ModelGetter, newEnviron func() (environs.Environ, error), findTools toolsFinder, envVersionUpdate func(*state.Model, version.Number) error, authorizer facade.Authorizer, ) (*AgentToolsAPI, error) { return &AgentToolsAPI{ modelGetter: modelGetter, newEnviron: newEn...
go
func NewAgentToolsAPI( modelGetter ModelGetter, newEnviron func() (environs.Environ, error), findTools toolsFinder, envVersionUpdate func(*state.Model, version.Number) error, authorizer facade.Authorizer, ) (*AgentToolsAPI, error) { return &AgentToolsAPI{ modelGetter: modelGetter, newEnviron: newEn...
[ "func", "NewAgentToolsAPI", "(", "modelGetter", "ModelGetter", ",", "newEnviron", "func", "(", ")", "(", "environs", ".", "Environ", ",", "error", ")", ",", "findTools", "toolsFinder", ",", "envVersionUpdate", "func", "(", "*", "state", ".", "Model", ",", "v...
// NewAgentToolsAPI creates a new instance of the Model API.
[ "NewAgentToolsAPI", "creates", "a", "new", "instance", "of", "the", "Model", "API", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/agenttools/agenttools.go#L47-L61
3,720
juju/juju
apiserver/facades/controller/agenttools/agenttools.go
envVersionUpdate
func envVersionUpdate(env *state.Model, ver version.Number) error { return env.UpdateLatestToolsVersion(ver) }
go
func envVersionUpdate(env *state.Model, ver version.Number) error { return env.UpdateLatestToolsVersion(ver) }
[ "func", "envVersionUpdate", "(", "env", "*", "state", ".", "Model", ",", "ver", "version", ".", "Number", ")", "error", "{", "return", "env", ".", "UpdateLatestToolsVersion", "(", "ver", ")", "\n", "}" ]
// Base implementation of envVersionUpdater
[ "Base", "implementation", "of", "envVersionUpdater" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/agenttools/agenttools.go#L106-L108
3,721
juju/juju
apiserver/facades/controller/agenttools/agenttools.go
UpdateToolsAvailable
func (api *AgentToolsAPI) UpdateToolsAvailable() error { if !api.authorizer.AuthController() { return common.ErrPerm } return updateToolsAvailability(api.modelGetter, api.newEnviron, api.findTools, api.envVersionUpdate) }
go
func (api *AgentToolsAPI) UpdateToolsAvailable() error { if !api.authorizer.AuthController() { return common.ErrPerm } return updateToolsAvailability(api.modelGetter, api.newEnviron, api.findTools, api.envVersionUpdate) }
[ "func", "(", "api", "*", "AgentToolsAPI", ")", "UpdateToolsAvailable", "(", ")", "error", "{", "if", "!", "api", ".", "authorizer", ".", "AuthController", "(", ")", "{", "return", "common", ".", "ErrPerm", "\n", "}", "\n", "return", "updateToolsAvailability"...
// UpdateToolsAvailable invokes a lookup and further update in environ // for new patches of the current tool versions.
[ "UpdateToolsAvailable", "invokes", "a", "lookup", "and", "further", "update", "in", "environ", "for", "new", "patches", "of", "the", "current", "tool", "versions", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/agenttools/agenttools.go#L136-L141
3,722
juju/juju
cmd/juju/crossmodel/findformatter.go
formatFindTabular
func formatFindTabular(writer io.Writer, value interface{}) error { endpoints, ok := value.(map[string]ApplicationOfferResult) if !ok { return errors.Errorf("expected value of type %T, got %T", endpoints, value) } return formatFoundEndpointsTabular(writer, endpoints) }
go
func formatFindTabular(writer io.Writer, value interface{}) error { endpoints, ok := value.(map[string]ApplicationOfferResult) if !ok { return errors.Errorf("expected value of type %T, got %T", endpoints, value) } return formatFoundEndpointsTabular(writer, endpoints) }
[ "func", "formatFindTabular", "(", "writer", "io", ".", "Writer", ",", "value", "interface", "{", "}", ")", "error", "{", "endpoints", ",", "ok", ":=", "value", ".", "(", "map", "[", "string", "]", "ApplicationOfferResult", ")", "\n", "if", "!", "ok", "...
// formatFindTabular returns a tabular summary of remote applications or // errors out if parameter is not of expected type.
[ "formatFindTabular", "returns", "a", "tabular", "summary", "of", "remote", "applications", "or", "errors", "out", "if", "parameter", "is", "not", "of", "expected", "type", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/crossmodel/findformatter.go#L20-L26
3,723
juju/juju
cmd/juju/crossmodel/findformatter.go
formatFoundEndpointsTabular
func formatFoundEndpointsTabular(writer io.Writer, all map[string]ApplicationOfferResult) error { tw := output.TabWriter(writer) w := output.Wrapper{tw} w.Println("Store", "URL", "Access", "Interfaces") for urlStr, one := range all { url, err := crossmodel.ParseOfferURL(urlStr) if err != nil { return err ...
go
func formatFoundEndpointsTabular(writer io.Writer, all map[string]ApplicationOfferResult) error { tw := output.TabWriter(writer) w := output.Wrapper{tw} w.Println("Store", "URL", "Access", "Interfaces") for urlStr, one := range all { url, err := crossmodel.ParseOfferURL(urlStr) if err != nil { return err ...
[ "func", "formatFoundEndpointsTabular", "(", "writer", "io", ".", "Writer", ",", "all", "map", "[", "string", "]", "ApplicationOfferResult", ")", "error", "{", "tw", ":=", "output", ".", "TabWriter", "(", "writer", ")", "\n", "w", ":=", "output", ".", "Wrap...
// formatFoundEndpointsTabular returns a tabular summary of offered applications' endpoints.
[ "formatFoundEndpointsTabular", "returns", "a", "tabular", "summary", "of", "offered", "applications", "endpoints", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/crossmodel/findformatter.go#L29-L52
3,724
juju/juju
core/crossmodel/offerurl.go
Path
func (u *OfferURL) Path() string { var parts []string if u.User != "" { parts = append(parts, u.User) } if u.ModelName != "" { parts = append(parts, u.ModelName) } path := strings.Join(parts, "/") path = fmt.Sprintf("%s.%s", path, u.ApplicationName) if u.Source == "" { return path } return fmt.Sprintf("...
go
func (u *OfferURL) Path() string { var parts []string if u.User != "" { parts = append(parts, u.User) } if u.ModelName != "" { parts = append(parts, u.ModelName) } path := strings.Join(parts, "/") path = fmt.Sprintf("%s.%s", path, u.ApplicationName) if u.Source == "" { return path } return fmt.Sprintf("...
[ "func", "(", "u", "*", "OfferURL", ")", "Path", "(", ")", "string", "{", "var", "parts", "[", "]", "string", "\n", "if", "u", ".", "User", "!=", "\"", "\"", "{", "parts", "=", "append", "(", "parts", ",", "u", ".", "User", ")", "\n", "}", "\n...
// Path returns the path component of the URL.
[ "Path", "returns", "the", "path", "component", "of", "the", "URL", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/crossmodel/offerurl.go#L36-L50
3,725
juju/juju
core/crossmodel/offerurl.go
parseOfferURL
func parseOfferURL(urlStr string) (*OfferURL, error) { urlParts, err := parseOfferURLParts(urlStr, false) if err != nil { return nil, err } url := OfferURL(*urlParts) return &url, nil }
go
func parseOfferURL(urlStr string) (*OfferURL, error) { urlParts, err := parseOfferURLParts(urlStr, false) if err != nil { return nil, err } url := OfferURL(*urlParts) return &url, nil }
[ "func", "parseOfferURL", "(", "urlStr", "string", ")", "(", "*", "OfferURL", ",", "error", ")", "{", "urlParts", ",", "err", ":=", "parseOfferURLParts", "(", "urlStr", ",", "false", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err",...
// parseOfferURL parses the specified URL string into an OfferURL.
[ "parseOfferURL", "parses", "the", "specified", "URL", "string", "into", "an", "OfferURL", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/crossmodel/offerurl.go#L87-L94
3,726
juju/juju
core/crossmodel/offerurl.go
MakeURL
func MakeURL(user, model, application, controller string) string { base := fmt.Sprintf("%s/%s.%s", user, model, application) if controller == "" { return base } return fmt.Sprintf("%s:%s", controller, base) }
go
func MakeURL(user, model, application, controller string) string { base := fmt.Sprintf("%s/%s.%s", user, model, application) if controller == "" { return base } return fmt.Sprintf("%s:%s", controller, base) }
[ "func", "MakeURL", "(", "user", ",", "model", ",", "application", ",", "controller", "string", ")", "string", "{", "base", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "user", ",", "model", ",", "application", ")", "\n", "if", "controller", "==",...
// MakeURL constructs an offer URL from the specified components.
[ "MakeURL", "constructs", "an", "offer", "URL", "from", "the", "specified", "components", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/crossmodel/offerurl.go#L161-L167
3,727
juju/juju
provider/cloudsigma/provider.go
Open
func (environProvider) Open(args environs.OpenParams) (environs.Environ, error) { logger.Infof("opening model %q", args.Config.Name()) if err := validateCloudSpec(args.Cloud); err != nil { return nil, errors.Annotate(err, "validating cloud spec") } client, err := newClient(args.Cloud, args.Config.UUID()) if err...
go
func (environProvider) Open(args environs.OpenParams) (environs.Environ, error) { logger.Infof("opening model %q", args.Config.Name()) if err := validateCloudSpec(args.Cloud); err != nil { return nil, errors.Annotate(err, "validating cloud spec") } client, err := newClient(args.Cloud, args.Config.UUID()) if err...
[ "func", "(", "environProvider", ")", "Open", "(", "args", "environs", ".", "OpenParams", ")", "(", "environs", ".", "Environ", ",", "error", ")", "{", "logger", ".", "Infof", "(", "\"", "\"", ",", "args", ".", "Config", ".", "Name", "(", ")", ")", ...
// Open opens the environment and returns it. // The configuration must have come from a previously // prepared environment.
[ "Open", "opens", "the", "environment", "and", "returns", "it", ".", "The", "configuration", "must", "have", "come", "from", "a", "previously", "prepared", "environment", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/cloudsigma/provider.go#L69-L89
3,728
juju/juju
provider/cloudsigma/provider.go
Validate
func (environProvider) Validate(cfg, old *config.Config) (*config.Config, error) { logger.Infof("validating model %q", cfg.Name()) // You should almost certainly not change this method; if you need to change // how configs are validated, you should edit validateConfig itself, to ensure // that your checks are alwa...
go
func (environProvider) Validate(cfg, old *config.Config) (*config.Config, error) { logger.Infof("validating model %q", cfg.Name()) // You should almost certainly not change this method; if you need to change // how configs are validated, you should edit validateConfig itself, to ensure // that your checks are alwa...
[ "func", "(", "environProvider", ")", "Validate", "(", "cfg", ",", "old", "*", "config", ".", "Config", ")", "(", "*", "config", ".", "Config", ",", "error", ")", "{", "logger", ".", "Infof", "(", "\"", "\"", ",", "cfg", ".", "Name", "(", ")", ")"...
// Validate ensures that config is a valid configuration for this // provider, applying changes to it if necessary, and returns the // validated configuration. // If old is not nil, it holds the previous environment configuration // for consideration when validating changes.
[ "Validate", "ensures", "that", "config", "is", "a", "valid", "configuration", "for", "this", "provider", "applying", "changes", "to", "it", "if", "necessary", "and", "returns", "the", "validated", "configuration", ".", "If", "old", "is", "not", "nil", "it", ...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/cloudsigma/provider.go#L115-L136
3,729
juju/juju
worker/metricworker/cleanup.go
newCleanup
func newCleanup(client metricsmanager.MetricsManagerClient, notify chan string) worker.Worker { f := func(stopCh <-chan struct{}) error { err := client.CleanupOldMetrics() if err != nil { cleanupLogger.Warningf("failed to cleanup %v - will retry later", err) return nil } select { case notify <- "cleanu...
go
func newCleanup(client metricsmanager.MetricsManagerClient, notify chan string) worker.Worker { f := func(stopCh <-chan struct{}) error { err := client.CleanupOldMetrics() if err != nil { cleanupLogger.Warningf("failed to cleanup %v - will retry later", err) return nil } select { case notify <- "cleanu...
[ "func", "newCleanup", "(", "client", "metricsmanager", ".", "MetricsManagerClient", ",", "notify", "chan", "string", ")", "worker", ".", "Worker", "{", "f", ":=", "func", "(", "stopCh", "<-", "chan", "struct", "{", "}", ")", "error", "{", "err", ":=", "c...
// NewCleanup creates a new periodic worker that calls the CleanupOldMetrics api.
[ "NewCleanup", "creates", "a", "new", "periodic", "worker", "that", "calls", "the", "CleanupOldMetrics", "api", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/metricworker/cleanup.go#L21-L35
3,730
juju/juju
provider/oci/networking.go
ensureNetworksAndSubnets
func (e *Environ) ensureNetworksAndSubnets(ctx envcontext.ProviderCallContext, controllerUUID, modelUUID string) (map[string][]ociCore.Subnet, error) { // if we have the subnets field populated, it means we already checked/created // the necessary resources. Simply return. if e.subnets != nil { return e.subnets, n...
go
func (e *Environ) ensureNetworksAndSubnets(ctx envcontext.ProviderCallContext, controllerUUID, modelUUID string) (map[string][]ociCore.Subnet, error) { // if we have the subnets field populated, it means we already checked/created // the necessary resources. Simply return. if e.subnets != nil { return e.subnets, n...
[ "func", "(", "e", "*", "Environ", ")", "ensureNetworksAndSubnets", "(", "ctx", "envcontext", ".", "ProviderCallContext", ",", "controllerUUID", ",", "modelUUID", "string", ")", "(", "map", "[", "string", "]", "[", "]", "ociCore", ".", "Subnet", ",", "error",...
// ensureNetworksAndSubnets creates VCNs, security lists and subnets that will // be used throughout the life-cycle of this juju deployment.
[ "ensureNetworksAndSubnets", "creates", "VCNs", "security", "lists", "and", "subnets", "that", "will", "be", "used", "throughout", "the", "life", "-", "cycle", "of", "this", "juju", "deployment", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oci/networking.go#L449-L506
3,731
juju/juju
provider/oci/networking.go
cleanupNetworksAndSubnets
func (e *Environ) cleanupNetworksAndSubnets(controllerUUID, modelUUID string) error { vcns, err := e.allVCNs(controllerUUID, modelUUID) if err != nil { return errors.Trace(err) } if len(vcns) == 0 { return nil } for _, vcn := range vcns { allSubnets, err := e.allSubnets(controllerUUID, modelUUID, vcn.Id) ...
go
func (e *Environ) cleanupNetworksAndSubnets(controllerUUID, modelUUID string) error { vcns, err := e.allVCNs(controllerUUID, modelUUID) if err != nil { return errors.Trace(err) } if len(vcns) == 0 { return nil } for _, vcn := range vcns { allSubnets, err := e.allSubnets(controllerUUID, modelUUID, vcn.Id) ...
[ "func", "(", "e", "*", "Environ", ")", "cleanupNetworksAndSubnets", "(", "controllerUUID", ",", "modelUUID", "string", ")", "error", "{", "vcns", ",", "err", ":=", "e", ".", "allVCNs", "(", "controllerUUID", ",", "modelUUID", ")", "\n", "if", "err", "!=", ...
// cleanupNetworksAndSubnets destroys all subnets, VCNs and security lists that have // been used by this juju deployment. This function should only be called when // destroying the environment, and only after destroying any resources that may be attached // to a network.
[ "cleanupNetworksAndSubnets", "destroys", "all", "subnets", "VCNs", "and", "security", "lists", "that", "have", "been", "used", "by", "this", "juju", "deployment", ".", "This", "function", "should", "only", "be", "called", "when", "destroying", "the", "environment"...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/oci/networking.go#L588-L630
3,732
juju/juju
state/metrics.go
validate
func (m *MetricBatch) validate() error { charmURL, err := charm.ParseURL(m.doc.CharmURL) if err != nil { return errors.Trace(err) } chrm, err := m.st.Charm(charmURL) if err != nil { return errors.Trace(err) } chrmMetrics := chrm.Metrics() if chrmMetrics == nil { return errors.Errorf("charm doesn't impleme...
go
func (m *MetricBatch) validate() error { charmURL, err := charm.ParseURL(m.doc.CharmURL) if err != nil { return errors.Trace(err) } chrm, err := m.st.Charm(charmURL) if err != nil { return errors.Trace(err) } chrmMetrics := chrm.Metrics() if chrmMetrics == nil { return errors.Errorf("charm doesn't impleme...
[ "func", "(", "m", "*", "MetricBatch", ")", "validate", "(", ")", "error", "{", "charmURL", ",", "err", ":=", "charm", ".", "ParseURL", "(", "m", ".", "doc", ".", "CharmURL", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Trace"...
// validate checks that the MetricBatch contains valid metrics.
[ "validate", "checks", "that", "the", "MetricBatch", "contains", "valid", "metrics", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/metrics.go#L98-L117
3,733
juju/juju
state/metrics.go
AddMetrics
func (st *State) AddMetrics(batch BatchParam) (*MetricBatch, error) { if len(batch.Metrics) == 0 { return nil, errors.New("cannot add a batch of 0 metrics") } charmURL, err := charm.ParseURL(batch.CharmURL) if err != nil { return nil, errors.NewNotValid(err, "could not parse charm URL") } unit, err := st.Uni...
go
func (st *State) AddMetrics(batch BatchParam) (*MetricBatch, error) { if len(batch.Metrics) == 0 { return nil, errors.New("cannot add a batch of 0 metrics") } charmURL, err := charm.ParseURL(batch.CharmURL) if err != nil { return nil, errors.NewNotValid(err, "could not parse charm URL") } unit, err := st.Uni...
[ "func", "(", "st", "*", "State", ")", "AddMetrics", "(", "batch", "BatchParam", ")", "(", "*", "MetricBatch", ",", "error", ")", "{", "if", "len", "(", "batch", ".", "Metrics", ")", "==", "0", "{", "return", "nil", ",", "errors", ".", "New", "(", ...
// AddMetrics adds a new batch of metrics to the database.
[ "AddMetrics", "adds", "a", "new", "batch", "of", "metrics", "to", "the", "database", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/metrics.go#L138-L207
3,734
juju/juju
state/metrics.go
AddModelMetrics
func (st *State) AddModelMetrics(batch ModelBatchParam) (*MetricBatch, error) { if len(batch.Metrics) == 0 { return nil, errors.New("cannot add a batch of 0 metrics") } slaCreds, err := st.SLACredential() if err != nil { return nil, errors.Trace(err) } metric := &MetricBatch{ st: st, doc: metricBatchDoc{ ...
go
func (st *State) AddModelMetrics(batch ModelBatchParam) (*MetricBatch, error) { if len(batch.Metrics) == 0 { return nil, errors.New("cannot add a batch of 0 metrics") } slaCreds, err := st.SLACredential() if err != nil { return nil, errors.Trace(err) } metric := &MetricBatch{ st: st, doc: metricBatchDoc{ ...
[ "func", "(", "st", "*", "State", ")", "AddModelMetrics", "(", "batch", "ModelBatchParam", ")", "(", "*", "MetricBatch", ",", "error", ")", "{", "if", "len", "(", "batch", ".", "Metrics", ")", "==", "0", "{", "return", "nil", ",", "errors", ".", "New"...
// AddModelMetrics adds a new model-centric batch of metrics to the database.
[ "AddModelMetrics", "adds", "a", "new", "model", "-", "centric", "batch", "of", "metrics", "to", "the", "database", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/metrics.go#L210-L253
3,735
juju/juju
state/metrics.go
MetricBatchesForUnit
func (st *State) MetricBatchesForUnit(unit string) ([]MetricBatch, error) { _, err := st.Unit(unit) if err != nil { return nil, errors.Trace(err) } return st.queryMetricBatches(bson.M{"unit": unit}) }
go
func (st *State) MetricBatchesForUnit(unit string) ([]MetricBatch, error) { _, err := st.Unit(unit) if err != nil { return nil, errors.Trace(err) } return st.queryMetricBatches(bson.M{"unit": unit}) }
[ "func", "(", "st", "*", "State", ")", "MetricBatchesForUnit", "(", "unit", "string", ")", "(", "[", "]", "MetricBatch", ",", "error", ")", "{", "_", ",", "err", ":=", "st", ".", "Unit", "(", "unit", ")", "\n", "if", "err", "!=", "nil", "{", "retu...
// MetricBatchesForUnit returns metric batches for the given unit.
[ "MetricBatchesForUnit", "returns", "metric", "batches", "for", "the", "given", "unit", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/metrics.go#L290-L296
3,736
juju/juju
state/metrics.go
MetricBatchesForModel
func (st *State) MetricBatchesForModel() ([]MetricBatch, error) { return st.queryMetricBatches(bson.M{"model-uuid": st.ModelUUID()}) }
go
func (st *State) MetricBatchesForModel() ([]MetricBatch, error) { return st.queryMetricBatches(bson.M{"model-uuid": st.ModelUUID()}) }
[ "func", "(", "st", "*", "State", ")", "MetricBatchesForModel", "(", ")", "(", "[", "]", "MetricBatch", ",", "error", ")", "{", "return", "st", ".", "queryMetricBatches", "(", "bson", ".", "M", "{", "\"", "\"", ":", "st", ".", "ModelUUID", "(", ")", ...
// MetricBatchesForModel returns metric batches for all the units in the model.
[ "MetricBatchesForModel", "returns", "metric", "batches", "for", "all", "the", "units", "in", "the", "model", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/metrics.go#L299-L301
3,737
juju/juju
state/metrics.go
MetricBatchesForApplication
func (st *State) MetricBatchesForApplication(application string) ([]MetricBatch, error) { app, err := st.Application(application) if err != nil { return nil, errors.Trace(err) } units, err := app.AllUnits() if err != nil { return nil, errors.Trace(err) } unitNames := make([]bson.M, len(units)) for i, u := r...
go
func (st *State) MetricBatchesForApplication(application string) ([]MetricBatch, error) { app, err := st.Application(application) if err != nil { return nil, errors.Trace(err) } units, err := app.AllUnits() if err != nil { return nil, errors.Trace(err) } unitNames := make([]bson.M, len(units)) for i, u := r...
[ "func", "(", "st", "*", "State", ")", "MetricBatchesForApplication", "(", "application", "string", ")", "(", "[", "]", "MetricBatch", ",", "error", ")", "{", "app", ",", "err", ":=", "st", ".", "Application", "(", "application", ")", "\n", "if", "err", ...
// MetricBatchesForApplication returns metric batches for the given application.
[ "MetricBatchesForApplication", "returns", "metric", "batches", "for", "the", "given", "application", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/metrics.go#L304-L318
3,738
juju/juju
state/metrics.go
MetricBatch
func (st *State) MetricBatch(id string) (*MetricBatch, error) { c, closer := st.db().GetCollection(metricsC) defer closer() doc := metricBatchDoc{} err := c.Find(bson.M{"_id": id}).One(&doc) if err == mgo.ErrNotFound { return nil, errors.NotFoundf("metric %v", id) } if err != nil { return nil, err } return...
go
func (st *State) MetricBatch(id string) (*MetricBatch, error) { c, closer := st.db().GetCollection(metricsC) defer closer() doc := metricBatchDoc{} err := c.Find(bson.M{"_id": id}).One(&doc) if err == mgo.ErrNotFound { return nil, errors.NotFoundf("metric %v", id) } if err != nil { return nil, err } return...
[ "func", "(", "st", "*", "State", ")", "MetricBatch", "(", "id", "string", ")", "(", "*", "MetricBatch", ",", "error", ")", "{", "c", ",", "closer", ":=", "st", ".", "db", "(", ")", ".", "GetCollection", "(", "metricsC", ")", "\n", "defer", "closer"...
// MetricBatch returns the metric batch with the given id.
[ "MetricBatch", "returns", "the", "metric", "batch", "with", "the", "given", "id", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/metrics.go#L321-L333
3,739
juju/juju
state/metrics.go
MetricsToSend
func (st *State) MetricsToSend(batchSize int) ([]*MetricBatch, error) { var docs []metricBatchDoc c, closer := st.db().GetCollection(metricsC) defer closer() q := bson.M{ "model-uuid": st.ModelUUID(), "sent": false, } err := c.Find(q).Limit(batchSize).All(&docs) if err != nil { return nil, errors.Tr...
go
func (st *State) MetricsToSend(batchSize int) ([]*MetricBatch, error) { var docs []metricBatchDoc c, closer := st.db().GetCollection(metricsC) defer closer() q := bson.M{ "model-uuid": st.ModelUUID(), "sent": false, } err := c.Find(q).Limit(batchSize).All(&docs) if err != nil { return nil, errors.Tr...
[ "func", "(", "st", "*", "State", ")", "MetricsToSend", "(", "batchSize", "int", ")", "(", "[", "]", "*", "MetricBatch", ",", "error", ")", "{", "var", "docs", "[", "]", "metricBatchDoc", "\n", "c", ",", "closer", ":=", "st", ".", "db", "(", ")", ...
// MetricsToSend returns batchSize metrics that need to be sent // to the collector
[ "MetricsToSend", "returns", "batchSize", "metrics", "that", "need", "to", "be", "sent", "to", "the", "collector" ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/metrics.go#L359-L380
3,740
juju/juju
state/metrics.go
CountOfUnsentMetrics
func (st *State) CountOfUnsentMetrics() (int, error) { c, closer := st.db().GetCollection(metricsC) defer closer() return c.Find(bson.M{ "model-uuid": st.ModelUUID(), "sent": false, }).Count() }
go
func (st *State) CountOfUnsentMetrics() (int, error) { c, closer := st.db().GetCollection(metricsC) defer closer() return c.Find(bson.M{ "model-uuid": st.ModelUUID(), "sent": false, }).Count() }
[ "func", "(", "st", "*", "State", ")", "CountOfUnsentMetrics", "(", ")", "(", "int", ",", "error", ")", "{", "c", ",", "closer", ":=", "st", ".", "db", "(", ")", ".", "GetCollection", "(", "metricsC", ")", "\n", "defer", "closer", "(", ")", "\n", ...
// CountOfUnsentMetrics returns the number of metrics that // haven't been sent to the collection service.
[ "CountOfUnsentMetrics", "returns", "the", "number", "of", "metrics", "that", "haven", "t", "been", "sent", "to", "the", "collection", "service", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/metrics.go#L384-L391
3,741
juju/juju
state/metrics.go
CountOfSentMetrics
func (st *State) CountOfSentMetrics() (int, error) { c, closer := st.db().GetCollection(metricsC) defer closer() return c.Find(bson.M{ "model-uuid": st.ModelUUID(), "sent": true, }).Count() }
go
func (st *State) CountOfSentMetrics() (int, error) { c, closer := st.db().GetCollection(metricsC) defer closer() return c.Find(bson.M{ "model-uuid": st.ModelUUID(), "sent": true, }).Count() }
[ "func", "(", "st", "*", "State", ")", "CountOfSentMetrics", "(", ")", "(", "int", ",", "error", ")", "{", "c", ",", "closer", ":=", "st", ".", "db", "(", ")", ".", "GetCollection", "(", "metricsC", ")", "\n", "defer", "closer", "(", ")", "\n", "r...
// CountOfSentMetrics returns the number of metrics that // have been sent to the collection service and have not // been removed by the cleanup worker.
[ "CountOfSentMetrics", "returns", "the", "number", "of", "metrics", "that", "have", "been", "sent", "to", "the", "collection", "service", "and", "have", "not", "been", "removed", "by", "the", "cleanup", "worker", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/metrics.go#L396-L403
3,742
juju/juju
state/metrics.go
Metrics
func (m *MetricBatch) Metrics() []Metric { result := make([]Metric, len(m.doc.Metrics)) copy(result, m.doc.Metrics) return result }
go
func (m *MetricBatch) Metrics() []Metric { result := make([]Metric, len(m.doc.Metrics)) copy(result, m.doc.Metrics) return result }
[ "func", "(", "m", "*", "MetricBatch", ")", "Metrics", "(", ")", "[", "]", "Metric", "{", "result", ":=", "make", "(", "[", "]", "Metric", ",", "len", "(", "m", ".", "doc", ".", "Metrics", ")", ")", "\n", "copy", "(", "result", ",", "m", ".", ...
// Metrics returns the metrics in this batch.
[ "Metrics", "returns", "the", "metrics", "in", "this", "batch", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/metrics.go#L443-L447
3,743
juju/juju
state/metrics.go
UniqueMetrics
func (m *MetricBatch) UniqueMetrics() []Metric { metrics := m.Metrics() sort.Sort(byTime(metrics)) uniq := map[string]Metric{} for _, m := range metrics { uniq[fmt.Sprintf("%s-%s", m.Key, labelsKey(m.Labels))] = m } results := make([]Metric, len(uniq)) i := 0 for _, m := range uniq { results[i] = m i++ }...
go
func (m *MetricBatch) UniqueMetrics() []Metric { metrics := m.Metrics() sort.Sort(byTime(metrics)) uniq := map[string]Metric{} for _, m := range metrics { uniq[fmt.Sprintf("%s-%s", m.Key, labelsKey(m.Labels))] = m } results := make([]Metric, len(uniq)) i := 0 for _, m := range uniq { results[i] = m i++ }...
[ "func", "(", "m", "*", "MetricBatch", ")", "UniqueMetrics", "(", ")", "[", "]", "Metric", "{", "metrics", ":=", "m", ".", "Metrics", "(", ")", "\n", "sort", ".", "Sort", "(", "byTime", "(", "metrics", ")", ")", "\n", "uniq", ":=", "map", "[", "st...
// UniqueMetrics returns only the last value for each // metric key in this batch.
[ "UniqueMetrics", "returns", "only", "the", "last", "value", "for", "each", "metric", "key", "in", "this", "batch", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/metrics.go#L451-L466
3,744
juju/juju
state/metrics.go
SetSent
func (m *MetricBatch) SetSent(t time.Time) error { deleteTime := t.UTC().Add(CleanupAge) ops := setSentOps([]string{m.UUID()}, deleteTime) if err := m.st.db().RunTransaction(ops); err != nil { return errors.Annotatef(err, "cannot set metric sent for metric %q", m.UUID()) } m.doc.Sent = true m.doc.DeleteTime = ...
go
func (m *MetricBatch) SetSent(t time.Time) error { deleteTime := t.UTC().Add(CleanupAge) ops := setSentOps([]string{m.UUID()}, deleteTime) if err := m.st.db().RunTransaction(ops); err != nil { return errors.Annotatef(err, "cannot set metric sent for metric %q", m.UUID()) } m.doc.Sent = true m.doc.DeleteTime = ...
[ "func", "(", "m", "*", "MetricBatch", ")", "SetSent", "(", "t", "time", ".", "Time", ")", "error", "{", "deleteTime", ":=", "t", ".", "UTC", "(", ")", ".", "Add", "(", "CleanupAge", ")", "\n", "ops", ":=", "setSentOps", "(", "[", "]", "string", "...
// SetSent marks the metric has having been sent at // the specified time.
[ "SetSent", "marks", "the", "metric", "has", "having", "been", "sent", "at", "the", "specified", "time", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/metrics.go#L470-L480
3,745
juju/juju
state/metrics.go
SetMetricBatchesSent
func (st *State) SetMetricBatchesSent(batchUUIDs []string) error { deleteTime := st.clock().Now().UTC().Add(CleanupAge) ops := setSentOps(batchUUIDs, deleteTime) if err := st.db().RunTransaction(ops); err != nil { return errors.Annotatef(err, "cannot set metric sent in bulk call") } return nil }
go
func (st *State) SetMetricBatchesSent(batchUUIDs []string) error { deleteTime := st.clock().Now().UTC().Add(CleanupAge) ops := setSentOps(batchUUIDs, deleteTime) if err := st.db().RunTransaction(ops); err != nil { return errors.Annotatef(err, "cannot set metric sent in bulk call") } return nil }
[ "func", "(", "st", "*", "State", ")", "SetMetricBatchesSent", "(", "batchUUIDs", "[", "]", "string", ")", "error", "{", "deleteTime", ":=", "st", ".", "clock", "(", ")", ".", "Now", "(", ")", ".", "UTC", "(", ")", ".", "Add", "(", "CleanupAge", ")"...
// SetMetricBatchesSent sets sent on each MetricBatch corresponding to the uuids provided.
[ "SetMetricBatchesSent", "sets", "sent", "on", "each", "MetricBatch", "corresponding", "to", "the", "uuids", "provided", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/metrics.go#L506-L513
3,746
juju/juju
worker/uniter/runner/jujuc/action-set.go
NewActionSetCommand
func NewActionSetCommand(ctx Context) (cmd.Command, error) { return &ActionSetCommand{ctx: ctx}, nil }
go
func NewActionSetCommand(ctx Context) (cmd.Command, error) { return &ActionSetCommand{ctx: ctx}, nil }
[ "func", "NewActionSetCommand", "(", "ctx", "Context", ")", "(", "cmd", ".", "Command", ",", "error", ")", "{", "return", "&", "ActionSetCommand", "{", "ctx", ":", "ctx", "}", ",", "nil", "\n", "}" ]
// NewActionSetCommand returns a new ActionSetCommand with the given context.
[ "NewActionSetCommand", "returns", "a", "new", "ActionSetCommand", "with", "the", "given", "context", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runner/jujuc/action-set.go#L27-L29
3,747
juju/juju
core/cache/hash.go
hash
func hash(settings map[string]interface{}) (string, error) { bytes, err := yaml.Marshal(settings) if err != nil { return "", errors.Trace(err) } hash := sha256.New() _, err = hash.Write(bytes) if err != nil { return "", errors.Trace(err) } return hex.EncodeToString(hash.Sum(nil)), nil }
go
func hash(settings map[string]interface{}) (string, error) { bytes, err := yaml.Marshal(settings) if err != nil { return "", errors.Trace(err) } hash := sha256.New() _, err = hash.Write(bytes) if err != nil { return "", errors.Trace(err) } return hex.EncodeToString(hash.Sum(nil)), nil }
[ "func", "hash", "(", "settings", "map", "[", "string", "]", "interface", "{", "}", ")", "(", "string", ",", "error", ")", "{", "bytes", ",", "err", ":=", "yaml", ".", "Marshal", "(", "settings", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// hash returns a hash of the yaml serialized settings. // If the settings are not able to be serialized an error is returned.
[ "hash", "returns", "a", "hash", "of", "the", "yaml", "serialized", "settings", ".", "If", "the", "settings", "are", "not", "able", "to", "be", "serialized", "an", "error", "is", "returned", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/cache/hash.go#L99-L110
3,748
juju/juju
api/controller/controller.go
NewClient
func NewClient(st base.APICallCloser) *Client { frontend, backend := base.NewClientFacade(st, "Controller") return &Client{ ClientFacade: frontend, facade: backend, ControllerConfigAPI: common.NewControllerConfig(backend), ModelStatusAPI: common.NewModelStatusAPI(backend), } }
go
func NewClient(st base.APICallCloser) *Client { frontend, backend := base.NewClientFacade(st, "Controller") return &Client{ ClientFacade: frontend, facade: backend, ControllerConfigAPI: common.NewControllerConfig(backend), ModelStatusAPI: common.NewModelStatusAPI(backend), } }
[ "func", "NewClient", "(", "st", "base", ".", "APICallCloser", ")", "*", "Client", "{", "frontend", ",", "backend", ":=", "base", ".", "NewClientFacade", "(", "st", ",", "\"", "\"", ")", "\n", "return", "&", "Client", "{", "ClientFacade", ":", "frontend",...
// NewClient creates a new `Client` based on an existing authenticated API // connection.
[ "NewClient", "creates", "a", "new", "Client", "based", "on", "an", "existing", "authenticated", "API", "connection", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/controller/controller.go#L35-L43
3,749
juju/juju
api/controller/controller.go
CloudSpec
func (c *Client) CloudSpec(modelTag names.ModelTag) (environs.CloudSpec, error) { api := cloudspec.NewCloudSpecAPI(c.facade, modelTag) return api.CloudSpec() }
go
func (c *Client) CloudSpec(modelTag names.ModelTag) (environs.CloudSpec, error) { api := cloudspec.NewCloudSpecAPI(c.facade, modelTag) return api.CloudSpec() }
[ "func", "(", "c", "*", "Client", ")", "CloudSpec", "(", "modelTag", "names", ".", "ModelTag", ")", "(", "environs", ".", "CloudSpec", ",", "error", ")", "{", "api", ":=", "cloudspec", ".", "NewCloudSpecAPI", "(", "c", ".", "facade", ",", "modelTag", ")...
// CloudSpec returns a CloudSpec for the specified model.
[ "CloudSpec", "returns", "a", "CloudSpec", "for", "the", "specified", "model", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/controller/controller.go#L75-L78
3,750
juju/juju
api/controller/controller.go
HostedModelConfigs
func (c *Client) HostedModelConfigs() ([]HostedConfig, error) { result := params.HostedModelConfigsResults{} err := c.facade.FacadeCall("HostedModelConfigs", nil, &result) if err != nil { return nil, errors.Trace(err) } // If we get to here, we have some values. Each value may or // may not have an error, but i...
go
func (c *Client) HostedModelConfigs() ([]HostedConfig, error) { result := params.HostedModelConfigsResults{} err := c.facade.FacadeCall("HostedModelConfigs", nil, &result) if err != nil { return nil, errors.Trace(err) } // If we get to here, we have some values. Each value may or // may not have an error, but i...
[ "func", "(", "c", "*", "Client", ")", "HostedModelConfigs", "(", ")", "(", "[", "]", "HostedConfig", ",", "error", ")", "{", "result", ":=", "params", ".", "HostedModelConfigsResults", "{", "}", "\n", "err", ":=", "c", ".", "facade", ".", "FacadeCall", ...
// HostedModelsConfig returns all model settings for the // controller model.
[ "HostedModelsConfig", "returns", "all", "model", "settings", "for", "the", "controller", "model", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/controller/controller.go#L104-L135
3,751
juju/juju
api/controller/controller.go
DestroyController
func (c *Client) DestroyController(args DestroyControllerParams) error { if c.BestAPIVersion() < 4 { if args.DestroyStorage == nil || !*args.DestroyStorage { return errors.New("this Juju controller requires DestroyStorage to be true") } args.DestroyStorage = nil } return c.facade.FacadeCall("DestroyControll...
go
func (c *Client) DestroyController(args DestroyControllerParams) error { if c.BestAPIVersion() < 4 { if args.DestroyStorage == nil || !*args.DestroyStorage { return errors.New("this Juju controller requires DestroyStorage to be true") } args.DestroyStorage = nil } return c.facade.FacadeCall("DestroyControll...
[ "func", "(", "c", "*", "Client", ")", "DestroyController", "(", "args", "DestroyControllerParams", ")", "error", "{", "if", "c", ".", "BestAPIVersion", "(", ")", "<", "4", "{", "if", "args", ".", "DestroyStorage", "==", "nil", "||", "!", "*", "args", "...
// DestroyController puts the controller model into a "dying" state, // and removes all non-manager machine instances.
[ "DestroyController", "puts", "the", "controller", "model", "into", "a", "dying", "state", "and", "removes", "all", "non", "-", "manager", "machine", "instances", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/controller/controller.go#L155-L166
3,752
juju/juju
api/controller/controller.go
ListBlockedModels
func (c *Client) ListBlockedModels() ([]params.ModelBlockInfo, error) { result := params.ModelBlockInfoList{} err := c.facade.FacadeCall("ListBlockedModels", nil, &result) return result.Models, err }
go
func (c *Client) ListBlockedModels() ([]params.ModelBlockInfo, error) { result := params.ModelBlockInfoList{} err := c.facade.FacadeCall("ListBlockedModels", nil, &result) return result.Models, err }
[ "func", "(", "c", "*", "Client", ")", "ListBlockedModels", "(", ")", "(", "[", "]", "params", ".", "ModelBlockInfo", ",", "error", ")", "{", "result", ":=", "params", ".", "ModelBlockInfoList", "{", "}", "\n", "err", ":=", "c", ".", "facade", ".", "F...
// ListBlockedModels returns a list of all models within the controller // which have at least one block in place.
[ "ListBlockedModels", "returns", "a", "list", "of", "all", "models", "within", "the", "controller", "which", "have", "at", "least", "one", "block", "in", "place", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/controller/controller.go#L170-L174
3,753
juju/juju
api/controller/controller.go
GrantController
func (c *Client) GrantController(user, access string) error { return c.modifyControllerUser(params.GrantControllerAccess, user, access) }
go
func (c *Client) GrantController(user, access string) error { return c.modifyControllerUser(params.GrantControllerAccess, user, access) }
[ "func", "(", "c", "*", "Client", ")", "GrantController", "(", "user", ",", "access", "string", ")", "error", "{", "return", "c", ".", "modifyControllerUser", "(", "params", ".", "GrantControllerAccess", ",", "user", ",", "access", ")", "\n", "}" ]
// GrantController grants a user access to the controller.
[ "GrantController", "grants", "a", "user", "access", "to", "the", "controller", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/controller/controller.go#L193-L195
3,754
juju/juju
api/controller/controller.go
RevokeController
func (c *Client) RevokeController(user, access string) error { return c.modifyControllerUser(params.RevokeControllerAccess, user, access) }
go
func (c *Client) RevokeController(user, access string) error { return c.modifyControllerUser(params.RevokeControllerAccess, user, access) }
[ "func", "(", "c", "*", "Client", ")", "RevokeController", "(", "user", ",", "access", "string", ")", "error", "{", "return", "c", ".", "modifyControllerUser", "(", "params", ".", "RevokeControllerAccess", ",", "user", ",", "access", ")", "\n", "}" ]
// RevokeController revokes a user's access to the controller.
[ "RevokeController", "revokes", "a", "user", "s", "access", "to", "the", "controller", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/controller/controller.go#L198-L200
3,755
juju/juju
api/controller/controller.go
GetControllerAccess
func (c *Client) GetControllerAccess(user string) (permission.Access, error) { if !names.IsValidUser(user) { return "", errors.Errorf("invalid username: %q", user) } entities := params.Entities{Entities: []params.Entity{{names.NewUserTag(user).String()}}} var results params.UserAccessResults err := c.facade.Faca...
go
func (c *Client) GetControllerAccess(user string) (permission.Access, error) { if !names.IsValidUser(user) { return "", errors.Errorf("invalid username: %q", user) } entities := params.Entities{Entities: []params.Entity{{names.NewUserTag(user).String()}}} var results params.UserAccessResults err := c.facade.Faca...
[ "func", "(", "c", "*", "Client", ")", "GetControllerAccess", "(", "user", "string", ")", "(", "permission", ".", "Access", ",", "error", ")", "{", "if", "!", "names", ".", "IsValidUser", "(", "user", ")", "{", "return", "\"", "\"", ",", "errors", "."...
// GetControllerAccess returns the access level the user has on the controller.
[ "GetControllerAccess", "returns", "the", "access", "level", "the", "user", "has", "on", "the", "controller", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/controller/controller.go#L229-L246
3,756
juju/juju
api/controller/controller.go
ConfigSet
func (c *Client) ConfigSet(values map[string]interface{}) error { if c.BestAPIVersion() < 5 { return errors.Errorf("this controller version doesn't support updating controller config") } return errors.Trace( c.facade.FacadeCall("ConfigSet", params.ControllerConfigSet{Config: values}, nil), ) }
go
func (c *Client) ConfigSet(values map[string]interface{}) error { if c.BestAPIVersion() < 5 { return errors.Errorf("this controller version doesn't support updating controller config") } return errors.Trace( c.facade.FacadeCall("ConfigSet", params.ControllerConfigSet{Config: values}, nil), ) }
[ "func", "(", "c", "*", "Client", ")", "ConfigSet", "(", "values", "map", "[", "string", "]", "interface", "{", "}", ")", "error", "{", "if", "c", ".", "BestAPIVersion", "(", ")", "<", "5", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ...
// ConfigSet updates the passed controller configuration values. Any // settings that aren't passed will be left with their previous // values.
[ "ConfigSet", "updates", "the", "passed", "controller", "configuration", "values", ".", "Any", "settings", "that", "aren", "t", "passed", "will", "be", "left", "with", "their", "previous", "values", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/controller/controller.go#L251-L258
3,757
juju/juju
api/controller/controller.go
Validate
func (s *MigrationSpec) Validate() error { if !names.IsValidModel(s.ModelUUID) { return errors.NotValidf("model UUID") } if !names.IsValidModel(s.TargetControllerUUID) { return errors.NotValidf("controller UUID") } if len(s.TargetAddrs) < 1 { return errors.NotValidf("empty target API addresses") } if !name...
go
func (s *MigrationSpec) Validate() error { if !names.IsValidModel(s.ModelUUID) { return errors.NotValidf("model UUID") } if !names.IsValidModel(s.TargetControllerUUID) { return errors.NotValidf("controller UUID") } if len(s.TargetAddrs) < 1 { return errors.NotValidf("empty target API addresses") } if !name...
[ "func", "(", "s", "*", "MigrationSpec", ")", "Validate", "(", ")", "error", "{", "if", "!", "names", ".", "IsValidModel", "(", "s", ".", "ModelUUID", ")", "{", "return", "errors", ".", "NotValidf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "!", ...
// Validate performs sanity checks on the migration configuration it // holds.
[ "Validate", "performs", "sanity", "checks", "on", "the", "migration", "configuration", "it", "holds", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/controller/controller.go#L275-L292
3,758
juju/juju
apiserver/facades/agent/uniter/status.go
NewStatusAPI
func NewStatusAPI(st *state.State, getCanModify common.GetAuthFunc, leadershipChecker leadership.Checker) *StatusAPI { // TODO(fwereade): so *all* of these have exactly the same auth // characteristics? I think not. unitSetter := common.NewStatusSetter(st, getCanModify) unitGetter := common.NewStatusGetter(st, getC...
go
func NewStatusAPI(st *state.State, getCanModify common.GetAuthFunc, leadershipChecker leadership.Checker) *StatusAPI { // TODO(fwereade): so *all* of these have exactly the same auth // characteristics? I think not. unitSetter := common.NewStatusSetter(st, getCanModify) unitGetter := common.NewStatusGetter(st, getC...
[ "func", "NewStatusAPI", "(", "st", "*", "state", ".", "State", ",", "getCanModify", "common", ".", "GetAuthFunc", ",", "leadershipChecker", "leadership", ".", "Checker", ")", "*", "StatusAPI", "{", "// TODO(fwereade): so *all* of these have exactly the same auth", "// c...
// NewStatusAPI creates a new server-side Status setter API facade.
[ "NewStatusAPI", "creates", "a", "new", "server", "-", "side", "Status", "setter", "API", "facade", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/uniter/status.go#L26-L42
3,759
juju/juju
apiserver/facades/agent/uniter/status.go
SetStatus
func (s *StatusAPI) SetStatus(args params.SetStatus) (params.ErrorResults, error) { return s.SetAgentStatus(args) }
go
func (s *StatusAPI) SetStatus(args params.SetStatus) (params.ErrorResults, error) { return s.SetAgentStatus(args) }
[ "func", "(", "s", "*", "StatusAPI", ")", "SetStatus", "(", "args", "params", ".", "SetStatus", ")", "(", "params", ".", "ErrorResults", ",", "error", ")", "{", "return", "s", ".", "SetAgentStatus", "(", "args", ")", "\n", "}" ]
// SetStatus will set status for a entities passed in args. If the entity is // a Unit it will instead set status to its agent, to emulate backwards // compatibility.
[ "SetStatus", "will", "set", "status", "for", "a", "entities", "passed", "in", "args", ".", "If", "the", "entity", "is", "a", "Unit", "it", "will", "instead", "set", "status", "to", "its", "agent", "to", "emulate", "backwards", "compatibility", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/uniter/status.go#L47-L49
3,760
juju/juju
apiserver/facades/agent/uniter/status.go
SetUnitStatus
func (s *StatusAPI) SetUnitStatus(args params.SetStatus) (params.ErrorResults, error) { return s.unitSetter.SetStatus(args) }
go
func (s *StatusAPI) SetUnitStatus(args params.SetStatus) (params.ErrorResults, error) { return s.unitSetter.SetStatus(args) }
[ "func", "(", "s", "*", "StatusAPI", ")", "SetUnitStatus", "(", "args", "params", ".", "SetStatus", ")", "(", "params", ".", "ErrorResults", ",", "error", ")", "{", "return", "s", ".", "unitSetter", ".", "SetStatus", "(", "args", ")", "\n", "}" ]
// SetUnitStatus sets status for all elements passed in args, the difference // with SetStatus is that if an entity is a Unit it will set its status instead // of its agent.
[ "SetUnitStatus", "sets", "status", "for", "all", "elements", "passed", "in", "args", "the", "difference", "with", "SetStatus", "is", "that", "if", "an", "entity", "is", "a", "Unit", "it", "will", "set", "its", "status", "instead", "of", "its", "agent", "."...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/uniter/status.go#L60-L62
3,761
juju/juju
apiserver/facades/agent/uniter/status.go
SetApplicationStatus
func (s *StatusAPI) SetApplicationStatus(args params.SetStatus) (params.ErrorResults, error) { return s.applicationSetter.SetStatus(args) }
go
func (s *StatusAPI) SetApplicationStatus(args params.SetStatus) (params.ErrorResults, error) { return s.applicationSetter.SetStatus(args) }
[ "func", "(", "s", "*", "StatusAPI", ")", "SetApplicationStatus", "(", "args", "params", ".", "SetStatus", ")", "(", "params", ".", "ErrorResults", ",", "error", ")", "{", "return", "s", ".", "applicationSetter", ".", "SetStatus", "(", "args", ")", "\n", ...
// SetApplicationStatus sets the status for all the Applications in args if the given Unit is // the leader.
[ "SetApplicationStatus", "sets", "the", "status", "for", "all", "the", "Applications", "in", "args", "if", "the", "given", "Unit", "is", "the", "leader", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/uniter/status.go#L66-L68
3,762
juju/juju
apiserver/facades/agent/uniter/status.go
UnitStatus
func (s *StatusAPI) UnitStatus(args params.Entities) (params.StatusResults, error) { return s.unitGetter.Status(args) }
go
func (s *StatusAPI) UnitStatus(args params.Entities) (params.StatusResults, error) { return s.unitGetter.Status(args) }
[ "func", "(", "s", "*", "StatusAPI", ")", "UnitStatus", "(", "args", "params", ".", "Entities", ")", "(", "params", ".", "StatusResults", ",", "error", ")", "{", "return", "s", ".", "unitGetter", ".", "Status", "(", "args", ")", "\n", "}" ]
// UnitStatus returns the workload status information for the unit.
[ "UnitStatus", "returns", "the", "workload", "status", "information", "for", "the", "unit", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/uniter/status.go#L71-L73
3,763
juju/juju
apiserver/facades/agent/uniter/status.go
ApplicationStatus
func (s *StatusAPI) ApplicationStatus(args params.Entities) (params.ApplicationStatusResults, error) { return s.applicationGetter.Status(args) }
go
func (s *StatusAPI) ApplicationStatus(args params.Entities) (params.ApplicationStatusResults, error) { return s.applicationGetter.Status(args) }
[ "func", "(", "s", "*", "StatusAPI", ")", "ApplicationStatus", "(", "args", "params", ".", "Entities", ")", "(", "params", ".", "ApplicationStatusResults", ",", "error", ")", "{", "return", "s", ".", "applicationGetter", ".", "Status", "(", "args", ")", "\n...
// ApplicationStatus returns the status of the Applications and its workloads // if the given unit is the leader.
[ "ApplicationStatus", "returns", "the", "status", "of", "the", "Applications", "and", "its", "workloads", "if", "the", "given", "unit", "is", "the", "leader", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/uniter/status.go#L77-L79
3,764
juju/juju
cmd/juju/firewall/listformatter.go
formatFirewallRulesTabular
func formatFirewallRulesTabular(writer io.Writer, rules firewallRules) { tw := output.TabWriter(writer) w := output.Wrapper{tw} sort.Sort(rules) w.Println("Service", "Whitelist subnets") for _, rule := range rules { w.Println(rule.KnownService, strings.Join(rule.WhitelistCIDRS, ",")) } tw.Flush() }
go
func formatFirewallRulesTabular(writer io.Writer, rules firewallRules) { tw := output.TabWriter(writer) w := output.Wrapper{tw} sort.Sort(rules) w.Println("Service", "Whitelist subnets") for _, rule := range rules { w.Println(rule.KnownService, strings.Join(rule.WhitelistCIDRS, ",")) } tw.Flush() }
[ "func", "formatFirewallRulesTabular", "(", "writer", "io", ".", "Writer", ",", "rules", "firewallRules", ")", "{", "tw", ":=", "output", ".", "TabWriter", "(", "writer", ")", "\n", "w", ":=", "output", ".", "Wrapper", "{", "tw", "}", "\n\n", "sort", ".",...
// formatFirewallRulesTabular returns a tabular summary of firewall rules.
[ "formatFirewallRulesTabular", "returns", "a", "tabular", "summary", "of", "firewall", "rules", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/firewall/listformatter.go#L39-L50
3,765
juju/juju
worker/raft/synclogstore.go
FirstIndex
func (s *syncLogStore) FirstIndex() (uint64, error) { s.mu.Lock() defer s.mu.Unlock() return s.store.FirstIndex() }
go
func (s *syncLogStore) FirstIndex() (uint64, error) { s.mu.Lock() defer s.mu.Unlock() return s.store.FirstIndex() }
[ "func", "(", "s", "*", "syncLogStore", ")", "FirstIndex", "(", ")", "(", "uint64", ",", "error", ")", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "s", ".", "store", ".", ...
// FirstIndex is part of raft.LogStore.
[ "FirstIndex", "is", "part", "of", "raft", ".", "LogStore", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/raft/synclogstore.go#L31-L35
3,766
juju/juju
worker/raft/synclogstore.go
GetLog
func (s *syncLogStore) GetLog(index uint64, log *raft.Log) error { s.mu.Lock() defer s.mu.Unlock() return s.store.GetLog(index, log) }
go
func (s *syncLogStore) GetLog(index uint64, log *raft.Log) error { s.mu.Lock() defer s.mu.Unlock() return s.store.GetLog(index, log) }
[ "func", "(", "s", "*", "syncLogStore", ")", "GetLog", "(", "index", "uint64", ",", "log", "*", "raft", ".", "Log", ")", "error", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "return",...
// GetLog is part of raft.LogStore.
[ "GetLog", "is", "part", "of", "raft", ".", "LogStore", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/raft/synclogstore.go#L45-L49
3,767
juju/juju
worker/raft/synclogstore.go
StoreLog
func (s *syncLogStore) StoreLog(log *raft.Log) error { s.mu.Lock() defer s.mu.Unlock() return s.store.StoreLog(log) }
go
func (s *syncLogStore) StoreLog(log *raft.Log) error { s.mu.Lock() defer s.mu.Unlock() return s.store.StoreLog(log) }
[ "func", "(", "s", "*", "syncLogStore", ")", "StoreLog", "(", "log", "*", "raft", ".", "Log", ")", "error", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "s", ".", "store", ...
// StoreLog is part of raft.LogStore.
[ "StoreLog", "is", "part", "of", "raft", ".", "LogStore", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/raft/synclogstore.go#L52-L56
3,768
juju/juju
worker/raft/synclogstore.go
StoreLogs
func (s *syncLogStore) StoreLogs(logs []*raft.Log) error { s.mu.Lock() defer s.mu.Unlock() return s.store.StoreLogs(logs) }
go
func (s *syncLogStore) StoreLogs(logs []*raft.Log) error { s.mu.Lock() defer s.mu.Unlock() return s.store.StoreLogs(logs) }
[ "func", "(", "s", "*", "syncLogStore", ")", "StoreLogs", "(", "logs", "[", "]", "*", "raft", ".", "Log", ")", "error", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "s", "....
// StoreLogs is part of raft.LogStore.
[ "StoreLogs", "is", "part", "of", "raft", ".", "LogStore", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/raft/synclogstore.go#L59-L63
3,769
juju/juju
worker/raft/synclogstore.go
DeleteRange
func (s *syncLogStore) DeleteRange(min, max uint64) error { s.mu.Lock() defer s.mu.Unlock() return s.store.DeleteRange(min, max) }
go
func (s *syncLogStore) DeleteRange(min, max uint64) error { s.mu.Lock() defer s.mu.Unlock() return s.store.DeleteRange(min, max) }
[ "func", "(", "s", "*", "syncLogStore", ")", "DeleteRange", "(", "min", ",", "max", "uint64", ")", "error", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "s", ".", "store", "....
// DeleteRange is part of raft.LogStore.
[ "DeleteRange", "is", "part", "of", "raft", ".", "LogStore", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/raft/synclogstore.go#L66-L70
3,770
juju/juju
worker/raft/synclogstore.go
Close
func (s *syncLogStore) Close() error { s.mu.Lock() defer s.mu.Unlock() return s.store.Close() }
go
func (s *syncLogStore) Close() error { s.mu.Lock() defer s.mu.Unlock() return s.store.Close() }
[ "func", "(", "s", "*", "syncLogStore", ")", "Close", "(", ")", "error", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "s", ".", "store", ".", "Close", "(", ")", "\n", "}" ]
// Close closes the underlying logstore.
[ "Close", "closes", "the", "underlying", "logstore", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/raft/synclogstore.go#L73-L77
3,771
juju/juju
state/backups/storage.go
docAsMetadata
func docAsMetadata(doc *storageMetaDoc) *Metadata { meta := NewMetadata() meta.Started = metadocUnixToTime(doc.Started) meta.Notes = doc.Notes meta.Origin.Model = doc.Model meta.Origin.Machine = doc.Machine meta.Origin.Hostname = doc.Hostname meta.Origin.Version = doc.Version meta.Origin.Series = doc.Series ...
go
func docAsMetadata(doc *storageMetaDoc) *Metadata { meta := NewMetadata() meta.Started = metadocUnixToTime(doc.Started) meta.Notes = doc.Notes meta.Origin.Model = doc.Model meta.Origin.Machine = doc.Machine meta.Origin.Hostname = doc.Hostname meta.Origin.Version = doc.Version meta.Origin.Series = doc.Series ...
[ "func", "docAsMetadata", "(", "doc", "*", "storageMetaDoc", ")", "*", "Metadata", "{", "meta", ":=", "NewMetadata", "(", ")", "\n", "meta", ".", "Started", "=", "metadocUnixToTime", "(", "doc", ".", "Started", ")", "\n", "meta", ".", "Notes", "=", "doc",...
// docAsMetadata returns a new backups.Metadata based on the storageMetaDoc.
[ "docAsMetadata", "returns", "a", "new", "backups", ".", "Metadata", "based", "on", "the", "storageMetaDoc", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L123-L156
3,772
juju/juju
state/backups/storage.go
newStorageMetaDoc
func newStorageMetaDoc(meta *Metadata) storageMetaDoc { var doc storageMetaDoc // Ignore metadata.ID. It will be set by storage later. doc.Checksum = meta.Checksum() doc.ChecksumFormat = meta.ChecksumFormat() doc.Size = meta.Size() if meta.Stored() != nil { stored := meta.Stored() doc.Stored = metadocTimeTo...
go
func newStorageMetaDoc(meta *Metadata) storageMetaDoc { var doc storageMetaDoc // Ignore metadata.ID. It will be set by storage later. doc.Checksum = meta.Checksum() doc.ChecksumFormat = meta.ChecksumFormat() doc.Size = meta.Size() if meta.Stored() != nil { stored := meta.Stored() doc.Stored = metadocTimeTo...
[ "func", "newStorageMetaDoc", "(", "meta", "*", "Metadata", ")", "storageMetaDoc", "{", "var", "doc", "storageMetaDoc", "\n\n", "// Ignore metadata.ID. It will be set by storage later.", "doc", ".", "Checksum", "=", "meta", ".", "Checksum", "(", ")", "\n", "doc", "."...
// newStorageMetaDoc creates a storageMetaDoc using the corresponding // values from the backup Metadata.
[ "newStorageMetaDoc", "creates", "a", "storageMetaDoc", "using", "the", "corresponding", "values", "from", "the", "backup", "Metadata", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L160-L186
3,773
juju/juju
state/backups/storage.go
newStorageDBWrapper
func newStorageDBWrapper(db *mgo.Database, metaColl, modelUUID string) *storageDBWrapper { session := db.Session.Copy() db = db.With(session) coll := db.C(metaColl) txnRunner := jujutxn.NewRunner(jujutxn.RunnerParams{ Database: db, ServerSideTransactions: false, }) dbWrap := storageDBWrapper{ ...
go
func newStorageDBWrapper(db *mgo.Database, metaColl, modelUUID string) *storageDBWrapper { session := db.Session.Copy() db = db.With(session) coll := db.C(metaColl) txnRunner := jujutxn.NewRunner(jujutxn.RunnerParams{ Database: db, ServerSideTransactions: false, }) dbWrap := storageDBWrapper{ ...
[ "func", "newStorageDBWrapper", "(", "db", "*", "mgo", ".", "Database", ",", "metaColl", ",", "modelUUID", "string", ")", "*", "storageDBWrapper", "{", "session", ":=", "db", ".", "Session", ".", "Copy", "(", ")", "\n", "db", "=", "db", ".", "With", "("...
// newStorageDBWrapper returns a DB operator for the , with its own session.
[ "newStorageDBWrapper", "returns", "a", "DB", "operator", "for", "the", "with", "its", "own", "session", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L204-L221
3,774
juju/juju
state/backups/storage.go
metadata
func (b *storageDBWrapper) metadata(id string, doc interface{}) error { err := b.metaColl.FindId(id).One(doc) if err == mgo.ErrNotFound { return errors.NotFoundf("backup metadata %q", id) } return errors.Trace(err) }
go
func (b *storageDBWrapper) metadata(id string, doc interface{}) error { err := b.metaColl.FindId(id).One(doc) if err == mgo.ErrNotFound { return errors.NotFoundf("backup metadata %q", id) } return errors.Trace(err) }
[ "func", "(", "b", "*", "storageDBWrapper", ")", "metadata", "(", "id", "string", ",", "doc", "interface", "{", "}", ")", "error", "{", "err", ":=", "b", ".", "metaColl", ".", "FindId", "(", "id", ")", ".", "One", "(", "doc", ")", "\n", "if", "err...
// metadata populates doc with the document matching the ID.
[ "metadata", "populates", "doc", "with", "the", "document", "matching", "the", "ID", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L224-L230
3,775
juju/juju
state/backups/storage.go
allMetadata
func (b *storageDBWrapper) allMetadata(docs interface{}) error { err := b.metaColl.Find(nil).All(docs) return errors.Trace(err) }
go
func (b *storageDBWrapper) allMetadata(docs interface{}) error { err := b.metaColl.Find(nil).All(docs) return errors.Trace(err) }
[ "func", "(", "b", "*", "storageDBWrapper", ")", "allMetadata", "(", "docs", "interface", "{", "}", ")", "error", "{", "err", ":=", "b", ".", "metaColl", ".", "Find", "(", "nil", ")", ".", "All", "(", "docs", ")", "\n", "return", "errors", ".", "Tra...
// allMetadata populates docs with the list of documents in storage.
[ "allMetadata", "populates", "docs", "with", "the", "list", "of", "documents", "in", "storage", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L233-L236
3,776
juju/juju
state/backups/storage.go
removeMetadataID
func (b *storageDBWrapper) removeMetadataID(id string) error { err := b.metaColl.RemoveId(id) return errors.Trace(err) }
go
func (b *storageDBWrapper) removeMetadataID(id string) error { err := b.metaColl.RemoveId(id) return errors.Trace(err) }
[ "func", "(", "b", "*", "storageDBWrapper", ")", "removeMetadataID", "(", "id", "string", ")", "error", "{", "err", ":=", "b", ".", "metaColl", ".", "RemoveId", "(", "id", ")", "\n", "return", "errors", ".", "Trace", "(", "err", ")", "\n", "}" ]
// removeMetadataID removes the identified metadata from storage.
[ "removeMetadataID", "removes", "the", "identified", "metadata", "from", "storage", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L239-L242
3,777
juju/juju
state/backups/storage.go
txnOpBase
func (b *storageDBWrapper) txnOpBase(id string) txn.Op { op := txn.Op{ C: b.metaColl.Name, Id: id, } return op }
go
func (b *storageDBWrapper) txnOpBase(id string) txn.Op { op := txn.Op{ C: b.metaColl.Name, Id: id, } return op }
[ "func", "(", "b", "*", "storageDBWrapper", ")", "txnOpBase", "(", "id", "string", ")", "txn", ".", "Op", "{", "op", ":=", "txn", ".", "Op", "{", "C", ":", "b", ".", "metaColl", ".", "Name", ",", "Id", ":", "id", ",", "}", "\n", "return", "op", ...
// txnOp returns a single transaction operation populated with the id // and the metadata collection name. The caller should set other op // values as needed.
[ "txnOp", "returns", "a", "single", "transaction", "operation", "populated", "with", "the", "id", "and", "the", "metadata", "collection", "name", ".", "The", "caller", "should", "set", "other", "op", "values", "as", "needed", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L247-L253
3,778
juju/juju
state/backups/storage.go
txnOpInsert
func (b *storageDBWrapper) txnOpInsert(id string, doc interface{}) txn.Op { op := b.txnOpBase(id) op.Assert = txn.DocMissing op.Insert = doc return op }
go
func (b *storageDBWrapper) txnOpInsert(id string, doc interface{}) txn.Op { op := b.txnOpBase(id) op.Assert = txn.DocMissing op.Insert = doc return op }
[ "func", "(", "b", "*", "storageDBWrapper", ")", "txnOpInsert", "(", "id", "string", ",", "doc", "interface", "{", "}", ")", "txn", ".", "Op", "{", "op", ":=", "b", ".", "txnOpBase", "(", "id", ")", "\n", "op", ".", "Assert", "=", "txn", ".", "Doc...
// txnOpInsert returns a single transaction operation that will insert // the document into storage.
[ "txnOpInsert", "returns", "a", "single", "transaction", "operation", "that", "will", "insert", "the", "document", "into", "storage", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L257-L262
3,779
juju/juju
state/backups/storage.go
txnOpUpdate
func (b *storageDBWrapper) txnOpUpdate(id string, updates ...bson.DocElem) txn.Op { op := b.txnOpBase(id) op.Assert = txn.DocExists op.Update = bson.D{{"$set", bson.D(updates)}} return op }
go
func (b *storageDBWrapper) txnOpUpdate(id string, updates ...bson.DocElem) txn.Op { op := b.txnOpBase(id) op.Assert = txn.DocExists op.Update = bson.D{{"$set", bson.D(updates)}} return op }
[ "func", "(", "b", "*", "storageDBWrapper", ")", "txnOpUpdate", "(", "id", "string", ",", "updates", "...", "bson", ".", "DocElem", ")", "txn", ".", "Op", "{", "op", ":=", "b", ".", "txnOpBase", "(", "id", ")", "\n", "op", ".", "Assert", "=", "txn",...
// txnOpInsert returns a single transaction operation that will update // the already stored document.
[ "txnOpInsert", "returns", "a", "single", "transaction", "operation", "that", "will", "update", "the", "already", "stored", "document", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L266-L271
3,780
juju/juju
state/backups/storage.go
runTransaction
func (b *storageDBWrapper) runTransaction(ops []txn.Op) error { err := b.txnRunner.RunTransaction(&jujutxn.Transaction{Ops: ops}) return errors.Trace(err) }
go
func (b *storageDBWrapper) runTransaction(ops []txn.Op) error { err := b.txnRunner.RunTransaction(&jujutxn.Transaction{Ops: ops}) return errors.Trace(err) }
[ "func", "(", "b", "*", "storageDBWrapper", ")", "runTransaction", "(", "ops", "[", "]", "txn", ".", "Op", ")", "error", "{", "err", ":=", "b", ".", "txnRunner", ".", "RunTransaction", "(", "&", "jujutxn", ".", "Transaction", "{", "Ops", ":", "ops", "...
// runTransaction runs the DB operations within a single transaction.
[ "runTransaction", "runs", "the", "DB", "operations", "within", "a", "single", "transaction", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L274-L277
3,781
juju/juju
state/backups/storage.go
blobStorage
func (b *storageDBWrapper) blobStorage(blobDB string) blobstore.ManagedStorage { dataStore := blobstore.NewGridFS(blobDB, blobDB, b.session) return blobstore.NewManagedStorage(b.db, dataStore) }
go
func (b *storageDBWrapper) blobStorage(blobDB string) blobstore.ManagedStorage { dataStore := blobstore.NewGridFS(blobDB, blobDB, b.session) return blobstore.NewManagedStorage(b.db, dataStore) }
[ "func", "(", "b", "*", "storageDBWrapper", ")", "blobStorage", "(", "blobDB", "string", ")", "blobstore", ".", "ManagedStorage", "{", "dataStore", ":=", "blobstore", ".", "NewGridFS", "(", "blobDB", ",", "blobDB", ",", "b", ".", "session", ")", "\n", "retu...
// blobStorage returns a ManagedStorage matching the env storage and the blobDB.
[ "blobStorage", "returns", "a", "ManagedStorage", "matching", "the", "env", "storage", "and", "the", "blobDB", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L280-L283
3,782
juju/juju
state/backups/storage.go
Copy
func (b *storageDBWrapper) Copy() *storageDBWrapper { session := b.session.Copy() coll := b.metaColl.With(session) db := coll.Database txnRunner := jujutxn.NewRunner(jujutxn.RunnerParams{ Database: db, ServerSideTransactions: false, }) dbWrap := storageDBWrapper{ session: session, db: ...
go
func (b *storageDBWrapper) Copy() *storageDBWrapper { session := b.session.Copy() coll := b.metaColl.With(session) db := coll.Database txnRunner := jujutxn.NewRunner(jujutxn.RunnerParams{ Database: db, ServerSideTransactions: false, }) dbWrap := storageDBWrapper{ session: session, db: ...
[ "func", "(", "b", "*", "storageDBWrapper", ")", "Copy", "(", ")", "*", "storageDBWrapper", "{", "session", ":=", "b", ".", "session", ".", "Copy", "(", ")", "\n\n", "coll", ":=", "b", ".", "metaColl", ".", "With", "(", "session", ")", "\n", "db", "...
// Copy returns a copy of the operator.
[ "Copy", "returns", "a", "copy", "of", "the", "operator", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L286-L303
3,783
juju/juju
state/backups/storage.go
addStorageMetadata
func addStorageMetadata(dbWrap *storageDBWrapper, doc *storageMetaDoc) (string, error) { // We use our own mongo _id value since the auto-generated one from // mongo may contain sensitive data (see bson.ObjectID). id := newStorageID(doc) doc.ID = id if err := doc.validate(); err != nil { return "", errors.Trace...
go
func addStorageMetadata(dbWrap *storageDBWrapper, doc *storageMetaDoc) (string, error) { // We use our own mongo _id value since the auto-generated one from // mongo may contain sensitive data (see bson.ObjectID). id := newStorageID(doc) doc.ID = id if err := doc.validate(); err != nil { return "", errors.Trace...
[ "func", "addStorageMetadata", "(", "dbWrap", "*", "storageDBWrapper", ",", "doc", "*", "storageMetaDoc", ")", "(", "string", ",", "error", ")", "{", "// We use our own mongo _id value since the auto-generated one from", "// mongo may contain sensitive data (see bson.ObjectID).", ...
// addStorageMetadata stores metadata for a backup where it can be // accessed later. It returns a new ID that is associated with the // backup. If the provided metadata already has an ID set, it is // ignored. The new ID is set on the doc, even when there is an error.
[ "addStorageMetadata", "stores", "metadata", "for", "a", "backup", "where", "it", "can", "be", "accessed", "later", ".", "It", "returns", "a", "new", "ID", "that", "is", "associated", "with", "the", "backup", ".", "If", "the", "provided", "metadata", "already...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L345-L365
3,784
juju/juju
state/backups/storage.go
AddDoc
func (s *backupsDocStorage) AddDoc(doc filestorage.Document) (string, error) { metadata, ok := doc.(*Metadata) if !ok { return "", errors.Errorf("doc must be of type *backups.Metadata") } metaDoc := newStorageMetaDoc(metadata) dbWrap := s.dbWrap.Copy() defer dbWrap.Close() id, err := addStorageMetadata(dbWra...
go
func (s *backupsDocStorage) AddDoc(doc filestorage.Document) (string, error) { metadata, ok := doc.(*Metadata) if !ok { return "", errors.Errorf("doc must be of type *backups.Metadata") } metaDoc := newStorageMetaDoc(metadata) dbWrap := s.dbWrap.Copy() defer dbWrap.Close() id, err := addStorageMetadata(dbWra...
[ "func", "(", "s", "*", "backupsDocStorage", ")", "AddDoc", "(", "doc", "filestorage", ".", "Document", ")", "(", "string", ",", "error", ")", "{", "metadata", ",", "ok", ":=", "doc", ".", "(", "*", "Metadata", ")", "\n", "if", "!", "ok", "{", "retu...
// AddDoc adds the document to storage and returns the new ID.
[ "AddDoc", "adds", "the", "document", "to", "storage", "and", "returns", "the", "new", "ID", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L408-L420
3,785
juju/juju
state/backups/storage.go
Doc
func (s *backupsDocStorage) Doc(id string) (filestorage.Document, error) { dbWrap := s.dbWrap.Copy() defer dbWrap.Close() doc, err := getStorageMetadata(dbWrap, id) if err != nil { return nil, errors.Trace(err) } metadata := docAsMetadata(doc) return metadata, nil }
go
func (s *backupsDocStorage) Doc(id string) (filestorage.Document, error) { dbWrap := s.dbWrap.Copy() defer dbWrap.Close() doc, err := getStorageMetadata(dbWrap, id) if err != nil { return nil, errors.Trace(err) } metadata := docAsMetadata(doc) return metadata, nil }
[ "func", "(", "s", "*", "backupsDocStorage", ")", "Doc", "(", "id", "string", ")", "(", "filestorage", ".", "Document", ",", "error", ")", "{", "dbWrap", ":=", "s", ".", "dbWrap", ".", "Copy", "(", ")", "\n", "defer", "dbWrap", ".", "Close", "(", ")...
// Doc returns the stored document associated with the given ID.
[ "Doc", "returns", "the", "stored", "document", "associated", "with", "the", "given", "ID", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L423-L434
3,786
juju/juju
state/backups/storage.go
ListDocs
func (s *backupsDocStorage) ListDocs() ([]filestorage.Document, error) { dbWrap := s.dbWrap.Copy() defer dbWrap.Close() var docs []storageMetaDoc if err := dbWrap.allMetadata(&docs); err != nil { return nil, errors.Trace(err) } list := make([]filestorage.Document, len(docs)) for i, doc := range docs { meta...
go
func (s *backupsDocStorage) ListDocs() ([]filestorage.Document, error) { dbWrap := s.dbWrap.Copy() defer dbWrap.Close() var docs []storageMetaDoc if err := dbWrap.allMetadata(&docs); err != nil { return nil, errors.Trace(err) } list := make([]filestorage.Document, len(docs)) for i, doc := range docs { meta...
[ "func", "(", "s", "*", "backupsDocStorage", ")", "ListDocs", "(", ")", "(", "[", "]", "filestorage", ".", "Document", ",", "error", ")", "{", "dbWrap", ":=", "s", ".", "dbWrap", ".", "Copy", "(", ")", "\n", "defer", "dbWrap", ".", "Close", "(", ")"...
// ListDocs returns the list of all stored documents.
[ "ListDocs", "returns", "the", "list", "of", "all", "stored", "documents", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L437-L452
3,787
juju/juju
state/backups/storage.go
RemoveDoc
func (s *backupsDocStorage) RemoveDoc(id string) error { dbWrap := s.dbWrap.Copy() defer dbWrap.Close() return errors.Trace(dbWrap.removeMetadataID(id)) }
go
func (s *backupsDocStorage) RemoveDoc(id string) error { dbWrap := s.dbWrap.Copy() defer dbWrap.Close() return errors.Trace(dbWrap.removeMetadataID(id)) }
[ "func", "(", "s", "*", "backupsDocStorage", ")", "RemoveDoc", "(", "id", "string", ")", "error", "{", "dbWrap", ":=", "s", ".", "dbWrap", ".", "Copy", "(", ")", "\n", "defer", "dbWrap", ".", "Close", "(", ")", "\n\n", "return", "errors", ".", "Trace"...
// RemoveDoc removes the identified document from storage.
[ "RemoveDoc", "removes", "the", "identified", "document", "from", "storage", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L455-L460
3,788
juju/juju
state/backups/storage.go
SetStored
func (s *backupsMetadataStorage) SetStored(id string) error { dbWrap := newStorageDBWrapper(s.db, storageMetaName, s.modelUUID) defer dbWrap.Close() // TODO(perrito666) 2016-05-02 lp:1558657 err := setStorageStoredTime(dbWrap, id, time.Now()) return errors.Trace(err) }
go
func (s *backupsMetadataStorage) SetStored(id string) error { dbWrap := newStorageDBWrapper(s.db, storageMetaName, s.modelUUID) defer dbWrap.Close() // TODO(perrito666) 2016-05-02 lp:1558657 err := setStorageStoredTime(dbWrap, id, time.Now()) return errors.Trace(err) }
[ "func", "(", "s", "*", "backupsMetadataStorage", ")", "SetStored", "(", "id", "string", ")", "error", "{", "dbWrap", ":=", "newStorageDBWrapper", "(", "s", ".", "db", ",", "storageMetaName", ",", "s", ".", "modelUUID", ")", "\n", "defer", "dbWrap", ".", ...
// SetStored records in the metadata the fact that the file was stored.
[ "SetStored", "records", "in", "the", "metadata", "the", "fact", "that", "the", "file", "was", "stored", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L468-L475
3,789
juju/juju
state/backups/storage.go
File
func (s *backupBlobStorage) File(id string) (io.ReadCloser, error) { file, _, err := s.storeImpl.GetForBucket(s.modelUUID, s.path(id)) return file, errors.Trace(err) }
go
func (s *backupBlobStorage) File(id string) (io.ReadCloser, error) { file, _, err := s.storeImpl.GetForBucket(s.modelUUID, s.path(id)) return file, errors.Trace(err) }
[ "func", "(", "s", "*", "backupBlobStorage", ")", "File", "(", "id", "string", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "file", ",", "_", ",", "err", ":=", "s", ".", "storeImpl", ".", "GetForBucket", "(", "s", ".", "modelUUID", ","...
// File returns the identified file from storage.
[ "File", "returns", "the", "identified", "file", "from", "storage", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L510-L513
3,790
juju/juju
state/backups/storage.go
AddFile
func (s *backupBlobStorage) AddFile(id string, file io.Reader, size int64) error { return s.storeImpl.PutForBucket(s.modelUUID, s.path(id), file, size) }
go
func (s *backupBlobStorage) AddFile(id string, file io.Reader, size int64) error { return s.storeImpl.PutForBucket(s.modelUUID, s.path(id), file, size) }
[ "func", "(", "s", "*", "backupBlobStorage", ")", "AddFile", "(", "id", "string", ",", "file", "io", ".", "Reader", ",", "size", "int64", ")", "error", "{", "return", "s", ".", "storeImpl", ".", "PutForBucket", "(", "s", ".", "modelUUID", ",", "s", "....
// AddFile adds the file to storage.
[ "AddFile", "adds", "the", "file", "to", "storage", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L516-L518
3,791
juju/juju
state/backups/storage.go
RemoveFile
func (s *backupBlobStorage) RemoveFile(id string) error { return s.storeImpl.RemoveForBucket(s.modelUUID, s.path(id)) }
go
func (s *backupBlobStorage) RemoveFile(id string) error { return s.storeImpl.RemoveForBucket(s.modelUUID, s.path(id)) }
[ "func", "(", "s", "*", "backupBlobStorage", ")", "RemoveFile", "(", "id", "string", ")", "error", "{", "return", "s", ".", "storeImpl", ".", "RemoveForBucket", "(", "s", ".", "modelUUID", ",", "s", ".", "path", "(", "id", ")", ")", "\n", "}" ]
// RemoveFile removes the identified file from storage.
[ "RemoveFile", "removes", "the", "identified", "file", "from", "storage", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/state/backups/storage.go#L521-L523
3,792
juju/juju
apiserver/facades/agent/upgrader/unitupgrader.go
NewUnitUpgraderAPI
func NewUnitUpgraderAPI( st *state.State, resources facade.Resources, authorizer facade.Authorizer, ) (*UnitUpgraderAPI, error) { if !authorizer.AuthUnitAgent() { return nil, common.ErrPerm } getCanWrite := func() (common.AuthFunc, error) { return authorizer.AuthOwner, nil } return &UnitUpgraderAPI{ Tool...
go
func NewUnitUpgraderAPI( st *state.State, resources facade.Resources, authorizer facade.Authorizer, ) (*UnitUpgraderAPI, error) { if !authorizer.AuthUnitAgent() { return nil, common.ErrPerm } getCanWrite := func() (common.AuthFunc, error) { return authorizer.AuthOwner, nil } return &UnitUpgraderAPI{ Tool...
[ "func", "NewUnitUpgraderAPI", "(", "st", "*", "state", ".", "State", ",", "resources", "facade", ".", "Resources", ",", "authorizer", "facade", ".", "Authorizer", ",", ")", "(", "*", "UnitUpgraderAPI", ",", "error", ")", "{", "if", "!", "authorizer", ".", ...
// NewUnitUpgraderAPI creates a new server-side UnitUpgraderAPI facade.
[ "NewUnitUpgraderAPI", "creates", "a", "new", "server", "-", "side", "UnitUpgraderAPI", "facade", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/upgrader/unitupgrader.go#L28-L46
3,793
juju/juju
apiserver/facades/agent/upgrader/unitupgrader.go
WatchAPIVersion
func (u *UnitUpgraderAPI) WatchAPIVersion(args params.Entities) (params.NotifyWatchResults, error) { result := params.NotifyWatchResults{ Results: make([]params.NotifyWatchResult, len(args.Entities)), } for i, agent := range args.Entities { tag, err := names.ParseTag(agent.Tag) if err != nil { result.Result...
go
func (u *UnitUpgraderAPI) WatchAPIVersion(args params.Entities) (params.NotifyWatchResults, error) { result := params.NotifyWatchResults{ Results: make([]params.NotifyWatchResult, len(args.Entities)), } for i, agent := range args.Entities { tag, err := names.ParseTag(agent.Tag) if err != nil { result.Result...
[ "func", "(", "u", "*", "UnitUpgraderAPI", ")", "WatchAPIVersion", "(", "args", "params", ".", "Entities", ")", "(", "params", ".", "NotifyWatchResults", ",", "error", ")", "{", "result", ":=", "params", ".", "NotifyWatchResults", "{", "Results", ":", "make",...
// WatchAPIVersion starts a watcher to track if there is a new version // of the API that we want to upgrade to. The watcher tracks changes to // the unit's assigned machine since that's where the required agent version is stored.
[ "WatchAPIVersion", "starts", "a", "watcher", "to", "track", "if", "there", "is", "a", "new", "version", "of", "the", "API", "that", "we", "want", "to", "upgrade", "to", ".", "The", "watcher", "tracks", "changes", "to", "the", "unit", "s", "assigned", "ma...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/upgrader/unitupgrader.go#L67-L88
3,794
juju/juju
apiserver/facades/agent/upgrader/unitupgrader.go
DesiredVersion
func (u *UnitUpgraderAPI) DesiredVersion(args params.Entities) (params.VersionResults, error) { result := make([]params.VersionResult, len(args.Entities)) for i, entity := range args.Entities { tag, err := names.ParseTag(entity.Tag) if err != nil { result[i].Error = common.ServerError(common.ErrPerm) contin...
go
func (u *UnitUpgraderAPI) DesiredVersion(args params.Entities) (params.VersionResults, error) { result := make([]params.VersionResult, len(args.Entities)) for i, entity := range args.Entities { tag, err := names.ParseTag(entity.Tag) if err != nil { result[i].Error = common.ServerError(common.ErrPerm) contin...
[ "func", "(", "u", "*", "UnitUpgraderAPI", ")", "DesiredVersion", "(", "args", "params", ".", "Entities", ")", "(", "params", ".", "VersionResults", ",", "error", ")", "{", "result", ":=", "make", "(", "[", "]", "params", ".", "VersionResult", ",", "len",...
// DesiredVersion reports the Agent Version that we want that unit to be running. // The desired version is what the unit's assigned machine is running.
[ "DesiredVersion", "reports", "the", "Agent", "Version", "that", "we", "want", "that", "unit", "to", "be", "running", ".", "The", "desired", "version", "is", "what", "the", "unit", "s", "assigned", "machine", "is", "running", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/agent/upgrader/unitupgrader.go#L92-L107
3,795
juju/juju
worker/uniter/runner/jujuc/goal-state.go
formatGoalState
func formatGoalState(gs application.GoalState) formattedGoalState { result := formattedGoalState{} copyUnits := func(units application.UnitsGoalState) unitsGoalStateContents { copiedUnits := unitsGoalStateContents{} for name, gs := range units { copiedUnits[name] = goalStateStatusContents{ Status: gs.Stat...
go
func formatGoalState(gs application.GoalState) formattedGoalState { result := formattedGoalState{} copyUnits := func(units application.UnitsGoalState) unitsGoalStateContents { copiedUnits := unitsGoalStateContents{} for name, gs := range units { copiedUnits[name] = goalStateStatusContents{ Status: gs.Stat...
[ "func", "formatGoalState", "(", "gs", "application", ".", "GoalState", ")", "formattedGoalState", "{", "result", ":=", "formattedGoalState", "{", "}", "\n\n", "copyUnits", ":=", "func", "(", "units", "application", ".", "UnitsGoalState", ")", "unitsGoalStateContents...
// formatGoalState moves information from application GoalState struct to // application GoalState struct.
[ "formatGoalState", "moves", "information", "from", "application", "GoalState", "struct", "to", "application", "GoalState", "struct", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runner/jujuc/goal-state.go#L76-L97
3,796
juju/juju
core/model/model.go
ValidateSeries
func ValidateSeries(modelType ModelType, charmSeries string) error { os, err := series.GetOSFromSeries(charmSeries) if err != nil { return errors.Trace(err) } switch modelType { case CAAS: if !caasOS.Contains(os.String()) { return errors.NotValidf("series %q in a kubernetes model", charmSeries) } case IA...
go
func ValidateSeries(modelType ModelType, charmSeries string) error { os, err := series.GetOSFromSeries(charmSeries) if err != nil { return errors.Trace(err) } switch modelType { case CAAS: if !caasOS.Contains(os.String()) { return errors.NotValidf("series %q in a kubernetes model", charmSeries) } case IA...
[ "func", "ValidateSeries", "(", "modelType", "ModelType", ",", "charmSeries", "string", ")", "error", "{", "os", ",", "err", ":=", "series", ".", "GetOSFromSeries", "(", "charmSeries", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Trac...
// ValidateSeries ensures the charm series is valid for the model type.
[ "ValidateSeries", "ensures", "the", "charm", "series", "is", "valid", "for", "the", "model", "type", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/core/model/model.go#L44-L60
3,797
juju/juju
apiserver/facades/client/firewallrules/backend.go
NewStateBackend
func NewStateBackend(st *state.State) (Backend, error) { m, err := st.Model() if err != nil { return nil, err } if m.Type() != state.ModelTypeIAAS { return nil, errors.NotSupportedf("Firewall Rules for non-IAAS models") } return &stateShim{ State: st, Model: m, }, nil }
go
func NewStateBackend(st *state.State) (Backend, error) { m, err := st.Model() if err != nil { return nil, err } if m.Type() != state.ModelTypeIAAS { return nil, errors.NotSupportedf("Firewall Rules for non-IAAS models") } return &stateShim{ State: st, Model: m, }, nil }
[ "func", "NewStateBackend", "(", "st", "*", "state", ".", "State", ")", "(", "Backend", ",", "error", ")", "{", "m", ",", "err", ":=", "st", ".", "Model", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n...
// NewStateBackend converts a state.State into a Backend.
[ "NewStateBackend", "converts", "a", "state", ".", "State", "into", "a", "Backend", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/client/firewallrules/backend.go#L37-L49
3,798
juju/juju
api/provisioner/machine.go
ModelAgentVersion
func (m *Machine) ModelAgentVersion() (*version.Number, error) { mc, err := m.st.ModelConfig() if err != nil { return nil, errors.Trace(err) } if v, ok := mc.AgentVersion(); ok { return &v, nil } return nil, errors.New("failed to get model's agent version.") }
go
func (m *Machine) ModelAgentVersion() (*version.Number, error) { mc, err := m.st.ModelConfig() if err != nil { return nil, errors.Trace(err) } if v, ok := mc.AgentVersion(); ok { return &v, nil } return nil, errors.New("failed to get model's agent version.") }
[ "func", "(", "m", "*", "Machine", ")", "ModelAgentVersion", "(", ")", "(", "*", "version", ".", "Number", ",", "error", ")", "{", "mc", ",", "err", ":=", "m", ".", "st", ".", "ModelConfig", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return",...
// ModelAgentVersion implements MachineProvisioner.ModelAgentVersion.
[ "ModelAgentVersion", "implements", "MachineProvisioner", ".", "ModelAgentVersion", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/provisioner/machine.go#L140-L151
3,799
juju/juju
api/provisioner/machine.go
ProvisioningInfo
func (m *Machine) ProvisioningInfo() (*params.ProvisioningInfo, error) { var results params.ProvisioningInfoResults args := params.Entities{Entities: []params.Entity{{m.tag.String()}}} err := m.st.facade.FacadeCall("ProvisioningInfo", args, &results) if err != nil { return nil, err } if len(results.Results) != ...
go
func (m *Machine) ProvisioningInfo() (*params.ProvisioningInfo, error) { var results params.ProvisioningInfoResults args := params.Entities{Entities: []params.Entity{{m.tag.String()}}} err := m.st.facade.FacadeCall("ProvisioningInfo", args, &results) if err != nil { return nil, err } if len(results.Results) != ...
[ "func", "(", "m", "*", "Machine", ")", "ProvisioningInfo", "(", ")", "(", "*", "params", ".", "ProvisioningInfo", ",", "error", ")", "{", "var", "results", "params", ".", "ProvisioningInfoResults", "\n", "args", ":=", "params", ".", "Entities", "{", "Entit...
// ProvisioningInfo implements MachineProvisioner.ProvisioningInfo.
[ "ProvisioningInfo", "implements", "MachineProvisioner", ".", "ProvisioningInfo", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/provisioner/machine.go#L184-L199