// GetSessionInfo retrieves the session for the passed session id. An error is
// returned if the session could not be found.
487056
func (db *TowerDB) GetSessionInfo(id *wtdb.SessionID) (*wtdb.SessionInfo, error) {
	db.mu.Lock()
	defer db.mu.Unlock()

	if info, ok := db.sessions[*id]; ok {
		return info, nil
	}

	return nil, wtdb.ErrSessionNotFound
}
722691
func (c *Connector) GetSessionData(ctx context.Context) (*SessionData, error) {
	s := pitaya.GetSessionFromCtx(ctx)
	res := &SessionData{
		Data: s.GetData(),
	}
	return res, nil
}
424456
func Get(ctx context.Context, name string) (*Session, error) {
	m, _ := ctx.Value(scopedManagerKey{}).(*scopedManager)
	if m == nil {
		return nil, ErrNotPassMiddleware
	}

	// try get session from storage first
	// to preserve session data from difference handler
	if s, ok := m.storage[name]; ok {
		return s, nil
	}

	// get session from manager
	s, err := m.Get(name)
	if err != nil {
		return nil, err
	}
	s.m = m

	// save session to storage for later get
	m.storage[name] = s
	return s, nil
}
1314216
func (kv *consulKV) getActiveSession(key string) (string, error) {
	pair, _, err := kv.client.Get(key, nil)
	if err != nil {
		return "", err
	}
	if pair != nil && pair.Session != "" {
		return pair.Session, nil
	}
	return "", nil
}
965177
func (s *StorageOverseer) Get(w http.ResponseWriter, r *http.Request) (value string, err error) {
	sessID, err := s.options.getCookieValue(w, r)
	if err != nil {
		return "", errors.Wrap(err, "unable to get session id from cookie")
	}

	val, err := s.Storer.Get(sessID)
	if err != nil {
		return "", errors.Wrap(err, "unable to get session value")
	}

	return val, nil
}
391722
func (this *RedisStore) Get(id string) (*Session, error) {
	key := id
	if this.opts.KeyPrefix != "" {
		key = this.opts.KeyPrefix + ":" + id
	}
	b, err := redis.Bytes(this.conn.Do("GET", key))
	if err != nil {
		return nil, err
	}
	var sess Session
	err = json.Unmarshal(b, &sess)
	if err != nil {
		return nil, err
	}
	return &sess, nil
}
13402
func GetSessionFromCtx(ctx context.Context) *session.Session {
	sessionVal := ctx.Value(constants.SessionCtxKey)
	if sessionVal == nil {
		logger.Log.Warn("ctx doesn't contain a session, are you calling GetSessionFromCtx from inside a remote?")
		return nil
	}
	return sessionVal.(*session.Session)
}
1155090
func (manager *Manager) GetSessionStore(sid string) (sessions Store, err error) {
	sessions, err = manager.provider.SessionRead(sid)
	return
}
18736
func (s *HeaderStorer) GetValueForSessionName(r *http.Request, name string) (string, error) {
	// fetch header field from header.
	headerBase64Encoded := r.Header.Get(s.HeaderFieldName)
	if headerBase64Encoded == "" {
		return "", ErrValueNotFound
	}

	// fetch value for name from JSON map.
	headerMap, err := s.headerToMap(headerBase64Encoded)
	if err != nil {
		return "", err
	}
	value, exists := headerMap[name]
	if !exists {
		return "", ErrValueNotFound
	}
	return value, nil
}
680444
func (s Session) AddSessionInfo(info string) Session {
	return s.appendString(TypeSessionInformation, info)
}
781946
func (this *MemoryStore) Get(id string) (*Session, error) {
	this.l.RLock()
	defer this.l.RUnlock()
	return this.m[id], nil
}
30975
func (api *CoreAPI) getSession(ctx context.Context) *CoreAPI {
	sesApi := *api

	// TODO: We could also apply this to api.blocks, and compose into writable api,
	// but this requires some changes in blockservice/merkledag
	sesApi.dag = dag.NewReadOnlyDagService(dag.NewSession(ctx, api.dag))

	return &sesApi
}
373357
func GetSession() (*mgo.Session, error) {
	var err error

	if mgoSession == nil {
		mgoSession, err = mgo.Dial(servers)
		if err != nil {
			return nil, err
		}
	}

	return mgoSession.Clone(), nil
}
1291321
func (s Session) getSessionJsonMap() map[string]string {
	if sessionJson, found := s[SessionObjectKeyName]; found {
		if _, valid := sessionJson.(map[string]string); !valid {
			sessionLog.Error("Session object key corrupted, reset", "was", sessionJson)
			s[SessionObjectKeyName] = map[string]string{}
		}
		// serialized data inside the session _objects
	} else {
		s[SessionObjectKeyName] = map[string]string{}
	}

	return s[SessionObjectKeyName].(map[string]string)
}
781888
func GetCurrentSessionIfPossible(
	ctx context.Context, kbpki CurrentSessionGetter, sessionNotRequired bool) (
	SessionInfo, error) {
	session, err := kbpki.GetCurrentSession(ctx)
	if err == nil {
		return session, nil
	}
	// Return all errors if a session is required.
	if !sessionNotRequired {
		return SessionInfo{}, err
	}

	// If not logged in, return empty session.
	if _, notLoggedIn := err.(NoCurrentSessionError); notLoggedIn {
		return SessionInfo{}, nil
	}

	// Otherwise, just return the error.
	return SessionInfo{}, err
}
750488
func (mgr *MemorySessionManager) Session(sid string) (Session, error) {
	mgr.lock.RLock()
	if s, ok := mgr.sessions[sid]; ok {
		s.createdAt = time.Now()
		mgr.lock.RUnlock()
		return s, nil
	}
	mgr.lock.RUnlock()
	return nil, fmt.Errorf("Can not retrieve session with id %s", sid)
}
145381
func (b *BackupEngine) GetInfo() *BackupEngineInfo {
	return &BackupEngineInfo{
		c: C.rocksdb_backup_engine_get_backup_info(b.c),
	}
}