// GetLinks returns the links for the given anchor hash.
GetLinks returns the links for the given anchor hash.
// GetLinks returns the links for the given anchor hash .
func (s *Store) GetLinks(anchorHash string) ([]*url.URL, error) {
	logger.Debugf("Retrieving anchor links for hash [%s]...", anchorHash)
	var err error
	query := fmt.Sprintf("%s:%s", hashTag, anchorHash)
	iter, err := s.store.Query(query)
	if err != nil {
		return nil, orberrors.NewTransient(fmt.Errorf("failed to get links for anchor [%s] query[%s]: %w",
			anchorHash, query, err))
	}
	ok, err := iter.Next()
	if err != nil {
		return nil, orberrors.NewTransient(fmt.Errorf("iterator error for anchor [%s]: %w", anchorHash, err))
	}
	var links []*url.URL
	for ok {
		value, err := iter.Value()
		if err != nil {
			return nil, orberrors.NewTransient(fmt.Errorf("failed to get iterator value for anchor [%s]: %w",
				anchorHash, err))
		}
		var link string
		err = s.unmarshal(value, &link)
		if err != nil {
			return nil, fmt.Errorf("unmarshal link [%s] for anchor [%s]: %w", value, anchorHash, err)
		}
		u, err := url.Parse(link)
		if err != nil {
			return nil, fmt.Errorf("parse link [%s] for anchor [%s]: %w", link, anchorHash, err)
		}
		links = append(links, u)
		ok, err = iter.Next()
		if err != nil {
			return nil, orberrors.NewTransient(fmt.Errorf("iterator error for anchor [%s]: %w", anchorHash, err))
		}
	}
	logger.Debugf("Returning anchor links for hash [%s]: %s", anchorHash, links)
	return links, nil
}
func ( s * Store ) GetLinks ( anchorHash string ) ( [ ] * url . URL , error ) { logger . Debugf ( " " , anchorHash ) var err error query := fmt . Sprintf ( " " , hashTag , anchorHash ) iter , err := s . store . Query ( query ) if err != nil { return nil , orberrors . NewTransient ( fmt . Errorf ( " " , anchorHash , query , err ) ) } ok , err := iter . Next ( ) if err != nil { return nil , orberrors . NewTransient ( fmt . Errorf ( " " , anchorHash , err ) ) } var links [ ] * url . URL for ok { value , err := iter . Value ( ) if err != nil { return nil , orberrors . NewTransient ( fmt . Errorf ( " " , anchorHash , err ) ) } var link string err = s . unmarshal ( value , & link ) if err != nil { return nil , fmt . Errorf ( " " , value , anchorHash , err ) } u , err := url . Parse ( link ) if err != nil { return nil , fmt . Errorf ( " " , link , anchorHash , err ) } links = append ( links , u ) ok , err = iter . Next ( ) if err != nil { return nil , orberrors . NewTransient ( fmt . Errorf ( " " , anchorHash , err ) ) } } logger . Debugf ( " " , anchorHash , links ) return links , nil }
GetLinks returns the links for the given anchor hash.
GetLinks returns the links for the given anchor hash .