// Read returns raw session store by session ID.
11678
func (p *RedisProvider) Read(sid string) (session.RawStore, error) {
	psid := p.prefix + sid
	if !p.Exist(sid) {
		if err := p.c.SetEx(psid, p.duration, "").Err(); err != nil {
			return nil, err
		}
	}

	var kv map[interface{}]interface{}
	kvs, err := p.c.Get(psid).Result()
	if err != nil {
		return nil, err
	}
	if len(kvs) == 0 {
		kv = make(map[interface{}]interface{})
	} else {
		kv, err = session.DecodeGob([]byte(kvs))
		if err != nil {
			return nil, err
		}
	}

	return NewRedisStore(p.c, p.prefix, sid, p.duration, kv), nil
}
595313
func (l *Locking) Read(p []byte) (n int, err error) {
	l.Lock()
	n, err = l.R.Read(p)
	l.Unlock()
	return
}
11990
func (c *conn) Read() (pdu.Body, error) {
	return pdu.Decode(c.r)
}
1055394
func (s *inMemStore) Get(id string) Session {
	s.mux.RLock()
	defer s.mux.RUnlock()

	sess := s.sessions[id]
	if sess == nil {
		return nil
	}

	sess.Access()
	return sess
}
176950
func (f *FileStore) Read(key string) ([]byte, error) {
	if err := ValidateKey(key); err != nil {
		return nil, err
	}
	bytes, err := f.filesystem.ReadFile(f.getPathByKey(key))
	if os.IsNotExist(err) {
		return bytes, ErrKeyNotFound
	}
	return bytes, err
}
1025324
func (r *AutoVXLANCfgResource) Read(id string) error {
	key := fmt.Sprintf(vXLANResourceConfigPath, id)
	return r.StateDriver.ReadState(key, r, json.Unmarshal)
}
52494
func (s *siphon) Read(p []byte) (int, error) {
	n, err := s.f.Read(p)

	if err == nil {
		return s.buf.Write(p[0:n]) // Write must succeed for Read to succeed
	}

	if err == io.EOF {
		s.d.cacheWithoutLock(s.key, s.buf.Bytes()) // cache may fail
		if closeErr := s.f.Close(); closeErr != nil {
			return n, closeErr // close must succeed for Read to succeed
		}
		return n, err
	}

	return n, err
}
822178
func (o *FileSystemSaver) Read() (store uuid.Store, err error) {
	store = uuid.Store{}
	_, err = os.Stat(o.Path);
	if err != nil {
		if os.IsNotExist(err) {
			dir, file := path.Split(o.Path)
			if dir == "" || dir == "/" {
				dir = os.TempDir()
			}
			o.Path = path.Join(dir, file)

			err = os.MkdirAll(dir, os.ModeDir|0700)
			if err == nil {
				// If new encode blank store
				goto open
			}
		}
		goto failed
	}

	open:
	err = o.openAndDo(o.decode, &store)
	if err == nil {
		o.Println("file system saver created", o.Path)
		return
	}

	failed:
	o.Println("file system saver read error - will autogenerate", err)
	return
}
880049
func (r *Reader) Read(b []byte) (n int, err error) {
	for {
		// If there's no data in the buffer, we'll grab the next record
		// and set the internal buffer to point to the data in that
		// record. When all data from buf is read, Done() will be called
		// on the record.
		if len(r.buf) == 0 {
			select {
			case record, ok := <-r.records:
				if !ok {
					// Channel is closed, return io.EOF.
					err = io.EOF
					return
				}

				r.buf = record.Data()
				r.done = record.Done
			default:
				// By convention, Read should return rather than wait
				// for data to become available. If no data is available
				// at this time, we'll return what we've copied
				// so far.
				return
			}
		}

		n += r.copy(b[n:])
		if n == len(b) {
			return
		}
	}

	return
}
678080
func (p *LedisProvider) Read(sid string) (session.RawStore, error) {
	if !p.Exist(sid) {
		if err := p.c.Set([]byte(sid), []byte("")); err != nil {
			return nil, err
		}
	}

	var kv map[interface{}]interface{}
	kvs, err := p.c.Get([]byte(sid))
	if err != nil {
		return nil, err
	}
	if len(kvs) == 0 {
		kv = make(map[interface{}]interface{})
	} else {
		kv, err = session.DecodeGob(kvs)
		if err != nil {
			return nil, err
		}
	}

	return NewLedisStore(p.c, sid, p.expire, kv), nil
}
233929
func (c *IdleTimingConn) Read(b []byte) (int, error) {
	c.closeMutex.RLock()
	n, err := c.doRead(b)
	c.closeMutex.RUnlock()
	return n, err
}
500885
func Read(file string) (*Data, error) {
	data := New()
	if err := data.Open(file); err != nil {
		return nil, err
	}
	return data, nil
}
730817
func (s *CfgServiceLBState) Read(id string) error {
	key := fmt.Sprintf(serviceLBConfigPath, id)
	err := s.StateDriver.ReadState(key, s, json.Unmarshal)
	return err
}
77881
func (c *i2cConnection) Read(data []byte) (read int, err error) {
	c.mutex.Lock()
	defer c.mutex.Unlock()

	if err = c.bus.SetAddress(c.address); err != nil {
		return 0, err
	}
	read, err = c.bus.Read(data)
	return
}
972895
func (api *DiskAPI) Read(id int64) (*sacloud.Disk, error) {
	return api.request(func(res *sacloud.Response) error {
		return api.read(id, nil, res)
	})
}
814923
func (f *DatastoreFile) Read(b []byte) (int, error) {
	if f.offset.read != f.offset.seek {
		// A Seek() call changed the offset, we need to issue a new GET
		_ = f.Close()

		f.offset.read = f.offset.seek
	} else if f.buf != nil {
		// f.buf + f behaves like an io.MultiReader
		n, err := f.buf.Read(b)
		if err == io.EOF {
			f.buf = nil // buffer has been drained
		}
		if n > 0 {
			return n, nil
		}
	}

	body, err := f.get()
	if err != nil {
		return 0, err
	}

	n, err := body.Read(b)

	f.offset.read += int64(n)
	f.offset.seek += int64(n)

	return n, err
}
1022565
func (s *CfgNetworkState) Read(id string) error {
	key := fmt.Sprintf(networkConfigPath, id)
	return s.StateDriver.ReadState(key, s, json.Unmarshal)
}