// Refresh the shard containing the document before performing the operation.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-refresh.html
// for details.
165749
func (s *GetService) Refresh(refresh string) *GetService {
	s.refresh = refresh
	return s
}
1294764
func (s *DeleteService) Refresh(refresh string) *DeleteService {
	s.refresh = refresh
	return s
}
726873
func (h *Harness) Refresh() (err *utils.Error) {
	// Allow only one thread to rebuild the process
	// If multiple requests to rebuild are queued only the last one is executed on
	// So before a build is started we wait for a second to determine if
	// more requests for a build are triggered.
	// Once no more requests are triggered the build will be processed
	h.mutex.Lock()
	defer h.mutex.Unlock()

	if h.app != nil {
		h.app.Kill()
	}

	utils.Logger.Info("Rebuild Called")
	var newErr error
	h.app, newErr = Build(h.config, h.paths)
	if newErr != nil {
		utils.Logger.Error("Build detected an error", "error", newErr)
		if castErr, ok := newErr.(*utils.Error); ok {
			return castErr
		}
		err = &utils.Error{
			Title:       "App failed to start up",
			Description: err.Error(),
		}
		return
	}

	if h.useProxy {
		h.app.Port = h.port
		if err2 := h.app.Cmd(h.runMode).Start(h.config); err2 != nil {
			utils.Logger.Error("Could not start application", "error", err2)
			if err,k :=err2.(*utils.Error);k {
				return err
			}
			return &utils.Error{
				Title:       "App failed to start up",
				Description: err2.Error(),
			}
		}
	} else {
		h.app = nil
	}

	return
}
1216052
func (g *Generation) Refresh() error {
	col, closer := g.st.db().GetCollection(generationsC)
	defer closer()

	var doc generationDoc
	if err := col.FindId(g.doc.DocId).One(&doc); err != nil {
		return errors.Trace(err)
	}
	g.doc = doc
	return nil
}
839238
func (loader *TemplateLoader) Refresh() (err *Error) {
	loader.templateMutex.Lock()
	defer loader.templateMutex.Unlock()

	loader.loadVersionSeed++
	runtimeLoader := &templateRuntime{loader: loader,
		version:     loader.loadVersionSeed,
		templateMap: map[string]Template{}}

	templateLog.Debug("Refresh: Refreshing templates from ", "path", loader.paths)
	if err = loader.initializeEngines(runtimeLoader, Config.StringDefault("template.engines", GO_TEMPLATE)); err != nil {
		return
	}
	for _, engine := range runtimeLoader.templatesAndEngineList {
		engine.Event(TEMPLATE_REFRESH_REQUESTED, nil)
	}
	RaiseEvent(TEMPLATE_REFRESH_REQUESTED, nil)
	defer func() {
		for _, engine := range runtimeLoader.templatesAndEngineList {
			engine.Event(TEMPLATE_REFRESH_COMPLETED, nil)
		}
		RaiseEvent(TEMPLATE_REFRESH_COMPLETED, nil)

		// Reset the runtimeLoader
		loader.runtimeLoader.Store(runtimeLoader)
	}()

	// Resort the paths, make sure the revel path is the last path,
	// so anything can override it
	revelTemplatePath := filepath.Join(RevelPath, "templates")
	// Go through the paths
	for i, o := range loader.paths {
		if o == revelTemplatePath && i != len(loader.paths)-1 {
			loader.paths[i] = loader.paths[len(loader.paths)-1]
			loader.paths[len(loader.paths)-1] = revelTemplatePath
		}
	}
	templateLog.Debug("Refresh: Refreshing templates from", "path", loader.paths)

	runtimeLoader.compileError = nil
	runtimeLoader.TemplatePaths = map[string]string{}

	for _, basePath := range loader.paths {
		// Walk only returns an error if the template loader is completely unusable
		// (namely, if one of the TemplateFuncs does not have an acceptable signature).

		// Handling symlinked directories
		var fullSrcDir string
		f, err := os.Lstat(basePath)
		if err == nil && f.Mode()&os.ModeSymlink == os.ModeSymlink {
			fullSrcDir, err = filepath.EvalSymlinks(basePath)
			if err != nil {
				templateLog.Panic("Refresh: Eval symlinks error ", "error", err)
			}
		} else {
			fullSrcDir = basePath
		}

		var templateWalker filepath.WalkFunc

		templateWalker = func(path string, info os.FileInfo, err error) error {
			if err != nil {
				templateLog.Error("Refresh: error walking templates:", "error", err)
				return nil
			}

			// Walk into watchable directories
			if info.IsDir() {
				if !loader.WatchDir(info) {
					return filepath.SkipDir
				}
				return nil
			}

			// Only add watchable
			if !loader.WatchFile(info.Name()) {
				return nil
			}

			fileBytes, err := runtimeLoader.findAndAddTemplate(path, fullSrcDir, basePath)
			if err != nil {
				// Add in this template name to the list of templates unable to be compiled
				runtimeLoader.compileErrorNameList = append(runtimeLoader.compileErrorNameList, filepath.ToSlash(path[len(fullSrcDir)+1:]))
			}
			// Store / report the first error encountered.
			if err != nil && runtimeLoader.compileError == nil {
				runtimeLoader.compileError, _ = err.(*Error)

				if nil == runtimeLoader.compileError {
					_, line, description := ParseTemplateError(err)

					runtimeLoader.compileError = &Error{
						Title:       "Template Compilation Error",
						Path:        path,
						Description: description,
						Line:        line,
						SourceLines: strings.Split(string(fileBytes), "\n"),
					}
				}
				templateLog.Errorf("Refresh: Template compilation error (In %s around line %d):\n\t%s",
					path, runtimeLoader.compileError.Line, err.Error())
			} else if nil != err { //&& strings.HasPrefix(templateName, "errors/") {

				if compileError, ok := err.(*Error); ok {
					templateLog.Errorf("Template compilation error (In %s around line %d):\n\t%s",
						path, compileError.Line, err.Error())
				} else {
					templateLog.Errorf("Template compilation error (In %s ):\n\t%s",
						path, err.Error())
				}
			}
			return nil
		}

		if _, err = os.Lstat(fullSrcDir); os.IsNotExist(err) {
			// #1058 Given views/template path is not exists
			// so no need to walk, move on to next path
			continue
		}

		funcErr := Walk(fullSrcDir, templateWalker)

		// If there was an error with the Funcs, set it and return immediately.
		if funcErr != nil {
			runtimeLoader.compileError = NewErrorFromPanic(funcErr)
			return runtimeLoader.compileError
		}
	}

	// Note: compileError may or may not be set.
	return runtimeLoader.compileError
}
367525
func (s *DeleteByQueryService) Refresh(refresh string) *DeleteByQueryService {
	s.refresh = refresh
	return s
}
593889
func (router *Router) Refresh() (err *Error) {
	RaiseEvent(ROUTE_REFRESH_REQUESTED, nil)
	router.Routes, err = parseRoutesFile(appModule, router.path, "", true)
	RaiseEvent(ROUTE_REFRESH_COMPLETED, nil)
	if err != nil {
		return
	}
	err = router.updateTree()
	return
}
412633
func (u *User) Refresh() error {
	var udoc userDoc
	if err := u.st.getUser(u.Name(), &udoc); err != nil {
		return err
	}
	u.doc = udoc
	return nil
}
635168
func (c *oidcConnector) Refresh(ctx context.Context, s connector.Scopes, identity connector.Identity) (connector.Identity, error) {
	return identity, nil
}
1369124
func (s *ExistsService) Refresh(refresh string) *ExistsService {
	s.refresh = refresh
	return s
}
1248996
func (s *ReindexService) Refresh(refresh string) *ReindexService {
	s.refresh = refresh
	return s
}
294621
func (r *Relation) Refresh() error {
	result, err := r.st.relation(r.tag, r.st.unitTag)
	if err != nil {
		return err
	}
	// NOTE: The status and life cycle information are the only
	// things that can change - id, tag and endpoint
	// information are static.
	r.life = result.Life
	r.suspended = result.Suspended

	return nil
}
614067
func (c *ShardedClient) Flush(expiration uint32) Response {
	var err error
	for shard, conn := range c.manager.GetAllShards() {
		response := c.flushHelper(shard, conn, expiration)
		if response.Error() != nil {
			if err == nil {
				err = response.Error()
			} else {
				err = errors.Wrap(response.Error(), err.Error())
			}
		}
	}

	if err != nil {
		return NewErrorResponse(err)
	}

	return NewResponse(StatusNoError)
}
417986
func (c *TokenController) Refresh(ctx *app.RefreshTokenContext) error {
	// retrieve the access token if it exists (otherwise, a jwtrequest.ErrNoTokenInRequest is returned, but it can be ignored here)
	accessToken := goajwt.ContextJWT(ctx)
	refreshToken := ctx.Payload.RefreshToken
	if refreshToken == nil {
		return jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterError("refresh_token", nil).Expected("not nil"))
	}
	var t *manager.TokenSet
	var err error
	if accessToken != nil {
		t, err = c.app.TokenService().ExchangeRefreshToken(ctx, *refreshToken, accessToken.Raw)
	} else {
		t, err = c.app.TokenService().ExchangeRefreshToken(ctx, *refreshToken, "")
	}
	if err != nil {
		c.TokenManager.AddLoginRequiredHeaderToUnauthorizedError(err, ctx.ResponseData)
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	ctx.ResponseData.Header().Set("Cache-Control", "no-cache")
	return ctx.OK(convertToken(*t))
}
189952
func (u UAA) Refresh(refreshToken string) (Token, error) {
	return u.RefreshCommand(u, refreshToken)
}
1253128
func (j *Job) Refresh() error {
	t := newTransaction()
	t.scanJobById(j.id, j)
	if err := t.exec(); err != nil {
		return err
	}
	return nil
}
1148413
func (s *OAuth2Storage) LoadRefresh(token string) (*osin.AccessData, error) {
	var pointedAccessData OAuth2AccessData
	var refreshToken OAuth2RefreshToken
	if err := Db().Model(OAuth2RefreshToken{}).Where(&OAuth2RefreshToken{Token: token}).Scan(&refreshToken); err != nil || refreshToken.Token == "" {
		return nil, errors.New("Refresh token not found")
	}

	var refreshTokenNullInt64 sql.NullInt64
	refreshTokenNullInt64.Int64, refreshTokenNullInt64.Valid = int64(refreshToken.ID), true

	if err := Db().Model(OAuth2AccessData{}).Where(&OAuth2AccessData{RefreshTokenID: refreshTokenNullInt64}).Scan(&pointedAccessData); err != nil {
		return nil, err
	}
	return s.LoadAccess(pointedAccessData.AccessToken)
}