aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dedo.go13
-rw-r--r--tests/dedo.go6
2 files changed, 7 insertions, 12 deletions
diff --git a/src/dedo.go b/src/dedo.go
index a7bc629..685f84c 100644
--- a/src/dedo.go
+++ b/src/dedo.go
@@ -433,9 +433,11 @@ const (
// maxAllocSize is the size used when creating array pointers.
maxAllocSize = 0x7FFFFFFF
+ // FIXME: why?
// MaxKeySize is the maximum length of a key, in bytes.
MaxKeySize = 32768
+ // FIXME: why?
// MaxValueSize is the maximum length of a value, in bytes.
MaxValueSize = (1 << 31) - 2
@@ -3744,15 +3746,6 @@ func (tx *Tx) close() {
tx.pages = nil
}
-// Copy writes the entire database to a writer.
-// This function exists for backwards compatibility.
-//
-// Deprecated; Use WriteTo() instead.
-func (tx *Tx) Copy(w io.Writer) error {
- _, err := tx.WriteTo(w)
- return err
-}
-
// WriteTo writes the entire database to a writer.
// If err == nil then exactly tx.Size() bytes will be written into the writer.
func (tx *Tx) WriteTo(w io.Writer) (n int64, err error) {
@@ -3811,7 +3804,7 @@ func (tx *Tx) CopyFile(path string, mode os.FileMode) error {
return err
}
- err = tx.Copy(f)
+ _, err = tx.WriteTo(f)
if err != nil {
_ = f.Close()
return err
diff --git a/tests/dedo.go b/tests/dedo.go
index 1ab2b61..4cfde1e 100644
--- a/tests/dedo.go
+++ b/tests/dedo.go
@@ -5793,7 +5793,8 @@ func TestTx_CopyFile_Error_Meta(t *testing.T) {
}
if err := db.View(func(tx *Tx) error {
- return tx.Copy(&failWriter{})
+ _, err := tx.WriteTo(&failWriter{})
+ return err
}); err == nil || err.Error() != "meta 0 copy: error injected for tests" {
t.Fatalf("unexpected error: %v", err)
}
@@ -5822,7 +5823,8 @@ func TestTx_CopyFile_Error_Normal(t *testing.T) {
}
if err := db.View(func(tx *Tx) error {
- return tx.Copy(&failWriter{3 * db.pageSize})
+ _, err := tx.WriteTo(&failWriter{3 * db.pageSize})
+ return err
}); err == nil || err.Error() != "error injected for tests" {
t.Fatalf("unexpected error: %v", err)
}