Interface wireframe

This commit is contained in:
Christian Schwarz
2017-04-14 19:26:32 +02:00
parent 8f11874a6e
commit 123becbd22
7 changed files with 278 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
package rpc
struct Unchunker {
In io.Reader
internalBuffer []byte
remainingChunkSize uint
}
func NewUnchunker(conn io.Reader) {
return Unchunker{In: conn} // TODO
}
func (c Unchunker) Read(b []byte) (n int, error) {
// read min(c.internalBuffer.len, b.len) from c.internalBuffer into b
// fill up internalBuffer
// 1 read up to max(remainingChunkSize,internalBuffer.len) from In
// 2 if remainingChunkSize == 0, read next chunk size, update remainingChunkSize
// 3 goto 1
}
struct Chunker {
In io.Reader
MaxChunkSize uint
ChunkBuf []byte // length of buf determines chunk size? --> would be fixed then
}