• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang services.Get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/AaronGoldman/ccfs/services.Get函数的典型用法代码示例。如果您正苦于以下问题:Golang Get函数的具体用法?Golang Get怎么用?Golang Get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: TestPostTagTagBlob

func TestPostTagTagBlob(t *testing.T) {
	testhkid := objects.HkidFromDString("46298148238932964800164113348087"+
		"9383618612455972320097996217675372497646408870646300138355611242"+
		"4820911870650421151988906751710824965155500230480521264034469", 10)
	domain1Hkid := objects.HkidFromDString("32076859881811206392323279987831"+
		"3732334949433938278619036381396945204532895319697233476900342324"+
		"1692155627674142765782672165943417419038514237233188152538761", 10)
	domain2Hkid := objects.HkidFromDString("49220288257701056900010210884990"+
		"0714973444364727181180850528073586453638681999434006549298762097"+
		"4197649255374796716934112121800838847071661501215957753532505", 10)
	err := services.InsertDomain(testhkid, "testTag1", domain1Hkid)
	if err != nil {
		t.Errorf("InsertDomain with error: %s", err)
	}
	err = services.InsertDomain(testhkid, "testTag1/testTag2", domain2Hkid)
	if err != nil {
		t.Errorf("InsertDomain with error: %s", err)
	}
	indata := objects.Blob([]byte("TestTagTagBlobData"))
	testpath := "testTag1/testTag2/testBlob"
	_, err = services.Post(testhkid, testpath, indata)
	outdata, err := services.Get(testhkid, testpath)
	if err != nil {
		log.Printf("[TestPostTagTagBlob] testhkid %s", testhkid)
		log.Printf("[TestPostTagTagBlob] domain1Hkid %s", domain1Hkid)
		log.Printf("[TestPostTagTagBlob] domain2Hkid %s", domain2Hkid)
		t.Errorf("Retreved with error: %s", err)
	} else if !bytes.Equal(indata, outdata) {
		t.Errorf("Expected:\n\t%s\nGot:\n\t%s", indata, outdata)
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:31,代码来源:ccfs_test.go


示例2: BenchmarkTagBlobNotFound

func BenchmarkTagBlobNotFound(b *testing.B) {
	for i := 0; i < b.N; i++ {
		_, err := services.Get(benchmarkRepo, "tagNotFound/benchmarkBlob")
		if err.Error() != "Blob not found" {
			b.Fatal(err)
		}
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:8,代码来源:benchmark_test.go


示例3: BenchmarkListBlobNotFound

func BenchmarkListBlobNotFound(b *testing.B) {
	for i := 0; i < b.N; i++ {
		_, err := services.Get(benchmarkRepo, "listNotFound/BlobFound")
		if err.Error() != "Blob not found" {
			b.Fatalf("List Blob incorrectly detected: %s", err)
		}
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:8,代码来源:benchmark_test.go


示例4: BenchmarkListBlobFound

func BenchmarkListBlobFound(b *testing.B) {
	indata := objects.Blob("List Blob Found Data")
	services.Post(benchmarkRepo, "listFound/BlobFound", indata)
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		_, err := services.Get(benchmarkRepo, "listFound/BlobFound")
		if err != nil {
			b.Fatalf("Failed to find List Blob: %s", err)
		}
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:11,代码来源:benchmark_test.go


示例5: TestGetTag

func TestGetTag(t *testing.T) {
	//think about what it means to get a domain with no path
	testhkid := objects.HkidFromDString("65232373562705602286177837897283294165955126"+
		"49112249373497830592072241416893611216069423804730437860475300564272"+
		"976762085068519188612732562106886379081213385", 10)
	outdata, err := services.Get(testhkid, "TestPostTag")
	truthdata := []byte("")
	if !bytes.Equal(truthdata, outdata) {
		log.Printf("\n\tTestGetList:\n\t%s\n\terror: %s\n", outdata, err)
		t.Fail()
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:12,代码来源:ccfs_test.go


示例6: TestPostListListBlob

func TestPostListListBlob(t *testing.T) {
	testhkid := objects.HkidFromDString("65232373562705602286177837897283294165955126"+
		"49112249373497830592072241416893611216069423804730437860475300564272"+
		"976762085068519188612732562106886379081213385", 10)
	testpath := "TestPostList1/TestPostList2/TestPostBlob"
	indata := []byte("TestPostListListBlobData")
	services.Post(testhkid, testpath, objects.Blob(indata))
	outdata, err := services.Get(testhkid, testpath)
	if !bytes.Equal(indata, outdata) || err != nil {
		t.Fail()
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:12,代码来源:ccfs_test.go


示例7: BenchmarkBlobInsert

//BenchmarkBlobInsert times the posting of a blob to a repository.
func BenchmarkBlobInsert(b *testing.B) {
	indata := objects.Blob("Benchmark Blob Data")
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		services.Post(benchmarkRepo, "benchmarkBlob", indata)
		//TODO clear blob after each insert
	}
	outdata, err := services.Get(benchmarkRepo, "benchmarkBlob")
	if !bytes.Equal(indata, outdata) || err != nil {
		b.Fatalf("\tExpected: %s\n\tActual: %s\n\tErr:%s\n",
			indata, outdata, err)
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:14,代码来源:benchmark_test.go


示例8: BenchmarkListBlobUpdate

func BenchmarkListBlobUpdate(b *testing.B) {
	indata := objects.Blob("Benchmark Blob Data")
	services.Post(benchmarkRepo, "listFound/benchmarkBlob", indata)
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		services.Post(benchmarkRepo, "listFound/benchmarkBlob", indata)
	}
	outdata, err := services.Get(benchmarkRepo, "listFound/benchmarkBlob")
	if !bytes.Equal(indata, outdata) || err != nil {
		b.Fatalf("\tExpected: %s\n\tActual: %s\n\tErr:%s\n",
			indata, outdata, err)
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:13,代码来源:benchmark_test.go


示例9: TestPostCommitBlob

func TestPostCommitBlob(t *testing.T) {
	testhkid := objects.HkidFromDString("65232373562705602286177837897283"+
		"2941659551264911224937349783059207224141689361121606942380473043"+
		"7860475300564272976762085068519188612732562106886379081213385", 10)
	testRepoHkid := objects.HkidFromDString("22371143209450593169269383669277"+
		"1410459232098247632372342448006863927240156318431751613873181811"+
		"3842641285036340692759591635625837820111726090732747634977413", 10)
	services.InsertRepo(testhkid, "TestPostCommit", testRepoHkid)
	testpath := "TestPostCommit/TestPostBlob"
	indata := []byte("TestPostCommitBlobData")
	services.Post(testhkid, testpath, objects.Blob(indata))
	outdata, err := services.Get(testhkid, testpath)
	if !bytes.Equal(indata, outdata) || err != nil {
		t.Fail()
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:16,代码来源:ccfs_test.go


示例10: TestPostTagBlob

func TestPostTagBlob(t *testing.T) {
	testhkid := objects.HkidFromDString("65232373562705602286177837897283"+
		"2941659551264911224937349783059207224141689361121606942380473043"+
		"7860475300564272976762085068519188612732562106886379081213385", 10)
	testDomainHkid := objects.HkidFromDString("48133155371863219707191657794884"+
		"7537768863308478273117048217437472569476796507874261675750733630"+
		"0675115007319549300204862762937376227751462258339344895829332", 10)
	services.InsertDomain(testhkid, "TestPostTag", testDomainHkid)
	testpath := "TestPostTag/TestPostBlob"
	indata := []byte("TestPostTagBlobData")
	services.Post(testhkid, testpath, objects.Blob(indata))
	outdata, err := services.Get(testhkid, testpath)
	if !bytes.Equal(indata, outdata) || err != nil {
		t.Fail()
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:16,代码来源:ccfs_test.go


示例11: TestGetCommit

func TestGetCommit(t *testing.T) {
	testhkid := objects.HkidFromDString("65232373562705602286177837897283294165955126"+
		"49112249373497830592072241416893611216069423804730437860475300564272"+
		"976762085068519188612732562106886379081213385", 10)
	outdata, err := services.Get(testhkid, "TestPostCommit")
	outlist, err := objects.ListFromBytes(outdata)
	typeString, hash := outlist.HashForNamesegment("TestPostBlob")
	//truthdata := []byte("90014ae279fa5034a51def77132457cd" +
	//	"66403facc3d88b54bd3e84ecade8f633,blob,TestPostBlob")
	if typeString != "blob" ||
		hash.Hex() != "90014ae279fa5034a51def77132457cd"+
			"66403facc3d88b54bd3e84ecade8f633" ||
		err != nil {
		log.Printf("\n\tTestGetList:\n\t%s\n", outdata)
		t.Fail()
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:17,代码来源:ccfs_test.go


示例12: BenchmarkTagBlobFound

func BenchmarkTagBlobFound(b *testing.B) {
	err := services.InsertDomain(benchmarkRepo, "tagFound", benchmarkTagHkid)
	if err != nil {
		b.Fatal(err)
	}
	_, err = services.Post(benchmarkRepo, "tagFound/benchmarkBlob",
		objects.Blob("Benchmark Blob Data"))
	if err != nil {
		b.Fatal(err)
	}
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		_, err := services.Get(benchmarkRepo, "tagFound/benchmarkBlob")
		if err != nil {
			b.Fatal(err)
		}
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:18,代码来源:benchmark_test.go


示例13: BenchmarkCommitBlobFound

func BenchmarkCommitBlobFound(b *testing.B) {
	err := services.InsertRepo(benchmarkRepo, "commitFound", benchmarkCommitHkid)
	if err != nil {
		b.Fatalf("Unable to insert Commit: %s", err)
	}
	_, err = services.Post(benchmarkRepo, "commitFound/benchmarkBlob",
		objects.Blob("Benchmark Blob Data"))
	if err != nil {
		b.Fatalf("Unable to post Commit Blob: %s", err)
	}
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		_, err := services.Get(benchmarkRepo, "commitFound/benchmarkBlob")
		if err != nil {
			b.Fatalf("Unable to retrieve Commit Blob: %s", err)
		}
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:18,代码来源:benchmark_test.go


示例14: TestPostListTagBlob

func TestPostListTagBlob(t *testing.T) {
	testhkid := objects.HkidFromDString("46298148238932964800164113348087"+
		"9383618612455972320097996217675372497646408870646300138355611242"+
		"4820911870650421151988906751710824965155500230480521264034469", 10)
	domainHkid := objects.HkidFromDString("12796633883654089746486670711069"+
		"9781359720828332046318301886846633714179790444071153863702142701"+
		"146332294245448463914286494124849121460550667767568731696934", 10)
	err := services.InsertDomain(testhkid, "testList/testTag", domainHkid)
	indata := objects.Blob([]byte("TestListTagBlobData"))
	testpath := "testList/testTag/testBlob"
	_, err = services.Post(testhkid, testpath, indata)
	outdata, err := services.Get(testhkid, testpath)
	if err != nil {
		t.Errorf("Retreved with error: %s", err)
	} else if !bytes.Equal(indata, outdata) {
		t.Errorf("Expected:\n\t%s\nGot:\n\t%s", indata, outdata)
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:18,代码来源:ccfs_test.go


示例15: TestPostTagListBlob

func TestPostTagListBlob(t *testing.T) {
	testhkid := objects.HkidFromDString("46298148238932964800164113348087"+
		"9383618612455972320097996217675372497646408870646300138355611242"+
		"4820911870650421151988906751710824965155500230480521264034469", 10)
	domainHkid := objects.HkidFromDString("62089221762245310704629142682144"+
		"1944826557905230450143203631438168806532495876980559885034903315"+
		"4294997505754401230560960060918213268981906409591978967796584", 10)
	err := services.InsertDomain(testhkid, "testTag", domainHkid)
	if err != nil {
		t.Errorf("InsertDomain with error: %s", err)
	}
	indata := objects.Blob([]byte("TestTagListBlobData"))
	testpath := "testTag/testList/testBlob"
	_, err = services.Post(testhkid, testpath, indata)
	outdata, err := services.Get(testhkid, testpath)
	if !bytes.Equal(indata, outdata) || err != nil {
		t.Fail()
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:19,代码来源:ccfs_test.go


示例16: BenchmarkHighLevelPath

func BenchmarkHighLevelPath(b *testing.B) {
	testhkid := objects.HkidFromDString("46298148238932964800164113348087"+
		"9383618612455972320097996217675372497646408870646300138355611242"+
		"4820911870650421151988906751710824965155500230480521264034469", 10)

	indata := objects.Blob([]byte("testing"))
	testpath := "testTag/testBlob"
	//_, err = Post(testhkid, testpath, indata)
	for i := 0; i < b.N; i++ {
		outdata, err := services.Get(testhkid, testpath)
		if err != nil {
			b.Fatalf("Failed to retrieve Blob: %s", err)
		}
		if !bytes.Equal(indata, outdata) {
			b.Fatalf("\tExpected: %s\n\tActual: %s\n\t",
				indata, outdata)
		}
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:19,代码来源:benchmark_test.go


示例17: TestGetBlob

func TestGetBlob(t *testing.T) {
	//hkidFromDString("4629814823893296480016411334808793836186124559723200"+
	//	"9799621767537249764640887064630013835561124248209118706504211519889067517"+
	//	"10824965155500230480521264034469", 10) //store the key
	setupForGets()

	dabytes, err := hex.DecodeString("1312ac161875b270da2ae4e1471ba94a" +
		"9883419250caa4c2f1fd80a91b37907e")

	hkid := objects.HKID(dabytes)
	path := "testTag/testBlob"
	b := []byte(":(")
	if err == nil {
		//log.Println(hkid.Hex())
		b, err = services.Get(hkid, path)
	}
	if !bytes.Equal([]byte("testing"), b) || err != nil {
		t.Fail()
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:20,代码来源:ccfs_test.go


示例18: webRepositoryHandler

func webRepositoryHandler(w http.ResponseWriter, r *http.Request) {
	parts := strings.SplitN(r.RequestURI[3:], "/", 2)
	hkidhex := parts[0]
	path := ""
	if len(parts) > 1 {
		path = parts[1]
	}
	err := error(nil)
	if len(hkidhex) == 64 {
		h, err := objects.HkidFromHex(hkidhex)
		if err == nil {
			b, err := services.Get(h, path)
			if err == nil {
				w.Write(b.Bytes())
				return
			}
			http.Error(w, fmt.Sprint(
				"HTTP Error 500 Internal server error\n\n", err), 500)
		}
	}
	w.Write([]byte(fmt.Sprintf("Invalid HKID\nerr: %v", err)))
	return
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:23,代码来源:ccfsWebService.go


示例19: TestPostTagCommitBlob

func TestPostTagCommitBlob(t *testing.T) {
	testhkid := objects.HkidFromDString("46298148238932964800164113348087"+
		"9383618612455972320097996217675372497646408870646300138355611242"+
		"4820911870650421151988906751710824965155500230480521264034469", 10)
	domainHkid := objects.HkidFromDString("39968110670682397993178679825250"+
		"9423226869972672234437068973021071131498376777586055610149840018"+
		"5744208447673206609026128894016152514163591905578729891874833", 10)
	repoHkid := objects.HkidFromDString("94522678075182002377842140271746"+
		"1502019766737301062946423046280258817349516439546479625226895211"+
		"80808353215150536034481206091147220911087792299373183736254", 10)
	err := services.InsertDomain(testhkid, "testTag", domainHkid)
	if err != nil {
		t.Errorf("InsertDomain with error: %s", err)
	}
	err = services.InsertRepo(testhkid, "testTag/testCommit", repoHkid)
	indata := objects.Blob([]byte("TestTagCommitBlobData"))
	testpath := "testTag/testCommit/testBlob"
	_, err = services.Post(testhkid, testpath, indata)
	outdata, err := services.Get(testhkid, testpath)
	if !bytes.Equal(indata, outdata) || err != nil {
		t.Fail()
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:23,代码来源:ccfs_test.go


示例20: TestPostListCommitBlob

func TestPostListCommitBlob(t *testing.T) {
	testhkid := objects.HkidFromDString("46298148238932964800164113348087"+
		"9383618612455972320097996217675372497646408870646300138355611242"+
		"4820911870650421151988906751710824965155500230480521264034469", 10)
	repoHkid := objects.HkidFromDString("59803288656043806807393139191118"+
		"0777289273091938777159029927847596771500408478956278378281366717"+
		"7487960901581583946753338859223459810645621124266443931192097", 10)
	err := services.InsertDomain(testhkid, "testList/testCommit", repoHkid)
	if err != nil {
		t.Errorf("InsertDomain with error: %s", err)
	}
	indata := objects.Blob([]byte("TestListCommitBlobData"))
	testpath := "testList/testCommit/testBlob"
	_, err = services.Post(testhkid, testpath, indata)
	outdata, err := services.Get(testhkid, testpath)
	if err != nil {
		log.Printf("[TestPostListCommitBlob] testhkid %s", testhkid)
		log.Printf("[TestPostListCommitBlob] repoHkid %s", repoHkid)
		t.Errorf("Retreved with error: %s", err)
	} else if !bytes.Equal(indata, outdata) {
		t.Errorf("Expected:\n\t%s\nGot:\n\t%s", indata, outdata)
	}
}
开发者ID:AaronGoldman,项目名称:ccfs,代码行数:23,代码来源:ccfs_test.go



注:本文中的github.com/AaronGoldman/ccfs/services.Get函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang lua.State类代码示例发布时间:2022-05-24
下一篇:
Golang objects.HKID类代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap