// storeRPMInfoRedis stores the rpm under the constructed repo key in the
// running redis-server
storeRPMInfoRedis stores the rpm under the constructed repo key in the
running redis-server
// storeRPMInfoRedis stores the rpm under the constructed repo key in the // running redis - server
func storeRPMInfoRedis(c redis.Conn, repo *Repo, rpm *RPM) error {
	repoKey := fmt.Sprintf("%s%s%s", repo.Name, repo.Version, repo.Type)
	if _, err := c.Do("SADD", repoKey+":packages", rpm.Name); err != nil {
		return err
	}
	pkgKey := fmt.Sprintf("%s:%s", repoKey, rpm.Name)
	_, err := c.Do("HMSET", redis.Args{}.Add(pkgKey).AddFlat(rpm)...)
	if err != nil {
		return err
	}
	rKey := pkgKey + ":requires"
	if err := storeIterableRedisSet(c, rKey, rpm.Requires); err != nil {
		return err
	}
	pKey := pkgKey + ":provides"
	if err := storeIterableRedisSet(c, pKey, rpm.Provides); err != nil {
		return err
	}
	fKey := pkgKey + ":files"
	for fIdx, f := range rpm.Files {
		val := fmt.Sprintf("file%d", fIdx)
		fMap := map[string]string{f.Name: val}
		_, err := c.Do("HMSET", redis.Args{}.Add(fKey).AddFlat(fMap)...)
		if err != nil {
			return err
		}
		fIdxKey := fmt.Sprintf("%s:file%d", pkgKey, fIdx)
		_, err = c.Do("HMSET", redis.Args{}.Add(fIdxKey).AddFlat(f)...)
		if err != nil {
			return err
		}
	}
	return nil
}
func storeRPMInfoRedis ( c redis . Conn , repo * Repo , rpm * RPM ) error { repoKey := fmt . Sprintf ( " " , repo . Name , repo . Version , repo . Type ) if _ , err := c . Do ( " " , repoKey + " " , rpm . Name ) ; err != nil { return err } pkgKey := fmt . Sprintf ( " " , repoKey , rpm . Name ) _ , err := c . Do ( " " , redis . Args { } . Add ( pkgKey ) . AddFlat ( rpm ) ... ) if err != nil { return err } rKey := pkgKey + " " if err := storeIterableRedisSet ( c , rKey , rpm . Requires ) ; err != nil { return err } pKey := pkgKey + " " if err := storeIterableRedisSet ( c , pKey , rpm . Provides ) ; err != nil { return err } fKey := pkgKey + " " for fIdx , f := range rpm . Files { val := fmt . Sprintf ( " " , fIdx ) fMap := map [ string ] string { f . Name : val } _ , err := c . Do ( " " , redis . Args { } . Add ( fKey ) . AddFlat ( fMap ) ... ) if err != nil { return err } fIdxKey := fmt . Sprintf ( " " , pkgKey , fIdx ) _ , err = c . Do ( " " , redis . Args { } . Add ( fIdxKey ) . AddFlat ( f ) ... ) if err != nil { return err } } return nil }
storeRPMInfoRedis stores the rpm under the constructed repo key in the
running redis-server
storeRPMInfoRedis stores the rpm under the constructed repo key in the running redis - server
// store the requires // store the provides // store file index mapping at reponame:packagename:files //             filename -> fileN // store each file map at reponame:packagename:fileN //             fileN -> File{}