xref: /spdk/examples/blob/cli/README.md (revision 2f5c602574a98ede645991abe279a96e19c50196)
1# blob-cli
2
3The blobcli tool has several options that are listed by using the -h command
4however the three operating modes are covered in more detail here:
5
6Command Mode
7------------
8
9This is the default and will just execute one command at a time. It's simple
10but the downside is that if you are going to interact quite a bit with the
11blobstore, the startup time for the application can be cumbersome.
12
13Shell Mode
14----------
15
16You startup shell mode by using the -S command. At that point you will get
17a "blob>" prompt where you can enter any of the commands, including -h,
18to execute them. You can stil enter just one at a time but the initial
19startup time for the application will not get in the way between commands
20anymore so it is much more usable.
21
22Script (aka test) Mode
23----------------------
24
25In script mode you just supply one command with a filename when you start
26the cli, for example `blobcli -T test.bs` will feed the tool the file
27called test.bs which contains a series of commands that will all run
28automatically and, like shell mode, will only initialize one time so is
29quick.
30
31The script file format (example) is shown below.  Comments are allowed and
32each line should contain one valid command (and its parameters) only. In
33order to operate on blobs via their ID value, use the token $Bn where n
34represents the instance of the blob created in the script.
35
36For example, the line `-s $B0` will operate on the blobid of the first
37blob created in the script (0 index based). `$B2` represents the third
38blob created in the script.
39
40If you start test mode with the additional "ignore" option, any invalid
41script lines will simply be skipped, otherwise the tool will exit if
42it runs into an invalid line (ie './blobcli -T test.bs ignore`).
43
44Sample test/bs file:
45
46~~~{.sh}
47# this is a comment
48-i
49-s bs
50-l bdevs
51-n 1
52-s bs
53-s $B0
54-n 2
55-s $B1
56-m $B0 Makefile
57-d $B0 M.blob
58-f $B1 65
59-d $B1 65.blob
60-s bs
61-x $B0 b0key boval
62-x $B1 b1key b1val
63-r $B0 b0key
64-s $B0
65-s $B1
66-s bs
67~~~
68