func (sr *StoreRoot) AddProps(name string, r interface{}) (*cid.Cid, error) {
    var b []byte
    var err error

    if rp, ok := r.(RepoProps); ok {
        if b, err = rp.Marshal(); err != nil {
            return nil, err
        }
    } else if rp, ok := r.(ReposetProps); ok {
        if b, err = rp.Marshal(); err != nil {
            return nil, err
        }
    } else {
        return nil, fmt.Errorf("upsupported index property type")
    }

    br := bytes.NewReader(b)
    reponode, err := FileNodeFromReader(sr.dserv, br)
    if err != nil {
        return nil, err
    }

    err = sr.dserv.Add(sr.ctx, reponode)
    if err != nil {
        return nil, err
    }

    var newcid *cid.Cid
    newcid = reponode.Cid()

    // verify added
    _, err = sr.dserv.Get(sr.ctx, newcid)
    if err != nil {
        return nil, err
    }

    rootdir := sr.GetDirectory()

    // test inserting that file
    err = rootdir.AddChild(name, reponode)
    if err != nil {
        return nil, err
    }

    return newcid, sr.Flush()
}
// AddRepoProps adds the repoprops under this directory giving it the name 'name'
AddRepoProps adds the repoprops under this directory giving it the name 'name'
// AddRepoProps adds the repoprops under this directory giving it the name ' name '
func (sr *StoreRoot) AddProps(name string, r interface{}) (*cid.Cid, error) {
    var b []byte
    var err error
    if rp, ok := r.(RepoProps); ok {
        if b, err = rp.Marshal(); err != nil {
            return nil, err
        }
    } else if rp, ok := r.(ReposetProps); ok {
        if b, err = rp.Marshal(); err != nil {
            return nil, err
        }
    } else {
        return nil, fmt.Errorf("upsupported index property type")
    }
    br := bytes.NewReader(b)
    reponode, err := FileNodeFromReader(sr.dserv, br)
    if err != nil {
        return nil, err
    }
    err = sr.dserv.Add(sr.ctx, reponode)
    if err != nil {
        return nil, err
    }
    var newcid *cid.Cid
    newcid = reponode.Cid()
    _, err = sr.dserv.Get(sr.ctx, newcid)
    if err != nil {
        return nil, err
    }
    rootdir := sr.GetDirectory()
    err = rootdir.AddChild(name, reponode)
    if err != nil {
        return nil, err
    }
    return newcid, sr.Flush()
}
func ( sr * StoreRoot ) AddProps ( name string , r interface { } ) ( * cid . Cid , error ) { var b [ ] byte var err error if rp , ok := r . ( RepoProps ) ; ok { if b , err = rp . Marshal ( ) ; err != nil { return nil , err } } else if rp , ok := r . ( ReposetProps ) ; ok { if b , err = rp . Marshal ( ) ; err != nil { return nil , err } } else { return nil , fmt . Errorf ( " " ) } br := bytes . NewReader ( b ) reponode , err := FileNodeFromReader ( sr . dserv , br ) if err != nil { return nil , err } err = sr . dserv . Add ( sr . ctx , reponode ) if err != nil { return nil , err } var newcid * cid . Cid newcid = reponode . Cid ( ) _ , err = sr . dserv . Get ( sr . ctx , newcid ) if err != nil { return nil , err } rootdir := sr . GetDirectory ( ) err = rootdir . AddChild ( name , reponode ) if err != nil { return nil , err } return newcid , sr . Flush ( ) }
AddRepoProps adds the repoprops under this directory giving it the name 'name'
AddRepoProps adds the repoprops under this directory giving it the name ' name '
// verify added // test inserting that file