// IsReaderSeekable returns if the underlying reader type can be seeked. A
// io.Reader might not actually be seekable if it is the ReaderSeekerCloser
// type.
963085
func IsReaderSeekable(r io.Reader) bool {
	switch v := r.(type) {
	case ReaderSeekerCloser:
		return v.IsSeeker()
	case *ReaderSeekerCloser:
		return v.IsSeeker()
	case io.ReadSeeker:
		return true
	default:
		return false
	}
}
126138
func IsAlreadyExists(e error) bool {
	type ae interface {
		IsAlreadyExistsError() bool
	}
	_, ok := Unwrap(e).(ae)
	return ok
}
604855
func CanCheckReadiness(ref corev1.ObjectReference) bool {
	switch ref.GroupVersionKind() {
	case groupVersionKind(buildv1.GroupVersion, "BuildConfig"), groupVersionKind(legacy.GroupVersion, "BuildConfig"):
		return true
	}
	_, found := readinessCheckers[ref.GroupVersionKind()]
	return found
}
408446
func (rkb TLFReaderKeyBundleV3) IsReader(user keybase1.UID, deviceKey kbfscrypto.CryptPublicKey) bool {
	_, ok := rkb.Keys[user][deviceKey]
	return ok
}
1125727
func CanReadFile(path string) bool {
	f, err := os.Open(path)
	if err != nil {
		return false
	}

	defer f.Close()

	return true
}
533263
func (te *TxEngine) AcceptReadOnly() error {
	te.beginRequests.Wait()
	te.stateLock.Lock()
	switch te.state {
	case AcceptingReadOnly:
		// Nothing to do
		te.stateLock.Unlock()
		return nil

	case NotServing:
		te.state = AcceptingReadOnly
		te.open()
		te.stateLock.Unlock()
		return nil

	case AcceptingReadAndWrite:
		return te.transitionTo(AcceptingReadOnly)

	case Transitioning:
		te.nextState = AcceptingReadOnly
		te.stateLock.Unlock()
		te.blockUntilEndOfTransition()
		return nil

	default:
		te.stateLock.Unlock()
		return te.unknownStateError()
	}
}
751440
func (k *Key) GetReadOnly() bool {
	if k == nil || k.ReadOnly == nil {
		return false
	}
	return *k.ReadOnly
}
851604
func newCloseableReader(r io.Reader, close func() error) io.ReadCloser {
	return &closeableReader{r, close}
}
216264
func NewSectionReadSeeker(base io.ReadSeeker, off, size int64) (ret ReadSeekContexter) {
	ret = &sectionReadSeeker{
		base: base,
		off:  off,
		size: size,
	}
	seekOff, err := ret.Seek(0, io.SeekStart)
	if err != nil {
		panic(err)
	}
	if seekOff != 0 {
		panic(seekOff)
	}
	return
}
752274
func (ch *Chunk) IsFullyRead() bool {
	if ch == nil || ch.R == nil {
		return true
	}
	return ch.Size <= ch.Pos
}
1367850
func CookieReaderOf(j CookieJar) CookieReader {
	valueType := reflect.TypeOf(j).Elem()

	cr := func(r io.Reader) (CookieJar, error) {
		value := reflect.New(valueType)
		jar, ok := value.Interface().(io.ReaderFrom)

		// The CookieJar have to implement the io.ReaderFrom
		// interface, so it could be unmarshaled.
		if !ok {
			message := "openflow: not a valid cookie reader"
			return nil, fmt.Errorf(message)
		}

		// Unmarshal the cookie jar and return it.
		_, err := jar.ReadFrom(r)
		return jar.(CookieJar), err
	}

	return CookieReaderFunc(cr)
}
884748
func ReadPOSTable(r io.Reader) (POSTable, error) {
	t := POSTable{}
	dec := gob.NewDecoder(r)
	if err := dec.Decode(&t.POSs); err != nil {
		return t, fmt.Errorf("POSs read error, %v", err)
	}
	if err := dec.Decode(&t.NameList); err != nil {
		return t, fmt.Errorf("name list read error, %v", err)
	}
	return t, nil
}
1142500
func NewSegmentReader(si *SegmentCommitInfo,
	termInfosIndexDivisor int, context store.IOContext) (r *SegmentReader, err error) {

	r = &SegmentReader{}
	r.AtomicReaderImpl = newAtomicReader(r)
	r.ARFieldsReader = r

	r.si = si
	if r.fieldInfos, err = ReadFieldInfos(si); err != nil {
		return nil, err
	}
	// log.Print("Obtaining SegmentCoreReaders...")
	if r.core, err = newSegmentCoreReaders(r, si.Info.Dir, si, context, termInfosIndexDivisor); err != nil {
		return nil, err
	}
	// r.segDocValues = newSegmentDocValues()

	var success = false
	defer func() {
		// With lock-less commits, it's entirely possible (and
		// fine) to hit a FileNotFound exception above.  In
		// this case, we want to explicitly close any subset
		// of things that were opened so that we don't have to
		// wait for a GC to do so.
		if !success {
			// log.Printf("Failed to initialize SegmentReader.")
			r.core.decRef()
		}
	}()

	codec := si.Info.Codec().(Codec)
	if si.HasDeletions() {
		panic("not supported yet")
	} else {
		assert(si.DelCount() == 0)
	}
	r.numDocs = si.Info.DocCount() - si.DelCount()

	if r.fieldInfos.HasDocValues {
		r.initDocValuesProducers(codec)
	}
	success = true
	return r, nil
}
1348774
func isReader(ctx context.Context, teamMemChecker kbfsmd.TeamMembershipChecker,
	currentUID keybase1.UID, mergedMasterHead kbfsmd.RootMetadata,
	extra kbfsmd.ExtraMetadata) (bool, error) {
	h, err := mergedMasterHead.MakeBareTlfHandle(extra)
	if err != nil {
		return false, err
	}

	if h.Type() == tlf.SingleTeam {
		isReader, err := teamMemChecker.IsTeamReader(
			ctx, h.Writers[0].AsTeamOrBust(), currentUID,
			keybase1.OfflineAvailability_NONE)
		if err != nil {
			return false, kbfsmd.ServerError{Err: err}
		}
		return isReader, nil
	}

	return h.IsReader(currentUID.AsUserOrTeam()), nil
}
688961
func (g *oneofGroup) onReadingAlternative(alt *oneofAlternative, msg reflect.Value) reflect.Value {
	switch wrap := msg.Field(g.fieldIdx); {
	case wrap.IsNil():
		return reflect.Value{} // no alternatives are set
	case wrap.Elem().Type() != alt.outerTyp:
		return reflect.Value{} // some other alternative is set
	default:
		return wrap.Elem().Elem().Field(0) // ~ (*msg.Wrapper).A
	}
}
53552
func (h Handle) IsReader(user keybase1.UserOrTeamID) bool {
	if h.TypeForKeying() == TeamKeying {
		panic("Can't call Handle.IsReader() for a single team TLF")
	}
	return h.TypeForKeying() == PublicKeying ||
		h.findUserInList(user, h.Readers) ||
		h.IsWriter(user)
}
681100
func IsIdent(b []byte) bool {
	l := NewLexer(buffer.NewReader(b))
	l.consumeIdentToken()
	l.r.Restore()
	return l.r.Pos() == len(b)
}