move decompressor to internal
This commit is contained in:
parent
2b86c283ec
commit
f64df95f23
5 changed files with 52 additions and 49 deletions
|
|
@ -33,6 +33,7 @@ import (
|
||||||
"github.com/google/cayley/db"
|
"github.com/google/cayley/db"
|
||||||
"github.com/google/cayley/graph"
|
"github.com/google/cayley/graph"
|
||||||
"github.com/google/cayley/http"
|
"github.com/google/cayley/http"
|
||||||
|
"github.com/google/cayley/internal"
|
||||||
"github.com/google/cayley/quad"
|
"github.com/google/cayley/quad"
|
||||||
"github.com/google/cayley/quad/cquads"
|
"github.com/google/cayley/quad/cquads"
|
||||||
"github.com/google/cayley/quad/nquads"
|
"github.com/google/cayley/quad/nquads"
|
||||||
|
|
@ -286,7 +287,7 @@ func decompressAndLoad(qw graph.QuadWriter, cfg *config.Config, path, typ string
|
||||||
r = res.Body
|
r = res.Body
|
||||||
}
|
}
|
||||||
|
|
||||||
r, err = quad.Decompressor(r)
|
r, err = internal.Decompressor(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ import (
|
||||||
"github.com/google/cayley/config"
|
"github.com/google/cayley/config"
|
||||||
"github.com/google/cayley/db"
|
"github.com/google/cayley/db"
|
||||||
"github.com/google/cayley/graph"
|
"github.com/google/cayley/graph"
|
||||||
|
"github.com/google/cayley/internal"
|
||||||
"github.com/google/cayley/quad"
|
"github.com/google/cayley/quad"
|
||||||
"github.com/google/cayley/query/gremlin"
|
"github.com/google/cayley/query/gremlin"
|
||||||
)
|
)
|
||||||
|
|
@ -705,7 +706,7 @@ var testDecompressor = []struct {
|
||||||
|
|
||||||
func TestDecompressor(t *testing.T) {
|
func TestDecompressor(t *testing.T) {
|
||||||
for _, test := range testDecompressor {
|
for _, test := range testDecompressor {
|
||||||
r, err := decompressor(test.input)
|
r, err := internal.Decompressor(test.input)
|
||||||
if err != test.err {
|
if err != test.err {
|
||||||
t.Fatalf("Unexpected error for %s, got:%v expect:%v", test.message, err, test.err)
|
t.Fatalf("Unexpected error for %s, got:%v expect:%v", test.message, err, test.err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import (
|
||||||
"github.com/barakmich/glog"
|
"github.com/barakmich/glog"
|
||||||
"github.com/julienschmidt/httprouter"
|
"github.com/julienschmidt/httprouter"
|
||||||
|
|
||||||
|
"github.com/google/cayley/internal"
|
||||||
"github.com/google/cayley/quad"
|
"github.com/google/cayley/quad"
|
||||||
"github.com/google/cayley/quad/cquads"
|
"github.com/google/cayley/quad/cquads"
|
||||||
)
|
)
|
||||||
|
|
@ -82,7 +83,7 @@ func (api *API) ServeV1WriteNQuad(w http.ResponseWriter, r *http.Request, params
|
||||||
blockSize = int64(api.config.LoadSize)
|
blockSize = int64(api.config.LoadSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
quadReader, err := quad.Decompressor(formFile)
|
quadReader, err := internal.Decompressor(formFile)
|
||||||
// TODO(kortschak) Make this configurable from the web UI.
|
// TODO(kortschak) Make this configurable from the web UI.
|
||||||
dec := cquads.NewDecoder(quadReader)
|
dec := cquads.NewDecoder(quadReader)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package quad
|
package internal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue