Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Unified Diff: common/chunkstream/chunk.go

Issue 1413923013: Add `chunk` segmented data library. (Closed) Base URL: https://github.com/luci/luci-go@logdog-review-streamserver
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: common/chunkstream/chunk.go
diff --git a/common/chunkstream/chunk.go b/common/chunkstream/chunk.go
new file mode 100644
index 0000000000000000000000000000000000000000..57c973ffad4539dfad6a2544e0dbbd5791dc742a
--- /dev/null
+++ b/common/chunkstream/chunk.go
@@ -0,0 +1,21 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package chunkstream
+
+// Chunk wraps a fixed-size byte buffer. It is the primary interface used by
+// the chunk library.
+//
+// A Chunk reference should be released once the user is finished with it. After
+// being released, it may no longer be accessed.
+type Chunk interface {
iannucci 2015/11/05 01:10:08 Is this intended to be used outside of the package
dnj 2015/11/13 23:22:03 I'm going to kill Len().
+ // Bytes returns the underlying byte slice contained by this Chunk.
+ Bytes() []byte
+ // Len returns the length of the underlying byte slice.
+ Len() int
iannucci 2015/11/05 01:10:07 maybe no Len() and then put Len() on chunkNode
dnj 2015/11/13 23:22:03 Done.
+
+ // Release releases the Chunk. After being released, a Chunk's methods may no
+ // longer be used.
+ Release()
+}

Powered by Google App Engine
This is Rietveld 408576698