Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2e21fba
DAOS-18304 ddb: store VOS path in vos_file_parts and raise path size …
kanard38 Apr 28, 2026
dfc555e
DAOS-18304 ddb: simplify dv_pool_open/destroy API and remove path cac…
kanard38 Apr 28, 2026
03378bb
DAOS-18304 ddb: update C test suites for new dv_pool_open/destroy API
kanard38 Apr 28, 2026
b6f8125
DAOS-18304 ddb: introduce DdbAPI interface and convert DdbContext to …
kanard38 Apr 28, 2026
5ca13e0
DAOS-18304 ddb: propagate DdbAPI through command and CLI layers
kanard38 Apr 28, 2026
7b3c6ac
DAOS-18304 ddb: use MOCKED_VOS_PATH_STR macro in Go unit tests
kanard38 Apr 28, 2026
b0f7207
DAOS-18304 ddb: replace noAutoOpen map with a string slice
kanard38 Apr 28, 2026
425fc48
daos-18304 ddb: capitalize VOS in help strings
kanard38 May 4, 2026
beaeed7
daos-18304 ddb: improve unknown command error message
kanard38 May 4, 2026
c12dcbb
Merge remote-tracking branch 'origin/master' into ckochhof/fix/master…
kanard38 May 5, 2026
b622710
Merge remote-tracking branch 'origin/master' into ckochhof/fix/master…
kanard38 May 7, 2026
232dde6
DAOS-18304 ddb: fix invalid merge conflict resolution in ddb_vos_tests.c
kanard38 May 7, 2026
bdd01e8
DAOS-18304 ddb: clarify why DTX records are inserted in suite setup
kanard38 May 7, 2026
de22289
DAOS-18304 ddb: fix inconsistent help strings for close and rm_pool
kanard38 May 7, 2026
56e0956
DAOS-18304 ddb: add doc comments to all exported Go symbols
kanard38 May 7, 2026
9de3531
DAOS-18304 ddb: decouple dv_pool_open from ddb_ctx
kanard38 May 11, 2026
7310312
DAOS-18304 ddb: replace DdbAPI god interface with build-tag CGo stubs
kanard38 May 11, 2026
d683277
DAOS-18304 ddb: move DtxAggr validation to command layer
kanard38 May 11, 2026
c4a1c1f
DAOS-18304 ddb: use grumbleUnknownCmdErr in unknownCmdError message
kanard38 May 11, 2026
0e95e3a
DAOS-18304 ddb: fix gofmt alignment in libddb Go wrappers
kanard38 May 11, 2026
961d42a
DAOS-18304 ddb: fix and improve dv_pool_open doc comment
kanard38 May 11, 2026
d3e88ed
Merge remote-tracking branch 'origin/master' into ckochhof/fix/master…
kanard38 May 11, 2026
a6cfa13
DAOS-18304 ddb: fix clang-format line length in ddb_vos_tests
kanard38 May 11, 2026
f103aec
DAOS-18304 ddb: fix dv_pool_open Doxygen style to match DAOS convention
kanard38 May 11, 2026
4ff740d
DAOS-18304 ddb: restore user-friendly unknown command error message
kanard38 May 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
239 changes: 129 additions & 110 deletions src/control/cmd/ddb/commands_wrapper.go

Large diffs are not rendered by default.

105 changes: 55 additions & 50 deletions src/control/cmd/ddb/ddb_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package main

import (
"fmt"
"math"

"github.com/desertbit/grumble"
Expand All @@ -30,32 +31,28 @@ func addAppCommands(app *grumble.App, ctx *DdbContext) {
a.String("path", "Optional, list contents of the provided path", grumble.Default(""))
},
Run: func(c *grumble.Context) error {
return ddbLs(ctx, c.Args.String("path"), c.Flags.Bool("recursive"), c.Flags.Bool("details"))
return ctx.Ls(c.Args.String("path"), c.Flags.Bool("recursive"), c.Flags.Bool("details"))
},
Completer: nil,
})
// Command: open
app.AddCommand(&grumble.Command{
Name: "open",
Aliases: nil,
Help: "Opens the vos file at <path>",
LongHelp: `Opens the vos file at <path>. The '-w' option allows for modifying the vos file
Help: "Opens the VOS file at <path>",
LongHelp: `Opens the VOS file at <path>. The '-w' option allows for modifying the VOS file
with the rm, load, commit_ilog, etc commands. The path <path> should be an absolute path to the
pool shard. Part of the path is used to determine what the pool uuid is.`,
HelpGroup: "vos",
Flags: func(f *grumble.Flags) {
f.Bool("w", "write_mode", false, "Open the vos file in write mode.")
f.Bool("w", "write_mode", false, "Open the VOS file in write mode.")
f.String("p", "db_path", "", "Path to the sys db to open.")
},
Args: func(a *grumble.Args) {
a.String("path", "Path to the vos file to open.")
a.String("path", "Path to the VOS file to open.")
},
Run: func(c *grumble.Context) error {
if c.Flags.String("db_path") != "" {
cleanup := SetCString(&ctx.ctx.dc_db_path, c.Flags.String("db_path"))
defer cleanup()
}
return ddbOpen(ctx, c.Args.String("path"), c.Flags.Bool("write_mode"))
return ctx.Open(c.Args.String("path"), c.Flags.String("db_path"), c.Flags.Bool("write_mode"))
},
Completer: openCompleter,
})
Expand All @@ -67,19 +64,19 @@ pool shard. Part of the path is used to determine what the pool uuid is.`,
LongHelp: "",
HelpGroup: "",
Run: func(c *grumble.Context) error {
return ddbVersion(ctx)
return ctx.Version()
},
Completer: nil,
})
// Command: close
app.AddCommand(&grumble.Command{
Name: "close",
Aliases: nil,
Help: "Close the currently opened vos pool shard",
Help: "Close the currently opened VOS file",
LongHelp: "",
HelpGroup: "vos",
Run: func(c *grumble.Context) error {
return ddbClose(ctx)
return ctx.Close()
},
Completer: nil,
})
Expand All @@ -91,7 +88,7 @@ pool shard. Part of the path is used to determine what the pool uuid is.`,
LongHelp: "",
HelpGroup: "vos",
Run: func(c *grumble.Context) error {
return ddbSuperblockDump(ctx)
return ctx.SuperblockDump()
},
Completer: nil,
})
Expand All @@ -100,7 +97,7 @@ pool shard. Part of the path is used to determine what the pool uuid is.`,
Name: "value_dump",
Aliases: nil,
Help: "Dump a value",
LongHelp: `Dump a value to the screen or file. The vos path should be a complete
LongHelp: `Dump a value to the screen or file. The VOS path should be a complete
path, including the akey and if the value is an array value it should include
the extent. If a path to a file was provided then the value will be written to
the file, else it will be printed to the screen.`,
Expand All @@ -110,7 +107,7 @@ the file, else it will be printed to the screen.`,
a.String("dst", "File path to dump the value to.", grumble.Default(""))
},
Run: func(c *grumble.Context) error {
return ddbValueDump(ctx, c.Args.String("path"), c.Args.String("dst"))
return ctx.ValueDump(c.Args.String("path"), c.Args.String("dst"))
},
Completer: nil,
})
Expand All @@ -126,28 +123,28 @@ and everything under it, to a single value.`,
a.String("path", "VOS tree path to remove.")
},
Run: func(c *grumble.Context) error {
return ddbRm(ctx, c.Args.String("path"))
return ctx.Rm(c.Args.String("path"))
},
Completer: nil,
})
// Command: value_load
app.AddCommand(&grumble.Command{
Name: "value_load",
Aliases: nil,
Help: "Load a value to a vos path. ",
LongHelp: `Load a value to a vos path. This can be used to update
Help: "Load a value to a VOS path. ",
LongHelp: `Load a value to a VOS path. This can be used to update
the value of an existing key, or create a new key. The <src> is a path to a
file on the file system. The <dst> is a vos tree path to a value where the
file on the file system. The <dst> is a VOS tree path to a value where the
data will be loaded. If the <dst> path currently exists, then the destination
path must match the value type, meaning, if the value type is an array, then
the path must include the extent, otherwise, it must not.`,
HelpGroup: "vos",
Args: func(a *grumble.Args) {
a.String("src", "Source file path.")
a.String("dst", "Destination vos tree path to a value.")
a.String("dst", "Destination VOS tree path to a value.")
},
Run: func(c *grumble.Context) error {
return ddbValueLoad(ctx, c.Args.String("src"), c.Args.String("dst"))
return ctx.ValueLoad(c.Args.String("src"), c.Args.String("dst"))
},
Completer: nil,
})
Expand All @@ -162,7 +159,7 @@ the path must include the extent, otherwise, it must not.`,
a.String("path", "VOS tree path to an object, dkey, or akey.")
},
Run: func(c *grumble.Context) error {
return ddbIlogDump(ctx, c.Args.String("path"))
return ctx.IlogDump(c.Args.String("path"))
},
Completer: nil,
})
Expand All @@ -177,7 +174,7 @@ the path must include the extent, otherwise, it must not.`,
a.String("path", "VOS tree path to an object, dkey, or akey.")
},
Run: func(c *grumble.Context) error {
return ddbIlogCommit(ctx, c.Args.String("path"))
return ctx.IlogCommit(c.Args.String("path"))
},
Completer: nil,
})
Expand All @@ -192,7 +189,7 @@ the path must include the extent, otherwise, it must not.`,
a.String("path", "VOS tree path to an object, dkey, or akey.")
},
Run: func(c *grumble.Context) error {
return ddbIlogClear(ctx, c.Args.String("path"))
return ctx.IlogClear(c.Args.String("path"))
},
Completer: nil,
})
Expand All @@ -211,7 +208,7 @@ the path must include the extent, otherwise, it must not.`,
a.String("path", "VOS tree path to a container.")
},
Run: func(c *grumble.Context) error {
return ddbDtxDump(ctx, c.Args.String("path"), c.Flags.Bool("active"), c.Flags.Bool("committed"))
return ctx.DtxDump(c.Args.String("path"), c.Flags.Bool("active"), c.Flags.Bool("committed"))
},
Completer: nil,
})
Expand All @@ -226,7 +223,7 @@ the path must include the extent, otherwise, it must not.`,
a.String("path", "VOS tree path to a container.")
},
Run: func(c *grumble.Context) error {
return ddbDtxCmtClear(ctx, c.Args.String("path"))
return ctx.DtxCmtClear(c.Args.String("path"))
},
Completer: nil,
})
Expand All @@ -239,10 +236,10 @@ the path must include the extent, otherwise, it must not.`,
HelpGroup: "smd",
Args: func(a *grumble.Args) {
a.String("nvme_conf", "Path to the nvme conf file. (default /mnt/daos/daos_nvme.conf)", grumble.Default(""))
a.String("db_path", "Path to the vos db. (default /mnt/daos)", grumble.Default(""))
a.String("db_path", "Path to the sys db. (default /mnt/daos)", grumble.Default(""))
},
Run: func(c *grumble.Context) error {
return ddbSmdSync(ctx, c.Args.String("nvme_conf"), c.Args.String("db_path"))
return ctx.SmdSync(c.Args.String("nvme_conf"), c.Args.String("db_path"))
},
Completer: nil,
})
Expand All @@ -254,7 +251,7 @@ the path must include the extent, otherwise, it must not.`,
LongHelp: "",
HelpGroup: "vos",
Run: func(c *grumble.Context) error {
return ddbVeaDump(ctx)
return ctx.VeaDump()
},
Completer: nil,
})
Expand All @@ -270,7 +267,7 @@ the path must include the extent, otherwise, it must not.`,
a.String("blk_cnt", "Total blocks of the region to mark free.")
},
Run: func(c *grumble.Context) error {
return ddbVeaUpdate(ctx, c.Args.String("offset"), c.Args.String("blk_cnt"))
return ctx.VeaUpdate(c.Args.String("offset"), c.Args.String("blk_cnt"))
},
Completer: nil,
})
Expand All @@ -286,7 +283,7 @@ the path must include the extent, otherwise, it must not.`,
a.String("dtx_id", "DTX id of the entry to commit. ")
},
Run: func(c *grumble.Context) error {
return ddbDtxActCommit(ctx, c.Args.String("path"), c.Args.String("dtx_id"))
return ctx.DtxActCommit(c.Args.String("path"), c.Args.String("dtx_id"))
},
Completer: nil,
})
Expand All @@ -302,46 +299,46 @@ the path must include the extent, otherwise, it must not.`,
a.String("dtx_id", "DTX id of the entry to abort. ")
},
Run: func(c *grumble.Context) error {
return ddbDtxActAbort(ctx, c.Args.String("path"), c.Args.String("dtx_id"))
return ctx.DtxActAbort(c.Args.String("path"), c.Args.String("dtx_id"))
},
Completer: nil,
})
// Command: feature
app.AddCommand(&grumble.Command{
Name: "feature",
Aliases: nil,
Help: "Manage vos pool features",
Help: "Manage VOS pool features",
LongHelp: "",
HelpGroup: "vos",
Flags: func(f *grumble.Flags) {
f.String("e", "enable", "", "Enable vos pool features")
f.String("d", "disable", "", "Disable vos pool features")
f.String("e", "enable", "", "Enable VOS pool features")
f.String("d", "disable", "", "Disable VOS pool features")
f.String("p", "db_path", "", "Path to the sys db")
f.Bool("s", "show", false, "Show current features")
},
Args: func(a *grumble.Args) {
a.String("path", "Optional, Path to the vos file", grumble.Default(""))
a.String("path", "Optional, Path to the VOS file", grumble.Default(""))
},
Run: func(c *grumble.Context) error {
return ddbFeature(ctx, c.Args.String("path"), c.Flags.String("enable"), c.Flags.String("disable"), c.Flags.Bool("show"))
return ctx.Feature(c.Args.String("path"), c.Flags.String("db_path"), c.Flags.String("enable"), c.Flags.String("disable"), c.Flags.Bool("show"))
},
Completer: featureCompleter,
})
// Command: rm_pool
app.AddCommand(&grumble.Command{
Name: "rm_pool",
Aliases: nil,
Help: "Remove a vos pool.",
Help: "Remove a VOS pool file.",
LongHelp: "",
HelpGroup: "vos",
Flags: func(f *grumble.Flags) {
f.String("p", "db_path", "", "Path to the sys db.")
f.String("p", "db_path", "", "Path to the sys db")
},
Args: func(a *grumble.Args) {
a.String("path", "Optional, Path to the vos file", grumble.Default(""))
a.String("path", "Path to the VOS file")
},
Run: func(c *grumble.Context) error {
return ddbRmPool(ctx, c.Args.String("path"))
return ctx.RmPool(c.Args.String("path"), c.Flags.String("db_path"))
},
Completer: rmPoolCompleter,
})
Expand All @@ -357,7 +354,7 @@ the path must include the extent, otherwise, it must not.`,
a.String("dtx_id", "DTX id of the entry to validate or 'all' to validate all active DTX entries.")
},
Run: func(c *grumble.Context) error {
return ddbDtxActDiscardInvalid(ctx, c.Args.String("path"), c.Args.String("dtx_id"))
return ctx.DtxActDiscardInvalid(c.Args.String("path"), c.Args.String("dtx_id"))
},
Completer: nil,
})
Expand All @@ -369,10 +366,10 @@ the path must include the extent, otherwise, it must not.`,
LongHelp: "",
HelpGroup: "vos",
Args: func(a *grumble.Args) {
a.String("db_path", "Path to the vos db.")
a.String("db_path", "Path to the sys db.")
},
Run: func(c *grumble.Context) error {
return ddbDevList(ctx, c.Args.String("db_path"))
return ctx.DevList(c.Args.String("db_path"))
},
Completer: nil,
})
Expand All @@ -384,12 +381,12 @@ the path must include the extent, otherwise, it must not.`,
LongHelp: "",
HelpGroup: "vos",
Args: func(a *grumble.Args) {
a.String("db_path", "Path to the vos db.")
a.String("db_path", "Path to the sys db.")
a.String("old_dev", "Old device UUID.")
a.String("new_dev", "New device UUID.")
},
Run: func(c *grumble.Context) error {
return ddbDevReplace(ctx, c.Args.String("db_path"), c.Args.String("old_dev"), c.Args.String("new_dev"))
return ctx.DevReplace(c.Args.String("db_path"), c.Args.String("old_dev"), c.Args.String("new_dev"))
},
Completer: nil,
})
Expand All @@ -407,7 +404,7 @@ the path must include the extent, otherwise, it must not.`,
a.String("path", "Optional, VOS tree path of a container to query.", grumble.Default(""))
},
Run: func(c *grumble.Context) error {
return ddbDtxStat(ctx, c.Args.String("path"), c.Flags.Bool("details"))
return ctx.DtxStat(c.Args.String("path"), c.Flags.Bool("details"))
},
Completer: nil,
})
Expand All @@ -426,7 +423,7 @@ the path must include the extent, otherwise, it must not.`,
a.String("tmpfs_mount", "Path to the tmpfs mountpoint.")
},
Run: func(c *grumble.Context) error {
return ddbProvMem(ctx, c.Args.String("db_path"), c.Args.String("tmpfs_mount"), c.Flags.Uint("tmpfs_size"))
return ctx.ProvMem(c.Args.String("db_path"), c.Args.String("tmpfs_mount"), c.Flags.Uint("tmpfs_size"))
},
Completer: nil,
})
Expand All @@ -445,7 +442,15 @@ the path must include the extent, otherwise, it must not.`,
f.String("d", "cmt_date", "", "Max aggregation committed date (format '1970-01-01 00:00:00')")
},
Run: func(c *grumble.Context) error {
return ddbDtxAggr(ctx, c.Args.String("path"), c.Flags.Uint64("cmt_time"), c.Flags.String("cmt_date"))
cmtTime := c.Flags.Uint64("cmt_time")
cmtDate := c.Flags.String("cmt_date")
if cmtTime != math.MaxUint64 && cmtDate != "" {
return fmt.Errorf("'--cmt_time' and '--cmt_date' options are mutually exclusive")
}
if cmtTime == math.MaxUint64 && cmtDate == "" {
return fmt.Errorf("'--cmt_time' or '--cmt_date' option has to be defined")
}
return ctx.DtxAggr(c.Args.String("path"), cmtTime, cmtDate)
},
Completer: nil,
})
Expand Down
Loading
Loading