From 0df55a731aa3330f82d22b010a7a2a4d66521972 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Sun, 29 Apr 2018 21:19:14 +0200 Subject: initial support for large objects This has gone through a lot of iterations on my branch, and I'm quite happy with the parts of the API that exist now. Test coverage can still be better, and will get better in the following commits. The API is not yet finished: I want to add Options arguments to Object.Upload(), Object.Copy(), Object.Move() and Object.Delete() that specify how each of these operations affect existing segments (and, later, also existing symlinks). For Upload(), uploading in segments shall become as easy as flipping a single switch. --- tests/shared_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/shared_test.go') diff --git a/tests/shared_test.go b/tests/shared_test.go index c35951f..7867d70 100644 --- a/tests/shared_test.go +++ b/tests/shared_test.go @@ -114,6 +114,10 @@ func etagOf(buf []byte) string { return hex.EncodeToString(hash[:]) } +func etagOfString(buf string) string { + return etagOf([]byte(buf)) +} + func getRandomName() string { var buf [16]byte _, err := rand.Read(buf[:]) @@ -123,6 +127,15 @@ func getRandomName() string { return hex.EncodeToString(buf[:]) } +func getRandomSegmentContent(length int) string { + buf := make([]byte, length/2) + _, err := rand.Read(buf) + if err != nil { + panic(err.Error()) + } + return hex.EncodeToString(buf) +} + //////////////////////////////////////////////////////////////////////////////// func expectBool(t *testing.T, actual, expected bool) { -- cgit v1.2.3