MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / DeepCopyInefficient

Function DeepCopyInefficient

base/util_testing.go:676–694  ·  view source on GitHub ↗

Make a deep copy from src into dst. Copied from https://github.com/getlantern/deepcopy, commit 7f45deb8130a0acc553242eb0e009e3f6f3d9ce3 (Apache 2 licensed)

(dst interface{}, src interface{})

Source from the content-addressed store, hash-verified

674// Make a deep copy from src into dst.
675// Copied from https://github.com/getlantern/deepcopy, commit 7f45deb8130a0acc553242eb0e009e3f6f3d9ce3 (Apache 2 licensed)
676func DeepCopyInefficient(dst interface{}, src interface{}) error {
677 if dst == nil {
678 return fmt.Errorf("dst cannot be nil")
679 }
680 if src == nil {
681 return fmt.Errorf("src cannot be nil")
682 }
683 b, err := JSONMarshal(src)
684 if err != nil {
685 return fmt.Errorf("Unable to marshal src: %s", err)
686 }
687 d := JSONDecoder(bytes.NewBuffer(b))
688 d.UseNumber()
689 err = d.Decode(dst)
690 if err != nil {
691 return fmt.Errorf("Unable to unmarshal into dst: %s", err)
692 }
693 return nil
694}
695
696// testRetryUntilTrue performs a short sleep-based retry loop until the timeout is reached or the
697// criteria in RetryUntilTrueFunc is met. Intended to

Callers 11

RedactedMethod · 0.92
handleCreateDBMethod · 0.92
handlePostIndexInitMethod · 0.92
handlePutDbConfigMethod · 0.92
RedactedMethod · 0.92
RedactedMethod · 0.92
RedactedMethod · 0.92
getInitialStartupConfigFunction · 0.92
BucketMethod · 0.92
DeepCopyMethod · 0.92
TestDeepCopyInefficientFunction · 0.85

Calls 5

ErrorfMethod · 0.80
UseNumberMethod · 0.80
JSONMarshalFunction · 0.70
JSONDecoderFunction · 0.70
DecodeMethod · 0.65

Tested by 1

TestDeepCopyInefficientFunction · 0.68