// ListObjects lists all of the objects in the pool associated with the I/O // context, and called the provided listFn function for each object, passing // to the function the name of the object. func (ioctx *IOContext) ListObjects(listFn ObjectListFunc) error { var ctx C.rados_list_ctx_t ret := C.rados_objects_list_open(ioctx.ioctx, &ctx) if ret < 0 { return RadosError(ret) } defer func() { C.rados_objects_list_close(ctx) }() for { var c_entry *C.char ret := C.rados_objects_list_next(ctx, &c_entry, nil) if ret == -2 { // FIXME return nil } else if ret < 0 { return RadosError(ret) } listFn(C.GoString(c_entry)) } panic("invalid state") }
// Closes the iterator cursor on the server. Be aware that iterators are not closed automatically // at the end of iteration. func (iter *Iter) Close() { C.rados_objects_list_close(iter.ctx) }
// Close closes the iterator. func (ol *ObjectList) Close() { C.rados_objects_list_close(ol.listContext) }
func (ctx *RadosListCtx) Close() { C.rados_objects_list_close(*ctx.list_ctx) }