Example #1
0
// LocatorSetKey sets the locator key or resets it if an empty key is provided.
func (c *Context) LocatorSetKey(key string) error {
	if key == "" {
		C.rados_ioctx_locator_set_key(c.ctx, nil)
	} else {
		ckey := C.CString(key)
		defer C.free(unsafe.Pointer(ckey))

		C.rados_ioctx_locator_set_key(c.ctx, ckey)
	}

	return nil
}
Example #2
0
// SetLocatorKey sets the key for mapping objects to pgs.
//
// The key is used instead of the object name to determine which placement groups an object is put in. This affects all
// subsequent operations of the io context - until a different locator key is set, all objects in this io context will
// be placed in the same pg.
//
// This is useful if you need to do clone_range operations, which must be done with the source and destination objects
// in the same pg.
func (pool *Pool) SetLocatorKey(key string) {
	k := C.CString(key)
	defer freeString(k)
	C.rados_ioctx_locator_set_key(pool.context, k)
}