// GetStatus retrieves proof collection status for the given verifiable credential.
GetStatus retrieves proof collection status for the given verifiable credential.
// GetStatus retrieves proof collection status for the given verifiable credential .
func (s *Store) GetStatus(anchorID string) (proof.VCStatus, error) {
	var err error
	vcIDEncoded := base64.RawURLEncoding.EncodeToString([]byte(anchorID))
	query := fmt.Sprintf("%s:%s", index, vcIDEncoded)
	iter, err := s.store.Query(query)
	if err != nil {
		return "", orberrors.NewTransient(fmt.Errorf("failed to get statuses for anchor event[%s] query[%s]: %w",
			anchorID, query, err))
	}
	ok, err := iter.Next()
	if err != nil {
		return "", orberrors.NewTransient(fmt.Errorf("iterator error for anchor event[%s] statuses: %w", anchorID, err))
	}
	if !ok {
		return "", fmt.Errorf("status not found for anchor event[%s]", anchorID)
	}
	var status proof.VCStatus
	for ok {
		value, err := iter.Value()
		if err != nil {
			return "", orberrors.NewTransient(fmt.Errorf("failed to get iterator value for anchor event[%s]: %w",
				anchorID, err))
		}
		err = s.unmarshal(value, &status)
		if err != nil {
			return "", fmt.Errorf("unmarshal status: %w", err)
		}
		if status == proof.VCStatusCompleted {
			return proof.VCStatusCompleted, nil
		}
		ok, err = iter.Next()
		if err != nil {
			return "", orberrors.NewTransient(fmt.Errorf("iterator error for anchor event[%s]: %w", anchorID, err))
		}
	}
	logger.Debugf("status for anchor event[%s]: %s", anchorID, status)
	return status, nil
}
func ( s * Store ) GetStatus ( anchorID string ) ( proof . VCStatus , error ) { var err error vcIDEncoded := base64 . RawURLEncoding . EncodeToString ( [ ] byte ( anchorID ) ) query := fmt . Sprintf ( " " , index , vcIDEncoded ) iter , err := s . store . Query ( query ) if err != nil { return " " , orberrors . NewTransient ( fmt . Errorf ( " " , anchorID , query , err ) ) } ok , err := iter . Next ( ) if err != nil { return " " , orberrors . NewTransient ( fmt . Errorf ( " " , anchorID , err ) ) } if ! ok { return " " , fmt . Errorf ( " " , anchorID ) } var status proof . VCStatus for ok { value , err := iter . Value ( ) if err != nil { return " " , orberrors . NewTransient ( fmt . Errorf ( " " , anchorID , err ) ) } err = s . unmarshal ( value , & status ) if err != nil { return " " , fmt . Errorf ( " " , err ) } if status == proof . VCStatusCompleted { return proof . VCStatusCompleted , nil } ok , err = iter . Next ( ) if err != nil { return " " , orberrors . NewTransient ( fmt . Errorf ( " " , anchorID , err ) ) } } logger . Debugf ( " " , anchorID , status ) return status , nil }
GetStatus retrieves proof collection status for the given verifiable credential.
GetStatus retrieves proof collection status for the given verifiable credential .