Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP CASSGO-29 #1847

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func TestObserve(t *testing.T) {
t.Fatal("select: unexpected observed stmt", observedStmt)
}

// reports errors when the query is poorly formed
// reports internal_errors when the query is poorly formed
resetObserved()
value = 0
if err := session.Query(`SELECT id FROM unknown_table WHERE id = ?`, 42).Observer(observer).Scan(&value); err == nil {
Expand Down Expand Up @@ -1451,8 +1451,8 @@ func injectInvalidPreparedStatement(t *testing.T, session *Session, table string

flight.preparedStatment = &preparedStatment{
id: []byte{'f', 'o', 'o', 'b', 'a', 'r'},
request: preparedMetadata{
resultMetadata: resultMetadata{
request: protocol.PreparedMetadata{
protocol.ResultMetadata: protocol.ResultMetadata{
colCount: 1,
actualColCount: 1,
columns: []ColumnInfo{
Expand Down
25 changes: 3 additions & 22 deletions compressor.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,9 @@
package gocql

import (
"github.com/golang/snappy"
"github.com/gocql/gocql/internal/compressor"
)

type Compressor interface {
Name() string
Encode(data []byte) ([]byte, error)
Decode(data []byte) ([]byte, error)
}
type Compressor = compressor.Compressor

// SnappyCompressor implements the Compressor interface and can be used to
// compress incoming and outgoing frames. The snappy compression algorithm
// aims for very high speeds and reasonable compression.
type SnappyCompressor struct{}

func (s SnappyCompressor) Name() string {
return "snappy"
}

func (s SnappyCompressor) Encode(data []byte) ([]byte, error) {
return snappy.Encode(nil, data), nil
}

func (s SnappyCompressor) Decode(data []byte) ([]byte, error) {
return snappy.Decode(nil, data)
}
type SnappyCompressor = compressor.SnappyCompressor
Loading