Add Write implementing rados_write_op_write.
Add WriteFull implementing rados_write_op_write_full.
Add WriteSame implementing rados_write_op_writesame.
These are some of the basic functions needed to write data to
a rados object using a WriteOp.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Refactor the previous ListOmapValues logic into a new read op step
that can be used for iteration over the results of the operation. The
previous function is now based on the ReadOp.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reimplement SetOmap in terms of a new SetOmap function on the WriteOp.
Now the actions of the write op can start to be atomically chained the
way WriteOps are supposed to.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Add a new error that will be returned from a op step method if the
method is called before the step is ready to provide data - like
when the operation has not yet been performed.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The WriteOp type will manage librados write operations and the
corresponding functions that ceph names like rados_write_op_*.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This utility function avoids having to have a custom finalizer for every
op step. It calls the free() function to release any allocated C memory
the step may have.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The LIBRADOS_OP_FLAG_* constants can be passed to rbd_writesame() and
other operations that will be added in the future.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Add wrappers for following three functions which involve snapshot ID:
1. rados_ioctx_snap_lookup()
2. rados_ioctx_snap_get_name()
3. rados_ioctx_snap_get_stamp()
Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
The GetLastVersion returns a number representing the most recent
read/write version for the io context.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The validate function works similarly to those already found
in rbd and cephfs. It will be used in future functions or
updated functions to ensure the C ioctx is ready for use.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Previously, ParseCmdLineArgs was the function directly wrapping the
ceph rados_conf_parse_argv function. This function has the improper
(IMO) behavior of assuming you didn't know your own argv[0] and just
always stuck "placeholder" in argv[0]. This function adds a more
direct wrapper ParseConfigArgv that allows the caller to pass an
full argv, and they can put any placholder value desired if they want.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
In order to avoid external dependencies on implementation details,
this change replaces RadosError with the unexported radosError. In case
some application really needs access to the integer value, it can use
the pattern
var errno interface{ Errno() int }
if errors.As(err, errno) { ... errno.Errno() ... }
Signed-off-by: Sven Anderson <sven@redhat.com>
These functions wrap rados_mon_command_target and allow the user to send
"command JSON" to specific MONs.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
These private functions with names like monCommand and pgCommand were no
different from the public xxxCommandWithInputBuffer commands. Thus the
redundant private functions are removed to simplify the file. As private
functions these can be added back later w/o fuss if the behavior of
the xxxCommand and xxxCommandWithInputBuffer calls need to differ more
in the future.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The *_command functions in librados and libcephfs document the use
of specific free functions for data allocated. These functions are
currently just wrappers around C's free() function. However, to be
more strictly compliant this change adds a free-function callback
to the CommandOutput type and the specific free functions are now
used outside the unit tests.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Replace the argument handling (wrangling?) around *_command functions,
such as MonCommand, with the new command input and output helper types
from the internal/cutil package.
No external change should be visible.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Add functions for issuing commands to ceph mgrs with
MgrCommand and MgrCommandWithInputBuffer, implemented simliarly
to the other *Command style functions.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Organize the rados package a bit more by moving functions that wrap
rados_xyz_command functions into a dedicated file. Move related test to
a separate file as well.
Signed-off-by: John Mulligan <jmulligan@redhat.com>