func DecodeDump(p []byte) (interface{}, error) { d := &decoder{} if err := rdb.DecodeDump(p, 0, nil, 0, d); err != nil { return nil, errors.Trace(err) } return d.obj, d.err }
func (s *DecoderSuite) TestDumpDecoder(c *C) { r := &FakeRedis{} err := rdb.DecodeDump([]byte("\u0000\xC0\n\u0006\u0000\xF8r?\xC5\xFB\xFB_("), 1, []byte("test"), 123, r) if err != nil { c.Error(err) } c.Assert(r.dbs[1]["test"], Equals, "10") }
func Restore(args [][]byte, wb *levigo.WriteBatch) interface{} { ttl, err := bconv.ParseInt(args[1], 10, 64) if err != nil { return InvalidIntError } err = rdb.DecodeDump(args[2], 0, args[0], ttl, &rdbDecoder{wb: wb}) if err != nil { return err } return ReplyOK }