|
|
@ -17,9 +17,6 @@ limitations under the License.
|
|
|
|
package driver
|
|
|
|
package driver
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"io"
|
|
|
|
|
|
|
|
"strconv"
|
|
|
|
"strconv"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
"sync"
|
|
|
|
"sync"
|
|
|
@ -153,28 +150,6 @@ func (mem *Memory) Delete(key string) (*rspb.Release, error) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (mem *Memory) dump(w io.Writer) error {
|
|
|
|
|
|
|
|
var b bytes.Buffer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fmt.Fprintln(&b, "memory:")
|
|
|
|
|
|
|
|
for key, recs := range mem.cache {
|
|
|
|
|
|
|
|
fmt.Fprintf(&b, "\t# %q\n", key)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
recs.Iter(func(index int, r *record) bool {
|
|
|
|
|
|
|
|
fmt.Fprintf(&b, "\t\t- [%d] v%d (status = %s)\n",
|
|
|
|
|
|
|
|
index,
|
|
|
|
|
|
|
|
r.rls.Version,
|
|
|
|
|
|
|
|
r.rls.Info.Status.Code,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_, err := w.Write(b.Bytes())
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// wlock locks mem for writing
|
|
|
|
// wlock locks mem for writing
|
|
|
|
func (mem *Memory) wlock() func() {
|
|
|
|
func (mem *Memory) wlock() func() {
|
|
|
|
mem.Lock()
|
|
|
|
mem.Lock()
|
|
|
|