func (s *Store) Get(partition uint32, key []byte) (value []byte, ok bool, err error) {
	lenK := len(key)
	var h = newFNV1a()
	h.writeUint32(partition)
	h.write(key)
	var ptrbuf = make([]byte, s.PtrBytes)
	hdelta := s.hdelta(h.hash(s.HashWidth))
	if _, err = s.accessor.ReadAt(ptrbuf, hdelta); err != nil {
		return
	}

	handle := s.getHandle(ptrbuf)
	if handle == 0 { // not found
		return nil, false, nil
	}

	// chunk for this hash exists
	var chunk []byte
	for {
		if chunk, err = s.Store.Get(handle); err != nil {
			return
		}

		if len(chunk) < s.PtrBytes+8 {
			return nil, false, &falloc.ECorrupted{s.accessor.Name(), int64(handle) << 4}
		}

		rdoff := s.PtrBytes
		rdpartition := uint32(chunk[rdoff])<<24 |
			uint32(chunk[rdoff+1])<<16 |
			uint32(chunk[rdoff+2])<<8 |
			uint32(chunk[rdoff+3])
		rdoff += 4
		if rdpartition == partition { // chunk partition OK
			rdLenK := int(chunk[rdoff])<<8 | int(chunk[rdoff+1])
			rdoff += 2
			rdLenV := int(chunk[rdoff])<<8 | int(chunk[rdoff+1])
			rdoff += 2
			if rdLenK == lenK { // chunk key length OK
				if rdoff+lenK > len(chunk) {
					return nil, false, &falloc.ECorrupted{
						s.accessor.Name(),
						int64(handle) << 4,
					}
				}

				if bytes.Compare(key, chunk[rdoff:rdoff+lenK]) == 0 { // hit
					rdoff += lenK
					if rdoff+rdLenV != len(chunk) {
						return nil, false, &falloc.ECorrupted{
							s.accessor.Name(),
							int64(handle) << 4,
						}
					}

					// Success
					return chunk[rdoff : rdoff+rdLenV], true, nil
				}
			}
		}

		next := s.getHandle(chunk)
		if next == 0 { // not found
			return nil, false, nil
		}

		handle = next
	}

	panic("unreachable")
}
// Get reads the value associated with partition, key in Store. It returns the
// data, key exists in ok and an error, if any. Get may return a non nil err
// iff !ok.
Get reads the value associated with partition, key in Store. It returns the
data, key exists in ok and an error, if any. Get may return a non nil err
iff !ok.
// Get reads the value associated with partition key in Store . It returns the // data key exists in ok and an error if any . Get may return a non nil err // iff !ok .
func (s *Store) Get(partition uint32, key []byte) (value []byte, ok bool, err error) {
	lenK := len(key)
	var h = newFNV1a()
	h.writeUint32(partition)
	h.write(key)
	var ptrbuf = make([]byte, s.PtrBytes)
	hdelta := s.hdelta(h.hash(s.HashWidth))
	if _, err = s.accessor.ReadAt(ptrbuf, hdelta); err != nil {
		return
	}
	handle := s.getHandle(ptrbuf)
	if handle == 0 { 
		return nil, false, nil
	}
	var chunk []byte
	for {
		if chunk, err = s.Store.Get(handle); err != nil {
			return
		}
		if len(chunk) < s.PtrBytes+8 {
			return nil, false, &falloc.ECorrupted{s.accessor.Name(), int64(handle) << 4}
		}
		rdoff := s.PtrBytes
		rdpartition := uint32(chunk[rdoff])<<24 |
			uint32(chunk[rdoff+1])<<16 |
			uint32(chunk[rdoff+2])<<8 |
			uint32(chunk[rdoff+3])
		rdoff += 4
		if rdpartition == partition { 
			rdLenK := int(chunk[rdoff])<<8 | int(chunk[rdoff+1])
			rdoff += 2
			rdLenV := int(chunk[rdoff])<<8 | int(chunk[rdoff+1])
			rdoff += 2
			if rdLenK == lenK { 
				if rdoff+lenK > len(chunk) {
					return nil, false, &falloc.ECorrupted{
						s.accessor.Name(),
						int64(handle) << 4,
					}
				}
				if bytes.Compare(key, chunk[rdoff:rdoff+lenK]) == 0 { 
					rdoff += lenK
					if rdoff+rdLenV != len(chunk) {
						return nil, false, &falloc.ECorrupted{
							s.accessor.Name(),
							int64(handle) << 4,
						}
					}
					return chunk[rdoff : rdoff+rdLenV], true, nil
				}
			}
		}
		next := s.getHandle(chunk)
		if next == 0 { 
			return nil, false, nil
		}
		handle = next
	}
	panic("unreachable")
}
func ( s * Store ) Get ( partition uint32 , key [ ] byte ) ( value [ ] byte , ok bool , err error ) { lenK := len ( key ) var h = newFNV1a ( ) h . writeUint32 ( partition ) h . write ( key ) var ptrbuf = make ( [ ] byte , s . PtrBytes ) hdelta := s . hdelta ( h . hash ( s . HashWidth ) ) if _ , err = s . accessor . ReadAt ( ptrbuf , hdelta ) ; err != nil { return } handle := s . getHandle ( ptrbuf ) if handle == 0 { return nil , false , nil } var chunk [ ] byte for { if chunk , err = s . Store . Get ( handle ) ; err != nil { return } if len ( chunk ) < s . PtrBytes + 8 { return nil , false , & falloc . ECorrupted { s . accessor . Name ( ) , int64 ( handle ) << 4 } } rdoff := s . PtrBytes rdpartition := uint32 ( chunk [ rdoff ] ) << 24 | uint32 ( chunk [ rdoff + 1 ] ) << 16 | uint32 ( chunk [ rdoff + 2 ] ) << 8 | uint32 ( chunk [ rdoff + 3 ] ) rdoff += 4 if rdpartition == partition { rdLenK := int ( chunk [ rdoff ] ) << 8 | int ( chunk [ rdoff + 1 ] ) rdoff += 2 rdLenV := int ( chunk [ rdoff ] ) << 8 | int ( chunk [ rdoff + 1 ] ) rdoff += 2 if rdLenK == lenK { if rdoff + lenK > len ( chunk ) { return nil , false , & falloc . ECorrupted { s . accessor . Name ( ) , int64 ( handle ) << 4 , } } if bytes . Compare ( key , chunk [ rdoff : rdoff + lenK ] ) == 0 { rdoff += lenK if rdoff + rdLenV != len ( chunk ) { return nil , false , & falloc . ECorrupted { s . accessor . Name ( ) , int64 ( handle ) << 4 , } } return chunk [ rdoff : rdoff + rdLenV ] , true , nil } } } next := s . getHandle ( chunk ) if next == 0 { return nil , false , nil } handle = next } panic ( " " ) }
Get reads the value associated with partition, key in Store.
Get reads the value associated with partition key in Store .
// not found // chunk for this hash exists // chunk partition OK // chunk key length OK // hit // Success // not found