Skip to content

Commit

Permalink
CompressionSnappy removed until its working
Browse files Browse the repository at this point in the history
  • Loading branch information
karrick committed Mar 26, 2015
1 parent 895a408 commit e592fd8
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 41 deletions.
1 change: 0 additions & 1 deletion examples/net/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func serveClient(conn net.Conn) {
fw, err := goavro.NewWriter(
goavro.BlockSize(2),
goavro.Compression(goavro.CompressionDeflate),
// goavro.Compression(goavro.CompressionSnappy),
goavro.WriterSchema(recordSchema),
goavro.ToWriter(conn))
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions ocf.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const (
const (
CompressionNull = "null"
CompressionDeflate = "deflate"
CompressionSnappy = "snappy"
)

var (
Expand All @@ -42,7 +41,7 @@ func init() {
// string is supported by this library.
func IsCompressionCodecSupported(someCodec string) bool {
switch someCodec {
case CompressionNull, CompressionDeflate, CompressionSnappy:
case CompressionNull, CompressionDeflate:
return true
default:
return false
Expand Down
19 changes: 0 additions & 19 deletions ocf_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package goavro
import (
"bufio"
"bytes"
"code.google.com/p/snappy-go/snappy"
"compress/flate"
"fmt"
"io"
Expand Down Expand Up @@ -264,24 +263,6 @@ func decompress(fr *Reader, toDecompress <-chan *readerBlock, toDecode chan<- *r
for block := range toDecompress {
toDecode <- block
}
case CompressionSnappy:
var src, dst []byte
for block := range toDecompress {
src, block.err = ioutil.ReadAll(block.r)
if block.err != nil {
block.err = fmt.Errorf("cannot read: %v", block.err)
toDecode <- block
continue
}
dst, block.err = snappy.Decode(dst, src)
if block.err != nil {
block.err = fmt.Errorf("cannot decompress: %v", block.err)
toDecode <- block
continue
}
block.r = bytes.NewReader(dst)
toDecode <- block
}
}
close(toDecode)
}
Expand Down
10 changes: 5 additions & 5 deletions ocf_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ func TestFileRead(t *testing.T) {
}()
var count int
for fr.Scan() {
datum := fr.Read()
if datum.Err != nil {
t.Errorf("Actual: %#v; Expected: %#v", datum.Err, nil)
datum, err := fr.Read()
if err != nil {
t.Errorf("Actual: %#v; Expected: %#v", err, nil)
}
_, ok := datum.Value.(*Record)
_, ok := datum.(*Record)
if !ok {
t.Errorf("Actual: %T; Expected: *Record", datum.Value)
t.Errorf("Actual: %T; Expected: *Record", datum)
}
count++
}
Expand Down
11 changes: 0 additions & 11 deletions ocf_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package goavro
import (
"bufio"
"bytes"
"code.google.com/p/snappy-go/snappy"
"compress/flate"
"encoding/json"
"fmt"
Expand Down Expand Up @@ -291,16 +290,6 @@ func compressor(fw *Writer, toCompress <-chan *writerBlock, toWrite chan<- *writ
bb = new(bytes.Buffer)
comp.Reset(bb)
}
case CompressionSnappy:
bb := new(bytes.Buffer)
comp := snappy.NewWriter(bb)
for block := range toCompress {
_, block.err = comp.Write(block.encoded.Bytes())
block.compressed = bb.Bytes()
toWrite <- block
bb = new(bytes.Buffer)
comp.Reset(bb)
}
}
close(toWrite)
}
Expand Down
3 changes: 0 additions & 3 deletions ocf_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ func TestNewWriterBailsMissingWriterSchema(t *testing.T) {

_, err = NewWriter(ToWriter(new(bytes.Buffer)), Compression(CompressionDeflate))
checkError(t, err, "missing schema")

_, err = NewWriter(ToWriter(new(bytes.Buffer)), Compression(CompressionSnappy))
checkError(t, err, "missing schema")
}

func TestNewWriterBailsInvalidWriterSchema(t *testing.T) {
Expand Down

0 comments on commit e592fd8

Please sign in to comment.