rados: add ioctx destroy method

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
This commit is contained in:
Noah Watkins 2015-01-09 11:37:30 -08:00
parent 7316c3d70f
commit 62e6137f1f
2 changed files with 10 additions and 0 deletions

View File

@ -84,3 +84,10 @@ func (p *IOContext) Truncate(oid string, size uint64) error {
return RadosError(int(ret))
}
}
// Destroy informs librados that the I/O context is no longer in use.
// Resources associated with the context may not be freed immediately, and the
// context should not be used again after calling this method.
func (ioctx *IOContext) Destroy() {
C.rados_ioctx_destroy(ioctx.ioctx)
}

View File

@ -114,6 +114,7 @@ func TestGetClusterStats(t *testing.T) {
}
}
pool.Destroy()
conn.Shutdown()
t.Error("Cluster stats aren't changing")
}
@ -302,4 +303,6 @@ func TestReadWrite(t *testing.T) {
assert.Equal(t, n_out, len(bytes_in))
assert.Equal(t, bytes_in, bytes_out)
pool.Destroy()
}