當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Blob.BlobRef方法代碼示例

本文整理匯總了Golang中camlistore/org/pkg/test.Blob.BlobRef方法的典型用法代碼示例。如果您正苦於以下問題:Golang Blob.BlobRef方法的具體用法?Golang Blob.BlobRef怎麽用?Golang Blob.BlobRef使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在camlistore/org/pkg/test.Blob的用法示例。


在下文中一共展示了Blob.BlobRef方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: mustReceive

func mustReceive(t *testing.T, dst blobserver.Storage, tb *test.Blob) blob.SizedRef {
	tbRef := tb.BlobRef()
	sb, err := blobserver.Receive(dst, tbRef, tb.Reader())
	if err != nil {
		t.Fatalf("Receive: %v", err)
	}
	if int(sb.Size) != len(tb.Contents) {
		t.Fatalf("size = %d; want %d", sb.Size, len(tb.Contents))
	}
	if sb.Ref != tbRef {
		t.Fatal("wrong blob received")
	}
	return sb
}
開發者ID:rfistman,項目名稱:camlistore,代碼行數:14,代碼來源:cond_test.go

示例2: checkShard

// checkShard iterates through shards and find the blob. error if it is not found in expectShard, found somewhere else, or not found at all
func (sto testStorage) checkShard(b *test.Blob, expectShard int) {
	for shardN, shard := range sto.shards {
		_, _, err := shard.Fetch(b.BlobRef())
		if err != nil && shardN == expectShard {
			sto.t.Errorf("expected ref %v in shard %d, but didn't find it there", b.BlobRef(), expectShard)
			continue
		}

		if err != nil {
			// node wasn't found here, as expected
			continue
		}

		if shardN != expectShard {
			sto.t.Errorf("found ref %v in shard %d, expected in shard %d", b.BlobRef(), shardN, expectShard)
		}

		// node was found, and we expected it
	}
}
開發者ID:stevearm,項目名稱:camlistore,代碼行數:21,代碼來源:shard_test.go

示例3: part

func part(blob *test.Blob, offset, size uint64) *BytesPart {
	return &BytesPart{BlobRef: blob.BlobRef(), Size: size, Offset: offset}
}
開發者ID:orian,項目名稱:camlistore,代碼行數:3,代碼來源:fileread_test.go


注:本文中的camlistore/org/pkg/test.Blob.BlobRef方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。