예제 #1
0
파일: storage.go 프로젝트: src-d/go-git
func createIndex(c *driver.Client, ns, set string) error {
	task, err := c.CreateIndex(nil, ns, set, set, urlField, driver.STRING)
	if err != nil {
		if err.Error() == "Index already exists" {
			return nil
		}

		return err
	}

	return <-task.OnComplete()
}
예제 #2
0
// InitServiceTable initializes the indices for the service table.
func InitServiceTable(as *aerospike.Client) error {
	bin := "Env"
	task, err := as.CreateIndex(
		nil, leverOSNamespace, serviceSet, serviceSet+bin, bin,
		aerospike.STRING)
	if err != nil {
		return err
	}
	err, isErr := <-task.OnComplete()
	if isErr && err != nil {
		return err
	}
	return nil
}