mirror of https://github.com/ceph/go-ceph
docs: update comments of preview and deprecated APIs
Signed-off-by: Sven Anderson <sven@redhat.com>
This commit is contained in:
parent
cee047149f
commit
26fd846da1
|
@ -9,18 +9,19 @@ import (
|
||||||
// ImageSpec values are used to identify an RBD image wherever Ceph APIs
|
// ImageSpec values are used to identify an RBD image wherever Ceph APIs
|
||||||
// require an image_spec/image_id_spec using image name/id and optional
|
// require an image_spec/image_id_spec using image name/id and optional
|
||||||
// pool and namespace.
|
// pool and namespace.
|
||||||
// PREVIEW
|
// PREVIEW
|
||||||
type ImageSpec struct {
|
type ImageSpec struct {
|
||||||
spec string
|
spec string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageSpec is used to construct an ImageSpec given an image name/id
|
// NewImageSpec is used to construct an ImageSpec given an image name/id
|
||||||
// and optional namespace and pool names.
|
// and optional namespace and pool names.
|
||||||
|
// PREVIEW
|
||||||
|
//
|
||||||
// NewImageSpec constructs an ImageSpec to identify an RBD image and thus
|
// NewImageSpec constructs an ImageSpec to identify an RBD image and thus
|
||||||
// requires image name/id, whereas NewLevelSpec constructs LevelSpec to
|
// requires image name/id, whereas NewLevelSpec constructs LevelSpec to
|
||||||
// identify entire pool, pool namespace or single RBD image, all of which
|
// identify entire pool, pool namespace or single RBD image, all of which
|
||||||
// requires pool name.
|
// requires pool name.
|
||||||
// PREVIEW
|
|
||||||
func NewImageSpec(pool, namespace, image string) ImageSpec {
|
func NewImageSpec(pool, namespace, image string) ImageSpec {
|
||||||
var s string
|
var s string
|
||||||
if pool != "" && namespace != "" {
|
if pool != "" && namespace != "" {
|
||||||
|
@ -34,10 +35,11 @@ func NewImageSpec(pool, namespace, image string) ImageSpec {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRawImageSpec returns a ImageSpec directly based on the spec string
|
// NewRawImageSpec returns a ImageSpec directly based on the spec string
|
||||||
// argument without constructing it from component values. This should only be
|
// argument without constructing it from component values.
|
||||||
// used if NewImageSpec can not create the imagespec value you want to pass to
|
// PREVIEW
|
||||||
// ceph.
|
//
|
||||||
// PREVIEW
|
// This should only be used if NewImageSpec can not create the imagespec value
|
||||||
|
// you want to pass to ceph.
|
||||||
func NewRawImageSpec(spec string) ImageSpec {
|
func NewRawImageSpec(spec string) ImageSpec {
|
||||||
return ImageSpec{spec}
|
return ImageSpec{spec}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,22 +7,20 @@ import (
|
||||||
"github.com/ceph/go-ceph/internal/commands"
|
"github.com/ceph/go-ceph/internal/commands"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TaskAdmin encapsulates management functions for
|
// TaskAdmin encapsulates management functions for ceph rbd task operations.
|
||||||
// ceph rbd task operations.
|
// PREVIEW
|
||||||
// PREVIEW
|
|
||||||
type TaskAdmin struct {
|
type TaskAdmin struct {
|
||||||
conn ccom.MgrCommander
|
conn ccom.MgrCommander
|
||||||
}
|
}
|
||||||
|
|
||||||
// Task returns a TaskAdmin type for
|
// Task returns a TaskAdmin type for managing ceph rbd task operations.
|
||||||
// managing ceph rbd task operations.
|
// PREVIEW
|
||||||
// PREVIEW
|
|
||||||
func (ra *RBDAdmin) Task() *TaskAdmin {
|
func (ra *RBDAdmin) Task() *TaskAdmin {
|
||||||
return &TaskAdmin{conn: ra.conn}
|
return &TaskAdmin{conn: ra.conn}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TaskRefs contains the action name and information about the image.
|
// TaskRefs contains the action name and information about the image.
|
||||||
// PREVIEW
|
// PREVIEW
|
||||||
type TaskRefs struct {
|
type TaskRefs struct {
|
||||||
Action string `json:"action"`
|
Action string `json:"action"`
|
||||||
PoolName string `json:"pool_name"`
|
PoolName string `json:"pool_name"`
|
||||||
|
@ -32,7 +30,7 @@ type TaskRefs struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TaskResponse contains the information about the task added on an image.
|
// TaskResponse contains the information about the task added on an image.
|
||||||
// PREVIEW
|
// PREVIEW
|
||||||
type TaskResponse struct {
|
type TaskResponse struct {
|
||||||
Sequence int `json:"sequence"`
|
Sequence int `json:"sequence"`
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
|
@ -57,11 +55,12 @@ func parseTaskResponseList(res commands.Response) ([]TaskResponse, error) {
|
||||||
return taskResponseList, err
|
return taskResponseList, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddFlatten adds a background task to flatten a cloned image based on the supplied image spec.
|
// AddFlatten adds a background task to flatten a cloned image based on the
|
||||||
|
// supplied image spec.
|
||||||
|
// PREVIEW
|
||||||
//
|
//
|
||||||
// Similar To:
|
// Similar To:
|
||||||
// rbd task add flatten <image_spec>
|
// rbd task add flatten <image_spec>
|
||||||
// PREVIEW
|
|
||||||
func (ta *TaskAdmin) AddFlatten(img ImageSpec) (TaskResponse, error) {
|
func (ta *TaskAdmin) AddFlatten(img ImageSpec) (TaskResponse, error) {
|
||||||
m := map[string]string{
|
m := map[string]string{
|
||||||
"prefix": "rbd task add flatten",
|
"prefix": "rbd task add flatten",
|
||||||
|
@ -71,11 +70,12 @@ func (ta *TaskAdmin) AddFlatten(img ImageSpec) (TaskResponse, error) {
|
||||||
return parseTaskResponse(commands.MarshalMgrCommand(ta.conn, m))
|
return parseTaskResponse(commands.MarshalMgrCommand(ta.conn, m))
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddRemove adds a background task to remove an image based on the supplied image spec.
|
// AddRemove adds a background task to remove an image based on the supplied
|
||||||
|
// image spec.
|
||||||
|
// PREVIEW
|
||||||
//
|
//
|
||||||
// Similar To:
|
// Similar To:
|
||||||
// rbd task add remove <image_spec>
|
// rbd task add remove <image_spec>
|
||||||
// PREVIEW
|
|
||||||
func (ta *TaskAdmin) AddRemove(img ImageSpec) (TaskResponse, error) {
|
func (ta *TaskAdmin) AddRemove(img ImageSpec) (TaskResponse, error) {
|
||||||
m := map[string]string{
|
m := map[string]string{
|
||||||
"prefix": "rbd task add remove",
|
"prefix": "rbd task add remove",
|
||||||
|
@ -85,12 +85,12 @@ func (ta *TaskAdmin) AddRemove(img ImageSpec) (TaskResponse, error) {
|
||||||
return parseTaskResponse(commands.MarshalMgrCommand(ta.conn, m))
|
return parseTaskResponse(commands.MarshalMgrCommand(ta.conn, m))
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddTrashRemove adds a background task to remove an image from the trash based on the
|
// AddTrashRemove adds a background task to remove an image from the trash based
|
||||||
// supplied image id spec.
|
// on the supplied image id spec.
|
||||||
|
// PREVIEW
|
||||||
//
|
//
|
||||||
// Similar To:
|
// Similar To:
|
||||||
// rbd task add trash remove <image_id_spec>
|
// rbd task add trash remove <image_id_spec>
|
||||||
// PREVIEW
|
|
||||||
func (ta *TaskAdmin) AddTrashRemove(img ImageSpec) (TaskResponse, error) {
|
func (ta *TaskAdmin) AddTrashRemove(img ImageSpec) (TaskResponse, error) {
|
||||||
m := map[string]string{
|
m := map[string]string{
|
||||||
"prefix": "rbd task add trash remove",
|
"prefix": "rbd task add trash remove",
|
||||||
|
@ -101,10 +101,10 @@ func (ta *TaskAdmin) AddTrashRemove(img ImageSpec) (TaskResponse, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// List pending or running asynchronous tasks.
|
// List pending or running asynchronous tasks.
|
||||||
|
// PREVIEW
|
||||||
//
|
//
|
||||||
// Similar To:
|
// Similar To:
|
||||||
// rbd task list
|
// rbd task list
|
||||||
// PREVIEW
|
|
||||||
func (ta *TaskAdmin) List() ([]TaskResponse, error) {
|
func (ta *TaskAdmin) List() ([]TaskResponse, error) {
|
||||||
m := map[string]string{
|
m := map[string]string{
|
||||||
"prefix": "rbd task list",
|
"prefix": "rbd task list",
|
||||||
|
@ -114,10 +114,10 @@ func (ta *TaskAdmin) List() ([]TaskResponse, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTaskByID returns pending or running asynchronous task using id.
|
// GetTaskByID returns pending or running asynchronous task using id.
|
||||||
|
// PREVIEW
|
||||||
//
|
//
|
||||||
// Similar To:
|
// Similar To:
|
||||||
// rbd task list <task_id>
|
// rbd task list <task_id>
|
||||||
// PREVIEW
|
|
||||||
func (ta *TaskAdmin) GetTaskByID(taskID string) (TaskResponse, error) {
|
func (ta *TaskAdmin) GetTaskByID(taskID string) (TaskResponse, error) {
|
||||||
m := map[string]string{
|
m := map[string]string{
|
||||||
"prefix": "rbd task list",
|
"prefix": "rbd task list",
|
||||||
|
@ -128,10 +128,10 @@ func (ta *TaskAdmin) GetTaskByID(taskID string) (TaskResponse, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel a pending or running asynchronous task.
|
// Cancel a pending or running asynchronous task.
|
||||||
|
// PREVIEW
|
||||||
//
|
//
|
||||||
// Similar To:
|
// Similar To:
|
||||||
// rbd task cancel <task_id>
|
// rbd task cancel <task_id>
|
||||||
// PREVIEW
|
|
||||||
func (ta *TaskAdmin) Cancel(taskID string) (TaskResponse, error) {
|
func (ta *TaskAdmin) Cancel(taskID string) (TaskResponse, error) {
|
||||||
m := map[string]string{
|
m := map[string]string{
|
||||||
"prefix": "rbd task cancel",
|
"prefix": "rbd task cancel",
|
||||||
|
|
|
@ -746,7 +746,9 @@ func (iter *MirrorImageGlobalStatusIter) Next() (*GlobalMirrorImageIDAndStatus,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close terminates iteration regardless if iteration was completed and
|
// Close terminates iteration regardless if iteration was completed and
|
||||||
// frees any associated resources. (DEPRECATED)
|
// frees any associated resources.
|
||||||
|
//
|
||||||
|
// Deprecated: not required
|
||||||
func (*MirrorImageGlobalStatusIter) Close() error {
|
func (*MirrorImageGlobalStatusIter) Close() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,11 +327,9 @@ func (image *Image) Rename(destname string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open the rbd image (DEPRECATED).
|
// Open the rbd image.
|
||||||
//
|
//
|
||||||
// Deprecated: The Open function was provided in earlier versions of the API
|
// Deprecated: use OpenImage and OpenImageReadOnly instead
|
||||||
// and now exists to support older code. The use of OpenImage and
|
|
||||||
// OpenImageReadOnly is preferred.
|
|
||||||
func (image *Image) Open(args ...interface{}) error {
|
func (image *Image) Open(args ...interface{}) error {
|
||||||
if err := image.validate(imageNeedsIOContext | imageNeedsName); err != nil {
|
if err := image.validate(imageNeedsIOContext | imageNeedsName); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -147,9 +147,10 @@ func (snapshot *Snapshot) IsProtected() (bool, error) {
|
||||||
return cIsProtected != 0, nil
|
return cIsProtected != 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set updates the rbd image (not the Snapshot) such that the snapshot
|
// Set updates the rbd image (not the Snapshot) such that the snapshot is the
|
||||||
// is the source of readable data (DEPRECATED).
|
// source of readable data.
|
||||||
// Refer the SetSnapshot method of the Image type instead.
|
//
|
||||||
|
// Deprecated: use the SetSnapshot method of the Image type instead
|
||||||
//
|
//
|
||||||
// Implements:
|
// Implements:
|
||||||
// int rbd_snap_set(rbd_image_t image, const char *snapname);
|
// int rbd_snap_set(rbd_image_t image, const char *snapname);
|
||||||
|
|
|
@ -10,8 +10,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// AddUserCap adds the capabilities for a user.
|
// AddUserCap adds the capabilities for a user.
|
||||||
|
// PREVIEW
|
||||||
|
//
|
||||||
// On Success, it returns the updated list of UserCaps for the user.
|
// On Success, it returns the updated list of UserCaps for the user.
|
||||||
// PREVIEW
|
|
||||||
func (api *API) AddUserCap(ctx context.Context, uid, userCap string) ([]UserCapSpec, error) {
|
func (api *API) AddUserCap(ctx context.Context, uid, userCap string) ([]UserCapSpec, error) {
|
||||||
if uid == "" {
|
if uid == "" {
|
||||||
return nil, errMissingUserID
|
return nil, errMissingUserID
|
||||||
|
@ -36,8 +37,9 @@ func (api *API) AddUserCap(ctx context.Context, uid, userCap string) ([]UserCapS
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveUserCap removes the capabilities from a user.
|
// RemoveUserCap removes the capabilities from a user.
|
||||||
|
// PREVIEW
|
||||||
|
//
|
||||||
// On Success, it returns the updated list of UserCaps for the user.
|
// On Success, it returns the updated list of UserCaps for the user.
|
||||||
// PREVIEW
|
|
||||||
func (api *API) RemoveUserCap(ctx context.Context, uid, userCap string) ([]UserCapSpec, error) {
|
func (api *API) RemoveUserCap(ctx context.Context, uid, userCap string) ([]UserCapSpec, error) {
|
||||||
if uid == "" {
|
if uid == "" {
|
||||||
return nil, errMissingUserID
|
return nil, errMissingUserID
|
||||||
|
|
Loading…
Reference in New Issue