// Load loads a graph from the given path and write it to qw.  See
// DecompressAndLoad for more information.
549929
func Load(qw graph.QuadWriter, batch int, path, typ string) error {
	return DecompressAndLoad(qw, batch, path, typ, nil)
}
559095
func (l MapLoader) Load(ep *transport.Endpoint) (storer.Storer, error) {
	s, ok := l[ep.String()]
	if !ok {
		return nil, transport.ErrRepositoryNotFound
	}

	return s, nil
}
42144
func (l *SigChainLoader) Load() (ret *SigChain, err error) {
	defer TimeLog(fmt.Sprintf("SigChainLoader#Load: %s", l.user.GetName()), l.G().Clock().Now(), l.G().Log.Debug)
	var current bool
	var preload bool

	uid := l.user.GetUID()

	l.M().Debug("+ SigChainLoader#Load(%s)", uid)
	defer func() {
		l.M().Debug("- SigChainLoader#Load(%s) -> (%v, %s)", uid, (ret != nil), ErrToOk(err))
	}()

	stage := func(s string) {
		l.M().Debug("| SigChainLoader#Load(%s) %s", uid, s)
	}

	stage("GetFingerprint")
	if err = l.GetKeyFamily(); err != nil {
		return nil, err
	}

	stage("AccessPreload")
	preload = l.AccessPreload()

	if !preload {
		stage("LoadLinksFromStorage")
		if err = l.LoadLinksFromStorage(); err != nil {
			return nil, err
		}
	}

	stage("MakeSigChain")
	if err = l.MakeSigChain(); err != nil {
		return nil, err
	}
	ret = l.chain
	stage("VerifyChain")
	if err = l.chain.VerifyChain(l.M(), uid); err != nil {
		return nil, err
	}
	stage("CheckFreshness")
	if current, err = l.CheckFreshness(); err != nil {
		return nil, err
	}
	if !current {
		stage("LoadFromServer")
		if err = l.LoadFromServer(); err != nil {
			return nil, err
		}
	} else if l.chain.GetComputedKeyInfosWithVersionBust() == nil {
		// The chain tip doesn't have a cached cki, probably because new
		// signatures have shown up since the last time we loaded it.
		l.M().Debug("| Need to reverify chain since we don't have ComputedKeyInfos")
	} else if !l.merkleTreeEldestMatchesLastLinkEldest() {
		// CheckFreshness above might've decided our chain tip hasn't moved,
		// but we might still need to proceed with the rest of the load if the
		// eldest KID has changed.
		l.M().Debug("| Merkle leaf doesn't match the chain tip.")
	} else {
		// The chain tip has a cached cki, AND the current eldest kid matches
		// it. Use what's cached and short circuit.
		l.M().Debug("| Sigchain was fully cached. Short-circuiting verification.")
		ret.wasFullyCached = true
		stage("VerifySig (in fully cached)")

		// Even though we're fully cached, we still need to call the below, so
		// we recompute historical subchains. Otherwise, we might hose our
		// UPAK caches.
		if err = l.VerifySigsAndComputeKeys(); err != nil {
			return nil, err
		}

		// Success in the fully cached case.
		return ret, nil
	}

	stage("VerifyChain")
	if err = l.chain.VerifyChain(l.M(), uid); err != nil {
		return nil, err
	}

	stage("StoreChain")
	if err = l.chain.Store(l.M()); err != nil {
		l.M().Debug("| continuing past error storing chain links: %s", err)
	}
	stage("VerifySig")
	if err = l.VerifySigsAndComputeKeys(); err != nil {
		return nil, err
	}
	stage("Store")
	if err = l.Store(); err != nil {
		l.M().Debug("| continuing past error storing chain: %s", err)
	}

	return ret, nil
}
931122
func Load(configFile string, data interface{}) (quick.Config, error) {
	return quick.LoadConfig(configFile, globalEtcdClient, data)
}
828276
func (t *TOMLLoader) Load(s interface{}) error {
	var r io.Reader

	if t.Reader != nil {
		r = t.Reader
	} else if t.Path != "" {
		file, err := getConfig(t.Path)
		if err != nil {
			return err
		}
		defer file.Close()
		r = file
	} else {
		return ErrSourceNotSet
	}

	if _, err := toml.DecodeReader(r, s); err != nil {
		return err
	}

	return nil
}
1035452
func Load(file string, v interface{}) error {
	b, err := ioutil.ReadFile(file)
	if err != nil {
		return err
	}

	return Unmarshal(b, v)
}
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
}
656261
func (g *GitArtifactDriver) Load(inputArtifact *wfv1.Artifact, path string) error {
	if g.SSHPrivateKey != "" {
		signer, err := ssh.ParsePrivateKey([]byte(g.SSHPrivateKey))
		if err != nil {
			return errors.InternalWrapError(err)
		}
		auth := &ssh2.PublicKeys{User: "git", Signer: signer}
		if g.InsecureIgnoreHostKey {
			auth.HostKeyCallback = ssh.InsecureIgnoreHostKey()
		}
		return gitClone(path, inputArtifact, auth, g.SSHPrivateKey)
	}
	if g.Username != "" || g.Password != "" {
		auth := &http.BasicAuth{Username: g.Username, Password: g.Password}
		return gitClone(path, inputArtifact, auth, "")
	}
	return gitClone(path, inputArtifact, nil, "")
}
1358887
func (c *ConfigFile) Load() error {
	rw, err := NewConfigReadWriter(c.version)
	if err != nil {
		return err
	}
	filename := rw.Filename(c)
	if _, err := os.Stat(filename); err != nil {
		return err
	}
	file, err := os.Open(filename)
	if err != nil {
		return err
	}
	err = rw.LoadFromReader(file, c)
	if err != nil {
		return err
	}
	defer file.Close()
	return nil
}
1108670
func (p *Proxy) Load(basePath, innerPath string, opts *ace.Options) (*template.Template, error) {
	var o *ace.Options

	if opts == nil {
		o = p.Opts
	} else {
		o = opts
	}

	return ace.Load(basePath, innerPath, o)
}
123213
func (driver *ArtifactDriver) Load(inputArtifact *wfv1.Artifact, path string) error {
	hdfscli, err := createHDFSClient(driver.Addresses, driver.HDFSUser, driver.KrbOptions)
	if err != nil {
		return err
	}
	defer util.Close(hdfscli)

	srcStat, err := hdfscli.Stat(driver.Path)
	if err != nil {
		return err
	}
	if srcStat.IsDir() {
		return fmt.Errorf("HDFS artifact does not suppot directory copy")
	}

	_, err = os.Stat(path)
	if err != nil && !os.IsNotExist(err) {
		return err
	}

	if os.IsNotExist(err) {
		dirPath := filepath.Dir(driver.Path)
		if dirPath != "." && dirPath != "/" {
			// Follow umask for the permission
			err = os.MkdirAll(dirPath, 0777)
			if err != nil {
				return err
			}
		}
	} else {
		if driver.Force {
			err = os.Remove(path)
			if err != nil && !os.IsNotExist(err) {
				return err
			}
		}
	}

	return hdfscli.CopyToLocal(driver.Path, path)
}
1301948
func (muf *MutableForest) Load(version int64) error {
	return muf.commitsTree.Load(version, true)
}
768144
func DecompressAndLoad(qw graph.QuadWriter, batch int, path, typ string, writerFunc func(graph.QuadWriter) graph.BatchWriter) error {
	if path == "" {
		return nil
	}
	qr, err := QuadReaderFor(path, typ)
	if err != nil {
		return err
	}
	defer qr.Close()

	if writerFunc == nil {
		writerFunc = graph.NewWriter
	}
	dest := writerFunc(qw)

	_, err = quad.CopyBatch(&batchLogger{BatchWriter: dest}, qr, batch)
	if err != nil {
		return fmt.Errorf("db: failed to load data: %v", err)
	}
	return dest.Close()
}
898691
func (t *Tree) Loaded() bool {
	t.lock.RLock()
	defer t.lock.RUnlock()
	return t.children != nil
}
1257853
func (n *Node) Load(k enr.Entry) error {
	return n.r.Load(k)
}
464152
func LoadJSON(filename string) *Graph {
	js, err := ioutil.ReadFile(filename)
	if err != nil {
		return nil
	}
	return ParseJSON(js)
}
1052334
func (r *GormWorkItemLinkTypeRepository) Load(ctx context.Context, ID uuid.UUID) (*WorkItemLinkType, error) {
	defer goa.MeasureSince([]string{"goa", "db", "workitemlinktype", "load"}, time.Now())
	log.Info(ctx, map[string]interface{}{
		"wilt_id": ID,
	}, "loading work item link type")
	modelLinkType := WorkItemLinkType{}
	db := r.db.Model(&modelLinkType).Where("id=?", ID).First(&modelLinkType)
	if db.RecordNotFound() {
		log.Error(ctx, map[string]interface{}{
			"wilt_id": ID,
		}, "work item link type not found")
		return nil, errors.NewNotFoundError("work item link type", ID.String())
	}
	if db.Error != nil {
		log.Error(ctx, map[string]interface{}{
			"wilt_id": ID,
			"err":     db.Error,
		}, "failed to create work item link type")
		return nil, errors.NewInternalError(ctx, db.Error)
	}
	return &modelLinkType, nil
}