Example #1
0
func dbConnect() (*cb.Bucket, error) {
	log.Printf("Connecting to couchbase bucket %v at %v",
		*couchbaseBucket, *couchbaseServer)
	rv, err := cb.GetBucket(*couchbaseServer, "default", *couchbaseBucket)
	if err != nil {
		return nil, err
	}
	return rv, nil
}
Example #2
0
func (ds *CouchbaseDataSource) dbConnect(couchbaseBucket string) (*cb.Bucket, error) {

	if ds.debug {
		log.Printf("Connecting to couchbase bucket %v at %v",
			couchbaseBucket, ds.couchbaseServer)
	}
	rv, err := cb.GetBucket(ds.couchbaseServer, "default", couchbaseBucket)
	if err != nil {
		return nil, err
	}
	return rv, nil
}
Example #3
0
func dbConnect() (*cb.Bucket, error) {

	cb.HttpClient = &http.Client{
		Transport: TimeoutTransport(*viewTimeout),
	}

	log.Printf("Connecting to couchbase bucket %v at %v",
		*couchbaseBucket, *couchbaseServer)
	rv, err := cb.GetBucket(*couchbaseServer, "default", *couchbaseBucket)
	if err != nil {
		return nil, err
	}
	return rv, nil
}
Example #4
0
func dbConnect() (*cb.Bucket, error) {
	cb.HTTPClient = &http.Client{
		Transport: TimeoutTransport(*viewTimeout),
	}

	log.Printf("Connecting to couchbase bucket %v at %v",
		*couchbaseBucket, *couchbaseServer)
	rv, err := cb.GetBucket(*couchbaseServer, "default", *couchbaseBucket)
	if err != nil {
		return nil, err
	}

	return rv, couchbaseutil.UpdateView(rv, "cbfs",
		ddocKey, designDoc, ddocVersion)
}
Example #5
0
func dbConnect(couchbaseBucket string) (*cb.Bucket, error) {

	//	cb.HttpClient = &http.Client{
	//		Transport: TimeoutTransport(*viewTimeout),
	//	}

	if *debugCouchbase {
		log.Printf("Connecting to couchbase bucket %v at %v",
			couchbaseBucket, *couchbaseServer)
	}
	rv, err := cb.GetBucket(*couchbaseServer, "default", couchbaseBucket)
	if err != nil {
		return nil, err
	}
	return rv, nil
}
Example #6
0
func dbConnect() (*cb.Bucket, error) {

	cb.HttpClient = &http.Client{
		Transport: TimeoutTransport(*viewTimeout),
	}

	log.Printf("Connecting to couchbase bucket %v at %v",
		*couchbaseBucket, *couchbaseServer)
	rv, err := cb.GetBucket(*couchbaseServer, "default", *couchbaseBucket)
	if err != nil {
		return nil, err
	}

	marker := viewMarker{}
	err = rv.Get(ddocKey, &marker)
	if err != nil {
		log.Printf("Error checking view version: %v", err)
	}
	if marker.Version < ddocVersion {
		log.Printf("Installing new version of views (old version=%v)",
			marker.Version)
		doc := json.RawMessage([]byte(designDoc))
		err = rv.PutDDoc("cbfs", &doc)
		if err != nil {
			return nil, err
		}
		marker.Version = ddocVersion
		marker.Node = serverId
		marker.Timestamp = time.Now().UTC()
		marker.Type = "ddocmarker"

		rv.Set(ddocKey, 0, &marker)
	}

	return rv, nil
}
Example #7
0
func GetDB() *couchbase.Bucket {
	bucket, _ := couchbase.GetBucket(gomenu1.POOL, "default", "default")
	return bucket
}