Commit 15a0b00c authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Put PAGESIZE into types.go, and use 1<<16 for input buffer size.

parent 86a06b0b
...@@ -5,8 +5,6 @@ import ( ...@@ -5,8 +5,6 @@ import (
"fmt" "fmt"
) )
const PAGESIZE int = 4096
// This implements a pool of buffers that returns slices with capacity // This implements a pool of buffers that returns slices with capacity
// (2^e * PAGESIZE) for e=0,1,... which have possibly been used, and // (2^e * PAGESIZE) for e=0,1,... which have possibly been used, and
// may contain random contents. // may contain random contents.
......
...@@ -14,8 +14,10 @@ import ( ...@@ -14,8 +14,10 @@ import (
// TODO make generic option setting. // TODO make generic option setting.
const ( const (
maxRead = (1 << 16) // bufSize should be a power of two to minimize lossage in
bufSize = maxRead + 1024 // BufferPool.
bufSize = (1 << 16)
maxRead = bufSize - PAGESIZE
) )
type Empty interface{} type Empty interface{}
......
...@@ -77,6 +77,9 @@ const ( ...@@ -77,6 +77,9 @@ const (
S_IFDIR = syscall.S_IFDIR S_IFDIR = syscall.S_IFDIR
S_IFREG = syscall.S_IFREG S_IFREG = syscall.S_IFREG
// TODO - get this from a canonical place.
PAGESIZE = 4096
) )
type Status int32 type Status int32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment