xref: /spdk/examples/blob/cli/README.md (revision 34edd9f1bf5fda4c987f4500ddc3c9f50be32e7d)
1e5b5eabeSwawryk# blob-cli
2e5b5eabeSwawryk
3e5044f79SPaul LuseThe blobcli tool has several options that are listed by using the -h command
4e5044f79SPaul Lusehowever the three operating modes are covered in more detail here:
5e5044f79SPaul Luse
6cb85bf0bSMaciej Wawryk## Command Mode
793be26a5SKarol Latecki
8e5044f79SPaul LuseThis is the default and will just execute one command at a time. It's simple
9e5044f79SPaul Lusebut the downside is that if you are going to interact quite a bit with the
10e5044f79SPaul Luseblobstore, the startup time for the application can be cumbersome.
11e5044f79SPaul Luse
12cb85bf0bSMaciej Wawryk## Shell Mode
1393be26a5SKarol Latecki
14e5044f79SPaul LuseYou startup shell mode by using the -S command. At that point you will get
15e5044f79SPaul Lusea "blob>" prompt where you can enter any of the commands, including -h,
16*34edd9f1SKamil Godzwonto execute them. You can still enter just one at a time but the initial
17e5044f79SPaul Lusestartup time for the application will not get in the way between commands
18e5044f79SPaul Luseanymore so it is much more usable.
19e5044f79SPaul Luse
20cb85bf0bSMaciej Wawryk## Script (aka test) Mode
2193be26a5SKarol Latecki
22e5044f79SPaul LuseIn script mode you just supply one command with a filename when you start
23e5044f79SPaul Lusethe cli, for example `blobcli -T test.bs` will feed the tool the file
24e5044f79SPaul Lusecalled test.bs which contains a series of commands that will all run
25e5044f79SPaul Luseautomatically and, like shell mode, will only initialize one time so is
26e5044f79SPaul Lusequick.
27e5044f79SPaul Luse
28e5044f79SPaul LuseThe script file format (example) is shown below.  Comments are allowed and
29e5044f79SPaul Luseeach line should contain one valid command (and its parameters) only. In
30e5044f79SPaul Luseorder to operate on blobs via their ID value, use the token $Bn where n
31e5044f79SPaul Luserepresents the instance of the blob created in the script.
32e5044f79SPaul Luse
33e5044f79SPaul LuseFor example, the line `-s $B0` will operate on the blobid of the first
34e5044f79SPaul Luseblob created in the script (0 index based). `$B2` represents the third
35e5044f79SPaul Luseblob created in the script.
36e5044f79SPaul Luse
37e5044f79SPaul LuseIf you start test mode with the additional "ignore" option, any invalid
38e5044f79SPaul Lusescript lines will simply be skipped, otherwise the tool will exit if
39e5044f79SPaul Luseit runs into an invalid line (ie './blobcli -T test.bs ignore`).
40e5044f79SPaul Luse
41e5044f79SPaul LuseSample test/bs file:
4293be26a5SKarol Latecki
43ee5c4f6fSDaniel Verkamp~~~{.sh}
44e5044f79SPaul Luse# this is a comment
45e5044f79SPaul Luse-i
46e5044f79SPaul Luse-s bs
47e5044f79SPaul Luse-l bdevs
48e5044f79SPaul Luse-n 1
49e5044f79SPaul Luse-s bs
50e5044f79SPaul Luse-s $B0
51e5044f79SPaul Luse-n 2
52e5044f79SPaul Luse-s $B1
53e5044f79SPaul Luse-m $B0 Makefile
54e5044f79SPaul Luse-d $B0 M.blob
55e5044f79SPaul Luse-f $B1 65
56e5044f79SPaul Luse-d $B1 65.blob
57e5044f79SPaul Luse-s bs
58e5044f79SPaul Luse-x $B0 b0key boval
59e5044f79SPaul Luse-x $B1 b1key b1val
60e5044f79SPaul Luse-r $B0 b0key
61e5044f79SPaul Luse-s $B0
62e5044f79SPaul Luse-s $B1
63e5044f79SPaul Luse-s bs
64ee5c4f6fSDaniel Verkamp~~~
65