func (sr *StoreRoot) HasProps(name string, r interface{}) (*cid.Cid, error) {

    switch r.(type) {
    case RepoProps:
    case ReposetProps:
    default:
        // Ok as well.
        return nil, fmt.Errorf("upsupported index property type")
    }

    rootdir := sr.GetDirectory()

    fsn, err := rootdir.Child(name)
    if err != nil {
        return nil, err
    }

    fi := fsn.(*mfs.File)

    if fi.Type() != mfs.TFile {
        return nil, fmt.Errorf("expected index property file, invalid type %v", fi.Type())
    }

    nd, err := fsn.GetNode()
    if err != nil {
        return nil, fmt.Errorf("failed to read index properties with error %v", err)
    }

    return nd.Cid(), nil
}
// Verify that the store contains a valid child repoprops file
Verify that the store contains a valid child repoprops file
// Verify that the store contains a valid child repoprops file
func (sr *StoreRoot) HasProps(name string, r interface{}) (*cid.Cid, error) {
    switch r.(type) {
    case RepoProps:
    case ReposetProps:
    default:
        return nil, fmt.Errorf("upsupported index property type")
    }
    rootdir := sr.GetDirectory()
    fsn, err := rootdir.Child(name)
    if err != nil {
        return nil, err
    }
    fi := fsn.(*mfs.File)
    if fi.Type() != mfs.TFile {
        return nil, fmt.Errorf("expected index property file, invalid type %v", fi.Type())
    }
    nd, err := fsn.GetNode()
    if err != nil {
        return nil, fmt.Errorf("failed to read index properties with error %v", err)
    }
    return nd.Cid(), nil
}
func ( sr * StoreRoot ) HasProps ( name string , r interface { } ) ( * cid . Cid , error ) { switch r . ( type ) { case RepoProps : case ReposetProps : default : return nil , fmt . Errorf ( " " ) } rootdir := sr . GetDirectory ( ) fsn , err := rootdir . Child ( name ) if err != nil { return nil , err } fi := fsn . ( * mfs . File ) if fi . Type ( ) != mfs . TFile { return nil , fmt . Errorf ( " " , fi . Type ( ) ) } nd , err := fsn . GetNode ( ) if err != nil { return nil , fmt . Errorf ( " " , err ) } return nd . Cid ( ) , nil }
Verify that the store contains a valid child repoprops file
Verify that the store contains a valid child repoprops file
// Ok as well.