src/server/pkg/storage/chunk/writer.go
func (w *Writer) Write(data []byte) (int, error) {
	offset := 0
	size := w.buf.Len()
	for i, b := range data {
		size++
		w.hash.Roll(b)
		if w.hash.Sum64()&w.splitMask == 0 {
			w.buf.Write(data[offset : i+1])
			if err := w.put(); err != nil {
				return 0, err
			}
			w.buf.Reset()
			offset = i + 1
			size = 0
		}
	}
	w.buf.Write(data[offset:])
	w.rangeSize += int64(len(data))
	return len(data), nil
}
func (w *Writer) Write(data []byte) (int, error) {
	offset := 0
	size := w.buf.Len()
	for i, b := range data {
		size++
		w.hash.Roll(b)
		if w.hash.Sum64()&w.splitMask == 0 {
			w.buf.Write(data[offset : i+1])
			if err := w.put(); err != nil {
				return 0, err
			}
			w.buf.Reset()
			offset = i + 1
			size = 0
		}
	}
	w.buf.Write(data[offset:])
	w.rangeSize += int64(len(data))
	return len(data), nil
}
// Write rolls through the data written, calling c.f when a chunk is found.
// Note: If making changes to this function, be wary of the performance
// implications (check before and after performance with chunker benchmarks).