// Load the container history from S3.
492196
func LoadContainerHistory(s3c *s3.Client, bucket, prefix string) (*ContainerHistory, error) {
	ch := &ContainerHistory{s3Client: s3c, s3Bucket: bucket, s3Prefix: prefix}
	return ch, ch.load()
}
240018
func (c *cluster) loadTopology() error {
	buf, err := ioutil.ReadFile(filepath.Join(c.Path, ".topology"))
	if os.IsNotExist(err) {
		c.Topology = newTopology()
		return nil
	} else if err != nil {
		return errors.Wrap(err, "reading file")
	}

	var pb internal.Topology
	if err := proto.Unmarshal(buf, &pb); err != nil {
		return errors.Wrap(err, "unmarshalling")
	}
	top, err := decodeTopology(&pb)
	if err != nil {
		return errors.Wrap(err, "decoding")
	}
	c.Topology = top

	return nil
}
379453
func (e *EnvironmentLoader) Load(s interface{}) error {
	strct := structs.New(s)
	strctMap := strct.Map()
	prefix := e.getPrefix(strct)

	for key, val := range strctMap {
		field := strct.Field(key)

		if err := e.processField(prefix, field, key, val); err != nil {
			return err
		}
	}

	return nil
}
1057721
func (m *EventStore) Load(ctx context.Context, id uuid.UUID) ([]eh.Event, error) {
	if m.Err != nil {
		return nil, m.Err
	}
	m.Loaded = id
	m.Context = ctx
	return m.Events, nil
}
219207
func (m *boxMap) Load(key string) (*Box, bool) {
	i, ok := m.data.Load(key)
	if !ok {
		return nil, false
	}
	s, ok := i.(*Box)
	return s, ok
}
561538
func (history *History) Less(i, j int) bool {
	containers := *history
	return containers[j].Created.Before(containers[i].Created)
}
85377
func LoadTraining(data []byte) (*Storage, error) {
	var storage Storage
	err := json.Unmarshal(data, &storage)

	if err != nil {
		return nil, err
	}

	return &storage, nil
}
365503
func Load() {
	_ = commands.API{}
	_ = application.ListApps{}
	_ = buildpack.ListBuildpacks{}
	_ = domain.CreateDomain{}
	_ = environmentvariablegroup.RunningEnvironmentVariableGroup{}
	_ = featureflag.ShowFeatureFlag{}
	_ = organization.ListOrgs{}
	_ = plugin.Plugins{}
	_ = pluginrepo.RepoPlugins{}
	_ = quota.CreateQuota{}
	_ = route.CreateRoute{}
	_ = routergroups.RouterGroups{}
	_ = securitygroup.ShowSecurityGroup{}
	_ = service.ShowService{}
	_ = serviceauthtoken.ListServiceAuthTokens{}
	_ = serviceaccess.ServiceAccess{}
	_ = servicebroker.ListServiceBrokers{}
	_ = servicekey.ServiceKey{}
	_ = space.CreateSpace{}
	_ = spacequota.SpaceQuota{}
	_ = user.CreateUser{}
}
824289
func (r Network_Storage) GetVolumeHistory() (resp []datatypes.Network_Storage_History, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_Storage", "getVolumeHistory", nil, &r.Options, &resp)
	return
}
968571
func (daemon *Daemon) ContainerCopy(name string, res string) (io.ReadCloser, error) {
	container, err := daemon.GetContainer(name)
	if err != nil {
		return nil, err
	}

	// Make sure an online file-system operation is permitted.
	if err := daemon.isOnlineFSOperationPermitted(container); err != nil {
		return nil, errdefs.System(err)
	}

	data, err := daemon.containerCopy(container, res)
	if err == nil {
		return data, nil
	}

	if os.IsNotExist(err) {
		return nil, containerFileNotFound{res, name}
	}
	return nil, errdefs.System(err)
}
81057
func (e *Engine) LoadAssets(virtualDirectory string, virtualExtension string, assetFn func(name string) ([]byte, error), namesFn func() []string) error {
	e.templateCache = make(map[string]*template.Template)
	// prepare the global amber funcs
	funcs := template.FuncMap{}

	for k, v := range amber.FuncMap { // add the amber's default funcs
		funcs[k] = v
	}

	if e.Config.Funcs != nil { // add the config's funcs
		for k, v := range e.Config.Funcs {
			funcs[k] = v
		}
	}
	if len(virtualDirectory) > 0 {
		if virtualDirectory[0] == '.' { // first check for .wrong
			virtualDirectory = virtualDirectory[1:]
		}
		if virtualDirectory[0] == '/' || virtualDirectory[0] == filepath.Separator { // second check for /something, (or ./something if we had dot on 0 it will be removed
			virtualDirectory = virtualDirectory[1:]
		}
	}
	amber.FuncMap = funcs //set the funcs

	e.mu.Lock()
	defer e.mu.Unlock()

	names := namesFn()

	for _, path := range names {
		if !strings.HasPrefix(path, virtualDirectory) {
			continue
		}
		ext := filepath.Ext(path)
		if ext == virtualExtension {

			rel, err := filepath.Rel(virtualDirectory, path)
			if err != nil {
				return err
			}

			buf, err := assetFn(path)
			if err != nil {
				return err
			}

			name := filepath.ToSlash(rel)
			tmpl, err := amber.CompileData(buf, name, amber.DefaultOptions)

			if err != nil {
				return err
			}

			e.templateCache[name] = tmpl
		}
	}

	return nil
}
21472
func Load(set *FIFOSet) (IO, error) {
	return &cio{
		config:  set.Config,
		closers: []io.Closer{set},
	}, nil
}
1169751
func (s *FilesystemStore) load(session *Session) error {
	filename := filepath.Join(s.path, "session_"+session.ID)
	fileMutex.RLock()
	defer fileMutex.RUnlock()
	fdata, err := ioutil.ReadFile(filename)
	if err != nil {
		return err
	}
	if err = securecookie.DecodeMulti(session.Name(), string(fdata),
		&session.Values, s.Codecs...); err != nil {
		return err
	}
	return nil
}
1033965
func (a *HistoricalApi) podContainerAggregations(request *restful.Request, response *restful.Response) {
	var key core.HistoricalKey
	if request.PathParameter("pod-id") != "" {
		key = core.HistoricalKey{
			ObjectType:    core.MetricSetTypePodContainer,
			PodId:         request.PathParameter("pod-id"),
			ContainerName: request.PathParameter("container-name"),
		}
	} else {
		key = core.HistoricalKey{
			ObjectType:    core.MetricSetTypePodContainer,
			NamespaceName: request.PathParameter("namespace-name"),
			PodName:       request.PathParameter("pod-name"),
			ContainerName: request.PathParameter("container-name"),
		}
	}
	a.processAggregationRequest(key, request, response)
}
331107
func (dh *Client) Container(containerId string) (containerInfo *docker.ContainerInfo, e error) {
	containerInfo = &docker.ContainerInfo{}
	e = dh.getJSON(dh.Address+"/containers/"+containerId+"/json", containerInfo)
	return containerInfo, e
}
166571
func (dfs *DistributedFilesystem) loadSnapshotImages(tenant, label string) error {
	vol, err := dfs.disk.Get(tenant)
	if err != nil {
		plog.WithError(err).WithField("tenant", tenant).Error("Could not get volume for tenant")
		return err
	}

	tenantLogger := plog.WithFields(log.Fields{
		"label":  label,
		"tenant": tenant,
	})

	// get the list of images for this snapshot
	images, err := func() ([]string, error) {
		r, err := vol.ReadMetadata(label, ImagesMetadataFile)
		defer r.Close()
		if err != nil {
			tenantLogger.WithError(err).Error("Could not read images metadata from snapshot for tenant")
			return nil, err
		}

		images := []string{}
		if err := importJSON(r, &images); err != nil {
			tenantLogger.WithError(err).Error("Could not interpret images metadata from snapshot for tenant")
			return nil, err
		}
		return images, nil
	}()

	// if the image data is incomplete, this is a bad snapshot, so remove it
	if err != nil {
		vol.RemoveSnapshot(label)
		return err
	}

	// try to load the image into the registry
	for _, image := range images {
		imageLogger := plog.WithField("image", image)

		img, err := dfs.docker.FindImage(image)
		if err != nil {
			imageLogger.WithError(err).Warn("Missing image for import to registry")
			continue
		}

		hash, err := dfs.docker.GetImageHash(img.ID)
		if err != nil {
			imageLogger.WithField("imageid", img.ID).WithError(err).
				Error("Could not get hash for image")
			return err
		}

		if err := dfs.index.PushImage(image, img.ID, hash); err != nil {
			imageLogger.WithError(err).Error("Could not push image into the registry")
			return err
		}

		imageLogger.Info("Loaded image into the registry")
	}

	tenantLogger.Info("Loaded images from snapshot for tenant")

	return nil
}
948877
func (ic *IncrementalCompact) Load(ctx context.Context, sess rets.Requester, url string) error {
	// extract an id'd subesection of metadata
	get := func(id, mtype string) (*rets.CompactMetadata, error) {
		if id == "" {
			id = "0"
		}
		params := rets.MetadataParams{
			Format: "COMPACT",
			MType:  mtype,
			ID:     id,
		}
		req := rets.MetadataRequest{
			URL:            url,
			MetadataParams: params,
		}
		reader, er := rets.MetadataStream(rets.MetadataResponse(ctx, sess, req))
		if er != nil {
			return nil, er
		}
		return rets.ParseMetadataCompactResult(reader)
	}
	msys, err := get("", metadata.MISystem.Name)
	if err != nil {
		return err
	}
	ic.Response = msys.Response
	ic.MSystem = msys.MSystem
	ic.Elements = map[string][]rets.CompactData{}
	// fmt.Printf("compact system: %v\n", compact)
	cds, err := ic.extractChildren(get, []string{}, metadata.MISystem)
	if err != nil {
		return err
	}
	for _, cd := range cds {
		// extract children from this element and put in the system elem
		ic.Elements[cd.Element] = append(ic.Elements[cd.Element], cd)
	}
	return nil
}